| 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 CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <d3d11.h> | 8 #include <d3d11.h> |
| 9 #include <d3d9.h> | 9 #include <d3d9.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // from any other. | 85 // from any other. |
| 86 class CONTENT_EXPORT DXVAVideoDecodeAccelerator | 86 class CONTENT_EXPORT DXVAVideoDecodeAccelerator |
| 87 : public media::VideoDecodeAccelerator { | 87 : public media::VideoDecodeAccelerator { |
| 88 public: | 88 public: |
| 89 enum State { | 89 enum State { |
| 90 kUninitialized, // un-initialized. | 90 kUninitialized, // un-initialized. |
| 91 kNormal, // normal playing state. | 91 kNormal, // normal playing state. |
| 92 kResetting, // upon received Reset(), before ResetDone() | 92 kResetting, // upon received Reset(), before ResetDone() |
| 93 kStopped, // upon output EOS received. | 93 kStopped, // upon output EOS received. |
| 94 kFlushing, // upon flush request received. | 94 kFlushing, // upon flush request received. |
| 95 kConfigChange, // stream configuration change detected. |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 // Does not take ownership of |client| which must outlive |*this|. | 98 // Does not take ownership of |client| which must outlive |*this|. |
| 98 DXVAVideoDecodeAccelerator( | 99 DXVAVideoDecodeAccelerator( |
| 99 const base::Callback<bool(void)>& make_context_current, | 100 const base::Callback<bool(void)>& make_context_current, |
| 100 gfx::GLContext* gl_context, | 101 gfx::GLContext* gl_context, |
| 101 bool enable_accelerated_vpx_decode); | 102 bool enable_accelerated_vpx_decode); |
| 102 ~DXVAVideoDecodeAccelerator() override; | 103 ~DXVAVideoDecodeAccelerator() override; |
| 103 | 104 |
| 104 // media::VideoDecodeAccelerator implementation. | 105 // media::VideoDecodeAccelerator implementation. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // Checks if the resolution, bitrate etc of the stream changed. We do this | 299 // Checks if the resolution, bitrate etc of the stream changed. We do this |
| 299 // by keeping track of the SPS/PPS frames and if they change we assume | 300 // by keeping track of the SPS/PPS frames and if they change we assume |
| 300 // that the configuration changed. | 301 // that the configuration changed. |
| 301 // Returns S_OK or S_FALSE on succcess. | 302 // Returns S_OK or S_FALSE on succcess. |
| 302 // The |config_changed| parameter is set to true if we detect a change in the | 303 // The |config_changed| parameter is set to true if we detect a change in the |
| 303 // stream. | 304 // stream. |
| 304 HRESULT CheckConfigChanged(IMFSample* sample, bool* config_changed); | 305 HRESULT CheckConfigChanged(IMFSample* sample, bool* config_changed); |
| 305 | 306 |
| 306 // Called when we detect a stream configuration change. We reinitialize the | 307 // Called when we detect a stream configuration change. We reinitialize the |
| 307 // decoder here. | 308 // decoder here. |
| 308 void ConfigChanged(const Config& config, | 309 void ConfigChanged(const Config& config); |
| 309 const base::win::ScopedComPtr<IMFSample>& input_sample); | |
| 310 | 310 |
| 311 // To expose client callbacks from VideoDecodeAccelerator. | 311 // To expose client callbacks from VideoDecodeAccelerator. |
| 312 media::VideoDecodeAccelerator::Client* client_; | 312 media::VideoDecodeAccelerator::Client* client_; |
| 313 | 313 |
| 314 base::win::ScopedComPtr<IMFTransform> decoder_; | 314 base::win::ScopedComPtr<IMFTransform> decoder_; |
| 315 base::win::ScopedComPtr<IMFTransform> video_format_converter_mft_; | 315 base::win::ScopedComPtr<IMFTransform> video_format_converter_mft_; |
| 316 | 316 |
| 317 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_; | 317 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_; |
| 318 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_; | 318 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_; |
| 319 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; | 319 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 456 |
| 457 // Function pointer for the MFCreateDXGIDeviceManager API. | 457 // Function pointer for the MFCreateDXGIDeviceManager API. |
| 458 static CreateDXGIDeviceManager create_dxgi_device_manager_; | 458 static CreateDXGIDeviceManager create_dxgi_device_manager_; |
| 459 | 459 |
| 460 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); | 460 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); |
| 461 }; | 461 }; |
| 462 | 462 |
| 463 } // namespace content | 463 } // namespace content |
| 464 | 464 |
| 465 #endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ | 465 #endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |