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 
71 
74 
77 
82  bool IsValid() const;
83 
97 
116 
134 
159 
181 
211 
249  GLuint texture_id,
250  std::function<void(OperationResult)> finished_callback);
251 
268 
282  Result<bool> IsOpen() const;
283 
306  Result<void> RecycleTexture(GLuint texture_id);
307 
333 
334 
336 
350 
366 
367  private:
368  class Impl;
369 
370  explicit ElementaryMediaTrack(int handle,
371  EmssVersionInfo version_info,
372  bool use_session_id_emulation);
373 
374  int GetHandle() const;
375 
376  std::unique_ptr<Impl> pimpl_;
377 
378  // access to GetHandle()
380 };
381 
382 } // namespace wasm
383 } // namespace samsung
384 
385 #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)
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).
Allows receiving ElementaryMediaTrack events.
Result< void > SetListener(ElementaryMediaTrackListener *listener)
Result< void > AppendEndOfTrack(SessionId session_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< void > AppendEncryptedPacket(const EncryptedElementaryMediaPacket &)
Tracks are used to deliver either audio or video frames to WASM Player.