Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
pp::MediaPlayer_Samsung Class Reference

#include <media_player_samsung.h>

Inheritance diagram for pp::MediaPlayer_Samsung:
pp::Resource

Public Types

enum  DoNotBindToInstance { DO_NOT_BIND_TO_INSTANCE }
 
typedef std::vector
< PP_VideoTrackInfo > 
VideoTracksList
 
typedef std::vector
< PP_AudioTrackInfo > 
AudioTracksList
 
typedef std::vector
< PP_TextTrackInfo > 
TextTracksList
 

Public Member Functions

 MediaPlayer_Samsung (const InstanceHandle &instance)
 Creates a player bound to pp::Instance.
 
 MediaPlayer_Samsung (const InstanceHandle &instance, DoNotBindToInstance)
 
 MediaPlayer_Samsung (const InstanceHandle &instance, PP_MediaPlayerMode player_mode, PP_BindToInstanceMode bind_mode)
 
 MediaPlayer_Samsung (const MediaPlayer_Samsung &other)
 
MediaPlayer_Samsungoperator= (const MediaPlayer_Samsung &other)
 
bool BindToInstance (const InstanceHandle &instance)
 
int32_t AttachDataSource (const MediaDataSource_Samsung &data_source, const CompletionCallback &callback)
 
int32_t Play (const CompletionCallback &callback)
 
int32_t Pause (const CompletionCallback &callback)
 
int32_t Stop (const CompletionCallback &callback)
 
int32_t Seek (PP_TimeTicks time, const CompletionCallback &callback)
 
int32_t SetPlaybackRate (double rate, const CompletionCallback &callback)
 
int32_t GetDuration (const CompletionCallbackWithOutput< PP_TimeDelta > &callback)
 
int32_t GetCurrentTime (const CompletionCallbackWithOutput< PP_TimeTicks > &callback)
 
int32_t GetPlayerState (const CompletionCallbackWithOutput< PP_MediaPlayerState > &callback)
 
int32_t GetCurrentVideoTrackInfo (const CompletionCallbackWithOutput< PP_VideoTrackInfo > &callback)
 
int32_t GetVideoTracksList (const CompletionCallbackWithOutput< VideoTracksList > &callback)
 
int32_t GetCurrentAudioTrackInfo (const CompletionCallbackWithOutput< PP_AudioTrackInfo > &callback)
 
int32_t GetAudioTracksList (const CompletionCallbackWithOutput< AudioTracksList > &callback)
 
int32_t GetCurrentTextTrackInfo (const CompletionCallbackWithOutput< PP_TextTrackInfo > &callback)
 
int32_t GetTextTracksList (const CompletionCallbackWithOutput< TextTracksList > &callback)
 
int32_t SelectTrack (PP_ElementaryStream_Type_Samsung track_type, uint32_t track_index, const CompletionCallback &callback)
 
int32_t AddExternalSubtitles (const std::string &file_path, const std::string &encoding, const CompletionCallbackWithOutput< PP_TextTrackInfo > &callback)
 
int32_t SetSubtitlesDelay (PP_TimeDelta delay, const CompletionCallback &callback)
 
int32_t SetDisplayRect (const PP_Rect &rect, const CompletionCallback &callback)
 
int32_t SetDisplayMode (PP_MediaPlayerDisplayMode display_mode, const CompletionCallback &callback)
 
int32_t SetDRMSpecificData (PP_MediaPlayerDRMType drm_type, PP_MediaPlayerDRMOperation drm_operation, uint32_t drm_data_size, const void *drm_data, const CompletionCallback &callback)
 
int32_t SetVr360Mode (PP_MediaPlayerVr360Mode display_mode, const CompletionCallback &callback)
 
int32_t SetVr360Rotation (float horizontal_angle, float vertical_angle, const CompletionCallback &callback)
 
int32_t SetVr360ZoomLevel (uint32_t zoom_level, const CompletionCallback &callback)
 
- Public Member Functions inherited from pp::Resource
 Resource ()
 The default constructor.
 
 Resource (const Resource &other)
 
virtual ~Resource ()
 Destructor.
 
Resourceoperator= (const Resource &other)
 
bool is_null () const
 
PP_Resource pp_resource () const
 
PP_Resource detach ()
 

Additional Inherited Members

