| 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 "media/gpu/dxva_video_decode_accelerator_win.h" | 5 #include "media/gpu/dxva_video_decode_accelerator_win.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #if !defined(OS_WIN) | 9 #if !defined(OS_WIN) |
| 10 #error This file should only be built on Windows. | 10 #error This file should only be built on Windows. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "media/video/video_decode_accelerator.h" | 44 #include "media/video/video_decode_accelerator.h" |
| 45 #include "third_party/angle/include/EGL/egl.h" | 45 #include "third_party/angle/include/EGL/egl.h" |
| 46 #include "third_party/angle/include/EGL/eglext.h" | 46 #include "third_party/angle/include/EGL/eglext.h" |
| 47 #include "ui/gl/gl_bindings.h" | 47 #include "ui/gl/gl_bindings.h" |
| 48 #include "ui/gl/gl_context.h" | 48 #include "ui/gl/gl_context.h" |
| 49 #include "ui/gl/gl_fence.h" | 49 #include "ui/gl/gl_fence.h" |
| 50 #include "ui/gl/gl_surface_egl.h" | 50 #include "ui/gl/gl_surface_egl.h" |
| 51 | 51 |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 // Path is appended on to the PROGRAM_FILES base path. | |
| 55 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\"; | |
| 56 | |
| 57 const wchar_t kVP8DecoderDLLName[] = | |
| 58 #if defined(ARCH_CPU_X86) | |
| 59 L"mfx_mft_vp8vd_32.dll"; | |
| 60 #elif defined(ARCH_CPU_X86_64) | |
| 61 L"mfx_mft_vp8vd_64.dll"; | |
| 62 #else | |
| 63 #error Unsupported Windows CPU Architecture | |
| 64 #endif | |
| 65 | |
| 66 const wchar_t kVP9DecoderDLLName[] = | |
| 67 #if defined(ARCH_CPU_X86) | |
| 68 L"mfx_mft_vp9vd_32.dll"; | |
| 69 #elif defined(ARCH_CPU_X86_64) | |
| 70 L"mfx_mft_vp9vd_64.dll"; | |
| 71 #else | |
| 72 #error Unsupported Windows CPU Architecture | |
| 73 #endif | |
| 74 | |
| 75 const wchar_t kMSVP9DecoderDLLName[] = L"MSVP9DEC.dll"; | 54 const wchar_t kMSVP9DecoderDLLName[] = L"MSVP9DEC.dll"; |
| 76 | 55 |
| 77 const CLSID CLSID_WebmMfVp8Dec = { | |
| 78 0x451e3cb7, | |
| 79 0x2622, | |
| 80 0x4ba5, | |
| 81 {0x8e, 0x1d, 0x44, 0xb3, 0xc4, 0x1d, 0x09, 0x24}}; | |
| 82 | |
| 83 const CLSID CLSID_WebmMfVp9Dec = { | |
| 84 0x07ab4bd2, | |
| 85 0x1979, | |
| 86 0x4fcd, | |
| 87 {0xa6, 0x97, 0xdf, 0x9a, 0xd1, 0x5b, 0x34, 0xfe}}; | |
| 88 | |
| 89 const CLSID MEDIASUBTYPE_VP80 = { | 56 const CLSID MEDIASUBTYPE_VP80 = { |
| 90 0x30385056, | 57 0x30385056, |
| 91 0x0000, | 58 0x0000, |
| 92 0x0010, | 59 0x0010, |
| 93 {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; | 60 {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; |
| 94 | 61 |
| 95 const CLSID MEDIASUBTYPE_VP90 = { | 62 const CLSID MEDIASUBTYPE_VP90 = { |
| 96 0x30395056, | 63 0x30395056, |
| 97 0x0000, | 64 0x0000, |
| 98 0x0010, | 65 0x0010, |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 profile == VP9PROFILE_PROFILE1 || | 1396 profile == VP9PROFILE_PROFILE1 || |
| 1430 profile == VP9PROFILE_PROFILE2 || | 1397 profile == VP9PROFILE_PROFILE2 || |
| 1431 profile == VP9PROFILE_PROFILE3)) { | 1398 profile == VP9PROFILE_PROFILE3)) { |
| 1432 if (profile != VP8PROFILE_ANY) { | 1399 if (profile != VP8PROFILE_ANY) { |
| 1433 codec_ = kCodecVP9; | 1400 codec_ = kCodecVP9; |
| 1434 clsid = CLSID_MSVPxDecoder; | 1401 clsid = CLSID_MSVPxDecoder; |
| 1435 decoder_dll = ::LoadLibrary(kMSVP9DecoderDLLName); | 1402 decoder_dll = ::LoadLibrary(kMSVP9DecoderDLLName); |
| 1436 if (decoder_dll) | 1403 if (decoder_dll) |
| 1437 using_ms_vp9_mft_ = true; | 1404 using_ms_vp9_mft_ = true; |
| 1438 } | 1405 } |
| 1439 if (!decoder_dll) { | |
| 1440 int program_files_key = base::DIR_PROGRAM_FILES; | |
| 1441 if (base::win::OSInfo::GetInstance()->wow64_status() == | |
| 1442 base::win::OSInfo::WOW64_ENABLED) { | |
| 1443 program_files_key = base::DIR_PROGRAM_FILES6432; | |
| 1444 } | |
| 1445 | |
| 1446 base::FilePath dll_path; | |
| 1447 RETURN_ON_FAILURE(PathService::Get(program_files_key, &dll_path), | |
| 1448 "failed to get path for Program Files", false); | |
| 1449 | |
| 1450 dll_path = dll_path.Append(kVPXDecoderDLLPath); | |
| 1451 if (profile == VP8PROFILE_ANY) { | |
| 1452 codec_ = kCodecVP8; | |
| 1453 dll_path = dll_path.Append(kVP8DecoderDLLName); | |
| 1454 clsid = CLSID_WebmMfVp8Dec; | |
| 1455 } else { | |
| 1456 codec_ = kCodecVP9; | |
| 1457 dll_path = dll_path.Append(kVP9DecoderDLLName); | |
| 1458 clsid = CLSID_WebmMfVp9Dec; | |
| 1459 } | |
| 1460 decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL, | |
| 1461 LOAD_WITH_ALTERED_SEARCH_PATH); | |
| 1462 } | |
| 1463 RETURN_ON_FAILURE(decoder_dll, "vpx decoder dll is not loaded", false); | 1406 RETURN_ON_FAILURE(decoder_dll, "vpx decoder dll is not loaded", false); |
| 1464 } else { | 1407 } else { |
| 1465 RETURN_ON_FAILURE(false, "Unsupported codec.", false); | 1408 RETURN_ON_FAILURE(false, "Unsupported codec.", false); |
| 1466 } | 1409 } |
| 1467 | 1410 |
| 1468 HRESULT hr = CreateCOMObjectFromDll( | 1411 HRESULT hr = CreateCOMObjectFromDll( |
| 1469 decoder_dll, clsid, __uuidof(IMFTransform), decoder_.ReceiveVoid()); | 1412 decoder_dll, clsid, __uuidof(IMFTransform), decoder_.ReceiveVoid()); |
| 1470 RETURN_ON_HR_FAILURE(hr, "Failed to create decoder instance", false); | 1413 RETURN_ON_HR_FAILURE(hr, "Failed to create decoder instance", false); |
| 1471 | 1414 |
| 1472 RETURN_ON_FAILURE(CheckDecoderDxvaSupport(), | 1415 RETURN_ON_FAILURE(CheckDecoderDxvaSupport(), |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2768 SetState(kConfigChange); | 2711 SetState(kConfigChange); |
| 2769 Invalidate(); | 2712 Invalidate(); |
| 2770 Initialize(config_, client_); | 2713 Initialize(config_, client_); |
| 2771 decoder_thread_task_runner_->PostTask( | 2714 decoder_thread_task_runner_->PostTask( |
| 2772 FROM_HERE, | 2715 FROM_HERE, |
| 2773 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2716 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2774 base::Unretained(this))); | 2717 base::Unretained(this))); |
| 2775 } | 2718 } |
| 2776 | 2719 |
| 2777 } // namespace media | 2720 } // namespace media |
| OLD | NEW |