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/synchronization/condition_variable.h" | 21 #include "base/synchronization/condition_variable.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
24 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
25 #include "content/common/gpu/media/vaapi_h264_decoder.h" | 25 #include "content/common/gpu/media/vaapi_h264_decoder.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 { | |
32 class GLImage; | |
33 } | |
34 | |
31 namespace content { | 35 namespace content { |
32 | 36 |
33 class VaapiPicture; | 37 class VaapiPicture; |
34 | 38 |
35 // Class to provide video decode acceleration for Intel systems with hardware | 39 // Class to provide video decode acceleration for Intel systems with hardware |
36 // support for it, and on which libva is available. | 40 // support for it, and on which libva is available. |
37 // Decoding tasks are performed in a separate decoding thread. | 41 // Decoding tasks are performed in a separate decoding thread. |
38 // | 42 // |
39 // Threading/life-cycle: this object is created & destroyed on the GPU | 43 // Threading/life-cycle: this object is created & destroyed on the GPU |
40 // ChildThread. A few methods on it are called on the decoder thread which is | 44 // ChildThread. A few methods on it are called on the decoder thread which is |
41 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread | 45 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread |
42 // can assume |*this| is still alive. See |weak_this_| below for more details. | 46 // can assume |*this| is still alive. See |weak_this_| below for more details. |
43 class CONTENT_EXPORT VaapiVideoDecodeAccelerator | 47 class CONTENT_EXPORT VaapiVideoDecodeAccelerator |
44 : public media::VideoDecodeAccelerator { | 48 : public media::VideoDecodeAccelerator { |
45 public: | 49 public: |
46 VaapiVideoDecodeAccelerator( | 50 VaapiVideoDecodeAccelerator( |
47 const base::Callback<bool(void)>& make_context_current); | 51 const base::Callback<bool(void)>& make_context_current, |
52 const base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>& | |
Pawel Osciak
2015/01/28 23:52:02
Please document.
| |
53 bind_image); | |
48 virtual ~VaapiVideoDecodeAccelerator(); | 54 virtual ~VaapiVideoDecodeAccelerator(); |
49 | 55 |
50 // media::VideoDecodeAccelerator implementation. | 56 // media::VideoDecodeAccelerator implementation. |
51 virtual bool Initialize(media::VideoCodecProfile profile, | 57 virtual bool Initialize(media::VideoCodecProfile profile, |
52 Client* client) override; | 58 Client* client) override; |
53 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 59 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
54 virtual void AssignPictureBuffers( | 60 virtual void AssignPictureBuffers( |
55 const std::vector<media::PictureBuffer>& buffers) override; | 61 const std::vector<media::PictureBuffer>& buffers) override; |
56 virtual void ReusePictureBuffer(int32 picture_buffer_id) override; | 62 virtual void ReusePictureBuffer(int32 picture_buffer_id) override; |
57 virtual void Flush() override; | 63 virtual void Flush() override; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 bool finish_flush_pending_; | 263 bool finish_flush_pending_; |
258 | 264 |
259 // Decoder requested a new surface set and we are waiting for all the surfaces | 265 // Decoder requested a new surface set and we are waiting for all the surfaces |
260 // to be returned before we can free them. | 266 // to be returned before we can free them. |
261 bool awaiting_va_surfaces_recycle_; | 267 bool awaiting_va_surfaces_recycle_; |
262 | 268 |
263 // Last requested number/resolution of output picture buffers. | 269 // Last requested number/resolution of output picture buffers. |
264 size_t requested_num_pics_; | 270 size_t requested_num_pics_; |
265 gfx::Size requested_pic_size_; | 271 gfx::Size requested_pic_size_; |
266 | 272 |
273 base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)> bind_image_; | |
274 | |
267 // The WeakPtrFactory for |weak_this_|. | 275 // The WeakPtrFactory for |weak_this_|. |
268 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; | 276 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; |
269 | 277 |
270 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 278 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
271 }; | 279 }; |
272 | 280 |
273 } // namespace content | 281 } // namespace content |
274 | 282 |
275 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 283 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |