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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // start of stream, end of stream, flush, drain the decoder, etc. | 200 // start of stream, end of stream, flush, drain the decoder, etc. |
201 bool SendMFTMessage(MFT_MESSAGE_TYPE msg, int32_t param); | 201 bool SendMFTMessage(MFT_MESSAGE_TYPE msg, int32_t param); |
202 | 202 |
203 // The bulk of the decoding happens here. This function handles errors, | 203 // The bulk of the decoding happens here. This function handles errors, |
204 // format changes and processes decoded output. | 204 // format changes and processes decoded output. |
205 void DoDecode(const gfx::ColorSpace& color_space); | 205 void DoDecode(const gfx::ColorSpace& color_space); |
206 | 206 |
207 // Invoked when we have a valid decoded output sample. Retrieves the D3D | 207 // Invoked when we have a valid decoded output sample. Retrieves the D3D |
208 // surface and maintains a copy of it which is passed eventually to the | 208 // surface and maintains a copy of it which is passed eventually to the |
209 // client when we have a picture buffer to copy the surface contents to. | 209 // client when we have a picture buffer to copy the surface contents to. |
210 bool ProcessOutputSample(IMFSample* sample, | 210 bool ProcessOutputSample(base::win::ScopedComPtr<IMFSample> sample, |
211 const gfx::ColorSpace& color_space); | 211 const gfx::ColorSpace& color_space); |
212 | 212 |
213 // Processes pending output samples by copying them to available picture | 213 // Processes pending output samples by copying them to available picture |
214 // slots. | 214 // slots. |
215 void ProcessPendingSamples(); | 215 void ProcessPendingSamples(); |
216 | 216 |
217 // Helper function to notify the accelerator client about the error. | 217 // Helper function to notify the accelerator client about the error. |
218 void StopOnError(VideoDecodeAccelerator::Error error); | 218 void StopOnError(VideoDecodeAccelerator::Error error); |
219 | 219 |
220 // Transitions the decoder to the uninitialized state. The decoder will stop | 220 // Transitions the decoder to the uninitialized state. The decoder will stop |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 uint64_t keyed_mutex_value, | 309 uint64_t keyed_mutex_value, |
310 int picture_buffer_id, | 310 int picture_buffer_id, |
311 int input_buffer_id, | 311 int input_buffer_id, |
312 const gfx::ColorSpace& color_space); | 312 const gfx::ColorSpace& color_space); |
313 | 313 |
314 // Copies the |video_frame| to the destination |dest_texture|. | 314 // Copies the |video_frame| to the destination |dest_texture|. |
315 void CopyTextureOnDecoderThread( | 315 void CopyTextureOnDecoderThread( |
316 ID3D11Texture2D* dest_texture, | 316 ID3D11Texture2D* dest_texture, |
317 base::win::ScopedComPtr<IDXGIKeyedMutex> dest_keyed_mutex, | 317 base::win::ScopedComPtr<IDXGIKeyedMutex> dest_keyed_mutex, |
318 uint64_t keyed_mutex_value, | 318 uint64_t keyed_mutex_value, |
319 IMFSample* video_frame, | 319 base::win::ScopedComPtr<IMFSample> video_frame, |
320 int picture_buffer_id, | 320 int picture_buffer_id, |
321 int input_buffer_id); | 321 int input_buffer_id); |
322 | 322 |
323 // Flushes the decoder device to ensure that the decoded surface is copied | 323 // Flushes the decoder device to ensure that the decoded surface is copied |
324 // to the target surface. |iterations| helps to maintain an upper limit on | 324 // to the target surface. |iterations| helps to maintain an upper limit on |
325 // the number of times we try to complete the flush operation. | 325 // the number of times we try to complete the flush operation. |
326 void FlushDecoder(int iterations, | 326 void FlushDecoder(int iterations, |
327 IDirect3DSurface9* src_surface, | 327 IDirect3DSurface9* src_surface, |
328 IDirect3DSurface9* dest_surface, | 328 IDirect3DSurface9* dest_surface, |
329 int picture_buffer_id, | 329 int picture_buffer_id, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 412 |
413 // Current state of the decoder. | 413 // Current state of the decoder. |
414 volatile State state_; | 414 volatile State state_; |
415 | 415 |
416 MFT_INPUT_STREAM_INFO input_stream_info_; | 416 MFT_INPUT_STREAM_INFO input_stream_info_; |
417 MFT_OUTPUT_STREAM_INFO output_stream_info_; | 417 MFT_OUTPUT_STREAM_INFO output_stream_info_; |
418 | 418 |
419 // Contains information about a decoded sample. | 419 // Contains information about a decoded sample. |
420 struct PendingSampleInfo { | 420 struct PendingSampleInfo { |
421 PendingSampleInfo(int32_t buffer_id, | 421 PendingSampleInfo(int32_t buffer_id, |
422 IMFSample* sample, | 422 base::win::ScopedComPtr<IMFSample> sample, |
423 const gfx::ColorSpace& color_space); | 423 const gfx::ColorSpace& color_space); |
424 PendingSampleInfo(const PendingSampleInfo& other); | 424 PendingSampleInfo(const PendingSampleInfo& other); |
425 ~PendingSampleInfo(); | 425 ~PendingSampleInfo(); |
426 | 426 |
427 int32_t input_buffer_id; | 427 int32_t input_buffer_id; |
428 | 428 |
429 // The target picture buffer id where the frame would be copied to. | 429 // The target picture buffer id where the frame would be copied to. |
430 // Defaults to -1. | 430 // Defaults to -1. |
431 int picture_buffer_id; | 431 int picture_buffer_id; |
432 | 432 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 553 |
554 // Function pointer for the MFCreateDXGIDeviceManager API. | 554 // Function pointer for the MFCreateDXGIDeviceManager API. |
555 static CreateDXGIDeviceManager create_dxgi_device_manager_; | 555 static CreateDXGIDeviceManager create_dxgi_device_manager_; |
556 | 556 |
557 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); | 557 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); |
558 }; | 558 }; |
559 | 559 |
560 } // namespace media | 560 } // namespace media |
561 | 561 |
562 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ | 562 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ |
OLD | NEW |