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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // A failure occurred at the browser layer or one of its dependencies. | 99 // A failure occurred at the browser layer or one of its dependencies. |
100 // Examples of such failures include GPU hardware failures, GPU driver | 100 // Examples of such failures include GPU hardware failures, GPU driver |
101 // failures, GPU library failures, browser programming errors, and so on. | 101 // failures, GPU library failures, browser programming errors, and so on. |
102 PLATFORM_FAILURE, | 102 PLATFORM_FAILURE, |
103 // Largest used enum. This should be adjusted when new errors are added. | 103 // Largest used enum. This should be adjusted when new errors are added. |
104 ERROR_MAX = PLATFORM_FAILURE, | 104 ERROR_MAX = PLATFORM_FAILURE, |
105 }; | 105 }; |
106 | 106 |
107 // Config structure contains parameters required for the VDA initialization. | 107 // Config structure contains parameters required for the VDA initialization. |
108 struct MEDIA_EXPORT Config { | 108 struct MEDIA_EXPORT Config { |
109 enum { kNoSurfaceID = SurfaceManager::kNoSurfaceID }; | |
110 | |
111 // Specifies the allocation and handling mode for output PictureBuffers. | 109 // Specifies the allocation and handling mode for output PictureBuffers. |
112 // When set to ALLOCATE, the VDA is expected to allocate backing memory | 110 // When set to ALLOCATE, the VDA is expected to allocate backing memory |
113 // for PictureBuffers at the time of AssignPictureBuffers() call. | 111 // for PictureBuffers at the time of AssignPictureBuffers() call. |
114 // When set to IMPORT, the VDA will not allocate, but after receiving | 112 // When set to IMPORT, the VDA will not allocate, but after receiving |
115 // AssignPictureBuffers() call, it will expect a call to | 113 // AssignPictureBuffers() call, it will expect a call to |
116 // ImportBufferForPicture() for each PictureBuffer before use. | 114 // ImportBufferForPicture() for each PictureBuffer before use. |
117 enum class OutputMode { | 115 enum class OutputMode { |
118 ALLOCATE, | 116 ALLOCATE, |
119 IMPORT, | 117 IMPORT, |
120 }; | 118 }; |
(...skipping 15 matching lines...) Expand all Loading... |
136 // Whether the stream is encrypted. | 134 // Whether the stream is encrypted. |
137 bool is_encrypted = false; | 135 bool is_encrypted = false; |
138 | 136 |
139 // The CDM that the VDA should use to decode encrypted streams. Must be | 137 // The CDM that the VDA should use to decode encrypted streams. Must be |
140 // set to a valid ID if |is_encrypted|. | 138 // set to a valid ID if |is_encrypted|. |
141 int cdm_id = CdmContext::kInvalidCdmId; | 139 int cdm_id = CdmContext::kInvalidCdmId; |
142 | 140 |
143 // Whether the client supports deferred initialization. | 141 // Whether the client supports deferred initialization. |
144 bool is_deferred_initialization_allowed = false; | 142 bool is_deferred_initialization_allowed = false; |
145 | 143 |
146 // An optional graphics surface that the VDA should render to. For setting | |
147 // an output SurfaceView on Android. It's only valid when not equal to | |
148 // |kNoSurfaceID|. | |
149 int surface_id = kNoSurfaceID; | |
150 | |
151 // Coded size of the video frame hint, subject to change. | 144 // Coded size of the video frame hint, subject to change. |
152 gfx::Size initial_expected_coded_size = gfx::Size(320, 240); | 145 gfx::Size initial_expected_coded_size = gfx::Size(320, 240); |
153 | 146 |
154 OutputMode output_mode = OutputMode::ALLOCATE; | 147 OutputMode output_mode = OutputMode::ALLOCATE; |
155 | 148 |
156 // The list of picture buffer formats that the client knows how to use. An | 149 // The list of picture buffer formats that the client knows how to use. An |
157 // empty list means any format is supported. | 150 // empty list means any format is supported. |
158 std::vector<VideoPixelFormat> supported_output_formats; | 151 std::vector<VideoPixelFormat> supported_output_formats; |
159 | 152 |
160 // The H264 SPS and PPS configuration data. Not all clients populate these | 153 // The H264 SPS and PPS configuration data. Not all clients populate these |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // back to the client, followed by NotifyFlushDone() being called on the | 277 // back to the client, followed by NotifyFlushDone() being called on the |
285 // client. Can be used to implement "end of stream" notification. | 278 // client. Can be used to implement "end of stream" notification. |
286 virtual void Flush() = 0; | 279 virtual void Flush() = 0; |
287 | 280 |
288 // Resets the decoder: all pending inputs are dropped immediately and the | 281 // Resets the decoder: all pending inputs are dropped immediately and the |
289 // decoder returned to a state ready for further Decode()s, followed by | 282 // decoder returned to a state ready for further Decode()s, followed by |
290 // NotifyResetDone() being called on the client. Can be used to implement | 283 // NotifyResetDone() being called on the client. Can be used to implement |
291 // "seek". | 284 // "seek". |
292 virtual void Reset() = 0; | 285 virtual void Reset() = 0; |
293 | 286 |
| 287 // An optional graphics surface that the VDA should render to. For setting |
| 288 // an output SurfaceView on Android. Passing |kNoSurfaceID| will clear any |
| 289 // previously set surface in favor of an internally generated texture. |
| 290 virtual void SetSurface(int32_t surface_id); |
| 291 |
294 // Destroys the decoder: all pending inputs are dropped immediately and the | 292 // Destroys the decoder: all pending inputs are dropped immediately and the |
295 // component is freed. This call may asynchornously free system resources, | 293 // component is freed. This call may asynchornously free system resources, |
296 // but its client-visible effects are synchronous. After this method returns | 294 // but its client-visible effects are synchronous. After this method returns |
297 // no more callbacks will be made on the client. Deletes |this| | 295 // no more callbacks will be made on the client. Deletes |this| |
298 // unconditionally, so make sure to drop all pointers to it! | 296 // unconditionally, so make sure to drop all pointers to it! |
299 virtual void Destroy() = 0; | 297 virtual void Destroy() = 0; |
300 | 298 |
301 // TO BE CALLED IN THE SAME PROCESS AS THE VDA IMPLEMENTATION ONLY. | 299 // TO BE CALLED IN THE SAME PROCESS AS THE VDA IMPLEMENTATION ONLY. |
302 // | 300 // |
303 // A decode "task" is a sequence that includes a Decode() call from Client, | 301 // A decode "task" is a sequence that includes a Decode() call from Client, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // std::unique_ptr<VideoDecodeAccelerator> uses "Destroy()" instead of trying to | 348 // std::unique_ptr<VideoDecodeAccelerator> uses "Destroy()" instead of trying to |
351 // use the destructor. | 349 // use the destructor. |
352 template <> | 350 template <> |
353 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> { | 351 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> { |
354 void operator()(media::VideoDecodeAccelerator* vda) const; | 352 void operator()(media::VideoDecodeAccelerator* vda) const; |
355 }; | 353 }; |
356 | 354 |
357 } // namespace std | 355 } // namespace std |
358 | 356 |
359 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ | 357 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |