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 /** | 6 /** |
7 * This file defines the <code>PPB_VideoDecoder</code> interface. | 7 * This file defines the <code>PPB_VideoDecoder</code> interface. |
8 */ | 8 */ |
9 | 9 |
10 [generate_thunk] | 10 [generate_thunk] |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 */ | 84 */ |
85 int32_t Initialize( | 85 int32_t Initialize( |
86 [in] PP_Resource video_decoder, | 86 [in] PP_Resource video_decoder, |
87 [in] PP_Resource graphics3d_context, | 87 [in] PP_Resource graphics3d_context, |
88 [in] PP_VideoProfile profile, | 88 [in] PP_VideoProfile profile, |
89 [in] PP_Bool allow_software_fallback, | 89 [in] PP_Bool allow_software_fallback, |
90 [in] PP_CompletionCallback callback); | 90 [in] PP_CompletionCallback callback); |
91 | 91 |
92 /** | 92 /** |
93 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's | 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 | 94 * |buffer|. The plugin should wait until the decoder signals completion by |
95 * until the decoder signals completion by returning PP_OK or by running | 95 * returning PP_OK or by running |callback| before calling Decode() again. |
igorc
2014/05/21 20:34:29
And another one - why do we need two ways to succe
| |
96 * |callback|. | |
97 * | 96 * |
98 * In general, each bitstream buffer should contain a demuxed bitstream frame | 97 * In general, each bitstream buffer should contain a demuxed bitstream frame |
99 * for the selected video codec. For example, H264 decoders expect to receive | 98 * 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 | 99 * 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. | 100 * decoders expect to receive a bitstream frame without the IVF frame header. |
102 * | 101 * |
103 * If the call to Decode() eventually results in a picture, the |decode_id| | 102 * 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 | 103 * 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 | 104 * 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 | 105 * or frame numbers to pictures.) This value is opaque to the API so the |
107 * plugin is free to pass any value. | 106 * plugin is free to pass any value. |
108 * | 107 * |
109 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 108 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
110 * decoder. | 109 * decoder. |
111 * @param[in] decode_id An optional value, chosen by the plugin, that can be | 110 * @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 | 111 * used to associate calls to Decode() with decoded pictures returned by |
113 * GetPicture(). | 112 * GetPicture(). |
114 * @param[in] size Buffer size in bytes. | 113 * @param[in] size Buffer size in bytes. |
115 * @param[in] buffer Starting address of buffer. | 114 * @param[in] buffer Starting address of buffer. |
116 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 115 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
117 * completion. | 116 * completion. |
118 * | 117 * |
119 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 118 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
119 * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Flush() | |
120 * or Reset() call is pending. | |
121 * Returns PP_ERROR_INPROGRESS if there is another Decode() call pending. | |
122 * Returns PP_ERROR_NOMEMORY if a bitstream buffer can't be created. | |
123 * Returns PP_ERROR_ABORTED when Reset() is called while Decode() is pending. | |
120 */ | 124 */ |
121 int32_t Decode( | 125 int32_t Decode( |
122 [in] PP_Resource video_decoder, | 126 [in] PP_Resource video_decoder, |
123 [in] uint32_t decode_id, | 127 [in] uint32_t decode_id, |
124 [in] uint32_t size, | 128 [in] uint32_t size, |
125 [in] mem_t buffer, | 129 [in] mem_t buffer, |
126 [in] PP_CompletionCallback callback); | 130 [in] PP_CompletionCallback callback); |
127 | 131 |
128 /** | 132 /** |
129 * Gets the next picture from the decoder. The picture is valid after the | 133 * 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 | 134 * decoder signals completion by returning PP_OK or running |callback|. The |
131 * plugin can call GetPicture() again after the decoder signals completion. | 135 * 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 | 136 * When the plugin is finished using the picture, it should return it to the |
133 * system by calling RecyclePicture(). | 137 * system by calling RecyclePicture(). |
134 * | 138 * |
135 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 139 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
136 * decoder. | 140 * decoder. |
137 * @param[out] picture A <code>PP_VideoPicture</code> to hold the decoded | 141 * @param[out] picture A <code>PP_VideoPicture</code> to hold the decoded |
138 * picture. | 142 * picture. |
139 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 143 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
140 * completion. | 144 * completion. |
141 * | 145 * |
142 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 146 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
143 * Returns PP_OK if a picture is available. | 147 * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() |
148 * call is pending. | |
149 * Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. | |
144 * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() | 150 * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() |
145 * completes while GetPicture() is pending. | 151 * completes while GetPicture() is pending. |
146 */ | 152 */ |
147 int32_t GetPicture( | 153 int32_t GetPicture( |
148 [in] PP_Resource video_decoder, | 154 [in] PP_Resource video_decoder, |
149 [out] PP_VideoPicture picture, | 155 [out] PP_VideoPicture picture, |
150 [in] PP_CompletionCallback callback); | 156 [in] PP_CompletionCallback callback); |
151 | 157 |
152 /** | 158 /** |
153 * Recycles a picture that the plugin has received from the decoder. | 159 * 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 | 160 * The plugin should call this as soon as it has finished using the texture so |
155 * the decoder can decode more pictures. | 161 * the decoder can decode more pictures. |
156 * | 162 * |
157 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 163 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
158 * decoder. | 164 * decoder. |
159 * @param[in] picture A <code>PP_VideoPicture</code> to return to | 165 * @param[in] picture A <code>PP_VideoPicture</code> to return to |
160 * the decoder. | 166 * the decoder. |
161 */ | 167 */ |
162 void RecyclePicture( | 168 void RecyclePicture( |
163 [in] PP_Resource video_decoder, | 169 [in] PP_Resource video_decoder, |
164 [in] PP_VideoPicture picture); | 170 [in] PP_VideoPicture picture); |
igorc
2014/05/21 19:44:37
Could you clarify which fields need to be filled o
| |
165 | 171 |
166 /** | 172 /** |
167 * Flushes the decoder. The plugin should call this when it reaches the end of | 173 * Flushes the decoder. The plugin should call Flush() when it reaches the |
168 * its video stream in order to stop cleanly. The decoder will run all pending | 174 * end of its video stream in order to stop cleanly. The decoder will run any |
169 * calls to completion. The plugin should make no further calls to the decoder | 175 * pending Decode() call to completion. The plugin should make no further |
170 * other than GetPicture() and RecyclePicture() until the decoder signals | 176 * calls to the decoder other than GetPicture() and RecyclePicture() until |
igorc
2014/05/21 19:07:05
Just to clarify - am I not allowed to call Reset()
| |
171 * completion by running the callback. Just before completion, any pending | 177 * the decoder signals completion by running |callback|. Just before |
172 * GetPicture() call will complete by running the callback with result | 178 * completion, any pending GetPicture() call will complete by running its |
173 * PP_ERROR_ABORTED to signal that no more pictures are available. | 179 * callback with result PP_ERROR_ABORTED to signal that no more pictures are |
180 * available. The plugin should recycle any pictures it is using before | |
181 * resuming decoding. | |
174 * | 182 * |
175 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 183 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
176 * decoder. | 184 * decoder. |
177 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 185 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
igorc
2014/05/21 19:07:05
As we discussed - could you add a clarification th
| |
178 * completion. | 186 * completion. |
179 * | 187 * |
180 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 188 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
189 * Returns PP_ERROR_FAILED if the decoder isn't initialized. | |
181 */ | 190 */ |
182 int32_t Flush( | 191 int32_t Flush( |
igorc
2014/05/21 20:15:47
Could you also clarify the difference between PP_O
| |
183 [in] PP_Resource video_decoder, | 192 [in] PP_Resource video_decoder, |
184 [in] PP_CompletionCallback callback); | 193 [in] PP_CompletionCallback callback); |
185 | 194 |
186 /** | 195 /** |
187 * Resets the decoder as quickly as possible. The plugin can call Reset() to | 196 * 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 | 197 * skip to another position in the video stream. After Reset() returns, any |
189 * GetPicture()) are immediately aborted, causing their callbacks to run with | 198 * pending calls to Decode() and GetPicture()) abort, causing their callbacks |
190 * PP_ERROR_ABORTED. The plugin should not make any further calls to the | 199 * to run with PP_ERROR_ABORTED. The plugin should not make further calls to |
191 * decoder until the decoder signals completion by running |callback|. | 200 * the decoder until the decoder signals completion by running |callback|. |
201 * The pictures in use by the plugin remain valid until decoding is resumed, | |
202 * but need not be recycled. | |
192 * | 203 * |
193 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 204 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
194 * decoder. | 205 * decoder. |
195 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on | 206 * @param[in] callback A <code>PP_CompletionCallback</code> to be called on |
196 * completion. | 207 * completion. |
197 * | 208 * |
198 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 209 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
210 * Returns PP_ERROR_FAILED if the decoder isn't initialized. | |
199 */ | 211 */ |
200 int32_t Reset( | 212 int32_t Reset( |
201 [in] PP_Resource video_decoder, | 213 [in] PP_Resource video_decoder, |
202 [in] PP_CompletionCallback callback); | 214 [in] PP_CompletionCallback callback); |
203 }; | 215 }; |
OLD | NEW |