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

Side by Side Diff: ppapi/api/ppb_video_decoder.idl

Issue 210373003: Pepper VideoDecoder API definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Exclude thunk from build for now. Created 6 years, 7 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
« no previous file with comments | « ppapi/api/pp_codecs.idl ('k') | ppapi/c/pp_codecs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_VideoDecoder</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 and the
22 * desired codec profile.
23 * - Call Decode() continuously (waiting for each previous call to complete) to
24 * push bitstream buffers to the decoder.
25 * - Call GetPicture() continuously (waiting for each previous call to complete)
26 * to pull decoded pictures from the decoder.
27 * - Call Flush() to signal end of stream to the decoder and perform shutdown
28 * when it completes.
29 * - Call Reset() to quickly stop the decoder (e.g. to implement Seek) and wait
30 * for the callback before restarting decoding at another point.
31 * - To destroy the decoder, the plugin should release all of its references to
32 * it. Any pending callbacks will abort before the decoder is destroyed.
33 *
34 * Available video codecs vary by platform.
35 * All: theora, vorbis, vp8.
36 * Chrome and ChromeOS: aac, h264.
37 * ChromeOS: mpeg4.
38 */
39 interface PPB_VideoDecoder {
40 /**
41 * Creates a new video decoder resource.
42 *
43 * @param[in] instance A <code>PP_Instance</code> identifying the instance
44 * with the video decoder.
45 *
46 * @return A <code>PP_Resource</code> corresponding to a video decoder if
47 * successful or 0 otherwise.
48 */
49 PP_Resource Create(
50 [in] PP_Instance instance);
51
52 /**
53 * Determines if the given resource is a video decoder.
54 *
55 * @param[in] resource A <code>PP_Resource</code> identifying a resource.
56 *
57 * @return <code>PP_TRUE</code> if the resource is a
58 * <code>PPB_VideoDecoder</code>, <code>PP_FALSE</code> if the resource is
59 * invalid or some other type.
60 */
61 PP_Bool IsVideoDecoder(
62 [in] PP_Resource resource);
63
64 /**
65 * Initializes a video decoder resource. This should be called after Create()
66 * and before any other functions.
67 *
68 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
69 * decoder.
70 * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use
71 * during decoding.
72 * @param[in] profile A <code>PP_VideoProfile</code> specifying the video
73 * codec profile.
74 * @param[in] allow_software_fallback A <code>PP_Bool</code> specifying
75 * whether the decoder can fall back to software decoding if a suitable
76 * hardware decoder isn't available.
77 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
78 * completion.
79 *
80 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
81 * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
82 * requested profile is not supported. In this case, the client may call
83 * Initialize() again with different parameters to find a good configuration.
84 */
85 int32_t Initialize(
86 [in] PP_Resource video_decoder,
87 [in] PP_Resource graphics3d_context,
88 [in] PP_VideoProfile profile,
89 [in] PP_Bool allow_software_fallback,
90 [in] PP_CompletionCallback callback);
91
92 /**
93 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
94 * |buffer|. The plugin should maintain the buffer and not call Decode() again
95 * until the decoder signals completion by returning PP_OK or by running
96 * |callback|.
97 *
98 * In general, each bitstream buffer should contain a demuxed bitstream frame
99 * for the selected video codec. For example, H264 decoders expect to receive
100 * one AnnexB NAL unit, including the 4 byte start code prefix, while VP8
101 * decoders expect to receive a bitstream frame without the IVF frame header.
102 *
103 * If the call to Decode() eventually results in a picture, the |decode_id|
104 * parameter is copied into the returned picture. The plugin can use this to
105 * associate decoded pictures with Decode() calls (e.g. to assign timestamps
106 * or frame numbers to pictures.) This value is opaque to the API so the
107 * plugin is free to pass any value.
108 *
109 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
110 * decoder.
111 * @param[in] decode_id An optional value, chosen by the plugin, that can be
112 * used to associate calls to Decode() with decoded pictures returned by
113 * GetPicture().
114 * @param[in] size Buffer size in bytes.
115 * @param[in] buffer Starting address of buffer.
116 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
117 * completion.
118 *
119 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
120 */
121 int32_t Decode(
122 [in] PP_Resource video_decoder,
123 [in] uint32_t decode_id,
124 [in] uint32_t size,
125 [in] mem_t buffer,
126 [in] PP_CompletionCallback callback);
127
128 /**
129 * Gets the next picture from the decoder. The picture is valid after the
130 * decoder signals completion by returning PP_OK or running |callback|. The
131 * plugin can call GetPicture() again after the decoder signals completion.
132 * When the plugin is finished using the picture, it should return it to the
133 * system by calling RecyclePicture().
134 *
135 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
136 * decoder.
137 * @param[out] picture A <code>PP_VideoPicture</code> to hold the decoded
138 * picture.
139 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
140 * completion.
141 *
142 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
143 * Returns PP_OK if a picture is available.
144 * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush()
145 * completes while GetPicture() is pending.
146 */
147 int32_t GetPicture(
148 [in] PP_Resource video_decoder,
149 [out] PP_VideoPicture picture,
150 [in] PP_CompletionCallback callback);
151
152 /**
153 * Recycles a picture that the plugin has received from the decoder.
154 * The plugin should call this as soon as it has finished using the texture so
155 * the decoder can decode more pictures.
156 *
157 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
158 * decoder.
159 * @param[in] picture A <code>PP_VideoPicture</code> to return to
160 * the decoder.
161 */
162 void RecyclePicture(
163 [in] PP_Resource video_decoder,
164 [in] PP_VideoPicture picture);
165
166 /**
167 * Flushes the decoder. The plugin should call this when it reaches the end of
168 * its video stream in order to stop cleanly. The decoder will run all pending
169 * calls to completion. The plugin should make no further calls to the decoder
170 * other than GetPicture() and RecyclePicture() until the decoder signals
171 * completion by running the callback. Just before completion, any pending
172 * GetPicture() call will complete by running the callback with result
173 * PP_ERROR_ABORTED to signal that no more pictures are available.
174 *
175 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
176 * decoder.
177 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
178 * completion.
179 *
180 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
181 */
182 int32_t Flush(
183 [in] PP_Resource video_decoder,
184 [in] PP_CompletionCallback callback);
185
186 /**
187 * Resets the decoder as quickly as possible. The plugin can call Reset() to
188 * skip to another position in the video stream. Pending calls to Decode() and
189 * GetPicture()) are immediately aborted, causing their callbacks to run with
190 * PP_ERROR_ABORTED. The plugin should not make any further calls to the
191 * decoder until the decoder signals completion by running |callback|.
192 *
193 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
194 * decoder.
195 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
196 * completion.
197 *
198 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
199 */
200 int32_t Reset(
201 [in] PP_Resource video_decoder,
202 [in] PP_CompletionCallback callback);
203 };
OLDNEW
« no previous file with comments | « ppapi/api/pp_codecs.idl ('k') | ppapi/c/pp_codecs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698