{{+bindTo:partials.standard_nacl_api}}
PP_Resource(* | Create )(PP_Instance instance) |
PP_Bool(* | IsVideoDecoder )(PP_Resource resource) |
int32_t(* | Initialize )(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_Bool allow_software_fallback, struct PP_CompletionCallback callback) |
int32_t(* | Decode )(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void *buffer, struct PP_CompletionCallback callback) |
int32_t(* | GetPicture )(PP_Resource video_decoder, struct PP_VideoPicture *picture, struct PP_CompletionCallback callback) |
void(* | RecyclePicture )(PP_Resource video_decoder, const struct PP_VideoPicture *picture) |
int32_t(* | Flush )(PP_Resource video_decoder, struct PP_CompletionCallback callback) |
int32_t(* | Reset )(PP_Resource video_decoder, struct PP_CompletionCallback callback) |
Video decoder interface.
Typical usage:
Available video codecs vary by platform. All: theora, vorbis, vp8. Chrome and ChromeOS: aac, h264. ChromeOS: mpeg4.
PP_Resource(* PPB_VideoDecoder::Create)(PP_Instance instance) |
Creates a new video decoder resource.
[in] | instance | A PP_Instance identifying the instance with the video decoder. |
PP_Resource
corresponding to a video decoder if successful or 0 otherwise. int32_t(* PPB_VideoDecoder::Decode)(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void *buffer, struct PP_CompletionCallback callback) |
Decodes a bitstream buffer.
Copies |size| bytes of data from the plugin's |buffer|. The plugin should maintain the buffer and not call Decode() again until the decoder signals completion by returning PP_OK or by running |callback|.
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] | video_decoder | A PP_Resource identifying the video decoder. |
[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 PP_CompletionCallback to be called on completion. |
pp_errors.h
. int32_t(* PPB_VideoDecoder::Flush)(PP_Resource video_decoder, struct PP_CompletionCallback callback) |
Flushes the decoder.
The plugin should call this when it reaches the end of its video stream in order to stop cleanly. The decoder will run all pending calls to completion. The plugin should make no further calls to the decoder other than GetPicture() and RecyclePicture() until the decoder signals completion by running the callback. Just before completion, any pending GetPicture() call will complete by running the callback with result PP_ERROR_ABORTED to signal that no more pictures are available.
[in] | video_decoder | A PP_Resource identifying the video decoder. |
[in] | callback | A PP_CompletionCallback to be called on completion. |
pp_errors.h
. int32_t(* PPB_VideoDecoder::GetPicture)(PP_Resource video_decoder, struct PP_VideoPicture *picture, struct PP_CompletionCallback 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] | video_decoder | A PP_Resource identifying the video decoder. |
[out] | picture | A PP_VideoPicture to hold the decoded picture. |
[in] | callback | A PP_CompletionCallback to be called on completion. |
pp_errors.h
. Returns PP_OK if a picture is available. Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() completes while GetPicture() is pending. int32_t(* PPB_VideoDecoder::Initialize)(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_Bool allow_software_fallback, struct PP_CompletionCallback callback) |
Initializes a video decoder resource.
This should be called after Create() and before any other functions.
[in] | video_decoder | A PP_Resource identifying the video decoder. |
[in] | graphics3d_context | A PPB_Graphics3D resource to use during decoding. |
[in] | profile | A PP_VideoProfile specifying the video codec profile. |
[in] | allow_software_fallback | A PP_Bool specifying whether the decoder can fall back to software decoding if a suitable hardware decoder isn't available. |
[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. PP_Bool(* PPB_VideoDecoder::IsVideoDecoder)(PP_Resource resource) |
Determines if the given resource is a video decoder.
[in] | resource | A PP_Resource identifying a resource. |
PP_TRUE
if the resource is a PPB_VideoDecoder
, PP_FALSE
if the resource is invalid or some other type. void(* PPB_VideoDecoder::RecyclePicture)(PP_Resource video_decoder, const struct 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] | video_decoder | A PP_Resource identifying the video decoder. |
[in] | picture | A PP_VideoPicture to return to the decoder. |
int32_t(* PPB_VideoDecoder::Reset)(PP_Resource video_decoder, struct PP_CompletionCallback callback) |
Resets the decoder as quickly as possible.
The plugin can call Reset() to skip to another position in the video stream. Pending calls to Decode() and GetPicture()) are immediately aborted, causing their callbacks to run with PP_ERROR_ABORTED. The plugin should not make any further calls to the decoder until the decoder signals completion by running |callback|.
[in] | video_decoder | A PP_Resource identifying the video decoder. |
[in] | callback | A PP_CompletionCallback to be called on completion. |
pp_errors.h
.