Pepper_42_C++_interfaces
|
#include <video_decoder.h>
Public Member Functions | |
VideoDecoder () | |
VideoDecoder (const InstanceHandle &instance) | |
VideoDecoder (const VideoDecoder &other) | |
int32_t | Initialize (const Graphics3D &graphics3d_context, PP_VideoProfile profile, PP_HardwareAcceleration acceleration, const CompletionCallback &callback) |
int32_t | Decode (uint32_t decode_id, uint32_t size, const void *buffer, const CompletionCallback &callback) |
int32_t | GetPicture (const CompletionCallbackWithOutput< PP_VideoPicture > &callback) |
void | RecyclePicture (const PP_VideoPicture &picture) |
int32_t | Flush (const CompletionCallback &callback) |
int32_t | Reset (const CompletionCallback &callback) |
Returns PP_ERROR_FAILED if the decoder isn't initialized. More... | |
![]() | |
Resource () | |
The default constructor. More... | |
Resource (const Resource &other) | |
virtual | ~Resource () |
Destructor. More... | |
Resource & | operator= (const Resource &other) |
bool | is_null () const |
PP_Resource | pp_resource () const |
PP_Resource | detach () |
Additional Inherited Members | |
![]() | |
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. More... | |
Video decoder interface.
Typical usage:
Available video codecs vary by platform. All: theora, vorbis, vp8. Chrome and ChromeOS: aac, h264. ChromeOS: mpeg4.
Definition at line 43 of file video_decoder.h.
pp::VideoDecoder::VideoDecoder | ( | ) |
Default constructor for creating an is_null() VideoDecoder
object.
|
explicit |
A constructor used to create a VideoDecoder
and associate it with the provided Instance
.
[in] | instance | The instance with which this resource will be associated. |
pp::VideoDecoder::VideoDecoder | ( | const VideoDecoder & | other | ) |
The copy constructor for VideoDecoder
.
[in] | other | A reference to a VideoDecoder . |
int32_t pp::VideoDecoder::Decode | ( | uint32_t | decode_id, |
uint32_t | size, | ||
const void * | buffer, | ||
const CompletionCallback & | callback | ||
) |
Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's |buffer|. The plugin should wait until the decoder signals completion by returning PP_OK or by running |callback| before calling Decode() again.
In general, each bitstream buffer should contain a demuxed bitstream frame for the selected video codec. For example, H264 decoders expect to receive one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 decoders expect to receive a bitstream frame without the IVF frame header.
If the call to Decode() eventually results in a picture, the |decode_id| parameter is copied into the returned picture. The plugin can use this to associate decoded pictures with Decode() calls (e.g. to assign timestamps or frame numbers to pictures.) This value is opaque to the API so the plugin is free to pass any value.
[in] | decode_id | An optional value, chosen by the plugin, that can be used to associate calls to Decode() with decoded pictures returned by GetPicture(). |
[in] | size | Buffer size in bytes. |
[in] | buffer | Starting address of buffer. |
[in] | callback | A CompletionCallback to be called on completion. |
pp_errors.h
. Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Flush() or Reset() call is pending. Returns PP_ERROR_INPROGRESS if there is another Decode() call pending. Returns PP_ERROR_NOMEMORY if a bitstream buffer can't be created. Returns PP_ERROR_ABORTED when Reset() is called while Decode() is pending. int32_t pp::VideoDecoder::Flush | ( | const CompletionCallback & | callback | ) |
Flushes the decoder. The plugin should call Flush() when it reaches the end of its video stream in order to stop cleanly. The decoder will run any pending Decode() call to completion. The plugin should make no further calls to the decoder other than GetPicture() and RecyclePicture() until the decoder signals completion by running |callback|. Just before completion, any pending GetPicture() call will complete by running its callback with result PP_ERROR_ABORTED to signal that no more pictures are available. Any pictures held by the plugin remain valid during and after the flush and should be recycled back to the decoder.
[in] | callback | A CompletionCallback to be called on completion. |
pp_errors.h
. Returns PP_ERROR_FAILED if the decoder isn't initialized. int32_t pp::VideoDecoder::GetPicture | ( | const CompletionCallbackWithOutput< PP_VideoPicture > & | callback | ) |
Gets the next picture from the decoder. The picture is valid after the decoder signals completion by returning PP_OK or running |callback|. The plugin can call GetPicture() again after the decoder signals completion. When the plugin is finished using the picture, it should return it to the system by calling RecyclePicture().
[in] | callback | A CompletionCallbackWithOutput to be called on completion, and on success, to hold the picture descriptor. |
pp_errors.h
. Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() call is pending. Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() completes while GetPicture() is pending. int32_t pp::VideoDecoder::Initialize | ( | const Graphics3D & | graphics3d_context, |
PP_VideoProfile | profile, | ||
PP_HardwareAcceleration | acceleration, | ||
const CompletionCallback & | callback | ||
) |
Initializes a video decoder resource. This should be called after Create() and before any other functions.
[in] | graphics3d_context | A PPB_Graphics3D resource to use during decoding. |
[in] | profile | A PP_VideoProfile specifying the video codec profile. |
[in] | acceleration | A PP_HardwareAcceleration specifying whether to use a hardware accelerated or a software implementation. |
[in] | callback | A PP_CompletionCallback to be called upon completion. |
pp_errors.h
. Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the requested profile is not supported. In this case, the client may call Initialize() again with different parameters to find a good configuration. void pp::VideoDecoder::RecyclePicture | ( | const PP_VideoPicture & | picture | ) |
Recycles a picture that the plugin has received from the decoder. The plugin should call this as soon as it has finished using the texture so the decoder can decode more pictures.
[in] | picture | A PP_VideoPicture to return to the decoder. |
int32_t pp::VideoDecoder::Reset | ( | const CompletionCallback & | callback | ) |
Returns PP_ERROR_FAILED if the decoder isn't initialized.
Resets the decoder as quickly as possible. The plugin can call Reset() to skip to another position in the video stream. After Reset() returns, any pending calls to Decode() and GetPicture()) abort, causing their callbacks to run with PP_ERROR_ABORTED. The plugin should not make further calls to the decoder other than RecyclePicture() until the decoder signals completion by running |callback|. Any pictures held by the plugin remain valid during and after the reset and should be recycled back to the decoder.
[in] | callback | A CompletionCallback to be called on completion. |
pp_errors.h
.