|
Tizen WASM Player
Tizen TV WebAssembly Media Player extension allowing for a low-level elementary media stream playback.
|
Tracks are used to deliver either audio or video frames to WASM Player. More...
#include <elementary_media_track.h>
Public Types | |
| enum | CloseReason { CloseReason::kSourceClosed, CloseReason::kSourceError, CloseReason::kSourceDetached, CloseReason::kSourceSuspended, CloseReason::kTrackDisabled, CloseReason::kTrackEnded, CloseReason::kTrackSeeking, CloseReason::kUnknown } |
| enum | ActiveDecodingMode { ActiveDecodingMode::kHardware, ActiveDecodingMode::kSoftware } |
| enum | TrackType { TrackType::kAudio, TrackType::kVideo, TrackType::kUnknown } |
Enumerates track types. Can be obtained by GetType(). More... | |
Friends | |
| class | ElementaryMediaStreamSource |
Tracks are used to deliver either audio or video frames to WASM Player.
Each instance of this class represents a single elementary media track (either audio or video). The track object allows sending ElementaryMediaPackets to platform for a playback.
Valid track objects can only be obtained through a call to ElementaryMediaStreamSource::AddTrack().
Definition at line 36 of file elementary_media_track.h.
Enumerates possible data decoding modes. Can be obtained by GetActiveDecodingMode() to check what decoding mode is selected for a particular track.
| Enumerator | |
|---|---|
| kHardware | Track is using platform hardware decoder. |
| kSoftware | Track is using platform software decoder. |
Definition at line 72 of file elementary_media_track.h.
|
strong |
Enumerates track close reasons. Values of this enum are passed to ElementaryMediaTrackListener::OnTrackClosed() to inform about the reason of the close.
| Enumerator | |
|---|---|
| kSourceClosed |
|
| kSourceError | Source was closed due to an error. |
| kSourceDetached | Source was detached from |
| kSourceSuspended | This |
| kTrackDisabled | This |
| kTrackEnded | This |
| kTrackSeeking | This |
| kUnknown | Track has closed due to an unspecified error; generally, this shouldn't happen. |
Definition at line 41 of file elementary_media_track.h.
|
strong |
Enumerates track types. Can be obtained by GetType().
| Enumerator | |
|---|---|
| kAudio | This is an audio track. |
| kVideo | This is a video track. |
| kUnknown | Unknown track type, usually a result of track being invalid (i.e. |
Definition at line 80 of file elementary_media_track.h.
| samsung::wasm::ElementaryMediaTrack::ElementaryMediaTrack | ( | ) |
Default constructor, creates an invalid ElementaryMediaTrack object. It can be further replaced with a proper one, received with a call to ElementaryMediaStreamSource::AddTrack().
| samsung::wasm::ElementaryMediaTrack::~ElementaryMediaTrack | ( | ) |
|
delete |
| samsung::wasm::ElementaryMediaTrack::ElementaryMediaTrack | ( | ElementaryMediaTrack && | ) |
| Result<void> samsung::wasm::ElementaryMediaTrack::AppendEncryptedPacket | ( | const EncryptedElementaryMediaPacket & | ) |
Appends a given EncryptedElementaryMediaPacket to the track.
AppendEncryptedPacketAsync() method to append encrypted packets over this method due to performance reasons (decrypting packets takes some time, doing it synchronously may decrease performance).AppendEncryptedPacket() cannot be called on the main thread.AppendEncryptedPacket() and AppendEncryptedPacketAsync() calls for the same track can be mixed.| [in] | packet | A packet to append. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error. | Result<void> samsung::wasm::ElementaryMediaTrack::AppendEncryptedPacketAsync | ( | const EncryptedElementaryMediaPacket & | ) |
Appends a given EncryptedElementaryMediaPacket to the track, but decrypts it asynchronously.
AppendEncryptedPacketAsync() will validate the packet and return result synchronously. However, packet decryption will be executed asynchronously. If decryption error occurs, it will be signaled via ElementaryMediaTrackListener::OnAppendError() event.
AppendEncryptedPacket() due to performance reasons (decrypting packets takes some time, doing it asynchronously will improve performance).AppendEncryptedPacketAsync() can be called both on the main thread and on side threads.AppendEncryptedPacket() and AppendEncryptedPacketAsync() calls for the same track can be mixed.| [in] | packet | A packet to append. |
Result<void> with operation_result field set to OperationResult::kSuccess if packet validation and append to track was successful, otherwise a code describing the error. Appends a special end-of-track packet to the source.
Upon processing this packet, the track will end. It is advised to end all tracks at a similar time. Operation will end once end of track is queued in Media Player's packet buffer.
A track that has ended will close and therefore emit the ElementaryMediaTrackListener::OnTrackClosed() event. When tracks associated with ElementaryMediaStreamSource end, the source changes it's state to ElementaryMediaStreamSource::ReadyState::kEnded.
AppendEndOfTrack() cannot be called on the main thread.| [in] | session_id | Id of the session the end of track packet should belong to. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error. Appends a special end-of-track packet to the source asynchronously.
Upon processing this packet, the track will end. It is advised to end all tracks at a similar time.
AppendEndOfTrackAsync() returns result synchronously when track starts closing or an error occurs.
If AppendEndOfTrackAsync() returns success synchronously but if in the meantime SessionId changes or seek operation starts, track will not be closed and an error informing that end of track append is aborted will be signaled via ElementaryMediaTrackListener::OnAppendError() event.
A track that has ended will close and therefore emit the ElementaryMediaTrackListener::OnTrackClosed() event. When tracks associated with ElementaryMediaStreamSource end, the source changes it's state to ElementaryMediaStreamSource::ReadyState::kEnded.
AppendEndOfTrackAsync() can be called both on the main thread and on side threads.| [in] | session_id | Id of the session the end of track packet should belong to. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error. | Result<void> samsung::wasm::ElementaryMediaTrack::AppendPacket | ( | const ElementaryMediaPacket & | packet | ) |
Appends a given ElementaryMediaPacket to the track.
AppendPacket() cannot be called on the main thread.AppendPacket() and AppendPacketAsync() calls for the same track can be mixed.| [in] | packet | A packet to append. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error. | Result<void> samsung::wasm::ElementaryMediaTrack::AppendPacketAsync | ( | const ElementaryMediaPacket & | packet | ) |
Appends a given ElementaryMediaPacket to the track asynchronously.
For clear packets, AppendPacketAsync() is functionally equivalent to AppendPacket() (i.e. it will validate the packet and return result synchronously).
AppendPacketAsync() can be called both on the main thread and on side threads.AppendPacket() and AppendPacketAsync() calls for the same track can be mixed.| [in] | packet | A packet to append. |
Result<void> with operation_result field set to OperationResult::kSuccess if packet validation and append to track was successful, otherwise a code describing the error. | Result<void> samsung::wasm::ElementaryMediaTrack::FillTextureWithNextFrame | ( | GLuint | texture_id, |
| std::function< void(OperationResult)> | finished_callback | ||
| ) |
Fills a provided texture with a decoded video frame.
The texture should be rendered as soon as possible after it's received. Player will resolve finished_callback when playback time reaches the point when a frame associated with the texture should be displayed.
Player will decode frames sent with ElementaryMediaTrack::AppendPacket() but won't render them on HTMLMediaElement when ElementaryMediaStreamSource is in the ElementaryMediaStreamSource::Mode::kVideoTexture mode. Instead, their contents can be accessed by calling this method repeatedly.
texture_id is processed, it must be freed with ElementaryMediaTrack::RecycleTexture().GL_TEXTURE_EXTERNAL_OES type.EmssVersionInfo::has_video_texture set to true.ElementaryMediaStreamSource::Mode::kVideoTexture mode of ElementaryMediaStreamSource.| texture_id | A texture that will be filled with video frame. |
| finished_callback | A callback which will be called when texture_id is ready and should be rendered by App. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error.| Result<void> samsung::wasm::ElementaryMediaTrack::FillTextureWithNextFrameSync | ( | GLuint | texture_id | ) |
Fills a provided texture with a decoded video frame synchronously. This method blocks until texture is available and assigned to texture_id.
The texture should be rendered as soon as possible after it's received.
Player will decode frames sent with ElementaryMediaTrack::AppendPacket() but won't render them on HTMLMediaElement when ElementaryMediaStreamSource is in the ElementaryMediaStreamSource::Mode::kVideoTexture mode. Instead, their contents can be accessed by calling this method repeatedly.
texture_id is processed, it must be freed with ElementaryMediaTrack::RecycleTexture().GL_TEXTURE_EXTERNAL_OES type.EmssVersionInfo::has_video_texture set to true.ElementaryMediaStreamSource::Mode::kVideoTexture mode of ElementaryMediaStreamSource.| texture_id | A texture that will be filled with video frame. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error.| Result<ActiveDecodingMode> samsung::wasm::ElementaryMediaTrack::GetActiveDecodingMode | ( | ) | const |
Returns decoder mode used for track.
Result<::ActiveDecodingMode> with the operation_result field set to OperationResult::kSuccess and a valid ActiveDecodingMode identifying the active decoding mode, otherwise a code describing an error.ActiveDecodingMode Returns id of the currently active session.
session_id using GetSessionId() and receive further updates with the ElementaryMediaTrackListener::OnSessionIdChanged() event.Result<SessionId> with the operation_result field set to OperationResult::kSuccess and a valid SessionId identifying the current session on a success, otherwise a code describing an error.| TrackType samsung::wasm::ElementaryMediaTrack::GetType | ( | ) | const |
Returns a TrackType of this track.
| Result<bool> samsung::wasm::ElementaryMediaTrack::IsOpen | ( | ) | const |
Returns the current state of this track.
An open track can accept ElementaryMediaPacket objects. Tracks open just before source enters ElementaryMediaStreamSource::ReadyState::kOpen state.
A closed track can't accept ElementaryMediaPacket objects. Tracks close just after source leaves ElementaryMediaStreamSource::ReadyState::kOpen state.
Result<Seconds> with operation_result field set to OperationResult::kSuccess and true if the track is open, otherwise false on success or a code describing the error. | bool samsung::wasm::ElementaryMediaTrack::IsValid | ( | ) | const |
Returns true if the track instance is valid. All methods calls on an invalid track will fail.
true if track instance is valid, otherwise false.
|
delete |
| ElementaryMediaTrack& samsung::wasm::ElementaryMediaTrack::operator= | ( | ElementaryMediaTrack && | ) |
| Result<void> samsung::wasm::ElementaryMediaTrack::RecycleTexture | ( | GLuint | texture_id | ) |
Release decoder buffers associated with the texture with texture_id. Should be called after painting the frame has been completed, as number of frames App can request simultaneously is limited by Platform.
EmssVersionInfo::has_video_texture set to true.ElementaryMediaStreamSource::Mode::kVideoTexture mode of ElementaryMediaStreamSource.| texture_id | A texture that will be recycled. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error.| Result<void> samsung::wasm::ElementaryMediaTrack::RegisterCurrentGraphicsContext | ( | ) |
Binds Player with an OpenGL graphics context associated with this WASM module.
Must be called before the ElementaryMediaTrack::FillTextureWithNextFrame() method is called for the first time.
EmssVersionInfo::has_video_texture set to true.ElementaryMediaStreamSource::Mode::kVideoTexture mode of ElementaryMediaStreamSource.Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error.| Result<void> samsung::wasm::ElementaryMediaTrack::SetListener | ( | ElementaryMediaTrackListener * | listener | ) |
Sets a listener to receive updates about this track's state changes. Only one listener can be set: setting another clears the previous one. Pass nullptr to reset the listener.
| [in] | listener | Listener to be set or nullptr to unset the listener. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error.ElementaryMediaTrackListener Sets media keys used for decrypting packets in this track.
| [in] | key | A MediaKey to be used by this track. |
Result<void> with operation_result field set to OperationResult::kSuccess on success, otherwise a code describing the error.MediaKey
|
friend |
Definition at line 463 of file elementary_media_track.h.