Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gpu_video_accelerator_util.h" | 5 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace content { |
| 8 | 8 |
| 9 // Make sure the enum values of media::VideoCodecProfile and | 9 // Make sure the enum values of media::VideoCodecProfile and |
| 10 // gpu::VideoCodecProfile match. | 10 // gpu::VideoCodecProfile match. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_HIGH444PREDICTIVEPROFILE); | 24 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_HIGH444PREDICTIVEPROFILE); |
| 25 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_SCALABLEBASELINE); | 25 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_SCALABLEBASELINE); |
| 26 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_SCALABLEHIGH); | 26 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_SCALABLEHIGH); |
| 27 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_STEREOHIGH); | 27 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_STEREOHIGH); |
| 28 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_MULTIVIEWHIGH); | 28 STATIC_ASSERT_ENUM_MATCH(H264PROFILE_MULTIVIEWHIGH); |
| 29 STATIC_ASSERT_ENUM_MATCH(VP8PROFILE_ANY); | 29 STATIC_ASSERT_ENUM_MATCH(VP8PROFILE_ANY); |
| 30 STATIC_ASSERT_ENUM_MATCH(VP9PROFILE_ANY); | 30 STATIC_ASSERT_ENUM_MATCH(VP9PROFILE_ANY); |
| 31 STATIC_ASSERT_ENUM_MATCH(VIDEO_CODEC_PROFILE_MAX); | 31 STATIC_ASSERT_ENUM_MATCH(VIDEO_CODEC_PROFILE_MAX); |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 media::VideoDecodeAccelerator::Capabilities | |
| 35 GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeCapabilities( | |
| 36 const gpu::VideoDecodeAcceleratorCapabilities& gpu_capabilities) { | |
| 37 media::VideoDecodeAccelerator::Capabilities capabilities; | |
| 38 capabilities.supported_profiles = | |
| 39 ConvertGpuToMediaDecodeProfiles(gpu_capabilities.supported_profiles); | |
| 40 capabilities.flags = | |
| 41 static_cast<media::VideoDecodeAccelerator::Capabilities::Flags>( | |
|
Pawel Osciak
2015/12/05 00:18:55
Is the cast needed? Both are uint32s...
liberato (no reviews please)
2015/12/07 19:04:39
yes: error: invalid conversion from 'uint32 {aka u
| |
| 42 gpu_capabilities.flags); | |
| 43 return capabilities; | |
| 44 } | |
| 45 | |
| 46 // static | |
| 34 media::VideoDecodeAccelerator::SupportedProfiles | 47 media::VideoDecodeAccelerator::SupportedProfiles |
| 35 GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeProfiles(const | 48 GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeProfiles(const |
| 36 gpu::VideoDecodeAcceleratorSupportedProfiles& gpu_profiles) { | 49 gpu::VideoDecodeAcceleratorSupportedProfiles& gpu_profiles) { |
| 37 media::VideoDecodeAccelerator::SupportedProfiles profiles; | 50 media::VideoDecodeAccelerator::SupportedProfiles profiles; |
| 38 for (const auto& gpu_profile : gpu_profiles) { | 51 for (const auto& gpu_profile : gpu_profiles) { |
| 39 media::VideoDecodeAccelerator::SupportedProfile profile; | 52 media::VideoDecodeAccelerator::SupportedProfile profile; |
| 40 profile.profile = | 53 profile.profile = |
| 41 static_cast<media::VideoCodecProfile>(gpu_profile.profile); | 54 static_cast<media::VideoCodecProfile>(gpu_profile.profile); |
| 42 profile.max_resolution = gpu_profile.max_resolution; | 55 profile.max_resolution = gpu_profile.max_resolution; |
| 43 profile.min_resolution = gpu_profile.min_resolution; | 56 profile.min_resolution = gpu_profile.min_resolution; |
| 44 profiles.push_back(profile); | 57 profiles.push_back(profile); |
| 45 } | 58 } |
| 46 return profiles; | 59 return profiles; |
| 47 } | 60 } |
| 48 | 61 |
| 49 // static | 62 // static |
| 63 gpu::VideoDecodeAcceleratorCapabilities | |
| 64 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeCapabilities( | |
| 65 const media::VideoDecodeAccelerator::Capabilities& media_capabilities) { | |
| 66 gpu::VideoDecodeAcceleratorCapabilities capabilities; | |
| 67 capabilities.supported_profiles = | |
| 68 ConvertMediaToGpuDecodeProfiles(media_capabilities.supported_profiles); | |
| 69 capabilities.flags = static_cast<uint32>(media_capabilities.flags); | |
| 70 return capabilities; | |
| 71 } | |
| 72 | |
| 73 // static | |
| 50 gpu::VideoDecodeAcceleratorSupportedProfiles | 74 gpu::VideoDecodeAcceleratorSupportedProfiles |
| 51 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(const | 75 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(const |
| 52 media::VideoDecodeAccelerator::SupportedProfiles& media_profiles) { | 76 media::VideoDecodeAccelerator::SupportedProfiles& media_profiles) { |
| 53 gpu::VideoDecodeAcceleratorSupportedProfiles profiles; | 77 gpu::VideoDecodeAcceleratorSupportedProfiles profiles; |
| 54 for (const auto& media_profile : media_profiles) { | 78 for (const auto& media_profile : media_profiles) { |
| 55 gpu::VideoDecodeAcceleratorSupportedProfile profile; | 79 gpu::VideoDecodeAcceleratorSupportedProfile profile; |
| 56 profile.profile = | 80 profile.profile = |
| 57 static_cast<gpu::VideoCodecProfile>(media_profile.profile); | 81 static_cast<gpu::VideoCodecProfile>(media_profile.profile); |
| 58 profile.max_resolution = media_profile.max_resolution; | 82 profile.max_resolution = media_profile.max_resolution; |
| 59 profile.min_resolution = media_profile.min_resolution; | 83 profile.min_resolution = media_profile.min_resolution; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 duplicate = true; | 148 duplicate = true; |
| 125 break; | 149 break; |
| 126 } | 150 } |
| 127 } | 151 } |
| 128 if (!duplicate) | 152 if (!duplicate) |
| 129 media_profiles->push_back(profile); | 153 media_profiles->push_back(profile); |
| 130 } | 154 } |
| 131 } | 155 } |
| 132 | 156 |
| 133 } // namespace content | 157 } // namespace content |
| OLD | NEW |