| 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 base::Callback<bool(void)>& make_context_current, | 58 const MakeContextCurrentCallback& make_context_current, |
| 59 const base::Callback< | 59 const BindImageCallback& bind_image); |
| 60 void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& bind_image); | |
| 61 ~VaapiVideoDecodeAccelerator() override; | 60 ~VaapiVideoDecodeAccelerator() override; |
| 62 | 61 |
| 63 // media::VideoDecodeAccelerator implementation. | 62 // media::VideoDecodeAccelerator implementation. |
| 64 bool Initialize(const Config& config, Client* client) override; | 63 bool Initialize(const Config& config, Client* client) override; |
| 65 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 64 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
| 66 void AssignPictureBuffers( | 65 void AssignPictureBuffers( |
| 67 const std::vector<media::PictureBuffer>& buffers) override; | 66 const std::vector<media::PictureBuffer>& buffers) override; |
| 68 void ReusePictureBuffer(int32_t picture_buffer_id) override; | 67 void ReusePictureBuffer(int32_t picture_buffer_id) override; |
| 69 void Flush() override; | 68 void Flush() override; |
| 70 void Reset() override; | 69 void Reset() override; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // each submitted command in order, and run each command only if its | 174 // each submitted command in order, and run each command only if its |
| 176 // dependencies are ready. | 175 // dependencies are ready. |
| 177 void SurfaceReady(const scoped_refptr<VaapiDecodeSurface>& dec_surface); | 176 void SurfaceReady(const scoped_refptr<VaapiDecodeSurface>& dec_surface); |
| 178 | 177 |
| 179 // Return a new VaapiDecodeSurface for decoding into, or nullptr if not | 178 // Return a new VaapiDecodeSurface for decoding into, or nullptr if not |
| 180 // available. | 179 // available. |
| 181 scoped_refptr<VaapiDecodeSurface> CreateSurface(); | 180 scoped_refptr<VaapiDecodeSurface> CreateSurface(); |
| 182 | 181 |
| 183 | 182 |
| 184 // Client-provided GL state. | 183 // Client-provided GL state. |
| 185 base::Callback<bool(void)> make_context_current_; | 184 MakeContextCurrentCallback make_context_current_; |
| 186 | 185 |
| 187 // VAVDA state. | 186 // VAVDA state. |
| 188 enum State { | 187 enum State { |
| 189 // Initialize() not called yet or failed. | 188 // Initialize() not called yet or failed. |
| 190 kUninitialized, | 189 kUninitialized, |
| 191 // DecodeTask running. | 190 // DecodeTask running. |
| 192 kDecoding, | 191 kDecoding, |
| 193 // Resetting, waiting for decoder to finish current task and cleanup. | 192 // Resetting, waiting for decoder to finish current task and cleanup. |
| 194 kResetting, | 193 kResetting, |
| 195 // Flushing, waiting for decoder to finish current task and cleanup. | 194 // Flushing, waiting for decoder to finish current task and cleanup. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // Decoder requested a new surface set and we are waiting for all the surfaces | 298 // Decoder requested a new surface set and we are waiting for all the surfaces |
| 300 // to be returned before we can free them. | 299 // to be returned before we can free them. |
| 301 bool awaiting_va_surfaces_recycle_; | 300 bool awaiting_va_surfaces_recycle_; |
| 302 | 301 |
| 303 // Last requested number/resolution of output picture buffers. | 302 // Last requested number/resolution of output picture buffers. |
| 304 size_t requested_num_pics_; | 303 size_t requested_num_pics_; |
| 305 gfx::Size requested_pic_size_; | 304 gfx::Size requested_pic_size_; |
| 306 | 305 |
| 307 // Binds the provided GLImage to a givenr client texture ID & texture target | 306 // Binds the provided GLImage to a givenr client texture ID & texture target |
| 308 // combination in GLES. | 307 // combination in GLES. |
| 309 base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)> | 308 BindImageCallback bind_image_; |
| 310 bind_image_; | |
| 311 | 309 |
| 312 // The WeakPtrFactory for |weak_this_|. | 310 // The WeakPtrFactory for |weak_this_|. |
| 313 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; | 311 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; |
| 314 | 312 |
| 315 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 313 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
| 316 }; | 314 }; |
| 317 | 315 |
| 318 } // namespace content | 316 } // namespace content |
| 319 | 317 |
| 320 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 318 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |