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

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: Tweak comment.x 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:
Ami GONE FROM CHROMIUM 2014/04/22 00:27:40 IIUC platform errors from the HW get delivered to
bbudge 2014/04/23 18:35:22 I can choose how to return the error, but yes, the
Ami GONE FROM CHROMIUM 2014/04/23 21:05:46 My worry is what happens if there are no outstandi
20 * - Call Create() to create a new video decoder resource.
21 * - Call Initialize() to initialize it with a 3d graphics context and the
22 * desired codec profile.
23 * - Call Decode() to send a bitstream buffer to the decoder.
24 * - Call GetPicture() to get the next decoded picture.
25 * - Call Flush() to signal end of stream to the decoder and perform shutdown
26 * when it completes.
27 * - To reset the decoder (e.g. to implement Seek), call Reset() and wait for
28 * the callback.
29 * - To destroy the decoder, the plugin should release all of its references to
30 * it. To avoid receiving aborted callbacks, call Flush() and wait for
Ami GONE FROM CHROMIUM 2014/04/22 00:27:40 It seems unfortunate to have to wait for the decod
bbudge 2014/04/23 18:35:22 I think we can avoid this in the resource destruct
Ami GONE FROM CHROMIUM 2014/04/23 21:05:46 Can it be hidden from the plugin? IOW make it so t
31 * completion first.
32 */
33 interface PPB_MediaCodecVideoDecoder {
34 /**
35 * Creates a new video decoder resource.
36 *
37 * @param[in] instance A <code>PP_Instance</code> identifying the instance
38 * with the video decoder.
39 *
40 * @return A <code>PP_Resource</code> corresponding to a video decoder if
41 * successful or 0 otherwise.
42 */
43 PP_Resource Create(
44 [in] PP_Instance instance);
45
46 /**
47 * Determines if the given resource is a video decoder.
48 *
49 * @param[in] resource A <code>PP_Resource</code> identifying a resource.
50 *
51 * @return <code>PP_TRUE</code> if the resource is a
52 * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the
53 * resource is invalid or some other type.
54 */
55 PP_Bool IsMediaCodecVideoDecoder(
56 [in] PP_Resource resource);
57
58 /**
59 * Initializes a video decoder resource. This should only be called once,
60 * after Create() and before any other functions.
61 *
62 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
63 * decoder.
64 * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use
65 * during decoding.
66 * @param[in] profile A <code>PP_MediaCodec_VideoProfile</code> specifying the
67 * video's codec profile.
68 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
69 * completion.
70 *
71 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
72 * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
73 * requested profile is not supported.
74 */
75 int32_t Initialize(
76 [in] PP_Resource video_decoder,
77 [in] PP_Resource graphics3d_context,
78 [in] PP_MediaCodec_VideoProfile profile,
79 [in] PP_CompletionCallback callback);
80
81 /**
82 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
83 * |buffer|. The plugin should maintain the buffer and not call Decode() again
84 * until the decoder signals completion by returning PP_OK or by running
85 * |callback|.
86 * If the call to Decode() eventually results in a picture, the |decode_id|
87 * parameter is copied into the returned picture. The plugin can use this to
88 * associate decoded pictures with Decode() calls (e.g. to assign timestamps
89 * or frame numbers to pictures.) It's OK to pass 0 if this isn't needed.
Ami GONE FROM CHROMIUM 2014/04/22 00:27:40 I would just say that this value is opaque to the
bbudge 2014/04/23 18:35:22 Done.
90 *
91 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
92 * decoder.
93 * @param[in] decode_id An optional value, chosen by the plugin, that can be
94 * used to associate calls to Decode() with decoded pictures returned by
95 * GetPicture().
96 * @param[in] size Buffer size in bytes.
97 * @param[in] buffer Starting address of buffer.
98 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
99 * completion.
100 *
101 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
102 */
103 int32_t Decode(
104 [in] PP_Resource video_decoder,
105 [in] uint32_t decode_id,
106 [in] uint32_t size,
107 [in] mem_t buffer,
108 [in] PP_CompletionCallback callback);
109
110 /**
111 * Gets the next picture from the decoder. The picture is valid after the
112 * decoder signals completion by returning PP_OK or running |callback|. The
113 * plugin can call GetPicture() again after the decoder signals completion.
114 * When the plugin is finished using the picture, it should return it to the
115 * system by calling RecyclePicture().
116 *
117 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
118 * decoder.
119 * @param[out] picture A <code>PP_MediaCodec_Picture</code> to hold the
120 * decoded picture.
121 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
122 * completion.
123 *
124 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
125 */
126 int32_t GetPicture(
127 [in] PP_Resource video_decoder,
128 [out] PP_MediaCodec_Picture picture,
129 [in] PP_CompletionCallback callback);
130
131 /**
132 * Recycles a picture that the plugin has received from the decoder.
133 * The plugin should call this as soon as it has finished using the texture so
134 * the decoder can decode more pictures.
135 *
136 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
137 * decoder.
138 * @param[in] picture A <code>PP_MediaCodec_Picture</code> to return to
139 * the decoder.
140 */
141 void RecyclePicture(
142 [in] PP_Resource video_decoder,
143 [in] PP_MediaCodec_Picture picture);
144
145 /**
146 * Flushes the decoder. The plugin should call this when it reaches the end of
147 * its video stream in order to stop cleanly. The decoder will run all pending
148 * calls to completion. The plugin should make no calls to the decoder other
149 * than RecyclePicture() until the decoder signals completion by running the
150 * callback.
151 *
152 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
153 * decoder.
154 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when
155 * flushing is complete.
156 *
157 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
158 */
159 int32_t Flush(
160 [in] PP_Resource video_decoder,
161 [in] PP_CompletionCallback callback);
162
163 /**
164 * Resets the decoder as quickly as possible. The plugin can call Reset to
165 * skip to another position in the video stream. Pending calls to Decode() and
166 * GetPicture()) are aborted, causing their callbacks to run with
167 * PP_ERROR_ABORTED. The plugin should not make any further calls to the
168 * decoder until the decoder signals completion by running |callback|.
169 *
170 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
171 * decoder.
172 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
173 * completion.
174 *
175 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
176 */
177 int32_t Reset(
178 [in] PP_Resource video_decoder,
179 [in] PP_CompletionCallback callback);
180 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698