Chromium Code Reviews| Index: gpu/ipc/common/gpu_info_struct_traits.cc |
| diff --git a/gpu/ipc/common/gpu_info_struct_traits.cc b/gpu/ipc/common/gpu_info_struct_traits.cc |
| index 6bcea5ce9ea1324912c68afa199eb52964e06e1d..ca3153bd65b2888754382679cb425c4affb8a74c 100644 |
| --- a/gpu/ipc/common/gpu_info_struct_traits.cc |
| +++ b/gpu/ipc/common/gpu_info_struct_traits.cc |
| @@ -57,4 +57,156 @@ bool EnumTraits<gpu::mojom::CollectInfoResult, gpu::CollectInfoResult>:: |
| return false; |
| } |
| +// static |
| +gpu::mojom::VideoCodecProfile |
| +EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>::ToMojom( |
| + gpu::VideoCodecProfile video_codec_profile) { |
| + switch (video_codec_profile) { |
| + case gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN: |
|
dcheng
2016/07/28 02:09:39
Oh I guess it's for consistency with the existing
Alex Z.
2016/07/28 19:40:44
I'll do the cleanup in a separate CL. For now let'
|
| + return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; |
| + case gpu::VideoCodecProfile::H264PROFILE_BASELINE: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_BASELINE; |
| + case gpu::VideoCodecProfile::H264PROFILE_MAIN: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_MAIN; |
| + case gpu::VideoCodecProfile::H264PROFILE_EXTENDED: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_EXTENDED; |
| + case gpu::VideoCodecProfile::H264PROFILE_HIGH: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH; |
| + case gpu::VideoCodecProfile::H264PROFILE_HIGH10PROFILE: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH10PROFILE; |
| + case gpu::VideoCodecProfile::H264PROFILE_HIGH422PROFILE: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH422PROFILE; |
| + case gpu::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE: |
| + return gpu::mojom::VideoCodecProfile:: |
| + H264PROFILE_HIGH444PREDICTIVEPROFILE; |
| + case gpu::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE; |
| + case gpu::VideoCodecProfile::H264PROFILE_SCALABLEHIGH: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEHIGH; |
| + case gpu::VideoCodecProfile::H264PROFILE_STEREOHIGH: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_STEREOHIGH; |
| + case gpu::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH: |
| + return gpu::mojom::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH; |
| + case gpu::VideoCodecProfile::VP8PROFILE_ANY: |
| + return gpu::mojom::VideoCodecProfile::VP8PROFILE_ANY; |
| + case gpu::VideoCodecProfile::VP9PROFILE_PROFILE0: |
| + return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE0; |
| + case gpu::VideoCodecProfile::VP9PROFILE_PROFILE1: |
| + return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE1; |
| + case gpu::VideoCodecProfile::VP9PROFILE_PROFILE2: |
| + return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE2; |
| + case gpu::VideoCodecProfile::VP9PROFILE_PROFILE3: |
| + return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE3; |
| + case gpu::VideoCodecProfile::HEVCPROFILE_MAIN: |
| + return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN; |
| + case gpu::VideoCodecProfile::HEVCPROFILE_MAIN10: |
| + return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN10; |
| + case gpu::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE: |
| + return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE; |
| + } |
| + NOTREACHED() << "Invalid VideoCodecProfile:" << video_codec_profile; |
| + return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; |
| +} |
| + |
| +// static |
| +bool EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>:: |
| + FromMojom(gpu::mojom::VideoCodecProfile input, |
| + gpu::VideoCodecProfile* out) { |
| + switch (input) { |
| + case gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN: |
| + *out = gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_BASELINE: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_BASELINE; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_MAIN: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_MAIN; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_EXTENDED: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_EXTENDED; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_HIGH; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH10PROFILE: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_HIGH10PROFILE; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH422PROFILE: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_HIGH422PROFILE; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEHIGH: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEHIGH; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_STEREOHIGH: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_STEREOHIGH; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH: |
| + *out = gpu::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::VP8PROFILE_ANY: |
| + *out = gpu::VideoCodecProfile::VP8PROFILE_ANY; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE0: |
| + *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE0; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE1: |
| + *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE1; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE2: |
| + *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE2; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE3: |
| + *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE3; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN: |
| + *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN10: |
| + *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN10; |
| + return true; |
| + case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE: |
| + *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE; |
| + return true; |
| + } |
| + NOTREACHED() << "Invalid VideoCodecProfile: " << input; |
| + return false; |
| +} |
| + |
| +// static |
| +bool StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfile, |
| + gpu::VideoDecodeAcceleratorSupportedProfile>:: |
| + Read(gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data, |
| + gpu::VideoDecodeAcceleratorSupportedProfile* out) { |
| + out->encrypted_only = data.encrypted_only(); |
| + return data.ReadProfile(&out->profile) && |
| + data.ReadMaxResolution(&out->max_resolution) && |
| + data.ReadMinResolution(&out->min_resolution); |
|
dcheng
2016/07/28 02:09:39
Will anything interesting happen if min resolution
Alex Z.
2016/07/28 19:40:43
There isn't any validation in the existing ParamTr
dcheng
2016/07/29 04:05:39
Right: what I'm trying to understand, though, is i
Alex Z.
2016/08/03 12:58:09
The corresponding structs are used by gpu::GPUInfo
|
| +} |
| + |
| +// static |
| +bool StructTraits<gpu::mojom::VideoDecodeAcceleratorCapabilities, |
| + gpu::VideoDecodeAcceleratorCapabilities>:: |
| + Read(gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView data, |
| + gpu::VideoDecodeAcceleratorCapabilities* out) { |
| + out->flags = data.flags(); |
| + return true; |
| +} |
| + |
| +// static |
| +bool StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfile, |
| + gpu::VideoEncodeAcceleratorSupportedProfile>:: |
| + Read(gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data, |
| + gpu::VideoEncodeAcceleratorSupportedProfile* out) { |
| + out->max_framerate_numerator = data.max_framerate_numerator(); |
| + out->max_framerate_denominator = data.max_framerate_denominator(); |
|
dcheng
2016/07/28 02:09:38
Are there any interesting checks to perform here?
Alex Z.
2016/07/28 19:40:43
Same as above.
|
| + return data.ReadProfile(&out->profile) && |
| + data.ReadMaxResolution(&out->max_resolution); |
| +} |
| + |
| } // namespace mojo |