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 // This file contains an implementation of VideoDecoderAccelerator | 5 // This file contains an implementation of VideoDecoderAccelerator |
6 // that utilizes hardware video decoder present on Intel CPUs. | 6 // that utilizes hardware video decoder present on Intel CPUs. |
7 | 7 |
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Threading/life-cycle: this object is created & destroyed on the GPU | 48 // Threading/life-cycle: this object is created & destroyed on the GPU |
49 // ChildThread. A few methods on it are called on the decoder thread which is | 49 // ChildThread. A few methods on it are called on the decoder thread which is |
50 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread | 50 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread |
51 // can assume |*this| is still alive. See |weak_this_| below for more details. | 51 // can assume |*this| is still alive. See |weak_this_| below for more details. |
52 class CONTENT_EXPORT VaapiVideoDecodeAccelerator | 52 class CONTENT_EXPORT VaapiVideoDecodeAccelerator |
53 : public media::VideoDecodeAccelerator { | 53 : public media::VideoDecodeAccelerator { |
54 public: | 54 public: |
55 class VaapiDecodeSurface; | 55 class VaapiDecodeSurface; |
56 | 56 |
57 VaapiVideoDecodeAccelerator( | 57 VaapiVideoDecodeAccelerator( |
58 const MakeContextCurrentCallback& make_context_current, | 58 const base::Callback<bool(void)>& make_context_current, |
59 const BindImageCallback& bind_image); | 59 const base::Callback< |
| 60 void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& bind_image); |
60 ~VaapiVideoDecodeAccelerator() override; | 61 ~VaapiVideoDecodeAccelerator() override; |
61 | 62 |
62 // media::VideoDecodeAccelerator implementation. | 63 // media::VideoDecodeAccelerator implementation. |
63 bool Initialize(const Config& config, Client* client) override; | 64 bool Initialize(const Config& config, Client* client) override; |
64 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 65 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
65 void AssignPictureBuffers( | 66 void AssignPictureBuffers( |
66 const std::vector<media::PictureBuffer>& buffers) override; | 67 const std::vector<media::PictureBuffer>& buffers) override; |
67 void ReusePictureBuffer(int32_t picture_buffer_id) override; | 68 void ReusePictureBuffer(int32_t picture_buffer_id) override; |
68 void Flush() override; | 69 void Flush() override; |
69 void Reset() override; | 70 void Reset() override; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // each submitted command in order, and run each command only if its | 175 // each submitted command in order, and run each command only if its |
175 // dependencies are ready. | 176 // dependencies are ready. |
176 void SurfaceReady(const scoped_refptr<VaapiDecodeSurface>& dec_surface); | 177 void SurfaceReady(const scoped_refptr<VaapiDecodeSurface>& dec_surface); |
177 | 178 |
178 // Return a new VaapiDecodeSurface for decoding into, or nullptr if not | 179 // Return a new VaapiDecodeSurface for decoding into, or nullptr if not |
179 // available. | 180 // available. |
180 scoped_refptr<VaapiDecodeSurface> CreateSurface(); | 181 scoped_refptr<VaapiDecodeSurface> CreateSurface(); |
181 | 182 |
182 | 183 |
183 // Client-provided GL state. | 184 // Client-provided GL state. |
184 MakeContextCurrentCallback make_context_current_; | 185 base::Callback<bool(void)> make_context_current_; |
185 | 186 |
186 // VAVDA state. | 187 // VAVDA state. |
187 enum State { | 188 enum State { |
188 // Initialize() not called yet or failed. | 189 // Initialize() not called yet or failed. |
189 kUninitialized, | 190 kUninitialized, |
190 // DecodeTask running. | 191 // DecodeTask running. |
191 kDecoding, | 192 kDecoding, |
192 // Resetting, waiting for decoder to finish current task and cleanup. | 193 // Resetting, waiting for decoder to finish current task and cleanup. |
193 kResetting, | 194 kResetting, |
194 // Flushing, waiting for decoder to finish current task and cleanup. | 195 // Flushing, waiting for decoder to finish current task and cleanup. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Decoder requested a new surface set and we are waiting for all the surfaces | 299 // Decoder requested a new surface set and we are waiting for all the surfaces |
299 // to be returned before we can free them. | 300 // to be returned before we can free them. |
300 bool awaiting_va_surfaces_recycle_; | 301 bool awaiting_va_surfaces_recycle_; |
301 | 302 |
302 // Last requested number/resolution of output picture buffers. | 303 // Last requested number/resolution of output picture buffers. |
303 size_t requested_num_pics_; | 304 size_t requested_num_pics_; |
304 gfx::Size requested_pic_size_; | 305 gfx::Size requested_pic_size_; |
305 | 306 |
306 // Binds the provided GLImage to a givenr client texture ID & texture target | 307 // Binds the provided GLImage to a givenr client texture ID & texture target |
307 // combination in GLES. | 308 // combination in GLES. |
308 BindImageCallback bind_image_; | 309 base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)> |
| 310 bind_image_; |
309 | 311 |
310 // The WeakPtrFactory for |weak_this_|. | 312 // The WeakPtrFactory for |weak_this_|. |
311 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; | 313 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; |
312 | 314 |
313 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 315 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
314 }; | 316 }; |
315 | 317 |
316 } // namespace content | 318 } // namespace content |
317 | 319 |
318 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 320 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |