Pepper_37_C++_interfaces
media_source_samsung.h
Go to the documentation of this file.
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PPAPI_CPP_SAMSUNG_MEDIA_SOURCE_SAMSUNG_H_
6 #define PPAPI_CPP_SAMSUNG_MEDIA_SOURCE_SAMSUNG_H_
7 
8 #include "ppapi/c/pp_array_output.h"
9 #include "ppapi/c/samsung/pp_media_source_samsung.h"
10 #include "ppapi/cpp/resource.h"
11 #include "ppapi/cpp/var.h"
12 #include "ppapi/cpp/samsung/media_control_samsung.h"
13 #include "ppapi/cpp/samsung/source_buffer_samsung.h"
14 #include "ppapi/cpp/completion_callback.h"
15 
16 namespace pp {
17 
18 class InstanceHandle;
19 
20 /// Interface used by PNaCl application to provide chunks of multimedia data
21 /// to the platform. Those chunks will be decoded and played by the platform.
22 ///
23 /// This interface inherits from PPB_MediaControl_Samsung.
24 ///
25 /// API is similar to one defined in JavaScript's Media Source Extensions
27  public:
28  // Creates an is_null() MediaControl object.
30 
31  /// Cretes MediaSource_Samsung resource for given |instance|
32  explicit MediaSource_Samsung(const InstanceHandle& instance);
33 
34  /// Destructor
35  virtual ~MediaSource_Samsung() {}
36 
37  /// PPB_MediaSource_Samsung API
38 
39  /// Binds given MediaSource to vide/audio object of given |id| present on
40  /// HTML page on which given module is embedded.
41  int32_t BindToHTMLPlayer(const Var& id, const CompletionCallback& callback);
42 
43  /// Adds source to the media source element. Added source
44  /// is container of type |type| encoded using codecs on |codecs| list.
45  ///
46  /// Returns status - PP_SourceAddStatus and |sourceBuffer| if status is OK.
47  int32_t AddSource(const Var& type, const Var& codecs,
49 
50  /// Removes given source.
51  int32_t RemoveSource(const SourceBuffer_Samsung& sourceBuffer, const CompletionCallback& callback);
52 
53  /// Sets duration in microseconds of currently played stream
54  /// duration is given in microseconds
55  int32_t SetDuration(PP_MicrosecondsDelta duration, const CompletionCallback& callback);
56 
57  /// Gets duration in microseconds of currently played stream
59 
60  /// Sets end of stream. |error| argument represents whether it is just end
61  /// of the stream (PP_MEDIAERROR_NO_ERROR) or some kind of error occured.
62  int32_t SetEndOfStream(PP_SourceEndedStatus error, const CompletionCallback& callback);
63 
64  /// Gets a current time of media.
66 
67  /// Gets a ReadyState of media.
69 
70  /// PPP_MediaSource_Samsung API
71 
72  /// Signals error during processing given data source (e.g. decoding error).
73  virtual void Error(const SourceBuffer_Samsung& source, PP_SourceError reason) = 0;
74 
75  /// Signals activation of given data source.
76  virtual void SourceOpen() = 0;
77 
78  /// Called when source is still attached to a media element, but endOfStream()
79  /// has been called.
80  virtual void SourceEnded() = 0;
81 
82  /// Signals unattached data source to a media element.
83  virtual void SourceClose() = 0;
84 
85  /// Signals error during processing given data source (e.g. decoding error).
86  virtual void AppendEnd(const SourceBuffer_Samsung& source) = 0;
87 
88 };
89 
90 } // namespace pp
91 
92 #endif // PPAPI_CPP_SAMSUNG_MEDIA_SOURCE_SAMSUNG_H_
int32_t GetReadyState(const CompletionCallbackWithOutput< PP_MediaReadyState > &callback)
Gets a ReadyState of media.
virtual void SourceClose()=0
Signals unattached data source to a media element.
virtual void SourceEnded()=0
virtual void AppendEnd(const SourceBuffer_Samsung &source)=0
Signals error during processing given data source (e.g. decoding error).
int32_t BindToHTMLPlayer(const Var &id, const CompletionCallback &callback)
PPB_MediaSource_Samsung API.
int32_t GetMediaTime(const CompletionCallbackWithOutput< PP_MicrosecondsDelta > &callback)
Gets a current time of media.
int32_t SetDuration(PP_MicrosecondsDelta duration, const CompletionCallback &callback)
virtual void SourceOpen()=0
Signals activation of given data source.
virtual void Error(const SourceBuffer_Samsung &source, PP_SourceError reason)=0
PPP_MediaSource_Samsung API.
virtual ~MediaSource_Samsung()
Destructor.
int32_t RemoveSource(const SourceBuffer_Samsung &sourceBuffer, const CompletionCallback &callback)
Removes given source.
int32_t GetDuration(const CompletionCallbackWithOutput< PP_MicrosecondsDelta > &callback)
Gets duration in microseconds of currently played stream.
int32_t AddSource(const Var &type, const Var &codecs, const CompletionCallbackWithOutput< SourceBuffer_Samsung > &callback)
A generic type used for passing data types between the module and the page.
Definition: var.h:21
int32_t SetEndOfStream(PP_SourceEndedStatus error, const CompletionCallback &callback)
A reference counted module resource.
Definition: resource.h:20