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 
66  kUnknown,
67  };
68 
72  enum class ActiveDecodingMode {
74  kHardware,
76  kSoftware
77  };
78 
80  enum class TrackType {
82  kAudio,
84  kVideo,
87  kUnknown,
88  };
89 
95 
98 
101 
106  bool IsValid() const;
107 
109  TrackType GetType() const;
110 
124 
143 
161 
186 
208 
238 
277  GLuint texture_id,
278  std::function<void(OperationResult)> finished_callback);
279 
316  Result<void> FillTextureWithNextFrameSync(GLuint texture_id);
317 
327 
344 
358  Result<bool> IsOpen() const;
359 
386  Result<void> RecycleTexture(GLuint texture_id);
387 
417 
419 
433 
449 
450  private:
451  class Impl;
452 
453  explicit ElementaryMediaTrack(int handle,
454  TrackType type,
455  EmssVersionInfo version_info,
456  bool use_session_id_emulation);
457 
458  int GetHandle() const;
459 
460  std::unique_ptr<Impl> pimpl_;
461 
462  // access to GetHandle()
464 };
465 
466 } // namespace wasm
467 } // namespace samsung
468 
469 #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
This ElementaryMediaStreamSource has been suspended.
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.