NaCl Player API
NaCl Player API Documentation
Samsung::NaClPlayer::ElementaryStream Class Referenceabstract

#include <es_data_source.h>

Inheritance diagram for Samsung::NaClPlayer::ElementaryStream:

Public Member Functions

 ElementaryStream (const ElementaryStream &other)
 
ElementaryStreamoperator= (const ElementaryStream &other)
 
virtual ElementaryStreamType GetStreamType () const =0
 Retrieves stream type represented by this resource.
 
int32_t InitializeDone (const std::function< void(int32_t)> &callback)
 
int32_t InitializeDone ()
 
int32_t InitializeDone (StreamInitializationMode mode, const std::function< void(int32_t)> &callback)
 
int32_t InitializeDone (StreamInitializationMode mode)
 
int32_t AppendPacket (const ESPacket &packet, const std::function< void(int32_t)> &callback)
 
int32_t AppendPacket (const ESPacket &packet)
 
int32_t AppendEncryptedPacket (const ESPacket &packet, const ESPacketEncryptionInfo &encryption_info, const std::function< void(int32_t)> &callback)
 
int32_t AppendEncryptedPacket (const ESPacket &packet, const ESPacketEncryptionInfo &encryption_info)
 
int32_t AppendTrustZonePacket (const ESPacket &packet, const TrustZoneReference &handle, const std::function< void(int32_t)> &callback)
 
int32_t AppendTrustZonePacket (const ESPacket &packet, const TrustZoneReference &handle)
 
int32_t Flush (const std::function< void(int32_t)> &callback)
 
int32_t Flush ()
 
int32_t SetDRMInitData (const std::string &type, uint32_t init_data_size, const void *init_data, const std::function< void(int32_t)> &callback)
 
int32_t SetDRMInitData (const std::string &type, uint32_t init_data_size, const void *init_data)
 

Protected Member Functions

virtual Impl * impl ()=0
 

Detailed Description

Interface representing common functionalities of elementary streams.

Basic usage:

  1. Crate stream by calling ESDataSource.AddStream
  2. Initialize buffer specific information (audio/video config)
  3. Call InitializeDone
  4. Attach Data Source to the player
  5. Appends Elementary Stream packets by calling AppendPacket
  6. Signalize end of stream (clip) by calling ESDataSource.SetEndOfStream

Most methods in this class are available in synchronous and asynchronous variant. Both versions perform the same action, the only difference is how results of those actions are reported to the caller. Asynchronous method propagates this result by a provided additional parameter callback function.

Common constraints:

  1. Synchronous methods can't be called from the main thread.
  2. Asynchronous methods must be called from a thread with attached MessageLoop, which is required to report a result via provided callback in the same thread as the call itself.

Definition at line 51 of file es_data_source.h.

Member Function Documentation

◆ AppendEncryptedPacket() [1/2]

int32_t Samsung::NaClPlayer::ElementaryStream::AppendEncryptedPacket ( const ESPacket packet,
const ESPacketEncryptionInfo encryption_info,
const std::function< void(int32_t)> &  callback 
)

Appends an encrypted elementary stream packet.

Before appending any packet to the buffer, it must be properly configured (

See also
InitializeDone()).
Parameters
[in]packetA ESPacket containing Elementary Stream packet data and metadata.
[in]encryption_infoA ESPacketEncryptionInfo containing packet encryption description.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes.
ErrorCodes::BufferFull if player internal buffer is full. Returns ErrorCodes::Failed if InitializeDone() has not successfully completed.

◆ AppendEncryptedPacket() [2/2]

int32_t Samsung::NaClPlayer::ElementaryStream::AppendEncryptedPacket ( const ESPacket packet,
const ESPacketEncryptionInfo encryption_info 
)

Synchronously appends an encrypted elementary stream packet.

Warning
This method can't be called from the main thread.

For detailed description

See also
AppendEncryptedPacket(..., callback).

◆ AppendPacket() [1/2]

int32_t Samsung::NaClPlayer::ElementaryStream::AppendPacket ( const ESPacket packet,
const std::function< void(int32_t)> &  callback 
)

Appends an elementary stream packet.

Before appending any packet to the buffer, it must be properly configured (

See also
InitializeDone()).
Parameters
[in]packetA ESPacket containing Elementary Stream packet data and metadata.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes.
ErrorCodes::BufferFull if player internal buffer is full. Returns ErrorCodes::Failed if InitializeDone() has not successfully completed.

◆ AppendPacket() [2/2]

int32_t Samsung::NaClPlayer::ElementaryStream::AppendPacket ( const ESPacket packet)

Synchronously appends an elementary stream packet.

Warning
This method can't be called from the main thread.

For detailed description

See also
AppendPacket(..., callback)

◆ AppendTrustZonePacket() [1/2]

