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

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: 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 /* From ppb_media_codec_video_decoder.idl modified Mon Apr 21 14:08:03 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] callback A <code>PP_CompletionCallback</code> to be called upon
81 * completion.
82 *
83 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
84 * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
85 * requested profile is not supported.
86 */
87 int32_t (*Initialize)(PP_Resource video_decoder,
88 PP_Resource graphics3d_context,
89 PP_MediaCodec_VideoProfile profile,
90 struct PP_CompletionCallback callback);
91 /**
92 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
93 * |buffer|. The plugin should maintain the buffer and not call Decode() again
94 * until the decoder signals completion by returning PP_OK or by running
95 * |callback|.
96 * If the call to Decode() eventually results in a picture, the |decode_id|
97 * parameter is copied into the returned picture. The plugin can use this to
98 * associate decoded pictures with Decode() calls (e.g. to assign timestamps
99 * or frame numbers to pictures.) It's OK to pass 0 if this isn't needed.
100 *
101 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
102 * decoder.
103 * @param[in] decode_id An optional value, chosen by the plugin, that can be
104 * used to associate calls to Decode() with decoded pictures returned by
105 * GetPicture().
106 * @param[in] size Buffer size in bytes.
107 * @param[in] buffer Starting address of buffer.
108 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
109 * completion.
110 *
111 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
112 */
113 int32_t (*Decode)(PP_Resource video_decoder,
114 uint32_t decode_id,
115 uint32_t size,
116 const void* buffer,
117 struct PP_CompletionCallback callback);
118 /**
119 * Gets the next picture from the decoder. The picture is valid after the
120 * decoder signals completion by returning PP_OK or running |callback|. The
121 * plugin can call GetPicture() again after the decoder signals completion.
122 * When the plugin is finished using the picture, it should return it to the
123 * system by calling RecyclePicture().
124 *
125 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
126 * decoder.
127 * @param[out] picture A <code>PP_MediaCodec_Picture</code> to hold the
128 * decoded picture.
129 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
130 * completion.
131 *
132 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
133 */
134 int32_t (*GetPicture)(PP_Resource video_decoder,
135 struct PP_MediaCodec_Picture* picture,
136 struct PP_CompletionCallback callback);
137 /**
138 * Recycles a picture that the plugin has received from the decoder.
139 * The plugin should call this as soon as it has finished using the texture so
140 * the decoder can decode more pictures.
141 *
142 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
143 * decoder.
144 * @param[in] picture A <code>PP_MediaCodec_Picture</code> to return to
145 * the decoder.
146 */
147 void (*RecyclePicture)(PP_Resource video_decoder,
148 const struct PP_MediaCodec_Picture* picture);
149 /**
150 * Flushes the decoder. The plugin should call this when it reaches the end of
151 * its video stream in order to stop cleanly. The decoder will run all pending
152 * calls to completion. The plugin should make no calls to the decoder other
153 * than RecyclePicture() until the decoder signals completion by running the
154 * callback.
155 *
156 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
157 * decoder.
158 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when
159 * flushing is complete.
160 *
161 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
162 */
163 int32_t (*Flush)(PP_Resource video_decoder,
164 struct PP_CompletionCallback callback);
165 /**
166 * Resets the decoder as quickly as possible. The plugin can call Reset to
167 * skip to another position in the video stream. Pending calls to Decode() and
168 * GetPicture()) are aborted, causing their callbacks to run with
169 * PP_ERROR_ABORTED. The plugin should not make any further calls to the
170 * decoder until the decoder signals completion by running |callback|.
171 *
172 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
173 * decoder.
174 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
175 * completion.
176 *
177 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
178 */
179 int32_t (*Reset)(PP_Resource video_decoder,
180 struct PP_CompletionCallback callback);
181 };
182 /**
183 * @}
184 */
185
186 #endif /* PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_ */
187
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698