- Protected Member Functions inherited from pp::Resource
 Resource (PP_Resource resource)
 
 Resource (PassRef, PP_Resource resource)
 
void PassRefFromConstructor (PP_Resource resource)
 
void Clear ()
 Sets this resource to null. This releases ownership of the resource.
 

Detailed Description

MediaPlayer_Samsung is type allowing application to control playback state, inquire about playback state. It's also responsible for assigning data source which will feed player with media data.

Assumptions:

  • Video is displayed in area of embed/object element of HTML page in which plugin is embedded.
  • Video and graphics from module can be displayed simultaneously. (see PPB_Instance.BindGraphics). Application must set proper CSS style for embed element with NaCl application (mostly transparent background).

Member Enumeration Documentation

An enum that controls binding Media Player to pp::Instance in the constructor. See descriptions of MediaPlayer_Samsung( const InstanceHandle& instance) and MediaPlayer_Samsung( const InstanceHandle& instance, DoNotBindToInstance).

Constructor & Destructor Documentation

pp::MediaPlayer_Samsung::MediaPlayer_Samsung ( const InstanceHandle instance,
DoNotBindToInstance   
)

Creates a player not bound to pp::Instance. It can be useful when the player is used with other graphic resources that need to be bound to pp::Instance. See PPB_Instance::BindGraphics and MediaPlayer_Samsung::BindToInstance.

pp::MediaPlayer_Samsung::MediaPlayer_Samsung ( const InstanceHandle instance,
PP_MediaPlayerMode  player_mode,
PP_BindToInstanceMode  bind_mode 
)

Creates a player with given modes. Default values create a player that can be used in the most typical scenarios.

Parameters
[in]player_modeCreate a player that is either bound to instance or not. It can be useful when the player is used with other graphic resources that need to be bound to pp::Instance. See PPB_Instance::BindGraphics and MediaPlayer_Samsung::BindToInstance for more details.
[in]bind_modeCreate a player that uses a specified playback mode.

Member Function Documentation

int32_t pp::MediaPlayer_Samsung::AddExternalSubtitles ( const std::string &  file_path,
const std::string &  encoding,
const CompletionCallbackWithOutput< PP_TextTrackInfo > &  callback 
)

Adds external subtitles. Returns PP_OK/code> in case of success and writes added text track information to |subtitles| param. After that newly added subtitles will be activated and SubtitleListener_Samsung will be notified about it's texts at the time those texts should be shown.

Please note that player is responsible only for subtitle file parsing. No subtitles are displayed by the player. Application can use SubtitleListener_Samsung to get subtitle texts at correct playback times and display them manually.

Constraints: Ability to add external subtitles after attaching data source is implementation dependent. If it is impossible to add external subtitles after data source is attached, this method will fail with PP_ERROR_NOTSUPPORTED error code. Therefore this method is guaranteed to succeed only before data source is attached.