int32_t Samsung::NaClPlayer::ElementaryStream::AppendTrustZonePacket ( const ESPacket packet,
const TrustZoneReference handle,
const std::function< void(int32_t)> &  callback 
)

Appends Elementary Stream packet using TrustZone handle.

Before appending any packet to the buffer, it must be properly configured (

See also
InitializeDone()).

Note: After successful append ownership of the TrustZone memory is transfered from the module to the browser and handle must not be released. But in case of any error (i.e. return code/callback call with status other than ErrorCodes::Success) the module is responsible for releasing memory reference.

Parameters
[in]packetA ESPacket containing Elementary Stream metadata. Note: when using this method of appending packets size and buffer fields of ESPacket struct must be set to 0 and nullptr. If they are not set to zero (nullptr), then ErrorCodes::BadArgument will be returned.
[in]handleA handle to TrustZone memory containing packet data which will be appended.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Returns ErrorCodes::Failed if InitializeDone() has not successfully completed. Returns ErrorCodes::BadArgument if either size or buffer are not set to 0.

◆ AppendTrustZonePacket() [2/2]

int32_t Samsung::NaClPlayer::ElementaryStream::AppendTrustZonePacket ( const ESPacket packet,
const TrustZoneReference handle 
)

Synchronously appends an elementary stream packet using TrustZone handle.

Warning
This method can't be called from the main thread.

For detailed description

See also
AppendTrustZonePacket(..., callback).

◆ Flush() [1/2]

int32_t Samsung::NaClPlayer::ElementaryStream::Flush ( const std::function< void(int32_t)> &  callback)

Flushes all appended, but not decoded or rendered packets to this buffer. This method is usually called during seek operations.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Returns ErrorCodes::Failed if InitializeDone() has not successfully completed.

◆ Flush() [2/2]

int32_t Samsung::NaClPlayer::ElementaryStream::Flush ( )

Synchronously flushes all appended, but not decoded or rendered packets to this buffer. This method is usually called during seek operations.

Warning
This method can't be called from the main thread.

For detailed description

See also
Flush(callback).

◆ InitializeDone() [1/4]

int32_t Samsung::NaClPlayer::ElementaryStream::InitializeDone ( const std::function< void(int32_t)> &  callback)

Call this method to confirm new/updated buffer config. This method will return ErrorCodes::Success if set buffer config is valid or one of the error codes from ErrorCodes otherwise.

This method assumes that all plugin provided all necessary Elementary Stream initialization metadata (see StreamInitializationMode_Full).

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Method returns ErrorCodes::BadArgument when stream configuration is invalid.

◆ InitializeDone() [2/4]

int32_t Samsung::NaClPlayer::ElementaryStream::InitializeDone ( )

Synchronously confirm new/updated buffer config. This method will return ErrorCodes::Success if set buffer config is valid or one of the error codes from ErrorCodes otherwise.

Warning
This method can't be called from the main thread.

For detailed description

See also
InitializeDone(callback).

◆ InitializeDone() [3/4]

int32_t Samsung::NaClPlayer::ElementaryStream::InitializeDone ( StreamInitializationMode  mode,
const std::function< void(int32_t)> &  callback 
)

Call this method to confirm new/updated buffer config. This method will return ErrorCodes::Success if set buffer config is valid or one of the error codes from ErrorCodes otherwise.

Parameters
[in]modeA parameter indicating how much information regarding elementary stream configuration was extracted by the plugin (demuxer).
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Method returns ErrorCodes::BadArgument when stream configuration is invalid.

◆ InitializeDone() [4/4]

int32_t Samsung::NaClPlayer::ElementaryStream::InitializeDone ( StreamInitializationMode  mode)

Synchronously confirm new/updated buffer config. This method will return ErrorCodes::Success if set buffer config is valid or one of the error codes from ErrorCodes otherwise.

Warning
This method can't be called from the main thread.

For detailed description

See also
InitializeDone(mode, callback).

◆ SetDRMInitData() [1/2]

int32_t Samsung::NaClPlayer::ElementaryStream::SetDRMInitData ( const std::string &  type,
uint32_t  init_data_size,
const void *  init_data,
const std::function< void(int32_t)> &  callback 
)

Found DRM system initialization metadata. type describes type of the initialization data init_data associated with the stream.

Parameters
[in]typeA string containing DRM system specific description of type of an init_data.
[in]init_data_sizeA size of DRM specific init_data buffer.
[in]init_dataA buffer containing DRM system initialization data.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes.

◆ SetDRMInitData() [2/2]

int32_t Samsung::NaClPlayer::ElementaryStream::SetDRMInitData ( const std::string &  type,
uint32_t  init_data_size,
const void *  init_data 
)

Synchronous version of SetDRMInitData.

Warning
This method can't be called from the main thread.

For detailed description

See also
SetDRMInitData(..., callback).

The documentation for this class was generated from the following file: