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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
904 } | 904 } |
905 | 905 |
906 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { | 906 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { |
907 return false; | 907 return false; |
908 } | 908 } |
909 | 909 |
910 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { | 910 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
911 return GL_BGRA_EXT; | 911 return GL_BGRA_EXT; |
912 } | 912 } |
913 | 913 |
914 // static | |
915 std::vector<media::VideoDecodeAccelerator::SupportedProfile> | |
916 DXVAVideoDecodeAccelerator::GetSupportedProfiles() { | |
wuchengli
2015/03/23 08:28:08
Add a TODO to say we need to make sure the profile
henryhsu
2015/03/23 10:06:35
Done.
| |
917 // Supported media profiles should be synced with Initialize function. | |
wuchengli
2015/03/23 08:28:08
line 537 should also use |media_profiles| array to
henryhsu
2015/03/23 10:06:35
Done.
| |
918 std::vector<media::VideoCodecProfile> media_profiles({ | |
wuchengli
2015/03/23 08:28:08
Just use an array.
henryhsu
2015/03/23 10:06:35
Done.
| |
919 media::H264PROFILE_BASELINE, | |
920 media::H264PROFILE_MAIN, | |
921 media::H264PROFILE_HIGH, | |
922 media::VP8PROFILE_ANY, | |
923 media::VP9PROFILE_ANY}); | |
924 std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles; | |
925 for (const auto& media_profile : media_profiles) { | |
926 media::VideoDecodeAccelerator::SupportedProfile profile; | |
927 profile.profile = media_profile; | |
928 // Windows Media Foundation H.264 decoding does not support decoding videos | |
929 // with any dimension smaller than 48 pixels: | |
930 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 | |
931 profile.min_resolution.SetSize(48, 48); | |
932 // Use 1088 to account for 16x16 macroblocks. | |
933 profile.max_resolution.SetSize(1920, 1088); | |
934 profiles.push_back(profile); | |
935 } | |
936 return profiles; | |
937 } | |
938 | |
914 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { | 939 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
915 HMODULE decoder_dll = NULL; | 940 HMODULE decoder_dll = NULL; |
916 | 941 |
917 // Profile must fall within the valid range for one of the supported codecs. | 942 // Profile must fall within the valid range for one of the supported codecs. |
918 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { | 943 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { |
919 // We mimic the steps CoCreateInstance uses to instantiate the object. This | 944 // We mimic the steps CoCreateInstance uses to instantiate the object. This |
920 // was previously done because it failed inside the sandbox, and now is done | 945 // was previously done because it failed inside the sandbox, and now is done |
921 // as a more minimal approach to avoid other side-effects CCI might have (as | 946 // as a more minimal approach to avoid other side-effects CCI might have (as |
922 // we are still in a reduced sandbox). | 947 // we are still in a reduced sandbox). |
923 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); | 948 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); |
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2139 D3DSURFACE_DESC surface_desc; | 2164 D3DSURFACE_DESC surface_desc; |
2140 hr = surface->GetDesc(&surface_desc); | 2165 hr = surface->GetDesc(&surface_desc); |
2141 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); | 2166 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); |
2142 *width = surface_desc.Width; | 2167 *width = surface_desc.Width; |
2143 *height = surface_desc.Height; | 2168 *height = surface_desc.Height; |
2144 } | 2169 } |
2145 return true; | 2170 return true; |
2146 } | 2171 } |
2147 | 2172 |
2148 } // namespace content | 2173 } // namespace content |
OLD | NEW |