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 10 matching lines...) Expand all Loading... |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/synchronization/condition_variable.h" | 22 #include "base/synchronization/condition_variable.h" |
23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
25 #include "content/common/content_export.h" | 25 #include "content/common/content_export.h" |
26 #include "content/common/gpu/media/vaapi_wrapper.h" | 26 #include "content/common/gpu/media/vaapi_wrapper.h" |
27 #include "media/base/bitstream_buffer.h" | 27 #include "media/base/bitstream_buffer.h" |
28 #include "media/video/picture.h" | 28 #include "media/video/picture.h" |
29 #include "media/video/video_decode_accelerator.h" | 29 #include "media/video/video_decode_accelerator.h" |
30 | 30 |
31 namespace gfx { | 31 namespace gl { |
32 class GLImage; | 32 class GLImage; |
33 } | 33 } |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 | 36 |
37 class AcceleratedVideoDecoder; | 37 class AcceleratedVideoDecoder; |
38 class VaapiPicture; | 38 class VaapiPicture; |
39 | 39 |
40 // Class to provide video decode acceleration for Intel systems with hardware | 40 // Class to provide video decode acceleration for Intel systems with hardware |
41 // support for it, and on which libva is available. | 41 // support for it, and on which libva is available. |
42 // Decoding tasks are performed in a separate decoding thread. | 42 // Decoding tasks are performed in a separate decoding thread. |
43 // | 43 // |
44 // Threading/life-cycle: this object is created & destroyed on the GPU | 44 // Threading/life-cycle: this object is created & destroyed on the GPU |
45 // ChildThread. A few methods on it are called on the decoder thread which is | 45 // ChildThread. A few methods on it are called on the decoder thread which is |
46 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread | 46 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread |
47 // can assume |*this| is still alive. See |weak_this_| below for more details. | 47 // can assume |*this| is still alive. See |weak_this_| below for more details. |
48 class CONTENT_EXPORT VaapiVideoDecodeAccelerator | 48 class CONTENT_EXPORT VaapiVideoDecodeAccelerator |
49 : public media::VideoDecodeAccelerator { | 49 : public media::VideoDecodeAccelerator { |
50 public: | 50 public: |
51 class VaapiDecodeSurface; | 51 class VaapiDecodeSurface; |
52 | 52 |
53 VaapiVideoDecodeAccelerator( | 53 VaapiVideoDecodeAccelerator( |
54 const base::Callback<bool(void)>& make_context_current, | 54 const base::Callback<bool(void)>& make_context_current, |
55 const base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>& | 55 const base::Callback<void(uint32, uint32, scoped_refptr<gl::GLImage>)>& |
56 bind_image); | 56 bind_image); |
57 ~VaapiVideoDecodeAccelerator() override; | 57 ~VaapiVideoDecodeAccelerator() override; |
58 | 58 |
59 // media::VideoDecodeAccelerator implementation. | 59 // media::VideoDecodeAccelerator implementation. |
60 bool Initialize(media::VideoCodecProfile profile, Client* client) override; | 60 bool Initialize(media::VideoCodecProfile profile, Client* client) override; |
61 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 61 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
62 void AssignPictureBuffers( | 62 void AssignPictureBuffers( |
63 const std::vector<media::PictureBuffer>& buffers) override; | 63 const std::vector<media::PictureBuffer>& buffers) override; |
64 void ReusePictureBuffer(int32 picture_buffer_id) override; | 64 void ReusePictureBuffer(int32 picture_buffer_id) override; |
65 void Flush() override; | 65 void Flush() override; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // Decoder requested a new surface set and we are waiting for all the surfaces | 296 // Decoder requested a new surface set and we are waiting for all the surfaces |
297 // to be returned before we can free them. | 297 // to be returned before we can free them. |
298 bool awaiting_va_surfaces_recycle_; | 298 bool awaiting_va_surfaces_recycle_; |
299 | 299 |
300 // Last requested number/resolution of output picture buffers. | 300 // Last requested number/resolution of output picture buffers. |
301 size_t requested_num_pics_; | 301 size_t requested_num_pics_; |
302 gfx::Size requested_pic_size_; | 302 gfx::Size requested_pic_size_; |
303 | 303 |
304 // Binds the provided GLImage to a givenr client texture ID & texture target | 304 // Binds the provided GLImage to a givenr client texture ID & texture target |
305 // combination in GLES. | 305 // combination in GLES. |
306 base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)> bind_image_; | 306 base::Callback<void(uint32, uint32, scoped_refptr<gl::GLImage>)> bind_image_; |
307 | 307 |
308 // The WeakPtrFactory for |weak_this_|. | 308 // The WeakPtrFactory for |weak_this_|. |
309 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; | 309 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; |
310 | 310 |
311 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 311 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
312 }; | 312 }; |
313 | 313 |
314 } // namespace content | 314 } // namespace content |
315 | 315 |
316 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 316 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |