| 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 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
| 8 #error This file should only be built on Windows. | 8 #error This file should only be built on Windows. |
| 9 #endif // !defined(OS_WIN) | 9 #endif // !defined(OS_WIN) |
| 10 | 10 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 EGLBoolean ret = eglQuerySurfacePointerANGLE( | 291 EGLBoolean ret = eglQuerySurfacePointerANGLE( |
| 292 egl_display, | 292 egl_display, |
| 293 picture_buffer->decoding_surface_, | 293 picture_buffer->decoding_surface_, |
| 294 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, | 294 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, |
| 295 &share_handle); | 295 &share_handle); |
| 296 | 296 |
| 297 RETURN_ON_FAILURE(share_handle && ret == EGL_TRUE, | 297 RETURN_ON_FAILURE(share_handle && ret == EGL_TRUE, |
| 298 "Failed to query ANGLE surface pointer", | 298 "Failed to query ANGLE surface pointer", |
| 299 linked_ptr<DXVAPictureBuffer>(NULL)); | 299 linked_ptr<DXVAPictureBuffer>(NULL)); |
| 300 | 300 |
| 301 // FIXME: after moving to D3D11, use RGBA surface. crbug.com/438691 |
| 301 HRESULT hr = decoder.device_->CreateTexture( | 302 HRESULT hr = decoder.device_->CreateTexture( |
| 302 buffer.size().width(), | 303 buffer.size().width(), |
| 303 buffer.size().height(), | 304 buffer.size().height(), |
| 304 1, | 305 1, |
| 305 D3DUSAGE_RENDERTARGET, | 306 D3DUSAGE_RENDERTARGET, |
| 306 use_rgb ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8, | 307 use_rgb ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8, |
| 307 D3DPOOL_DEFAULT, | 308 D3DPOOL_DEFAULT, |
| 308 picture_buffer->decoding_texture_.Receive(), | 309 picture_buffer->decoding_texture_.Receive(), |
| 309 &share_handle); | 310 &share_handle); |
| 310 | 311 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 void DXVAVideoDecodeAccelerator::Destroy() { | 717 void DXVAVideoDecodeAccelerator::Destroy() { |
| 717 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 718 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 718 Invalidate(); | 719 Invalidate(); |
| 719 delete this; | 720 delete this; |
| 720 } | 721 } |
| 721 | 722 |
| 722 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { | 723 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { |
| 723 return false; | 724 return false; |
| 724 } | 725 } |
| 725 | 726 |
| 727 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
| 728 return GL_BGRA_EXT; |
| 729 } |
| 730 |
| 726 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { | 731 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
| 727 HMODULE decoder_dll = NULL; | 732 HMODULE decoder_dll = NULL; |
| 728 | 733 |
| 729 // Profile must fall within the valid range for one of the supported codecs. | 734 // Profile must fall within the valid range for one of the supported codecs. |
| 730 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { | 735 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { |
| 731 // We mimic the steps CoCreateInstance uses to instantiate the object. This | 736 // We mimic the steps CoCreateInstance uses to instantiate the object. This |
| 732 // was previously done because it failed inside the sandbox, and now is done | 737 // was previously done because it failed inside the sandbox, and now is done |
| 733 // as a more minimal approach to avoid other side-effects CCI might have (as | 738 // as a more minimal approach to avoid other side-effects CCI might have (as |
| 734 // we are still in a reduced sandbox). | 739 // we are still in a reduced sandbox). |
| 735 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); | 740 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 decoder_thread_.Start(); | 1451 decoder_thread_.Start(); |
| 1447 decoder_thread_task_runner_ = decoder_thread_.task_runner(); | 1452 decoder_thread_task_runner_ = decoder_thread_.task_runner(); |
| 1448 } | 1453 } |
| 1449 | 1454 |
| 1450 bool DXVAVideoDecodeAccelerator::OutputSamplesPresent() { | 1455 bool DXVAVideoDecodeAccelerator::OutputSamplesPresent() { |
| 1451 base::AutoLock lock(decoder_lock_); | 1456 base::AutoLock lock(decoder_lock_); |
| 1452 return !pending_output_samples_.empty(); | 1457 return !pending_output_samples_.empty(); |
| 1453 } | 1458 } |
| 1454 | 1459 |
| 1455 } // namespace content | 1460 } // namespace content |
| OLD | NEW |