Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: ppapi/api/ppb_media_codec_video_decoder.idl

Issue 210373003: Pepper VideoDecoder API definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..fb97ce23f0ecccd1bf662abfd3462c56526c3255
--- /dev/null
+++ b/ppapi/api/ppb_media_codec_video_decoder.idl
@@ -0,0 +1,190 @@
+/* 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 GetBitstreamBuffer() to get a buffer to hold bitstream data.
+ * - Fill the bitstream buffer with video data to decode.
+ * - Call Decode() to send the bitstream data 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. Hardware video decoding is
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 I thought the point of this take on the API was to
bbudge 2014/04/11 17:15:16 We aren't attempting to provide software fallback
+ * not supported on all platforms.
+ *
+ * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
+ * decoder.
+ * @param[in] context A <code>PPB_Graphics3D</code> resource to use for
+ * 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 on platforms where hardware video decoding is
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 I'm surprised status is not returned in the callba
bbudge 2014/04/11 17:15:16 Comment is a bit misleading since calling this wit
+ * not available.
+ */
+ int32_t Initialize(
+ [in] PP_Resource video_decoder,
+ [in] PP_Resource context,
dmichael (off chromium) 2014/04/09 21:54:07 might be good to name graphics3d_context
bbudge 2014/04/11 17:15:16 Done.
+ [in] PP_MediaCodec_Profile profile,
dmichael (off chromium) 2014/04/09 21:54:07 Do you have a function yet for getting supported p
Ami GONE FROM CHROMIUM 2014/04/09 22:18:38 profile is a property of the video to be decoded.
bbudge 2014/04/16 00:51:05 So based on this discussion, I don't think we can
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Gets a bitstream buffer to hold video data to be decoded. The bitstream
+ * buffer is a read-only struct describing the buffer. The plugin can have
+ * multiple requests for bitstream buffers pending. It should bound the number
+ * of decodes it has in flight to some constant number by throttling its calls
+ * to GetBitstreamBuffer().
dmichael (off chromium) 2014/04/09 21:54:07 I wonder if it might be possible for Chrome/PPAPI
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 why GBB() and not Decode() in this sentence?
bbudge 2014/04/11 17:15:16 I tried to think of a way to do this automatically
bbudge 2014/04/11 17:15:16 Throttling GBB would limit the number of pending d
bbudge 2014/04/16 00:51:05 I've changed the API to eliminate GBB. I've also c
+ *
+ * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
+ * decoder.
+ * @param[in] size The size of the buffer in bytes.
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 s/size/capacity/ ?
bbudge 2014/04/11 17:15:16 Eliminated GBB.
+ * @param[out] bitstream_buffer A <code>PP_MediaCodec_BitstreamBuffer</code>
+ * to hold the bitstream buffer.
+ * @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 GetBitstreamBuffer(
+ [in] PP_Resource video_decoder,
+ [in] uint32_t size,
+ [out] PP_MediaCodec_BitstreamBuffer bitstream_buffer,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Decodes a bitstream buffer. The plugin should have first called
+ * GetBitstreamBuffer() and filled the returned buffer with bitstream data.
+ * Decode() takes back ownership of the bitstream buffer. The plugin should
+ * not use |bitstream_buffer| after calling Decode().
+ *
+ * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
+ * decoder.
+ * @param[in] bitstream_buffer A <code>PP_MediaCodec_BitstreamBuffer</code>
+ * holding the bitstream data. This contains a |buffer_id| field that can be
+ * used to associate bitstream buffers with picture buffers.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion.
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 what does "completion" mean in this context? - d
bbudge 2014/04/11 17:15:16 Yes, completion means the buffer has been decoded.
bbudge 2014/04/16 00:51:05 I've changed the semantics slightly. Now this mean
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Decode(
+ [in] PP_Resource video_decoder,
+ [in] PP_MediaCodec_BitstreamBuffer bitstream_buffer,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Gets the next picture buffer from the decoder. When the plugin is finished
+ * with the picture, it should call RecyclePictureBuffer() to return it to the
+ * system. The plugin can call GetPictureBuffer() again in its callback to
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 what callback?
bbudge 2014/04/11 17:15:16 The user-provided callback. Made the comment clear
+ * request the next 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.
+ *
+ * @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 decodes are completed including callbacks
+ * to the plugin. Once done flushing, the decoder will call |callback|. While
+ * flushing, the plugin should not attempt to decode more video.
dmichael (off chromium) 2014/04/09 21:54:07 You could maybe flesh this comment out a bit with
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 what about calling reset during flush?
bbudge 2014/04/11 17:15:16 I'm going to say the plugin can't call anything du
bbudge 2014/04/16 00:51:05 Also, Flush is to signal end-of-stream, so the plu
+ *
+ * @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 Flush(
+ [in] PP_Resource video_decoder,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Resets the decoder as quickly as possible. Pending decodes are aborted
+ * and the decoder is put back into a state ready to receive further decode
+ * calls. Once all decodes are aborted and reset is complete, |callback| will
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 Forbid decode & flush from being called during res
bbudge 2014/04/11 17:15:16 Done.
+ * be called.
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 doco impact on ownership of picture and bitstream
bbudge 2014/04/11 17:15:16 Done.
+ *
+ * @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);
+};
Ami GONE FROM CHROMIUM 2014/04/09 22:12:41 How does teardown work? (plugin needs to be able t
bbudge 2014/04/11 17:15:16 The plugin should just release its references on t
igorc 2014/04/11 22:16:28 Would be great to document this.
bbudge 2014/04/16 00:51:05 It's a Pepper convention, but I'll add a note at t

Powered by Google App Engine
This is Rietveld 408576698