OLD | NEW |
1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* From ppb_video_decoder.idl modified Tue May 6 05:19:45 2014. */ | 6 /* From ppb_video_decoder.idl modified Wed May 21 09:50:52 2014. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_VIDEO_DECODER_H_ | 8 #ifndef PPAPI_C_PPB_VIDEO_DECODER_H_ |
9 #define PPAPI_C_PPB_VIDEO_DECODER_H_ | 9 #define PPAPI_C_PPB_VIDEO_DECODER_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_codecs.h" | 12 #include "ppapi/c/pp_codecs.h" |
13 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
14 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
15 #include "ppapi/c/pp_macros.h" | 15 #include "ppapi/c/pp_macros.h" |
16 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 * requested profile is not supported. In this case, the client may call | 93 * requested profile is not supported. In this case, the client may call |
94 * Initialize() again with different parameters to find a good configuration. | 94 * Initialize() again with different parameters to find a good configuration. |
95 */ | 95 */ |
96 int32_t (*Initialize)(PP_Resource video_decoder, | 96 int32_t (*Initialize)(PP_Resource video_decoder, |
97 PP_Resource graphics3d_context, | 97 PP_Resource graphics3d_context, |
98 PP_VideoProfile profile, | 98 PP_VideoProfile profile, |
99 PP_Bool allow_software_fallback, | 99 PP_Bool allow_software_fallback, |
100 struct PP_CompletionCallback callback); | 100 struct PP_CompletionCallback callback); |
101 /** | 101 /** |
102 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's | 102 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's |
103 * |buffer|. The plugin should maintain the buffer and not call Decode() again | 103 * |buffer|. The plugin should wait until the decoder signals completion by |
104 * until the decoder signals completion by returning PP_OK or by running | 104 * returning PP_OK or by running |callback| before calling Decode() again. |
105 * |callback|. | |
106 * | 105 * |
107 * In general, each bitstream buffer should contain a demuxed bitstream frame | 106 * In general, each bitstream buffer should contain a demuxed bitstream frame |
108 * for the selected video codec. For example, H264 decoders expect to receive | 107 * for the selected video codec. For example, H264 decoders expect to receive |
109 * one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 | 108 * one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 |
110 * decoders expect to receive a bitstream frame without the IVF frame header. | 109 * decoders expect to receive a bitstream frame without the IVF frame header. |
111 * | 110 * |
112 * If the call to Decode() eventually results in a picture, the |decode_id| | 111 * If the call to Decode() eventually results in a picture, the |decode_id| |
113 * parameter is copied into the returned picture. The plugin can use this to | 112 * parameter is copied into the returned picture. The plugin can use this to |
114 * associate decoded pictures with Decode() calls (e.g. to assign timestamps | 113 * associate decoded pictures with Decode() calls (e.g. to assign timestamps |
115 * or frame numbers to pictures.) This value is opaque to the API so the | 114 * or frame numbers to pictures.) This value is opaque to the API so the |
116 * plugin is free to pass any value. | 115 * plugin is free to pass any value. |
117 * | 116 * |
118 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 117 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
119 * decoder. | 118 * decoder. |
120 * @param[in] decode_id An optional value, chosen by the plugin, that can be | 119 * @param[in] decode_id An optional value, chosen by the plugin, that can be |
121 * used to associate calls to Decode() with decoded pictures returned by | 120 * used to associate calls to Decode() with decoded pictures returned by |
122 * GetPicture(). | 121 * GetPicture(). |
123 * @param[in] size Buffer size in bytes. | 122 * @param[in] size Buffer size in bytes. |
124 * @param[in] buffer Starting address of buffer. | 123 * @param[in] buffer Starting address of buffer. |
125 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 124 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
126 * completion. | 125 * completion. |
127 * | 126 * |
128 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 127 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 128 * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Flush() |
| 129 * or Reset() call is pending. |
| 130 * Returns PP_ERROR_INPROGRESS if there is another Decode() call pending. |
| 131 * Returns PP_ERROR_NOMEMORY if a bitstream buffer can't be created. |
| 132 * Returns PP_ERROR_ABORTED when Reset() is called while Decode() is pending. |
129 */ | 133 */ |
130 int32_t (*Decode)(PP_Resource video_decoder, | 134 int32_t (*Decode)(PP_Resource video_decoder, |
131 uint32_t decode_id, | 135 uint32_t decode_id, |
132 uint32_t size, | 136 uint32_t size, |
133 const void* buffer, | 137 const void* buffer, |
134 struct PP_CompletionCallback callback); | 138 struct PP_CompletionCallback callback); |
135 /** | 139 /** |
136 * Gets the next picture from the decoder. The picture is valid after the | 140 * Gets the next picture from the decoder. The picture is valid after the |
137 * decoder signals completion by returning PP_OK or running |callback|. The | 141 * decoder signals completion by returning PP_OK or running |callback|. The |
138 * plugin can call GetPicture() again after the decoder signals completion. | 142 * plugin can call GetPicture() again after the decoder signals completion. |
139 * When the plugin is finished using the picture, it should return it to the | 143 * When the plugin is finished using the picture, it should return it to the |
140 * system by calling RecyclePicture(). | 144 * system by calling RecyclePicture(). |
141 * | 145 * |
142 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 146 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
143 * decoder. | 147 * decoder. |
144 * @param[out] picture A <code>PP_VideoPicture</code> to hold the decoded | 148 * @param[out] picture A <code>PP_VideoPicture</code> to hold the decoded |
145 * picture. | 149 * picture. |
146 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 150 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
147 * completion. | 151 * completion. |
148 * | 152 * |
149 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 153 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
150 * Returns PP_OK if a picture is available. | 154 * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() |
| 155 * call is pending. |
| 156 * Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. |
151 * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() | 157 * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() |
152 * completes while GetPicture() is pending. | 158 * completes while GetPicture() is pending. |
153 */ | 159 */ |
154 int32_t (*GetPicture)(PP_Resource video_decoder, | 160 int32_t (*GetPicture)(PP_Resource video_decoder, |
155 struct PP_VideoPicture* picture, | 161 struct PP_VideoPicture* picture, |
156 struct PP_CompletionCallback callback); | 162 struct PP_CompletionCallback callback); |
157 /** | 163 /** |
158 * Recycles a picture that the plugin has received from the decoder. | 164 * Recycles a picture that the plugin has received from the decoder. |
159 * The plugin should call this as soon as it has finished using the texture so | 165 * The plugin should call this as soon as it has finished using the texture so |
160 * the decoder can decode more pictures. | 166 * the decoder can decode more pictures. |
161 * | 167 * |
162 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 168 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
163 * decoder. | 169 * decoder. |
164 * @param[in] picture A <code>PP_VideoPicture</code> to return to | 170 * @param[in] picture A <code>PP_VideoPicture</code> to return to |
165 * the decoder. | 171 * the decoder. |
166 */ | 172 */ |
167 void (*RecyclePicture)(PP_Resource video_decoder, | 173 void (*RecyclePicture)(PP_Resource video_decoder, |
168 const struct PP_VideoPicture* picture); | 174 const struct PP_VideoPicture* picture); |
169 /** | 175 /** |
170 * Flushes the decoder. The plugin should call this when it reaches the end of | 176 * Flushes the decoder. The plugin should call Flush() when it reaches the |
171 * its video stream in order to stop cleanly. The decoder will run all pending | 177 * end of its video stream in order to stop cleanly. The decoder will run any |
172 * calls to completion. The plugin should make no further calls to the decoder | 178 * pending Decode() call to completion. The plugin should make no further |
173 * other than GetPicture() and RecyclePicture() until the decoder signals | 179 * calls to the decoder other than GetPicture() and RecyclePicture() until |
174 * completion by running the callback. Just before completion, any pending | 180 * the decoder signals completion by running |callback|. Just before |
175 * GetPicture() call will complete by running the callback with result | 181 * completion, any pending GetPicture() call will complete by running its |
176 * PP_ERROR_ABORTED to signal that no more pictures are available. | 182 * callback with result PP_ERROR_ABORTED to signal that no more pictures are |
| 183 * available. The plugin should recycle any pictures it is using before |
| 184 * resuming decoding. |
177 * | 185 * |
178 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 186 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
179 * decoder. | 187 * decoder. |
180 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 188 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
181 * completion. | 189 * completion. |
182 * | 190 * |
183 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 191 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 192 * Returns PP_ERROR_FAILED if the decoder isn't initialized. |
184 */ | 193 */ |
185 int32_t (*Flush)(PP_Resource video_decoder, | 194 int32_t (*Flush)(PP_Resource video_decoder, |
186 struct PP_CompletionCallback callback); | 195 struct PP_CompletionCallback callback); |
187 /** | 196 /** |
188 * Resets the decoder as quickly as possible. The plugin can call Reset() to | 197 * Resets the decoder as quickly as possible. The plugin can call Reset() to |
189 * skip to another position in the video stream. Pending calls to Decode() and | 198 * skip to another position in the video stream. After Reset() returns, any |
190 * GetPicture()) are immediately aborted, causing their callbacks to run with | 199 * pending calls to Decode() and GetPicture()) abort, causing their callbacks |
191 * PP_ERROR_ABORTED. The plugin should not make any further calls to the | 200 * to run with PP_ERROR_ABORTED. The plugin should not make further calls to |
192 * decoder until the decoder signals completion by running |callback|. | 201 * the decoder until the decoder signals completion by running |callback|. |
| 202 * The pictures in use by the plugin remain valid until decoding is resumed, |
| 203 * but need not be recycled. |
193 * | 204 * |
194 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 205 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
195 * decoder. | 206 * decoder. |
196 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 207 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
197 * completion. | 208 * completion. |
198 * | 209 * |
199 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 210 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 211 * Returns PP_ERROR_FAILED if the decoder isn't initialized. |
200 */ | 212 */ |
201 int32_t (*Reset)(PP_Resource video_decoder, | 213 int32_t (*Reset)(PP_Resource video_decoder, |
202 struct PP_CompletionCallback callback); | 214 struct PP_CompletionCallback callback); |
203 }; | 215 }; |
204 /** | 216 /** |
205 * @} | 217 * @} |
206 */ | 218 */ |
207 | 219 |
208 #endif /* PPAPI_C_PPB_VIDEO_DECODER_H_ */ | 220 #endif /* PPAPI_C_PPB_VIDEO_DECODER_H_ */ |
209 | 221 |
OLD | NEW |