OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
11 #include "media/base/bitstream_buffer.h" | 11 #include "media/base/bitstream_buffer.h" |
12 #include "media/base/video_decoder_config.h" | 12 #include "media/base/video_decoder_config.h" |
13 #include "media/video/picture.h" | 13 #include "media/video/picture.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 // Video decoder interface. | 18 // Video decoder interface. |
19 // This interface is extended by the various components that ultimately | 19 // This interface is extended by the various components that ultimately |
20 // implement the backend of PPB_VideoDecode_Dev. | 20 // implement the backend of PPB_VideoDecode_Dev. |
21 class MEDIA_EXPORT VideoDecodeAccelerator { | 21 class MEDIA_EXPORT VideoDecodeAccelerator { |
22 public: | 22 public: |
23 virtual ~VideoDecodeAccelerator(); | |
24 | |
25 // Enumeration of potential errors generated by the API. | 23 // Enumeration of potential errors generated by the API. |
26 // Note: Keep these in sync with PP_VideoDecodeError_Dev. Also do not | 24 // Note: Keep these in sync with PP_VideoDecodeError_Dev. Also do not |
27 // rearrange, reuse or remove values as they are used for gathering UMA | 25 // rearrange, reuse or remove values as they are used for gathering UMA |
28 // statistics. | 26 // statistics. |
29 enum Error { | 27 enum Error { |
30 // An operation was attempted during an incompatible decoder state. | 28 // An operation was attempted during an incompatible decoder state. |
31 ILLEGAL_STATE = 1, | 29 ILLEGAL_STATE = 1, |
32 // Invalid argument was passed to an API method. | 30 // Invalid argument was passed to an API method. |
33 INVALID_ARGUMENT, | 31 INVALID_ARGUMENT, |
34 // Encoded input is unreadable. | 32 // Encoded input is unreadable. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // NotifyResetDone() being called on the client. Can be used to implement | 124 // NotifyResetDone() being called on the client. Can be used to implement |
127 // "seek". | 125 // "seek". |
128 virtual void Reset() = 0; | 126 virtual void Reset() = 0; |
129 | 127 |
130 // Destroys the decoder: all pending inputs are dropped immediately and the | 128 // Destroys the decoder: all pending inputs are dropped immediately and the |
131 // component is freed. This call may asynchornously free system resources, | 129 // component is freed. This call may asynchornously free system resources, |
132 // but its client-visible effects are synchronous. After this method returns | 130 // but its client-visible effects are synchronous. After this method returns |
133 // no more callbacks will be made on the client. Deletes |this| | 131 // no more callbacks will be made on the client. Deletes |this| |
134 // unconditionally, so make sure to drop all pointers to it! | 132 // unconditionally, so make sure to drop all pointers to it! |
135 virtual void Destroy() = 0; | 133 virtual void Destroy() = 0; |
| 134 |
| 135 protected: |
| 136 // Do not delete directly; use Destroy() or own it with a scoped_ptr, which |
| 137 // will Destroy() it properly by default. |
| 138 virtual ~VideoDecodeAccelerator(); |
136 }; | 139 }; |
137 | 140 |
138 } // namespace media | 141 } // namespace media |
139 | 142 |
| 143 namespace base { |
| 144 |
| 145 template <class T> |
| 146 struct DefaultDeleter; |
| 147 |
| 148 // Specialize DefaultDeleter so that scoped_ptr<VideoDecodeAccelerator> always |
| 149 // uses "Destroy()" instead of trying to use the destructor. |
| 150 template <> |
| 151 struct MEDIA_EXPORT DefaultDeleter<media::VideoDecodeAccelerator> { |
| 152 public: |
| 153 void operator()(void* video_decode_accelerator) const; |
| 154 }; |
| 155 |
| 156 } // namespace base |
| 157 |
140 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 158 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |