OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 enum VideoColorFormat { | 154 enum VideoColorFormat { |
155 // Value represents 32-bit RGBA format where each component is 8-bit in order | 155 // Value represents 32-bit RGBA format where each component is 8-bit in order |
156 // R-G-B-A. Regardless of endianness of the architecture color components are | 156 // R-G-B-A. Regardless of endianness of the architecture color components are |
157 // stored in this order in the memory. | 157 // stored in this order in the memory. |
158 VIDEOCOLORFORMAT_RGBA = 0, | 158 VIDEOCOLORFORMAT_RGBA = 0, |
159 }; | 159 }; |
160 | 160 |
161 // Video decoder interface. | 161 // Video decoder interface. |
162 // This interface is extended by the various components that ultimately | 162 // This interface is extended by the various components that ultimately |
163 // implement the backend of PPB_VideoDecode_Dev. | 163 // implement the backend of PPB_VideoDecode_Dev. |
164 class VideoDecodeAccelerator { | 164 // |
| 165 // No thread-safety guarantees are implied by the use of RefCountedThreadSafe |
| 166 // below. |
| 167 class VideoDecodeAccelerator |
| 168 : public base::RefCountedThreadSafe<VideoDecodeAccelerator> { |
165 public: | 169 public: |
166 virtual ~VideoDecodeAccelerator(); | |
167 | |
168 // Enumeration of potential errors generated by the API. | 170 // Enumeration of potential errors generated by the API. |
169 // TODO(fischman): these errors are a bad match for both what OMX generates | 171 // TODO(fischman): these errors are a bad match for both what OMX generates |
170 // and for what the plugin wants. Overhaul this list with a more useful set. | 172 // and for what the plugin wants. Overhaul this list with a more useful set. |
171 enum Error { | 173 enum Error { |
172 VIDEODECODERERROR_NONE = 0, | 174 VIDEODECODERERROR_NONE = 0, |
173 VIDEODECODERERROR_UNINITIALIZED, | 175 VIDEODECODERERROR_UNINITIALIZED, |
174 VIDEODECODERERROR_UNSUPPORTED, | 176 VIDEODECODERERROR_UNSUPPORTED, |
175 VIDEODECODERERROR_INVALIDINPUT, | 177 VIDEODECODERERROR_INVALIDINPUT, |
176 VIDEODECODERERROR_MEMFAILURE, | 178 VIDEODECODERERROR_MEMFAILURE, |
177 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, | 179 VIDEODECODERERROR_INSUFFICIENT_BUFFERS, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // Callback to notify that decoded has decoded the end of the current | 221 // Callback to notify that decoded has decoded the end of the current |
220 // bitstream buffer. | 222 // bitstream buffer. |
221 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) = 0; | 223 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) = 0; |
222 | 224 |
223 // Flush completion callback. | 225 // Flush completion callback. |
224 virtual void NotifyFlushDone() = 0; | 226 virtual void NotifyFlushDone() = 0; |
225 | 227 |
226 // Reset completion callback. | 228 // Reset completion callback. |
227 virtual void NotifyResetDone() = 0; | 229 virtual void NotifyResetDone() = 0; |
228 | 230 |
229 // Destroy completion callback. | |
230 virtual void NotifyDestroyDone() = 0; | |
231 | |
232 // Callback to notify about decoding errors. | 231 // Callback to notify about decoding errors. |
233 virtual void NotifyError(Error error) = 0; | 232 virtual void NotifyError(Error error) = 0; |
234 }; | 233 }; |
235 | 234 |
236 // Video decoder functions. | 235 // Video decoder functions. |
237 | 236 |
238 // Initializes the video decoder with specific configuration. | 237 // Initializes the video decoder with specific configuration. |
239 // Parameters: | 238 // Parameters: |
240 // |config| is the configuration on which the decoder should be initialized. | 239 // |config| is the configuration on which the decoder should be initialized. |
241 // | 240 // |
(...skipping 30 matching lines...) Expand all Loading... |
272 // client. Can be used to implement "end of stream" notification. | 271 // client. Can be used to implement "end of stream" notification. |
273 virtual void Flush() = 0; | 272 virtual void Flush() = 0; |
274 | 273 |
275 // Resets the decoder: all pending inputs are dropped immediately and the | 274 // Resets the decoder: all pending inputs are dropped immediately and the |
276 // decoder returned to a state ready for further Decode()s, followed by | 275 // decoder returned to a state ready for further Decode()s, followed by |
277 // NotifyResetDone() being called on the client. Can be used to implement | 276 // NotifyResetDone() being called on the client. Can be used to implement |
278 // "seek". | 277 // "seek". |
279 virtual void Reset() = 0; | 278 virtual void Reset() = 0; |
280 | 279 |
281 // Destroys the decoder: all pending inputs are dropped immediately and the | 280 // Destroys the decoder: all pending inputs are dropped immediately and the |
282 // component is freed, followed by NotifyDestroyDone being called on the | 281 // component is freed. This call may asynchornously free system resources, |
283 // client. After this is called no other calls may be made on the decoder, | 282 // but its client-visible effects are synchronous. After this method returns |
284 // and after NotifyDestroyDone is called no callbacks will be made by the | 283 // no more callbacks will be made on the client. |
285 // decoder on the client. | |
286 virtual void Destroy() = 0; | 284 virtual void Destroy() = 0; |
| 285 |
| 286 protected: |
| 287 friend class base::RefCountedThreadSafe<VideoDecodeAccelerator>; |
| 288 virtual ~VideoDecodeAccelerator(); |
287 }; | 289 }; |
288 | 290 |
289 } // namespace media | 291 } // namespace media |
290 | 292 |
291 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 293 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |