| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 media::VideoDecodeAccelerator::SupportedProfiles | 45 media::VideoDecodeAccelerator::SupportedProfiles |
| 46 GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeProfiles(const | 46 GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeProfiles(const |
| 47 gpu::VideoDecodeAcceleratorSupportedProfiles& gpu_profiles) { | 47 gpu::VideoDecodeAcceleratorSupportedProfiles& gpu_profiles) { |
| 48 media::VideoDecodeAccelerator::SupportedProfiles profiles; | 48 media::VideoDecodeAccelerator::SupportedProfiles profiles; |
| 49 for (const auto& gpu_profile : gpu_profiles) { | 49 for (const auto& gpu_profile : gpu_profiles) { |
| 50 media::VideoDecodeAccelerator::SupportedProfile profile; | 50 media::VideoDecodeAccelerator::SupportedProfile profile; |
| 51 profile.profile = | 51 profile.profile = |
| 52 static_cast<media::VideoCodecProfile>(gpu_profile.profile); | 52 static_cast<media::VideoCodecProfile>(gpu_profile.profile); |
| 53 profile.max_resolution = gpu_profile.max_resolution; | 53 profile.max_resolution = gpu_profile.max_resolution; |
| 54 profile.min_resolution = gpu_profile.min_resolution; | 54 profile.min_resolution = gpu_profile.min_resolution; |
| 55 profile.encrypted_only = gpu_profile.encrypted_only; |
| 55 profiles.push_back(profile); | 56 profiles.push_back(profile); |
| 56 } | 57 } |
| 57 return profiles; | 58 return profiles; |
| 58 } | 59 } |
| 59 | 60 |
| 60 // static | 61 // static |
| 61 gpu::VideoDecodeAcceleratorCapabilities | 62 gpu::VideoDecodeAcceleratorCapabilities |
| 62 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeCapabilities( | 63 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeCapabilities( |
| 63 const media::VideoDecodeAccelerator::Capabilities& media_capabilities) { | 64 const media::VideoDecodeAccelerator::Capabilities& media_capabilities) { |
| 64 gpu::VideoDecodeAcceleratorCapabilities capabilities; | 65 gpu::VideoDecodeAcceleratorCapabilities capabilities; |
| 65 capabilities.supported_profiles = | 66 capabilities.supported_profiles = |
| 66 ConvertMediaToGpuDecodeProfiles(media_capabilities.supported_profiles); | 67 ConvertMediaToGpuDecodeProfiles(media_capabilities.supported_profiles); |
| 67 capabilities.flags = media_capabilities.flags; | 68 capabilities.flags = media_capabilities.flags; |
| 68 return capabilities; | 69 return capabilities; |
| 69 } | 70 } |
| 70 | 71 |
| 71 // static | 72 // static |
| 72 gpu::VideoDecodeAcceleratorSupportedProfiles | 73 gpu::VideoDecodeAcceleratorSupportedProfiles |
| 73 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(const | 74 GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(const |
| 74 media::VideoDecodeAccelerator::SupportedProfiles& media_profiles) { | 75 media::VideoDecodeAccelerator::SupportedProfiles& media_profiles) { |
| 75 gpu::VideoDecodeAcceleratorSupportedProfiles profiles; | 76 gpu::VideoDecodeAcceleratorSupportedProfiles profiles; |
| 76 for (const auto& media_profile : media_profiles) { | 77 for (const auto& media_profile : media_profiles) { |
| 77 gpu::VideoDecodeAcceleratorSupportedProfile profile; | 78 gpu::VideoDecodeAcceleratorSupportedProfile profile; |
| 78 profile.profile = | 79 profile.profile = |
| 79 static_cast<gpu::VideoCodecProfile>(media_profile.profile); | 80 static_cast<gpu::VideoCodecProfile>(media_profile.profile); |
| 80 profile.max_resolution = media_profile.max_resolution; | 81 profile.max_resolution = media_profile.max_resolution; |
| 81 profile.min_resolution = media_profile.min_resolution; | 82 profile.min_resolution = media_profile.min_resolution; |
| 83 profile.encrypted_only = media_profile.encrypted_only; |
| 82 profiles.push_back(profile); | 84 profiles.push_back(profile); |
| 83 } | 85 } |
| 84 return profiles; | 86 return profiles; |
| 85 } | 87 } |
| 86 | 88 |
| 87 // static | 89 // static |
| 88 media::VideoEncodeAccelerator::SupportedProfiles | 90 media::VideoEncodeAccelerator::SupportedProfiles |
| 89 GpuVideoAcceleratorUtil::ConvertGpuToMediaEncodeProfiles(const | 91 GpuVideoAcceleratorUtil::ConvertGpuToMediaEncodeProfiles(const |
| 90 gpu::VideoEncodeAcceleratorSupportedProfiles& gpu_profiles) { | 92 gpu::VideoEncodeAcceleratorSupportedProfiles& gpu_profiles) { |
| 91 media::VideoEncodeAccelerator::SupportedProfiles profiles; | 93 media::VideoEncodeAccelerator::SupportedProfiles profiles; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 duplicate = true; | 148 duplicate = true; |
| 147 break; | 149 break; |
| 148 } | 150 } |
| 149 } | 151 } |
| 150 if (!duplicate) | 152 if (!duplicate) |
| 151 media_profiles->push_back(profile); | 153 media_profiles->push_back(profile); |
| 152 } | 154 } |
| 153 } | 155 } |
| 154 | 156 |
| 155 } // namespace content | 157 } // namespace content |
| OLD | NEW |