| 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 = gpu_capabilities.flags; |
| 41 return capabilities; |
| 42 } |
| 43 |
| 44 // static |
| 34 media::VideoDecodeAccelerator::SupportedProfiles | 45 media::VideoDecodeAccelerator::SupportedProfiles |
| 35 GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeProfiles(const | 46 GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeProfiles(const |
| 36 gpu::VideoDecodeAcceleratorSupportedProfiles& gpu_profiles) { | 47 gpu::VideoDecodeAcceleratorSupportedProfiles& gpu_profiles) { |
| 37 media::VideoDecodeAccelerator::SupportedProfiles profiles; | 48 media::VideoDecodeAccelerator::SupportedProfiles profiles; |
| 38 for (const auto& gpu_profile : gpu_profiles) { | 49 for (const auto& gpu_profile : gpu_profiles) { |
| 39 media::VideoDecodeAccelerator::SupportedProfile profile; | 50 media::VideoDecodeAccelerator::SupportedProfile profile; |
| 40 profile.profile = | 51 profile.profile = |
| 41 static_cast<media::VideoCodecProfile>(gpu_profile.profile); | 52 static_cast<media::VideoCodecProfile>(gpu_profile.profile); |
| 42 profile.max_resolution = gpu_profile.max_resolution; | 53 profile.max_resolution = gpu_profile.max_resolution; |
| 43 profile.min_resolution = gpu_profile.min_resolution; | 54 profile.min_resolution = gpu_profile.min_resolution; |
| 44 profiles.push_back(profile); | 55 profiles.push_back(profile); |
| 45 } | 56 } |
| 46 return profiles; | 57 return profiles; |
| 47 } | 58 } |
| 48 | 59 |
| 49 // static | 60 // static |
| 61 gpu::VideoDecodeAcceleratorCapabilities |
| 62 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeCapabilities( |
| 63 const media::VideoDecodeAccelerator::Capabilities& media_capabilities) { |
| 64 gpu::VideoDecodeAcceleratorCapabilities capabilities; |
| 65 capabilities.supported_profiles = |
| 66 ConvertMediaToGpuDecodeProfiles(media_capabilities.supported_profiles); |
| 67 capabilities.flags = media_capabilities.flags; |
| 68 return capabilities; |
| 69 } |
| 70 |
| 71 // static |
| 50 gpu::VideoDecodeAcceleratorSupportedProfiles | 72 gpu::VideoDecodeAcceleratorSupportedProfiles |
| 51 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(const | 73 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(const |
| 52 media::VideoDecodeAccelerator::SupportedProfiles& media_profiles) { | 74 media::VideoDecodeAccelerator::SupportedProfiles& media_profiles) { |
| 53 gpu::VideoDecodeAcceleratorSupportedProfiles profiles; | 75 gpu::VideoDecodeAcceleratorSupportedProfiles profiles; |
| 54 for (const auto& media_profile : media_profiles) { | 76 for (const auto& media_profile : media_profiles) { |
| 55 gpu::VideoDecodeAcceleratorSupportedProfile profile; | 77 gpu::VideoDecodeAcceleratorSupportedProfile profile; |
| 56 profile.profile = | 78 profile.profile = |
| 57 static_cast<gpu::VideoCodecProfile>(media_profile.profile); | 79 static_cast<gpu::VideoCodecProfile>(media_profile.profile); |
| 58 profile.max_resolution = media_profile.max_resolution; | 80 profile.max_resolution = media_profile.max_resolution; |
| 59 profile.min_resolution = media_profile.min_resolution; | 81 profile.min_resolution = media_profile.min_resolution; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 duplicate = true; | 146 duplicate = true; |
| 125 break; | 147 break; |
| 126 } | 148 } |
| 127 } | 149 } |
| 128 if (!duplicate) | 150 if (!duplicate) |
| 129 media_profiles->push_back(profile); | 151 media_profiles->push_back(profile); |
| 130 } | 152 } |
| 131 } | 153 } |
| 132 | 154 |
| 133 } // namespace content | 155 } // namespace content |
| OLD | NEW |