OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ | 5 #ifndef MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ |
6 #define MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ | 6 #define MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ |
7 | 7 |
8 #include <d3d11.h> | 8 #include <d3d11.h> |
9 #include <d3d9.h> | 9 #include <d3d9.h> |
10 #include <mfidl.h> | 10 #include <mfidl.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace media { | 23 namespace media { |
24 class DXVAVideoDecodeAccelerator; | 24 class DXVAVideoDecodeAccelerator; |
25 | 25 |
26 // Maintains information about a DXVA picture buffer, i.e. whether it is | 26 // Maintains information about a DXVA picture buffer, i.e. whether it is |
27 // available for rendering, the texture information, etc. | 27 // available for rendering, the texture information, etc. |
28 class DXVAPictureBuffer { | 28 class DXVAPictureBuffer { |
29 public: | 29 public: |
30 static linked_ptr<DXVAPictureBuffer> Create( | 30 static linked_ptr<DXVAPictureBuffer> Create( |
31 const DXVAVideoDecodeAccelerator& decoder, | 31 const DXVAVideoDecodeAccelerator& decoder, |
32 const media::PictureBuffer& buffer, | 32 const PictureBuffer& buffer, |
33 EGLConfig egl_config); | 33 EGLConfig egl_config); |
34 virtual ~DXVAPictureBuffer(); | 34 virtual ~DXVAPictureBuffer(); |
35 | 35 |
36 virtual bool ReusePictureBuffer() = 0; | 36 virtual bool ReusePictureBuffer() = 0; |
37 virtual void ResetReuseFence(); | 37 virtual void ResetReuseFence(); |
38 // Copies the output sample data to the picture buffer provided by the | 38 // Copies the output sample data to the picture buffer provided by the |
39 // client. | 39 // client. |
40 // The dest_surface parameter contains the decoded bits. | 40 // The dest_surface parameter contains the decoded bits. |
41 virtual bool CopyOutputSampleDataToPictureBuffer( | 41 virtual bool CopyOutputSampleDataToPictureBuffer( |
42 DXVAVideoDecodeAccelerator* decoder, | 42 DXVAVideoDecodeAccelerator* decoder, |
(...skipping 12 matching lines...) Expand all Loading... |
55 virtual bool waiting_to_reuse() const; | 55 virtual bool waiting_to_reuse() const; |
56 virtual gl::GLFence* reuse_fence(); | 56 virtual gl::GLFence* reuse_fence(); |
57 | 57 |
58 // Called when the source surface |src_surface| is copied to the destination | 58 // Called when the source surface |src_surface| is copied to the destination |
59 // |dest_surface| | 59 // |dest_surface| |
60 virtual bool CopySurfaceComplete(IDirect3DSurface9* src_surface, | 60 virtual bool CopySurfaceComplete(IDirect3DSurface9* src_surface, |
61 IDirect3DSurface9* dest_surface); | 61 IDirect3DSurface9* dest_surface); |
62 virtual bool BindSampleToTexture(base::win::ScopedComPtr<IMFSample> sample); | 62 virtual bool BindSampleToTexture(base::win::ScopedComPtr<IMFSample> sample); |
63 | 63 |
64 protected: | 64 protected: |
65 explicit DXVAPictureBuffer(const media::PictureBuffer& buffer); | 65 explicit DXVAPictureBuffer(const PictureBuffer& buffer); |
66 | 66 |
67 bool available_; | 67 bool available_; |
68 media::PictureBuffer picture_buffer_; | 68 PictureBuffer picture_buffer_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(DXVAPictureBuffer); | 70 DISALLOW_COPY_AND_ASSIGN(DXVAPictureBuffer); |
71 }; | 71 }; |
72 | 72 |
73 // Copies the video result into an RGBA EGL pbuffer. | 73 // Copies the video result into an RGBA EGL pbuffer. |
74 class PbufferPictureBuffer : public DXVAPictureBuffer { | 74 class PbufferPictureBuffer : public DXVAPictureBuffer { |
75 public: | 75 public: |
76 explicit PbufferPictureBuffer(const media::PictureBuffer& buffer); | 76 explicit PbufferPictureBuffer(const PictureBuffer& buffer); |
77 ~PbufferPictureBuffer() override; | 77 ~PbufferPictureBuffer() override; |
78 | 78 |
79 bool Initialize(const DXVAVideoDecodeAccelerator& decoder, | 79 bool Initialize(const DXVAVideoDecodeAccelerator& decoder, |
80 EGLConfig egl_config); | 80 EGLConfig egl_config); |
81 bool InitializeTexture(const DXVAVideoDecodeAccelerator& decoder, | 81 bool InitializeTexture(const DXVAVideoDecodeAccelerator& decoder, |
82 bool use_rgb); | 82 bool use_rgb); |
83 | 83 |
84 bool ReusePictureBuffer() override; | 84 bool ReusePictureBuffer() override; |
85 void ResetReuseFence() override; | 85 void ResetReuseFence() override; |
86 bool CopyOutputSampleDataToPictureBuffer(DXVAVideoDecodeAccelerator* decoder, | 86 bool CopyOutputSampleDataToPictureBuffer(DXVAVideoDecodeAccelerator* decoder, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 base::win::ScopedComPtr<ID3D11Texture2D> decoder_dx11_texture_; | 123 base::win::ScopedComPtr<ID3D11Texture2D> decoder_dx11_texture_; |
124 | 124 |
125 // Set to true if RGB is supported by the texture. | 125 // Set to true if RGB is supported by the texture. |
126 // Defaults to true. | 126 // Defaults to true. |
127 bool use_rgb_; | 127 bool use_rgb_; |
128 }; | 128 }; |
129 | 129 |
130 // Shares the decoded texture with ANGLE without copying by using an EGL stream. | 130 // Shares the decoded texture with ANGLE without copying by using an EGL stream. |
131 class EGLStreamPictureBuffer : public DXVAPictureBuffer { | 131 class EGLStreamPictureBuffer : public DXVAPictureBuffer { |
132 public: | 132 public: |
133 explicit EGLStreamPictureBuffer(const media::PictureBuffer& buffer); | 133 explicit EGLStreamPictureBuffer(const PictureBuffer& buffer); |
134 ~EGLStreamPictureBuffer() override; | 134 ~EGLStreamPictureBuffer() override; |
135 | 135 |
136 bool Initialize(); | 136 bool Initialize(); |
137 bool ReusePictureBuffer() override; | 137 bool ReusePictureBuffer() override; |
138 bool BindSampleToTexture(base::win::ScopedComPtr<IMFSample> sample) override; | 138 bool BindSampleToTexture(base::win::ScopedComPtr<IMFSample> sample) override; |
139 | 139 |
140 private: | 140 private: |
141 EGLStreamKHR stream_; | 141 EGLStreamKHR stream_; |
142 | 142 |
143 base::win::ScopedComPtr<IMFSample> current_d3d_sample_; | 143 base::win::ScopedComPtr<IMFSample> current_d3d_sample_; |
144 base::win::ScopedComPtr<ID3D11Texture2D> dx11_decoding_texture_; | 144 base::win::ScopedComPtr<ID3D11Texture2D> dx11_decoding_texture_; |
145 }; | 145 }; |
146 | 146 |
147 } // namespace media | 147 } // namespace media |
148 | 148 |
149 #endif // MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ | 149 #endif // MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ |
OLD | NEW |