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.

Samsung Specific PPAPIs migration to WASM

PPAPI WASM (Emscripten)
Player NaCl Player WASM Player
Sockets POSIX API (through nacl_io)
https://developer.chrome.com/docs/native-client/devguide/coding/nacl_io/
POSIX API
Video Decoder pp::VideoDecoder Part of WASM Player functionality.

WASM Player needs to be initialized with RenderingMode::kVideoTexture parameter, which indicates that you want to return decoded frames to application as GL Texture instead of presenting them on a screen.

NaCl Player -> WASM Player

Samsung::NaClPlayer::ESDataSource

PPAPI WASM (Emscripten)
Samsung::NaClPlayer::ESDataSource::AddStream samsung::wasm::ElementaryMediaStreamSource::AddTrack
Samsung::NaClPlayer::ESDataSource::SetDuration samsung::wasm::ElementaryMediaStreamSource::SetDuration
Samsung::NaClPlayer::ESDataSource::SetEndOfStream samsung::wasm::ElementaryMediaTrack::AppendEndOfTrack

Samsung::NaClPlayer::ElementaryStream

PPAPI WASM (Emscripten)
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::AppendPacket samsung::wasm::ElementaryMediaTrack::AppendPacketAsync
Samsung::NaClPlayer::ElementaryStream::AppendEncryptedPacket samsung::wasm::ElementaryMediaTrack::AppendEncryptedPacketAsync
Samsung::NaClPlayer::ElementaryStream::AppendTrustZonePacket -
Samsung::NaClPlayer::ElementaryStream::Flush samsung::wasm::ElementaryMediaStreamSource::Flush
Samsung::NaClPlayer::ElementaryStream::SetDRMInitData samsung::wasm::MediaKey::SetupEncryption

Samsung::NaClPlayer::AudioElementaryStream

PPAPI WASM (Emscripten)
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 -
Samsung::NaClPlayer::AudioElementaryStream::GetBitsPerChannel -
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

Samsung::NaClPlayer::VideoElementaryStream

PPAPI WASM (Emscripten)
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 -
Samsung::NaClPlayer::VideoElementaryStream::SetVideoFrameFormat -
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

Samsung::NaClPlayer::MediaPlayer

PPAPI WASM (Emscripten)
Samsung::NaClPlayer::MediaPlayer::MediaPlayer samsung::wasm::HtmlMediaElement
Samsung::NaClPlayer::MediaPlayer::SetMediaEventsListener samsung::html::HtmlMediaElement::SetListener
Samsung::NaClPlayer::MediaPlayer::SetSubtitleListener -
Samsung::NaClPlayer::MediaPlayer::SetBufferingListener samsung::html::HtmlMediaElement::SetListener
Samsung::NaClPlayer::MediaPlayer::SetDRMListener -
Samsung::NaClPlayer::MediaPlayer::BindToDisplay -
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 -
Samsung::NaClPlayer::MediaPlayer::GetDuration samsung::html::HTMLMediaElement::GetDuration
Samsung::NaClPlayer::MediaPlayer::GetCurrentTime samsung::html::HTMLMediaElement::GetCurrentTime
Samsung::NaClPlayer::MediaPlayer::GetPlayerState -
Samsung::NaClPlayer::MediaPlayer::GetCurrentVideoTrackInfo -
Samsung::NaClPlayer::MediaPlayer::GetVideoTracksList -
Samsung::NaClPlayer::MediaPlayer::GetCurrentAudioTrackInfo -
Samsung::NaClPlayer::MediaPlayer::GetAudioTracksList -
Samsung::NaClPlayer::MediaPlayer::GetCurrentTextTrackInfo -
Samsung::NaClPlayer::MediaPlayer::GetTextTracksList -
Samsung::NaClPlayer::MediaPlayer::SelectTrack -
Samsung::NaClPlayer::MediaPlayer::AddExternalSubtitles -
Samsung::NaClPlayer::MediaPlayer::SetSubtitlesDelay -
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 -
Samsung::NaClPlayer::MediaPlayer::SetVr360Rotation -
Samsung::NaClPlayer::MediaPlayer::SetDRMSpecificData samsung::wasm::MediaKey::SetupEncryption

Samsung::NaClPlayer::URLDataSource

PPAPI WASM (Emscripten)
Samsung::NaClPlayer::URLDataSource Available using video tag with url src element.

VideoDecoder -> WASM Player

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