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

Side by Side Diff: ppapi/c/ppb_media_codec_video_decoder.h

Issue 210373003: Pepper VideoDecoder API definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add 'allow_software_fallback' param to Initialize. 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 /* From ppb_media_codec_video_decoder.idl modified Wed Apr 23 11:36:55 2014. */
7
8 #ifndef PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_
9 #define PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_
10
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_media_codec.h"
16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_size.h"
18 #include "ppapi/c/pp_stdint.h"
19
20 #define PPB_MEDIACODECVIDEODECODER_INTERFACE_0_1 \
21 "PPB_MediaCodecVideoDecoder;0.1" /* dev */
22 /**
23 * @file
24 * This file defines the <code>PPB_MediaCodecVideoDecoder</code> interface.
25 */
26
27
28 /**
29 * @addtogroup Interfaces
30 * @{
31 */
32 /**
33 * Video decoder interface.
34 *
35 * Typical usage:
36 * - Call Create() to create a new video decoder resource.
37 * - Call Initialize() to initialize it with a 3d graphics context and the
38 * desired codec profile.
39 * - Call Decode() to send a bitstream buffer to the decoder.
40 * - Call GetPicture() to get the next decoded picture.
41 * - Call Flush() to signal end of stream to the decoder and perform shutdown
42 * when it completes.
43 * - To reset the decoder (e.g. to implement Seek), call Reset() and wait for
44 * the callback.
45 * - To destroy the decoder, the plugin should release all of its references to
46 * it. To avoid receiving aborted callbacks, call Flush() and wait for
47 * completion first.
48 */
49 struct PPB_MediaCodecVideoDecoder_0_1 { /* dev */
50 /**
51 * Creates a new video decoder resource.
52 *
53 * @param[in] instance A <code>PP_Instance</code> identifying the instance
54 * with the video decoder.
55 *
56 * @return A <code>PP_Resource</code> corresponding to a video decoder if
57 * successful or 0 otherwise.
58 */
59 PP_Resource (*Create)(PP_Instance instance);
60 /**
61 * Determines if the given resource is a video decoder.
62 *
63 * @param[in] resource A <code>PP_Resource</code> identifying a resource.
64 *
65 * @return <code>PP_TRUE</code> if the resource is a
66 * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the
67 * resource is invalid or some other type.
68 */
69 PP_Bool (*IsMediaCodecVideoDecoder)(PP_Resource resource);
70 /**
71 * Initializes a video decoder resource. This should only be called once,
72 * after Create() and before any other functions.
73 *
74 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
75 * decoder.
76 * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use
77 * during decoding.
78 * @param[in] profile A <code>PP_MediaCodec_VideoProfile</code> specifying the
79 * video's codec profile.
80 * @param[in] allow_software_fallback A <code>PP_Bool</code> specifying
81 * whether the decoder can fall back to software decoding if a suitable
82 * hardware decoder isn't available.
83 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
84 * completion.
85 *
86 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
87 * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
88 * requested profile is not supported.
89 */
90 int32_t (*Initialize)(PP_Resource video_decoder,
91 PP_Resource graphics3d_context,
92 PP_MediaCodec_VideoProfile profile,
93 PP_Bool allow_software_fallback,
94 struct PP_CompletionCallback callback);
95 /**
96 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
97 * |buffer|. The plugin should maintain the buffer and not call Decode() again
98 * until the decoder signals completion by returning PP_OK or by running
99 * |callback|.
100 * If the call to Decode() eventually results in a picture, the |decode_id|
101 * parameter is copied into the returned picture. The plugin can use this to
102 * associate decoded pictures with Decode() calls (e.g. to assign timestamps
103 * or frame numbers to pictures.) This value is opaque to the API so the
104 * plugin is free to pass any value.
105 *
106 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
107 * decoder.
108 * @param[in] decode_id An optional value, chosen by the plugin, that can be
109 * used to associate calls to Decode() with decoded pictures returned by
110 * GetPicture().
111 * @param[in] size Buffer size in bytes.
112 * @param[in] buffer Starting address of buffer.
113 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
114 * completion.
115 *
116 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
117 */
118 int32_t (*Decode)(PP_Resource video_decoder,
119 uint32_t decode_id,
120 uint32_t size,
121 const void* buffer,
122 struct PP_CompletionCallback callback);
123 /**
124 * Gets the next picture from the decoder. The picture is valid after the
125 * decoder signals completion by returning PP_OK or running |callback|. The
126 * plugin can call GetPicture() again after the decoder signals completion.
127 * When the plugin is finished using the picture, it should return it to the
128 * system by calling RecyclePicture().
129 *
130 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
131 * decoder.
132 * @param[out] picture A <code>PP_MediaCodec_Picture</code> to hold the
133 * decoded picture.
134 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
135 * completion.
136 *
137 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
138 */
139 int32_t (*GetPicture)(PP_Resource video_decoder,
140 struct PP_MediaCodec_Picture* picture,
141 struct PP_CompletionCallback callback);
142 /**
143 * Recycles a picture that the plugin has received from the decoder.
144 * The plugin should call this as soon as it has finished using the texture so
145 * the decoder can decode more pictures.
146 *
147 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
148 * decoder.
149 * @param[in] picture A <code>PP_MediaCodec_Picture</code> to return to
150 * the decoder.
151 */
152 void (*RecyclePicture)(PP_Resource video_decoder,
153 const struct PP_MediaCodec_Picture* picture);
154 /**
155 * Flushes the decoder. The plugin should call this when it reaches the end of
156 * its video stream in order to stop cleanly. The decoder will run all pending
157 * calls to completion. The plugin should make no calls to the decoder other
158 * than RecyclePicture() until the decoder signals completion by running the
159 * callback.
160 *
161 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
162 * decoder.
163 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when
164 * flushing is complete.
165 *
166 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
167 */
168 int32_t (*Flush)(PP_Resource video_decoder,
169 struct PP_CompletionCallback callback);
170 /**
171 * Resets the decoder as quickly as possible. The plugin can call Reset to
172 * skip to another position in the video stream. Pending calls to Decode() and
173 * GetPicture()) are aborted, causing their callbacks to run with
174 * PP_ERROR_ABORTED. The plugin should not make any further calls to the
175 * decoder until the decoder signals completion by running |callback|.
176 *
177 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
178 * decoder.
179 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
180 * completion.
181 *
182 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
183 */
184 int32_t (*Reset)(PP_Resource video_decoder,
185 struct PP_CompletionCallback callback);
186 };
187 /**
188 * @}
189 */
190
191 #endif /* PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_ */
192
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698