| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_GPU_D3D11_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
| 6 #define MEDIA_GPU_D3D11_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
| 7 |
| 8 #include <d3d11.h> |
| 9 |
| 10 #include <list> |
| 11 #include <memory> |
| 12 |
| 13 #include "base/win/scoped_comptr.h" |
| 14 #include "media/gpu/accelerated_video_decoder.h" |
| 15 #include "media/gpu/d3d11_h264_accelerator.h" |
| 16 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" |
| 17 #include "media/gpu/media_gpu_export.h" |
| 18 #include "media/video/video_decode_accelerator.h" |
| 19 |
| 20 namespace media { |
| 21 |
| 22 class MEDIA_GPU_EXPORT D3D11VideoDecodeAccelerator |
| 23 : public VideoDecodeAccelerator, |
| 24 public D3D11VideoDecoderClient { |
| 25 public: |
| 26 D3D11VideoDecodeAccelerator( |
| 27 const GetGLContextCallback& get_gl_context_cb, |
| 28 const MakeGLContextCurrentCallback& make_context_current_cb); |
| 29 |
| 30 ~D3D11VideoDecodeAccelerator() override; |
| 31 |
| 32 // VideoDecodeAccelerator implementation. |
| 33 bool Initialize(const Config& config, Client* client) override; |
| 34 void Decode(const BitstreamBuffer& bitstream_buffer) override; |
| 35 void DoDecode(); |
| 36 void AssignPictureBuffers(const std::vector<PictureBuffer>& buffers) override; |
| 37 void ReusePictureBuffer(int32_t picture_buffer_id) override; |
| 38 void Flush() override; |
| 39 void Reset() override; |
| 40 void Destroy() override; |
| 41 bool TryToSetupDecodeOnSeparateThread( |
| 42 const base::WeakPtr<Client>& decode_client, |
| 43 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) |
| 44 override; |
| 45 GLenum GetSurfaceInternalFormat() const override; |
| 46 |
| 47 // D3D11VideoDecoderClient implementation. |
| 48 D3D11PictureBuffer* GetPicture() override; |
| 49 void OutputResult(D3D11PictureBuffer* buffer, |
| 50 size_t input_buffer_id) override; |
| 51 size_t input_buffer_id() const override; |
| 52 |
| 53 private: |
| 54 Client* client_; |
| 55 GetGLContextCallback get_gl_context_cb_; |
| 56 MakeGLContextCurrentCallback make_context_current_cb_; |
| 57 base::win::ScopedComPtr<ID3D11Device> device_; |
| 58 base::win::ScopedComPtr<ID3D11DeviceContext> device_context_; |
| 59 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_; |
| 60 base::win::ScopedComPtr<ID3D11VideoContext> video_context_; |
| 61 std::unique_ptr<AcceleratedVideoDecoder> decoder_; |
| 62 std::unique_ptr<D3D11H264Accelerator> h264_accelerator_; |
| 63 |
| 64 GUID decoder_guid_; |
| 65 |
| 66 std::list<BitstreamBuffer> input_buffer_queue_; |
| 67 uint32_t input_buffer_id_; |
| 68 std::unique_ptr<base::SharedMemory> bitstream_buffer_; |
| 69 size_t bitstream_buffer_size_; |
| 70 |
| 71 std::vector<std::unique_ptr<D3D11PictureBuffer>> picture_buffers_; |
| 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(D3D11VideoDecodeAccelerator); |
| 74 }; |
| 75 |
| 76 } // namespace media |
| 77 |
| 78 #endif // MEDIA_GPU_D3D11_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
| OLD | NEW |