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 #ifndef MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ | 5 #ifndef MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
6 #define MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ | 6 #define MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
7 | 7 |
8 #include <d3d11.h> | 8 #include <d3d11.h> |
9 #include <d3d9.h> | 9 #include <d3d9.h> |
10 #include <initguid.h> | 10 #include <initguid.h> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // TODO(ananta) | 64 // TODO(ananta) |
65 // Move this to a common place so that all VDA's can use this. | 65 // Move this to a common place so that all VDA's can use this. |
66 class H264ConfigChangeDetector { | 66 class H264ConfigChangeDetector { |
67 public: | 67 public: |
68 H264ConfigChangeDetector(); | 68 H264ConfigChangeDetector(); |
69 ~H264ConfigChangeDetector(); | 69 ~H264ConfigChangeDetector(); |
70 | 70 |
71 // Detects stream configuration changes. | 71 // Detects stream configuration changes. |
72 // Returns false on failure. | 72 // Returns false on failure. |
73 bool DetectConfig(const uint8_t* stream, unsigned int size); | 73 bool DetectConfig(const uint8_t* stream, unsigned int size); |
74 | |
75 bool config_changed() const { return config_changed_; } | 74 bool config_changed() const { return config_changed_; } |
76 | 75 |
77 gfx::ColorSpace current_color_space() const; | 76 gfx::ColorSpace current_color_space() const; |
78 | 77 |
79 private: | 78 private: |
80 // These fields are used to track the SPS/PPS in the H.264 bitstream and | 79 // These fields are used to track the SPS/PPS in the H.264 bitstream and |
81 // are eventually compared against the SPS/PPS in the bitstream to detect | 80 // are eventually compared against the SPS/PPS in the bitstream to detect |
82 // a change. | 81 // a change. |
83 int last_sps_id_; | 82 int last_sps_id_; |
84 std::vector<uint8_t> last_sps_; | 83 std::vector<uint8_t> last_sps_; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // some second generation Intel GPU drivers crash if we create a video | 160 // some second generation Intel GPU drivers crash if we create a video |
162 // device with a resolution higher then 1920 x 1088. This function | 161 // device with a resolution higher then 1920 x 1088. This function |
163 // checks if the GPU is in this list and if yes returns true. | 162 // checks if the GPU is in this list and if yes returns true. |
164 static bool IsLegacyGPU(ID3D11Device* device); | 163 static bool IsLegacyGPU(ID3D11Device* device); |
165 | 164 |
166 // Creates and initializes an instance of the D3D device and the | 165 // Creates and initializes an instance of the D3D device and the |
167 // corresponding device manager. The device manager instance is eventually | 166 // corresponding device manager. The device manager instance is eventually |
168 // passed to the IMFTransform interface implemented by the decoder. | 167 // passed to the IMFTransform interface implemented by the decoder. |
169 bool CreateD3DDevManager(); | 168 bool CreateD3DDevManager(); |
170 | 169 |
| 170 // TODO(hubbe): COMMENT |
| 171 bool CreateVideoProcessor(); |
| 172 |
171 // Creates and initializes an instance of the DX11 device and the | 173 // Creates and initializes an instance of the DX11 device and the |
172 // corresponding device manager. The device manager instance is eventually | 174 // corresponding device manager. The device manager instance is eventually |
173 // passed to the IMFTransform interface implemented by the decoder. | 175 // passed to the IMFTransform interface implemented by the decoder. |
174 bool CreateDX11DevManager(); | 176 bool CreateDX11DevManager(); |
175 | 177 |
176 // Creates, initializes and sets the media codec types for the decoder. | 178 // Creates, initializes and sets the media codec types for the decoder. |
177 bool InitDecoder(VideoCodecProfile profile); | 179 bool InitDecoder(VideoCodecProfile profile); |
178 | 180 |
179 // Validates whether the decoder supports hardware video acceleration. | 181 // Validates whether the decoder supports hardware video acceleration. |
180 bool CheckDecoderDxvaSupport(); | 182 bool CheckDecoderDxvaSupport(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // Returns if we have output samples waiting to be processed. We only | 276 // Returns if we have output samples waiting to be processed. We only |
275 // allow one output sample to be present in the output queue at any given | 277 // allow one output sample to be present in the output queue at any given |
276 // time. | 278 // time. |
277 bool OutputSamplesPresent(); | 279 bool OutputSamplesPresent(); |
278 | 280 |
279 // Copies the source surface |src_surface| to the destination |dest_surface|. | 281 // Copies the source surface |src_surface| to the destination |dest_surface|. |
280 // The copying is done on the decoder thread. | 282 // The copying is done on the decoder thread. |
281 void CopySurface(IDirect3DSurface9* src_surface, | 283 void CopySurface(IDirect3DSurface9* src_surface, |
282 IDirect3DSurface9* dest_surface, | 284 IDirect3DSurface9* dest_surface, |
283 int picture_buffer_id, | 285 int picture_buffer_id, |
284 int input_buffer_id); | 286 int input_buffer_id, |
| 287 const gfx::ColorSpace& color_space); |
285 | 288 |
286 // This is a notification that the source surface |src_surface| was copied to | 289 // This is a notification that the source surface |src_surface| was copied to |
287 // the destination |dest_surface|. Received on the main thread. | 290 // the destination |dest_surface|. Received on the main thread. |
288 void CopySurfaceComplete(IDirect3DSurface9* src_surface, | 291 void CopySurfaceComplete(IDirect3DSurface9* src_surface, |
289 IDirect3DSurface9* dest_surface, | 292 IDirect3DSurface9* dest_surface, |
290 int picture_buffer_id, | 293 int picture_buffer_id, |
291 int input_buffer_id); | 294 int input_buffer_id); |
292 | 295 |
293 void BindPictureBufferToSample(base::win::ScopedComPtr<IMFSample> sample, | 296 void BindPictureBufferToSample(base::win::ScopedComPtr<IMFSample> sample, |
294 int picture_buffer_id, | 297 int picture_buffer_id, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; | 373 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; |
371 base::win::ScopedComPtr<IDirect3DQuery9> query_; | 374 base::win::ScopedComPtr<IDirect3DQuery9> query_; |
372 | 375 |
373 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; | 376 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; |
374 base::win::ScopedComPtr<ID3D11Device> angle_device_; | 377 base::win::ScopedComPtr<ID3D11Device> angle_device_; |
375 base::win::ScopedComPtr<IMFDXGIDeviceManager> d3d11_device_manager_; | 378 base::win::ScopedComPtr<IMFDXGIDeviceManager> d3d11_device_manager_; |
376 base::win::ScopedComPtr<ID3D10Multithread> multi_threaded_; | 379 base::win::ScopedComPtr<ID3D10Multithread> multi_threaded_; |
377 base::win::ScopedComPtr<ID3D11DeviceContext> d3d11_device_context_; | 380 base::win::ScopedComPtr<ID3D11DeviceContext> d3d11_device_context_; |
378 base::win::ScopedComPtr<ID3D11Query> d3d11_query_; | 381 base::win::ScopedComPtr<ID3D11Query> d3d11_query_; |
379 | 382 |
| 383 base::win::ScopedComPtr<IDirectXVideoProcessorService> |
| 384 video_processor_service_; |
| 385 base::win::ScopedComPtr<IDirectXVideoProcessor> processor_; |
| 386 DXVA2_ProcAmpValues default_procamp_values_; |
| 387 |
380 // Ideally the reset token would be a stack variable which is used while | 388 // Ideally the reset token would be a stack variable which is used while |
381 // creating the device manager. However it seems that the device manager | 389 // creating the device manager. However it seems that the device manager |
382 // holds onto the token and attempts to access it if the underlying device | 390 // holds onto the token and attempts to access it if the underlying device |
383 // changes. | 391 // changes. |
384 // TODO(ananta): This needs to be verified. | 392 // TODO(ananta): This needs to be verified. |
385 uint32_t dev_manager_reset_token_; | 393 uint32_t dev_manager_reset_token_; |
386 | 394 |
387 // Reset token for the DX11 device manager. | 395 // Reset token for the DX11 device manager. |
388 uint32_t dx11_dev_manager_reset_token_; | 396 uint32_t dx11_dev_manager_reset_token_; |
389 | 397 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 535 |
528 // Function pointer for the MFCreateDXGIDeviceManager API. | 536 // Function pointer for the MFCreateDXGIDeviceManager API. |
529 static CreateDXGIDeviceManager create_dxgi_device_manager_; | 537 static CreateDXGIDeviceManager create_dxgi_device_manager_; |
530 | 538 |
531 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); | 539 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); |
532 }; | 540 }; |
533 | 541 |
534 } // namespace media | 542 } // namespace media |
535 | 543 |
536 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ | 544 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
OLD | NEW |