Parameters
[in]file_pathA path of the subtitles.
[in]encodingSubtitle encoding can be selected:
  • by passing NULL or an empty string, which causes UTF-8 to be used,
  • by passing a valid IANA character set name (see: https://www.iana.org/assignments/character-sets/character-sets.xhtml).

    Please note however, that exact set of supported charset names is platform dependent (PP_ERROR_BADARGUMENT is returned if the provided encoding name is not supported).

[in]callbackA CompletionCallbackWithOutput to be called upon completion with added subtitles information.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_FILENOTFOUND - if provided file_path is invalid.
  • PP_ERROR_BADARGUMENT - if provided encoding is invalid.
  • PP_ERROR_NOTSUPPORTED - if method was called after attaching a data source and such operation is not supported on the current implementation.

int32_t pp::MediaPlayer_Samsung::AttachDataSource ( const MediaDataSource_Samsung data_source,
const CompletionCallback callback 
)

Attaches given MediaDataSource_Samsung to the player.

You can pass a NULL resource as buffer to detach currently attached data source. Reattaching data source will return PP_OK and do nothing.

Attaching data source to the player will cause:

  1. Detaching currently attached data source
  2. Performing initialization of newly bound data source (this step is specific to data source which is being bound).
Parameters
[in]data_sourceA MediaDataSource_Samsung identifying data source to be attached to the player.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h.
bool pp::MediaPlayer_Samsung::BindToInstance ( const InstanceHandle instance)

Binds this resource to the pp::Instance as the current display surface. It is like PPB_Instance::BindGraphics for media player resource. Normally, when the constructor is called without DoNotBindToInstance, there is no need to call this method.

int32_t pp::MediaPlayer_Samsung::GetAudioTracksList ( const CompletionCallbackWithOutput< AudioTracksList > &  callback)

Retrieves information of all audio tracks from the media played from attached data source.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with list of audio tracks available in currently attached data source. List will be empty if media played form attached data source doesn't have any audio tracks.
Returns
If >= 0, the number of the tracks is returned, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
int32_t pp::MediaPlayer_Samsung::GetCurrentAudioTrackInfo ( const CompletionCallbackWithOutput< PP_AudioTrackInfo > &  callback)

Retrieves information of current audio track from the media played from attached data source.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with retrieved audio track information.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if no video track is available in media played from attached data source.
int32_t pp::MediaPlayer_Samsung::GetCurrentTextTrackInfo ( const CompletionCallbackWithOutput< PP_TextTrackInfo > &  callback)

Retrieves information of current text/subtitles track from the media played from attached data source.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with retrieved text/subtitles track information.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if no video track is available in media played from attached data source.
int32_t pp::MediaPlayer_Samsung::GetCurrentTime ( const CompletionCallbackWithOutput< PP_TimeTicks > &  callback)

Retrieves current time/position of the media played from attached data source.

This operation can be performed only for media player in PP_MEDIAPLAYERSTATE_PLAYING or PP_MEDIAPLAYERSTATE_PAUSED states.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with retrieved current time.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if data can't be retrieved due to invalid player state.
int32_t pp::MediaPlayer_Samsung::GetCurrentVideoTrackInfo ( const CompletionCallbackWithOutput< PP_VideoTrackInfo > &  callback)

Retrieves information of current video track from the media played from attached data source.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with retrieved video track information.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if no video track is available in media played from attached data source.
int32_t pp::MediaPlayer_Samsung::GetDuration ( const CompletionCallbackWithOutput< PP_TimeDelta > &  callback)

Retrieves duration of the media played from attached data source.

Parameters
[in]callbackA CompletionCallbackWitOutput to be called upon completion with retrieved duration of the media.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if given operation is not supported by attached data source (e.g. live content playback).
int32_t pp::MediaPlayer_Samsung::GetPlayerState ( const CompletionCallbackWithOutput< PP_MediaPlayerState > &  callback)

Retrieves current state the media player.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with retrieved player state.
Returns
PP_OK on success, otherwise an error code from pp_errors.h.
int32_t pp::MediaPlayer_Samsung::GetTextTracksList ( const CompletionCallbackWithOutput< TextTracksList > &  callback)

Retrieves information of all text/subtitles tracks from the media played from attached data source.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with list of text/subtitles tracks available in currently attached data source. List will be empty if media played form attached data source doesn't have any text/subtitles tracks.
Returns
If >= 0, the number of the tracks is returned, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
int32_t pp::MediaPlayer_Samsung::GetVideoTracksList ( const CompletionCallbackWithOutput< VideoTracksList > &  callback)

Retrieves information of all video tracks from the media played from attached data source.

Parameters
[in]callbackA CompletionCallbackWithOutput to be called upon completion with list of video tracks available in currently attached data source. List will be empty if media played form attached data source doesn't have any video tracks.
Returns
If >= 0, the number of the tracks is returned, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
int32_t pp::MediaPlayer_Samsung::Pause ( const CompletionCallback callback)

Requests to pause playback of media from data source attached to the media player.

Parameters
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if given operation is not supported by attached data source.
int32_t pp::MediaPlayer_Samsung::Play ( const CompletionCallback callback)

Requests to start playback of media from data source attached to the media player.

Parameters
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if given operation is not supported by attached data source.
int32_t pp::MediaPlayer_Samsung::Seek ( PP_TimeTicks  time,
const CompletionCallback callback 
)

Requests to seek media from attached data source to the given time stamp. After calling Seek new packets should be sent to the player. Only after receiving a number of packets the player can complete a seek operation and run a callback.

Parameters
[in]timeA time stamp from begging of the clip to from which playback should be resumed.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if given operation is not supported by attached data source.
int32_t pp::MediaPlayer_Samsung::SelectTrack ( PP_ElementaryStream_Type_Samsung  track_type,
uint32_t  track_index,
const CompletionCallback callback 
)

Selects a track for the given stream type to be activated for media played from the attached data source.

Remarks: If activated track is a text track, it will be automatically activated and therefore it's subtitles will be delivered as events to the SubtitleListener_Samsung.

Constraints: An ability to handle multiple video tracks at a time is not guaranteed to be supported on all platforms, therefore calling this method with a PP_ElementaryStream_Type_Samsung_VIDEO as a stream type may result with a PP_ERROR_NOTSUPPORTED error code.

Parameters
[in]track_typeA type of the stream for which activate track.
[in]track_indexAn index of the track which has to be activated. Valid track index can be obtained from one of PP_*TrackInfo structures returned by corresponding call to Get*TracksInfo.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player or passed |track_type| or |track_index| are not valid.
  • PP_ERROR_NOTSUPPORTED - if called with PP_ElementaryStream_Type_Samsung_VIDEO on a platform that supports only one video track at a time.
int32_t pp::MediaPlayer_Samsung::SetDisplayMode ( PP_MediaPlayerDisplayMode  display_mode,
const CompletionCallback callback 
)

Sets a display mode which will be used by player. If no display mode is set, PP_MEDIAPLAYERDISPLAYMODE_STRETCH is used.

Parameters
[in]display_modeA display mode to be used. See PP_MediaPlayerDisplayMode enum for possible options.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h.
int32_t pp::MediaPlayer_Samsung::SetDisplayRect ( const PP_Rect &  rect,
const CompletionCallback callback 
)

Sets display region in which video will be displayed. Passed position is relative to the embed/object element of WebPage associated with given plugin.

Parameters
[in]rectVideo region in which video will be displayed.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h.
int32_t pp::MediaPlayer_Samsung::SetDRMSpecificData ( PP_MediaPlayerDRMType  drm_type,
PP_MediaPlayerDRMOperation  drm_operation,
uint32_t  drm_data_size,
const void *  drm_data,
const CompletionCallback callback 
)

Calls DRM system specific operation.

Parameters
[in]drm_typeA DRM system to be used
[in]drm_operationA DRM specific operation to be performed.
[in]drm_data_sizeA size of data buffer passed to DRM system.
[in]drm_dataA data buffer passed to DRM system.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
int32_t pp::MediaPlayer_Samsung::SetPlaybackRate ( double  rate,
const CompletionCallback callback 
)

Sets playback rate, pass: |rate| == 1.0 to mark normal playback 0.0 < |rate| < 1.0 to mark speeds slower than normal |rate| > 1.0 to mark speeds faster than normal

Parameters
[in]rateA rate of the playback.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if given operation is not supported by attached data source.
int32_t pp::MediaPlayer_Samsung::SetSubtitlesDelay ( PP_TimeDelta  delay,
const CompletionCallback callback 
)

Sets subtitles (text stream) SubtitleListener event emission delay regarding to the current media time.

Parameters
[in]delayA delay to be set.
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
int32_t pp::MediaPlayer_Samsung::SetVr360Mode ( PP_MediaPlayerVr360Mode  display_mode,
const CompletionCallback callback 
)

Set Vr360 mode. This function should be called player idle state.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]vr360_modePP_MediaPlayerVr360Mode
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.
  • PP_ERROR_FAILED - if player was is invalid state.
int32_t pp::MediaPlayer_Samsung::SetVr360Rotation ( float  horizontal_angle,
float  vertical_angle,
const CompletionCallback callback 
)

Set Vr360 rotation.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]horizontal_angle- horizontal angle of rotation.
[in]vertical_angle- vrtical angle of rotation.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.
int32_t pp::MediaPlayer_Samsung::SetVr360ZoomLevel ( uint32_t  zoom_level,
const CompletionCallback callback 
)

Set Vr360 zoom.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]zoom- zoom level.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.
int32_t pp::MediaPlayer_Samsung::Stop ( const CompletionCallback callback)

Requests to stop playback of media from data source attached to the media player.

Parameters
[in]callbackA CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if no data source is connected to the media player.
  • PP_ERROR_NOTSUPPORTED - if given operation is not supported by attached data source.

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