Migration from Native Client to WebAssembly
This section provides an extension to https://developer.chrome.com/docs/native-client/migration/ article, which describes interface mapping from Google PPAPI interfaces to WebAssembly.
Emscripten SDK, modified by Samsung, provides additional functionalities that were available in Native Client - Player, Sockets and Video Decoder APIs.
This topic lists all the Samsung-specific PPAPIs and their corresponding WASM APIs, for ease of reference when planning your WebAssembly application project.
Samsung-specific PPAPIs vs. WASM
The following table contains all the Samsung specific PPAPIs and their WebAssembly (WASM) equivalents in the Samsung Emscripten SDK.
PPAPI | WASM | |
---|---|---|
Player | NaCl Player | WASM Player |
Sockets | POSIX API (through nacl_io) | POSIX API |
Video Decoder | pp::VideoDecoder
|
Part of WASM Player functionality. WASM Player needs to be initialized with the RenderingMode::kVideoTexture parameter, which indicates that you want to return decoded frames to application as GL Texture instead of presenting them on a screen.
|
Table 1. Samsung PPAPIs and Their WASM Equivalents
Data Source Functionalities
The following table shows how the WASM Player supports the Samsung::NaClPlayer::ESDataSource
functionalities.
PPAPI | Corresponding WASM API |
---|---|
Samsung::NaClPlayer::ESDataSource::AddStream
|
samsung::wasm::ElementaryMediaStreamSource::AddTrack
|
Samsung::NaClPlayer::ESDataSource::SetDuration
|
samsung::wasm::ElementaryMediaStreamSource::SetDuration
|
Samsung::NaClPlayer::ESDataSource::SetEndOfStream
|
samsung::wasm::ElementaryMediaTrack::AppendEndOfTrack
|
Table 2. Data Source Methods
Elementary Stream Functionalities
The following table shows how the WASM Player supports the Samsung::NaClPlayer::ElementaryStream
functionalities.
PPAPI | Corresponding WASM API |
---|---|
Samsung::NaClPlayer::ElementaryStream::GetStreamType
|
samsung::wasm::ElementaryMediaTrack::GetType
|
Samsung::NaClPlayer::ElementaryStream::InitializeDone
|
samsung::wasm::ElementaryMediaStreamSource::AddTrack
|
Samsung::NaClPlayer::ElementaryStream::AppendPacket
|
samsung::wasm::ElementaryMediaTrack::AppendPacketAsync
|
Samsung::NaClPlayer::ElementaryStream::AppendEncryptedPacket
|
samsung::wasm::ElementaryMediaTrack::AppendEncryptedPacketAsync
|
Samsung::NaClPlayer::ElementaryStream::AppendTrustZonePacket
|
No corresponding WASM API available |
Samsung::NaClPlayer::ElementaryStream::Flush
|
samsung::wasm::ElementaryMediaStreamSource::Flush
|
Samsung::NaClPlayer::ElementaryStream::SetDRMInitData
|
samsung::wasm::MediaKey::SetupEncryption
|
Table 3. Elementary Stream Methods
Audio Elementary Stream Functionalities
The following table shows how the WASM Player supports the Samsung::NaClPlayer::AudioElementaryStream
functionalities.
PPAPI | Corresponding WASM API |
---|---|
Samsung::NaClPlayer::AudioElementaryStream::GetAudioCodecType
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::AudioElementaryStream::SetAudioCodecType
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::AudioElementaryStream::GetAudioCodecProfile
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::AudioElementaryStream::SetAudioCodecProfile
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::AudioElementaryStream::GetSampleFormat
|
samsung::wasm::ElementaryAudioTrackConfig::sample_format
|
Samsung::NaClPlayer::AudioElementaryStream::SetSampleFormat
|
samsung::wasm::ElementaryAudioTrackConfig::sample_format
|
Samsung::NaClPlayer::AudioElementaryStream::SetBitsPerChannel
|
No corresponding WASM API available |
Samsung::NaClPlayer::AudioElementaryStream::GetBitsPerChannel
|
No corresponding WASM API available |
Samsung::NaClPlayer::AudioElementaryStream::GetSamplesPerSecond
|
samsung::wasm::ElementaryAudioTrackConfig::samples_per_second
|
Samsung::NaClPlayer::AudioElementaryStream::GetBitsPerChannel
|
samsung::wasm::ElementaryAudioTrackConfig::samples_per_second
|
Samsung::NaClPlayer::AudioElementaryStream::SetCodecExtraData
|
samsung::wasm::ElementaryMediaTrackConfig::extradata
|
Table 4. Audio Elementary Stream Methods
Video Elementary Stream Functionalities
The following table shows how the WASM Player supports the Samsung::NaClPlayer::VideoElementaryStream
functionalities.
PPAPI | Corresponding WASM API |
---|---|
Samsung::NaClPlayer::VideoElementaryStream::GetVideoCodecType
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::VideoElementaryStream::SetVideoCodecType
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::VideoElementaryStream::GetVideoCodecProfile
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::VideoElementaryStream::SetVideoCodecProfile
|
samsung::wasm::ElementaryMediaTrackConfig::mime_type
|
Samsung::NaClPlayer::VideoElementaryStream::GetVideoFrameFormat
|
No corresponding WASM API available |
Samsung::NaClPlayer::VideoElementaryStream::SetVideoFrameFormat
|
No corresponding WASM API available |
Samsung::NaClPlayer::VideoElementaryStream::GetVideoFrameSize
|
samsung::wasm::ElementaryVideoTrackConfig::width samsung::wasm::ElementaryVideoTrackConfig::height
|
Samsung::NaClPlayer::VideoElementaryStream::SetVideoFrameSize
|
samsung::wasm::ElementaryVideoTrackConfig::width samsung::wasm::ElementaryVideoTrackConfig::height
|
Samsung::NaClPlayer::VideoElementaryStream::GetFrameRate
|
samsung::wasm::ElementaryVideoTrackConfig::framerate_num samsung::wasm::ElementaryVideoTrackConfig::framerate_den
|
Samsung::NaClPlayer::VideoElementaryStream::SetFrameRate
|
samsung::wasm::ElementaryVideoTrackConfig::framerate_num samsung::wasm::ElementaryVideoTrackConfig::framerate_den
|
Samsung::NaClPlayer::VideoElementaryStream::SetCodecExtraData
|
samsung::wasm::ElementaryMediaTrackConfig::extradata
|
Table 5. Video Elementary Stream Methods
Media Player Functionalities
The following table shows how the WASM Player supports the Samsung::NaClPlayer::MediaPlayer
functionalities.
PPAPI | Corresponding WASM API |
---|---|
Samsung::NaClPlayer::MediaPlayer::MediaPlayer
|
samsung::wasm::HtmlMediaElement
|
Samsung::NaClPlayer::MediaPlayer::SetMediaEventsListener
|
samsung::html::HtmlMediaElement::SetListener
|
Samsung::NaClPlayer::MediaPlayer::SetSubtitleListener
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::SetBufferingListener
|
samsung::html::HtmlMediaElement::SetListener
|
Samsung::NaClPlayer::MediaPlayer::SetDRMListener
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::BindToDisplay
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::AttachDataSource
|
samsung::html::HTMLMediaElement::SetSrc
|
Samsung::NaClPlayer::MediaPlayer::Play
|
samsung::html::HTMLMediaElement::Play
|
Samsung::NaClPlayer::MediaPlayer::Pause
|
samsung::html::HTMLMediaElement::Pause
|
Samsung::NaClPlayer::MediaPlayer::Stop
|
samsung::html::HTMLMediaElement::~HTMLMediaElement
|
Samsung::NaClPlayer::MediaPlayer::Seek
|
samsung::html::HTMLMediaElement::SetCurrentTime
|
Samsung::NaClPlayer::MediaPlayer::SetPlaybackRate
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::GetDuration
|
samsung::html::HTMLMediaElement::GetDuration
|
Samsung::NaClPlayer::MediaPlayer::GetCurrentTime
|
samsung::html::HTMLMediaElement::GetCurrentTime
|
Samsung::NaClPlayer::MediaPlayer::GetPlayerState
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::GetCurrentVideoTrackInfo
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::GetVideoTracksList
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::GetCurrentAudioTrackInfo
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::GetAudioTracksList
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::GetCurrentTextTrackInfo
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::GetTextTracksList
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::SelectTrack
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::AddExternalSubtitles
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::SetSubtitlesDelay
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::SetDisplayRect
|
Customized with video-tag parameters in JavaScript |
Samsung::NaClPlayer::MediaPlayer::SetDisplayMode
|
Customized with video-tag parameters in JavaScript |
Samsung::NaClPlayer::MediaPlayer::SetVr360Mode
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::SetVr360Rotation
|
No corresponding WASM API available |
Samsung::NaClPlayer::MediaPlayer::SetDRMSpecificData
|
samsung::wasm::MediaKey::SetupEncryption
|
Table 6. Media Player Methods
URL Data Source Functionalities
The following table shows how the WASM Player supports the Samsung::NaClPlayer::URLDataSource
functionalities.
PPAPI | WASM (Emscripten) |
---|---|
Samsung::NaClPlayer::URLDataSource
|
Available using video tag with url src element.
|
Table 7. URL Data Source Methods
Video Decoder Functionalities
The following table shows how the WASM Player supports the pp::VideoDecoder
functionalities.
PPAPI | WASM (Emscripten) |
---|---|
pp::VideoDecoder::Create
|
samsung::wasm::ElementaryMediaStreamSource::AddTrack
|
pp::VideoDecoder::Initialize
|
samsung::wasm::ElementaryMediaStreamSource::AddTrack
|
pp::VideoDecoder::Decode
|
samsung::html::HtmlMediaElement::Play
|
pp::VideoDecoder::GetPicture
|
samsung::wasm::ElementaryMediaTrack::FillTextureWithNextFrame
|
pp::VideoDecoder::RecyclePicture
|
samsung::wasm::ElementaryMediaTrack::RecycleTexture
|
pp::VideoDecoder::Flush
|
samsung::wasm::ElementaryMediaStreamSource::Flush
|
pp::VideoDecoder::Reset
|
samsung::wasm::ElementaryMediaStreamSource::RemoveTrack samsung::wasm::ElementaryMediaStreamSource::AddTrack
|
Table 8. Video Decoder Methods