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

Side by Side 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: Eliminate GetBitstreamBuffer function. Add 'picture_id' parameter. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 /**
7 * This file defines the <code>PPB_MediaCodecVideoDecoder</code> interface.
8 */
9
10 [generate_thunk]
11
12 label Chrome {
13 [channel=dev] M36 = 0.1
14 };
15
16 /**
17 * Video decoder interface.
18 *
19 * Typical usage:
20 * - Call Create() to create a new video decoder resource.
21 * - Call Initialize() to initialize it with a 3d graphics context.
22 * - Call Decode() to send a bitstream buffer to the decoder.
23 * - Call GetPictureBuffer() to get the next decoded picture.
24 * - To signal end of stream to the decoder: call Flush() and wait for the
25 * callback.
26 * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for
27 * the callback.
28 */
29 interface PPB_MediaCodecVideoDecoder {
30 /**
31 * Creates a new video decoder resource.
32 *
33 * @param[in] instance A <code>PP_Instance</code> identifying the instance
34 * with the video decoder.
35 *
36 * @return A <code>PP_Resource</code> corresponding to a video decoder if
37 * successful or 0 otherwise.
38 */
39 PP_Resource Create(
40 [in] PP_Instance instance);
41
42 /**
43 * Determines if the given resource is a video decoder.
44 *
45 * @param[in] resource A <code>PP_Resource</code> identifying a resource.
46 *
47 * @return <code>PP_TRUE</code> if the resource is a
48 * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the
49 * resource is invalid or some other type.
50 */
51 PP_Bool IsMediaCodecVideoDecoder(
52 [in] PP_Resource resource);
53
54 /**
55 * Initializes a video decoder resource. This should only be called once,
56 * after Create() and before any other functions. Video decoding is not
57 * supported on all platforms.
58 *
59 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
60 * decoder.
61 * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use
62 * during decoding.
63 * @param[in] profile A <code>PP_MediaCodec_Profile</code> specifying the
64 * video stream profile.
65 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
66 * completion.
67 *
68 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
69 * Returns PP_ERROR_NOTSUPPORTED here or to the callback if video decoding is
70 * not available.
71 */
72 int32_t Initialize(
73 [in] PP_Resource video_decoder,
74 [in] PP_Resource context,
75 [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
76 [in] PP_CompletionCallback callback);
77
78 /**
79 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
80 * |buffer|. The plugin should maintain the buffer until the callback is run.
81 * If the bitstream buffer results in a picture, the |picture_id| parameter
82 * will be copied into the picture buffer that is returned by
83 * GetPictureBuffer(). This can be used to associate Decode calls with decoded
84 * pictures (e.g. to associate timestamps with pictures.) The plugin can use
85 * 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
86 * over consuming system resources.
87 *
88 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
89 * decoder.
90 * @param[in] picture_id An identifier that can be used to associate calls to
91 * Decode() with decoded pictures returned by GetPictureBuffer().
92 * @param[in] size Buffer size in bytes.
93 * @param[in] buffer Starting address of buffer.
94 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when
95 * 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
96 *
97 * @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
98 */
99 int32_t Decode(
100 [in] PP_Resource video_decoder,
101 [in] uint32_t picture_id,
102 [in] uint32_t size,
103 [in] mem_t buffer,
104 [in] PP_CompletionCallback callback);
105
106 /**
107 * 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
108 * with the picture, it should call RecyclePictureBuffer() to return it to the
109 * 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
110 * |callback| is called. In particular, the plugin can call it from within
111 * |callback| to request another picture.
112 *
113 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
114 * decoder.
115 * @param[out] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to
116 * hold the decoded picture.
117 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
118 * completion. |picture_buffer| will describe the buffer if successful.
119 *
120 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
121 */
122 int32_t GetPictureBuffer(
123 [in] PP_Resource video_decoder,
124 [out] PP_MediaCodec_PictureBuffer picture_buffer,
125 [in] PP_CompletionCallback callback);
126
127 /**
128 * Recycles a picture buffer that the plugin has received from the decoder.
129 * The plugin should call this as soon as it has finished using the texture so
130 * the system can decode more pictures.
131 *
132 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
133 * decoder.
134 * @param[in] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to
135 * return to the system.
136 */
137 void RecyclePictureBuffer(
138 [in] PP_Resource video_decoder,
139 [in] PP_MediaCodec_PictureBuffer picture_buffer);
140
141 /**
142 * Flushes the decoder. Any pending calls to the decoder are completed,
143 * including callbacks to the plugin. Once flushed, the decoder will call
144 * |callback|. While flushing, the plugin should not make any calls to the
145 * decoder. The plugin should call Flush() to signal end of stream to the
146 * decoder.
147 *
148 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
149 * decoder.
150 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when
151 * flushing is complete.
152 *
153 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
154 */
155 int32_t Flush(
156 [in] PP_Resource video_decoder,
157 [in] PP_CompletionCallback callback);
158
159 /**
160 * Resets the decoder as quickly as possible. Pending calls are aborted,
161 * causing callbacks to run with PP_ERROR_ABORTED. The decoder is put back
162 * into a state ready to receive further Decode calls and |callback| is
163 * called. While resetting, the plugin should not make any calls to the
164 * decoder. The plugin can use Reset() when it needs to seek to a new position
165 * in the stream.
166 *
167 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
168 * decoder.
169 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
170 * completion.
171 *
172 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
173 */
174 int32_t Reset(
175 [in] PP_Resource video_decoder,
176 [in] PP_CompletionCallback callback);
177 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698