Tizen WASM Player
Tizen TV WebAssembly Media Player extension allowing for a low-level elementary media stream playback.
elementary_media_track.h
Go to the documentation of this file.
1 // Copyright 2020 Samsung Electronics
2 // TizenTV Emscripten extensions are available under two separate licenses, the
3 // MIT license and the University of Illinois/NCSA Open Source License. Both
4 // these licenses can be found in the LICENSE file.
5 
6 #ifndef INCLUDE_SAMSUNG_WASM_ELEMENTARY_MEDIA_TRACK_H_
7 #define INCLUDE_SAMSUNG_WASM_ELEMENTARY_MEDIA_TRACK_H_
8 
9 #include <cstdint>
10 #include <functional>
11 #include <memory>
12 
13 #include "GLES/gl.h"
14 #include "samsung/wasm/common.h"
18 
19 namespace samsung {
20 namespace wasm {
21 
22 class ElementaryMediaTrackListener;
23 class MediaKey;
24 struct ElementaryMediaPacket;
25 struct EncryptedElementaryMediaPacket;
26 
36 class ElementaryMediaTrack final {
37  public:
41  enum class CloseReason {
45 
48 
51 
54 
57 
60 
63  kUnknown,
64  };
65 
69  enum class ActiveDecodingMode {
71  kHardware,
73  kSoftware
74  };
75 
77  enum class TrackType {
79  kAudio,
81  kVideo,
84  kUnknown,
85  };
86 
92 
95 
98 
103  bool IsValid() const;
104 
106  TrackType GetType() const;
107 
121 
140 
158 
183 
205 
235 
274  GLuint texture_id,
275  std::function<void(OperationResult)> finished_callback);
276 
313  Result<void> FillTextureWithNextFrameSync(GLuint texture_id);
314 
324 
341 
355  Result<bool> IsOpen() const;
356 
383  Result<void> RecycleTexture(GLuint texture_id);
384 
414 
416 
430 
446 
447  private:
448  class Impl;
449 
450  explicit ElementaryMediaTrack(int handle,
451  TrackType type,
452  EmssVersionInfo version_info,
453  bool use_session_id_emulation);
454 
455  int GetHandle() const;
456 
457  std::unique_ptr<Impl> pimpl_;
458 
459  // access to GetHandle()
461 };
462 
463 } // namespace wasm
464 } // namespace samsung
465 
466 #endif // INCLUDE_SAMSUNG_WASM_ELEMENTARY_MEDIA_TRACK_H_
Result< void > AppendEncryptedPacketAsync(const EncryptedElementaryMediaPacket &)
Result< void > AppendPacketAsync(const ElementaryMediaPacket &packet)
Type representing a single encrypted packet (either video or audio).
Main class of WASM Player. ElementaryMediaStreamSource acts as a data source for html::HTMLMediaEleme...
Result< void > FillTextureWithNextFrame(GLuint texture_id, std::function< void(OperationResult)> finished_callback)
Result< void > AppendEndOfTrackAsync(SessionId session_id)
TrackType
Enumerates track types. Can be obtained by GetType().
Result< bool > IsOpen() const
Class representing an instance of media keys used to decrypt content.
Definition: media_key.h:71
int32_t SessionId
Definition: session_id.h:25
OperationResult
Enumerates possible outcomes of WASM function calls.
Result< void > AppendPacket(const ElementaryMediaPacket &packet)
Source was detached from html::HTMLMediaElement.
Result< SessionId > GetSessionId() const
This ElementaryMediaTrack has been disabled.
Type representing a single packet (video or audio).
TrackType GetType() const
Returns a TrackType of this track.
Allows receiving ElementaryMediaTrack events.
Result< void > SetListener(ElementaryMediaTrackListener *listener)
Result< void > AppendEndOfTrack(SessionId session_id)
Result< void > FillTextureWithNextFrameSync(GLuint texture_id)
This ElementaryMediaTrack has started seeking.
Result< void > SetMediaKey(MediaKey *key)
Result< void > RecycleTexture(GLuint texture_id)
Result< void > RegisterCurrentGraphicsContext()
ElementaryMediaTrack & operator=(const ElementaryMediaTrack &)=delete
Result< ActiveDecodingMode > GetActiveDecodingMode() const
Result< void > AppendEncryptedPacket(const EncryptedElementaryMediaPacket &)
Tracks are used to deliver either audio or video frames to WASM Player.