Chromium Code Reviews| Index: ppapi/api/ppb_media_codec_video_decoder.idl |
| diff --git a/ppapi/api/ppb_media_codec_video_decoder.idl b/ppapi/api/ppb_media_codec_video_decoder.idl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..95d9bbfc0dfa61e2ed4f2b1f098cbcfcb4612be5 |
| --- /dev/null |
| +++ b/ppapi/api/ppb_media_codec_video_decoder.idl |
| @@ -0,0 +1,177 @@ |
| +/* Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +/** |
| + * This file defines the <code>PPB_MediaCodecVideoDecoder</code> interface. |
| + */ |
| + |
| +[generate_thunk] |
| + |
| +label Chrome { |
| + [channel=dev] M36 = 0.1 |
| +}; |
| + |
| +/** |
| + * Video decoder interface. |
| + * |
| + * Typical usage: |
| + * - Call Create() to create a new video decoder resource. |
| + * - Call Initialize() to initialize it with a 3d graphics context. |
| + * - Call Decode() to send a bitstream buffer to the decoder. |
| + * - Call GetPictureBuffer() to get the next decoded picture. |
| + * - To signal end of stream to the decoder: call Flush() and wait for the |
| + * callback. |
| + * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for |
| + * the callback. |
| + */ |
| +interface PPB_MediaCodecVideoDecoder { |
| + /** |
| + * Creates a new video decoder resource. |
| + * |
| + * @param[in] instance A <code>PP_Instance</code> identifying the instance |
| + * with the video decoder. |
| + * |
| + * @return A <code>PP_Resource</code> corresponding to a video decoder if |
| + * successful or 0 otherwise. |
| + */ |
| + PP_Resource Create( |
| + [in] PP_Instance instance); |
| + |
| + /** |
| + * Determines if the given resource is a video decoder. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> identifying a resource. |
| + * |
| + * @return <code>PP_TRUE</code> if the resource is a |
| + * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the |
| + * resource is invalid or some other type. |
| + */ |
| + PP_Bool IsMediaCodecVideoDecoder( |
| + [in] PP_Resource resource); |
| + |
| + /** |
| + * Initializes a video decoder resource. This should only be called once, |
| + * after Create() and before any other functions. Video decoding is not |
| + * supported on all platforms. |
| + * |
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| + * decoder. |
| + * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use |
| + * during decoding. |
| + * @param[in] profile A <code>PP_MediaCodec_Profile</code> specifying the |
| + * video stream profile. |
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| + * completion. |
| + * |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + * Returns PP_ERROR_NOTSUPPORTED here or to the callback if video decoding is |
| + * not available. |
| + */ |
| + int32_t Initialize( |
| + [in] PP_Resource video_decoder, |
| + [in] PP_Resource context, |
| + [in] PP_MediaCodec_Profile profile, |
|
igorc
2014/04/11 22:13:18
Could we have a function that returns the list of
bbudge
2014/04/16 00:51:05
See the comments on patchset #1. In short, the plu
|
| + [in] PP_CompletionCallback callback); |
| + |
| + /** |
| + * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's |
| + * |buffer|. The plugin should maintain the buffer until the callback is run. |
| + * If the bitstream buffer results in a picture, the |picture_id| parameter |
| + * will be copied into the picture buffer that is returned by |
| + * GetPictureBuffer(). This can be used to associate Decode calls with decoded |
| + * pictures (e.g. to associate timestamps with pictures.) The plugin can use |
| + * the callback to throttle calls to Decode to some constant number to avoid |
|
igorc
2014/04/11 22:13:18
Could you clarify (or provide an API) to help dete
bbudge
2014/04/16 00:51:05
I've changed the behavior of Decode. Now only a si
|
| + * over consuming system resources. |
| + * |
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| + * decoder. |
| + * @param[in] picture_id An identifier that can be used to associate calls to |
| + * Decode() with decoded pictures returned by GetPictureBuffer(). |
| + * @param[in] size Buffer size in bytes. |
| + * @param[in] buffer Starting address of buffer. |
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called when |
| + * the decoder has finished reading the buffer. |
|
igorc
2014/04/11 22:13:18
Does it mean I cannot free picture_id->timestamp m
bbudge
2014/04/16 00:51:05
True, not every Decode results in a picture. Since
|
| + * |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
|
igorc
2014/04/11 22:13:18
Could you add clarifications - in which cases I sh
bbudge
2014/04/16 00:51:05
In that case, it's better to call Reset, since all
igorc
2014/04/21 23:12:48
Could you add it to the comments? Basically that a
bbudge
2014/04/21 23:29:05
Good idea. I'll add them in a later CL, when it be
|
| + */ |
| + int32_t Decode( |
| + [in] PP_Resource video_decoder, |
| + [in] uint32_t picture_id, |
| + [in] uint32_t size, |
| + [in] mem_t buffer, |
| + [in] PP_CompletionCallback callback); |
| + |
| + /** |
| + * Gets the next picture buffer from the decoder. When the plugin is finished |
|
igorc
2014/04/11 22:13:18
Would be nice to clarify that the picture is avail
bbudge
2014/04/16 00:51:05
Good you bring this up. The plugin may fall behind
|
| + * with the picture, it should call RecyclePictureBuffer() to return it to the |
| + * system. The plugin can call GetPictureBuffer() again at any time after |
|
igorc
2014/04/11 22:13:18
I'm not sure I understand the significance of this
bbudge
2014/04/16 00:51:05
Only 1 GetPictureBuffer call may be outstanding. C
|
| + * |callback| is called. In particular, the plugin can call it from within |
| + * |callback| to request another picture. |
| + * |
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| + * decoder. |
| + * @param[out] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to |
| + * hold the decoded picture. |
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| + * completion. |picture_buffer| will describe the buffer if successful. |
| + * |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + */ |
| + int32_t GetPictureBuffer( |
| + [in] PP_Resource video_decoder, |
| + [out] PP_MediaCodec_PictureBuffer picture_buffer, |
| + [in] PP_CompletionCallback callback); |
| + |
| + /** |
| + * Recycles a picture buffer that the plugin has received from the decoder. |
| + * The plugin should call this as soon as it has finished using the texture so |
| + * the system can decode more pictures. |
| + * |
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| + * decoder. |
| + * @param[in] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to |
| + * return to the system. |
| + */ |
| + void RecyclePictureBuffer( |
| + [in] PP_Resource video_decoder, |
| + [in] PP_MediaCodec_PictureBuffer picture_buffer); |
| + |
| + /** |
| + * Flushes the decoder. Any pending calls to the decoder are completed, |
| + * including callbacks to the plugin. Once flushed, the decoder will call |
| + * |callback|. While flushing, the plugin should not make any calls to the |
| + * decoder. The plugin should call Flush() to signal end of stream to the |
| + * decoder. |
| + * |
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| + * decoder. |
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called when |
| + * flushing is complete. |
| + * |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + */ |
| + int32_t Flush( |
| + [in] PP_Resource video_decoder, |
| + [in] PP_CompletionCallback callback); |
| + |
| + /** |
| + * Resets the decoder as quickly as possible. Pending calls are aborted, |
| + * causing callbacks to run with PP_ERROR_ABORTED. The decoder is put back |
| + * into a state ready to receive further Decode calls and |callback| is |
| + * called. While resetting, the plugin should not make any calls to the |
| + * decoder. The plugin can use Reset() when it needs to seek to a new position |
| + * in the stream. |
| + * |
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| + * decoder. |
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| + * completion. |
| + * |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + */ |
| + int32_t Reset( |
| + [in] PP_Resource video_decoder, |
| + [in] PP_CompletionCallback callback); |
| +}; |