Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "gpu/ipc/common/gpu_info_struct_traits.h" | 5 #include "gpu/ipc/common/gpu_info_struct_traits.h" |
| 6 | 6 |
| 7 namespace mojo { | 7 namespace mojo { |
| 8 | 8 |
| 9 // static | 9 // static |
| 10 bool StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice>::Read( | 10 bool StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice>::Read( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 *out = gpu::CollectInfoResult::kCollectInfoNonFatalFailure; | 50 *out = gpu::CollectInfoResult::kCollectInfoNonFatalFailure; |
| 51 return true; | 51 return true; |
| 52 case gpu::mojom::CollectInfoResult::kCollectInfoFatalFailure: | 52 case gpu::mojom::CollectInfoResult::kCollectInfoFatalFailure: |
| 53 *out = gpu::CollectInfoResult::kCollectInfoFatalFailure; | 53 *out = gpu::CollectInfoResult::kCollectInfoFatalFailure; |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 NOTREACHED() << "Invalid CollectInfoResult value:" << input; | 56 NOTREACHED() << "Invalid CollectInfoResult value:" << input; |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 | 59 |
| 60 // static | |
| 61 gpu::mojom::VideoCodecProfile | |
| 62 EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>::ToMojom( | |
| 63 gpu::VideoCodecProfile video_codec_profile) { | |
| 64 switch (video_codec_profile) { | |
| 65 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'
| |
| 66 return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; | |
| 67 case gpu::VideoCodecProfile::H264PROFILE_BASELINE: | |
| 68 return gpu::mojom::VideoCodecProfile::H264PROFILE_BASELINE; | |
| 69 case gpu::VideoCodecProfile::H264PROFILE_MAIN: | |
| 70 return gpu::mojom::VideoCodecProfile::H264PROFILE_MAIN; | |
| 71 case gpu::VideoCodecProfile::H264PROFILE_EXTENDED: | |
| 72 return gpu::mojom::VideoCodecProfile::H264PROFILE_EXTENDED; | |
| 73 case gpu::VideoCodecProfile::H264PROFILE_HIGH: | |
| 74 return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH; | |
| 75 case gpu::VideoCodecProfile::H264PROFILE_HIGH10PROFILE: | |
| 76 return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH10PROFILE; | |
| 77 case gpu::VideoCodecProfile::H264PROFILE_HIGH422PROFILE: | |
| 78 return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH422PROFILE; | |
| 79 case gpu::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE: | |
| 80 return gpu::mojom::VideoCodecProfile:: | |
| 81 H264PROFILE_HIGH444PREDICTIVEPROFILE; | |
| 82 case gpu::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE: | |
| 83 return gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE; | |
| 84 case gpu::VideoCodecProfile::H264PROFILE_SCALABLEHIGH: | |
| 85 return gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEHIGH; | |
| 86 case gpu::VideoCodecProfile::H264PROFILE_STEREOHIGH: | |
| 87 return gpu::mojom::VideoCodecProfile::H264PROFILE_STEREOHIGH; | |
| 88 case gpu::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH: | |
| 89 return gpu::mojom::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH; | |
| 90 case gpu::VideoCodecProfile::VP8PROFILE_ANY: | |
| 91 return gpu::mojom::VideoCodecProfile::VP8PROFILE_ANY; | |
| 92 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE0: | |
| 93 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE0; | |
| 94 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE1: | |
| 95 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE1; | |
| 96 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE2: | |
| 97 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE2; | |
| 98 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE3: | |
| 99 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE3; | |
| 100 case gpu::VideoCodecProfile::HEVCPROFILE_MAIN: | |
| 101 return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN; | |
| 102 case gpu::VideoCodecProfile::HEVCPROFILE_MAIN10: | |
| 103 return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN10; | |
| 104 case gpu::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE: | |
| 105 return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE; | |
| 106 } | |
| 107 NOTREACHED() << "Invalid VideoCodecProfile:" << video_codec_profile; | |
| 108 return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; | |
| 109 } | |
| 110 | |
| 111 // static | |
| 112 bool EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>:: | |
| 113 FromMojom(gpu::mojom::VideoCodecProfile input, | |
| 114 gpu::VideoCodecProfile* out) { | |
| 115 switch (input) { | |
| 116 case gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN: | |
| 117 *out = gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; | |
| 118 return true; | |
| 119 case gpu::mojom::VideoCodecProfile::H264PROFILE_BASELINE: | |
| 120 *out = gpu::VideoCodecProfile::H264PROFILE_BASELINE; | |
| 121 return true; | |
| 122 case gpu::mojom::VideoCodecProfile::H264PROFILE_MAIN: | |
| 123 *out = gpu::VideoCodecProfile::H264PROFILE_MAIN; | |
| 124 return true; | |
| 125 case gpu::mojom::VideoCodecProfile::H264PROFILE_EXTENDED: | |
| 126 *out = gpu::VideoCodecProfile::H264PROFILE_EXTENDED; | |
| 127 return true; | |
| 128 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH: | |
| 129 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH; | |
| 130 return true; | |
| 131 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH10PROFILE: | |
| 132 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH10PROFILE; | |
| 133 return true; | |
| 134 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH422PROFILE: | |
| 135 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH422PROFILE; | |
| 136 return true; | |
| 137 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE: | |
| 138 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE; | |
| 139 return true; | |
| 140 case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE: | |
| 141 *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE; | |
| 142 return true; | |
| 143 case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEHIGH: | |
| 144 *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEHIGH; | |
| 145 return true; | |
| 146 case gpu::mojom::VideoCodecProfile::H264PROFILE_STEREOHIGH: | |
| 147 *out = gpu::VideoCodecProfile::H264PROFILE_STEREOHIGH; | |
| 148 return true; | |
| 149 case gpu::mojom::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH: | |
| 150 *out = gpu::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH; | |
| 151 return true; | |
| 152 case gpu::mojom::VideoCodecProfile::VP8PROFILE_ANY: | |
| 153 *out = gpu::VideoCodecProfile::VP8PROFILE_ANY; | |
| 154 return true; | |
| 155 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE0: | |
| 156 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE0; | |
| 157 return true; | |
| 158 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE1: | |
| 159 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE1; | |
| 160 return true; | |
| 161 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE2: | |
| 162 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE2; | |
| 163 return true; | |
| 164 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE3: | |
| 165 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE3; | |
| 166 return true; | |
| 167 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN: | |
| 168 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN; | |
| 169 return true; | |
| 170 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN10: | |
| 171 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN10; | |
| 172 return true; | |
| 173 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE: | |
| 174 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE; | |
| 175 return true; | |
| 176 } | |
| 177 NOTREACHED() << "Invalid VideoCodecProfile: " << input; | |
| 178 return false; | |
| 179 } | |
| 180 | |
| 181 // static | |
| 182 bool StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfile, | |
| 183 gpu::VideoDecodeAcceleratorSupportedProfile>:: | |
| 184 Read(gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data, | |
| 185 gpu::VideoDecodeAcceleratorSupportedProfile* out) { | |
| 186 out->encrypted_only = data.encrypted_only(); | |
| 187 return data.ReadProfile(&out->profile) && | |
| 188 data.ReadMaxResolution(&out->max_resolution) && | |
| 189 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
| |
| 190 } | |
| 191 | |
| 192 // static | |
| 193 bool StructTraits<gpu::mojom::VideoDecodeAcceleratorCapabilities, | |
| 194 gpu::VideoDecodeAcceleratorCapabilities>:: | |
| 195 Read(gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView data, | |
| 196 gpu::VideoDecodeAcceleratorCapabilities* out) { | |
| 197 out->flags = data.flags(); | |
| 198 return true; | |
| 199 } | |
| 200 | |
| 201 // static | |
| 202 bool StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfile, | |
| 203 gpu::VideoEncodeAcceleratorSupportedProfile>:: | |
| 204 Read(gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data, | |
| 205 gpu::VideoEncodeAcceleratorSupportedProfile* out) { | |
| 206 out->max_framerate_numerator = data.max_framerate_numerator(); | |
| 207 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.
| |
| 208 return data.ReadProfile(&out->profile) && | |
| 209 data.ReadMaxResolution(&out->max_resolution); | |
| 210 } | |
| 211 | |
| 60 } // namespace mojo | 212 } // namespace mojo |
| OLD | NEW |