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_1.h> |
9 #include <d3d9.h> | 9 #include <d3d9.h> |
10 #include <initguid.h> | 10 #include <initguid.h> |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 | 12 |
13 // Work around bug in this header by disabling the relevant warning for it. | 13 // Work around bug in this header by disabling the relevant warning for it. |
14 // https://connect.microsoft.com/VisualStudio/feedback/details/911260/dxva2api-h
-in-win8-sdk-triggers-c4201-with-w4 | 14 // https://connect.microsoft.com/VisualStudio/feedback/details/911260/dxva2api-h
-in-win8-sdk-triggers-c4201-with-w4 |
15 #pragma warning(push) | 15 #pragma warning(push) |
16 #pragma warning(disable : 4201) | 16 #pragma warning(disable : 4201) |
17 #include <dxva2api.h> | 17 #include <dxva2api.h> |
18 #pragma warning(pop) | 18 #pragma warning(pop) |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 uint64_t keyed_mutex_value, | 310 uint64_t keyed_mutex_value, |
311 int picture_buffer_id, | 311 int picture_buffer_id, |
312 int input_buffer_id, | 312 int input_buffer_id, |
313 const gfx::ColorSpace& color_space); | 313 const gfx::ColorSpace& color_space); |
314 | 314 |
315 // Copies the |video_frame| to the destination |dest_texture|. | 315 // Copies the |video_frame| to the destination |dest_texture|. |
316 void CopyTextureOnDecoderThread( | 316 void CopyTextureOnDecoderThread( |
317 ID3D11Texture2D* dest_texture, | 317 ID3D11Texture2D* dest_texture, |
318 base::win::ScopedComPtr<IDXGIKeyedMutex> dest_keyed_mutex, | 318 base::win::ScopedComPtr<IDXGIKeyedMutex> dest_keyed_mutex, |
319 uint64_t keyed_mutex_value, | 319 uint64_t keyed_mutex_value, |
320 base::win::ScopedComPtr<IMFSample> video_frame, | 320 base::win::ScopedComPtr<IMFSample> input_sample, |
321 int picture_buffer_id, | 321 int picture_buffer_id, |
322 int input_buffer_id); | 322 int input_buffer_id, |
| 323 const gfx::ColorSpace& color_space); |
323 | 324 |
324 // Flushes the decoder device to ensure that the decoded surface is copied | 325 // Flushes the decoder device to ensure that the decoded surface is copied |
325 // to the target surface. |iterations| helps to maintain an upper limit on | 326 // to the target surface. |iterations| helps to maintain an upper limit on |
326 // the number of times we try to complete the flush operation. | 327 // the number of times we try to complete the flush operation. |
327 void FlushDecoder(int iterations, | 328 void FlushDecoder(int iterations, |
328 IDirect3DSurface9* src_surface, | 329 IDirect3DSurface9* src_surface, |
329 IDirect3DSurface9* dest_surface, | 330 IDirect3DSurface9* dest_surface, |
330 int picture_buffer_id, | 331 int picture_buffer_id, |
331 int input_buffer_id); | 332 int input_buffer_id); |
332 | 333 |
333 // Polls to wait for GPU commands to be finished on the picture buffer | 334 // Polls to wait for GPU commands to be finished on the picture buffer |
334 // before reusing it. | 335 // before reusing it. |
335 void WaitForOutputBuffer(int32_t picture_buffer_id, int count); | 336 void WaitForOutputBuffer(int32_t picture_buffer_id, int count); |
336 | 337 |
337 // Initializes the DX11 Video format converter media types. | |
338 // Returns true on success. | |
339 bool InitializeDX11VideoFormatConverterMediaType( | |
340 int width, | |
341 int height, | |
342 const gfx::ColorSpace& color_space); | |
343 | |
344 // Returns the output video frame dimensions (width, height). | 338 // Returns the output video frame dimensions (width, height). |
345 // |sample| :- This is the output sample containing the video frame. | 339 // |sample| :- This is the output sample containing the video frame. |
346 // |width| :- The width is returned here. | 340 // |width| :- The width is returned here. |
347 // |height| :- The height is returned here. | 341 // |height| :- The height is returned here. |
348 // Returns true on success. | 342 // Returns true on success. |
349 bool GetVideoFrameDimensions(IMFSample* sample, int* width, int* height); | 343 bool GetVideoFrameDimensions(IMFSample* sample, int* width, int* height); |
350 | 344 |
351 // Sets the output type on the |transform| to the GUID identified by the | 345 // Sets the output type on the |transform| to the GUID identified by the |
352 // the |output_type| parameter. The GUID can be MFVideoFormat_RGB32, | 346 // the |output_type| parameter. The GUID can be MFVideoFormat_RGB32, |
353 // MFVideoFormat_ARGB32, MFVideoFormat_NV12, etc. | 347 // MFVideoFormat_ARGB32, MFVideoFormat_NV12, etc. |
(...skipping 16 matching lines...) Expand all Loading... |
370 // Called when we detect a stream configuration change. We reinitialize the | 364 // Called when we detect a stream configuration change. We reinitialize the |
371 // decoder here. | 365 // decoder here. |
372 void ConfigChanged(const Config& config); | 366 void ConfigChanged(const Config& config); |
373 | 367 |
374 uint32_t GetTextureTarget() const; | 368 uint32_t GetTextureTarget() const; |
375 | 369 |
376 // To expose client callbacks from VideoDecodeAccelerator. | 370 // To expose client callbacks from VideoDecodeAccelerator. |
377 VideoDecodeAccelerator::Client* client_; | 371 VideoDecodeAccelerator::Client* client_; |
378 | 372 |
379 base::win::ScopedComPtr<IMFTransform> decoder_; | 373 base::win::ScopedComPtr<IMFTransform> decoder_; |
380 base::win::ScopedComPtr<IMFTransform> video_format_converter_mft_; | |
381 | 374 |
382 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_; | 375 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_; |
383 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_; | 376 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_; |
384 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; | 377 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; |
385 base::win::ScopedComPtr<IDirect3DQuery9> query_; | 378 base::win::ScopedComPtr<IDirect3DQuery9> query_; |
386 | 379 |
387 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; | 380 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; |
388 base::win::ScopedComPtr<ID3D11Device> angle_device_; | 381 base::win::ScopedComPtr<ID3D11Device> angle_device_; |
389 base::win::ScopedComPtr<IMFDXGIDeviceManager> d3d11_device_manager_; | 382 base::win::ScopedComPtr<IMFDXGIDeviceManager> d3d11_device_manager_; |
390 base::win::ScopedComPtr<ID3D10Multithread> multi_threaded_; | 383 base::win::ScopedComPtr<ID3D10Multithread> multi_threaded_; |
391 base::win::ScopedComPtr<ID3D11DeviceContext> d3d11_device_context_; | 384 base::win::ScopedComPtr<ID3D11DeviceContext> d3d11_device_context_; |
392 base::win::ScopedComPtr<ID3D11Query> d3d11_query_; | 385 base::win::ScopedComPtr<ID3D11Query> d3d11_query_; |
393 | 386 |
| 387 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_; |
| 388 base::win::ScopedComPtr<ID3D11VideoContext1> video_context_; |
| 389 base::win::ScopedComPtr<ID3D11VideoProcessorEnumerator> enumerator_; |
| 390 base::win::ScopedComPtr<ID3D11VideoProcessor> d3d11_processor_; |
| 391 |
394 base::win::ScopedComPtr<IDirectXVideoProcessorService> | 392 base::win::ScopedComPtr<IDirectXVideoProcessorService> |
395 video_processor_service_; | 393 video_processor_service_; |
396 base::win::ScopedComPtr<IDirectXVideoProcessor> processor_; | 394 base::win::ScopedComPtr<IDirectXVideoProcessor> processor_; |
397 DXVA2_ProcAmpValues default_procamp_values_; | 395 DXVA2_ProcAmpValues default_procamp_values_; |
398 | 396 |
399 // Ideally the reset token would be a stack variable which is used while | 397 // Ideally the reset token would be a stack variable which is used while |
400 // creating the device manager. However it seems that the device manager | 398 // creating the device manager. However it seems that the device manager |
401 // holds onto the token and attempts to access it if the underlying device | 399 // holds onto the token and attempts to access it if the underlying device |
402 // changes. | 400 // changes. |
403 // TODO(ananta): This needs to be verified. | 401 // TODO(ananta): This needs to be verified. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 555 |
558 // Function pointer for the MFCreateDXGIDeviceManager API. | 556 // Function pointer for the MFCreateDXGIDeviceManager API. |
559 static CreateDXGIDeviceManager create_dxgi_device_manager_; | 557 static CreateDXGIDeviceManager create_dxgi_device_manager_; |
560 | 558 |
561 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); | 559 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); |
562 }; | 560 }; |
563 | 561 |
564 } // namespace media | 562 } // namespace media |
565 | 563 |
566 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ | 564 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
OLD | NEW |