Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: gpu/ipc/common/gpu_info_struct_traits.cc

Issue 2147693002: Struct traits used by GpuInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed according to comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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:
66 return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN;
67 // Commented out because
68 // VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN
69 // case gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_MIN:
70 // return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MIN;
71 case gpu::VideoCodecProfile::H264PROFILE_BASELINE:
72 return gpu::mojom::VideoCodecProfile::H264PROFILE_BASELINE;
73 case gpu::VideoCodecProfile::H264PROFILE_MAIN:
74 return gpu::mojom::VideoCodecProfile::H264PROFILE_MAIN;
75 case gpu::VideoCodecProfile::H264PROFILE_EXTENDED:
76 return gpu::mojom::VideoCodecProfile::H264PROFILE_EXTENDED;
77 case gpu::VideoCodecProfile::H264PROFILE_HIGH:
78 return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH;
79 case gpu::VideoCodecProfile::H264PROFILE_HIGH10PROFILE:
80 return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH10PROFILE;
81 case gpu::VideoCodecProfile::H264PROFILE_HIGH422PROFILE:
82 return gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH422PROFILE;
83 case gpu::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE:
84 return gpu::mojom::VideoCodecProfile::
85 H264PROFILE_HIGH444PREDICTIVEPROFILE;
86 case gpu::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE:
87 return gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE;
88 case gpu::VideoCodecProfile::H264PROFILE_SCALABLEHIGH:
89 return gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEHIGH;
90 case gpu::VideoCodecProfile::H264PROFILE_STEREOHIGH:
91 return gpu::mojom::VideoCodecProfile::H264PROFILE_STEREOHIGH;
92 case gpu::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH:
93 return gpu::mojom::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH;
94 case gpu::VideoCodecProfile::VP8PROFILE_ANY:
95 return gpu::mojom::VideoCodecProfile::VP8PROFILE_ANY;
96 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE0:
97 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE0;
98 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE1:
99 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE1;
100 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE2:
101 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE2;
102 case gpu::VideoCodecProfile::VP9PROFILE_PROFILE3:
103 return gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE3;
104 case gpu::VideoCodecProfile::HEVCPROFILE_MAIN:
105 return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN;
106 case gpu::VideoCodecProfile::HEVCPROFILE_MAIN10:
107 return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN10;
108 case gpu::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE:
109 return gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE;
110 // VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE
111 // case gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_MAX:
112 // return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MAX;
113 }
114 NOTREACHED() << "Invalid VideoCodecProfile:" << video_codec_profile;
115 return gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN;
116 }
117
118 // static
119 bool EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>::
120 FromMojom(gpu::mojom::VideoCodecProfile input,
121 gpu::VideoCodecProfile* out) {
122 switch (input) {
123 case gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN:
124 *out = gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN;
125 return true;
126 // Commented out because
127 // VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN
128 // case gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MIN:
129 // *out = gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MIN;
130 // return true;
131 case gpu::mojom::VideoCodecProfile::H264PROFILE_BASELINE:
132 *out = gpu::VideoCodecProfile::H264PROFILE_BASELINE;
133 return true;
134 case gpu::mojom::VideoCodecProfile::H264PROFILE_MAIN:
135 *out = gpu::VideoCodecProfile::H264PROFILE_MAIN;
136 return true;
137 case gpu::mojom::VideoCodecProfile::H264PROFILE_EXTENDED:
138 *out = gpu::VideoCodecProfile::H264PROFILE_EXTENDED;
139 return true;
140 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH:
141 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH;
142 return true;
143 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH10PROFILE:
144 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH10PROFILE;
145 return true;
146 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH422PROFILE:
147 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH422PROFILE;
148 return true;
149 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE:
150 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE;
151 return true;
152 case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE:
153 *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE;
154 return true;
155 case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEHIGH:
156 *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEHIGH;
157 return true;
158 case gpu::mojom::VideoCodecProfile::H264PROFILE_STEREOHIGH:
159 *out = gpu::VideoCodecProfile::H264PROFILE_STEREOHIGH;
160 return true;
161 case gpu::mojom::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH:
162 *out = gpu::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH;
163 return true;
164 case gpu::mojom::VideoCodecProfile::VP8PROFILE_ANY:
165 *out = gpu::VideoCodecProfile::VP8PROFILE_ANY;
166 return true;
167 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE0:
168 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE0;
169 return true;
170 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE1:
171 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE1;
172 return true;
173 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE2:
174 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE2;
175 return true;
176 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE3:
177 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE3;
178 return true;
179 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN:
180 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN;
181 return true;
182 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN10:
183 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN10;
184 return true;
185 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE:
186 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE;
187 return true;
188 // VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE
189 // case gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MAX:
190 // *out = gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_MAX;
191 // return true;
192 }
193 NOTREACHED() << "Invalid VideoCodecProfile: " << input;
194 return false;
195 }
196
197 // static
198 bool StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfile,
199 gpu::VideoDecodeAcceleratorSupportedProfile>::
200 Read(gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data,
201 gpu::VideoDecodeAcceleratorSupportedProfile* out) {
202 out->encrypted_only = data.encrypted_only();
203 return data.ReadProfile(&out->profile) &&
204 data.ReadMaxResolution(&out->max_resolution) &&
205 data.ReadMinResolution(&out->min_resolution);
206 }
207
208 // static
209 bool StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfile,
210 gpu::VideoEncodeAcceleratorSupportedProfile>::
211 Read(gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data,
212 gpu::VideoEncodeAcceleratorSupportedProfile* out) {
213 out->max_framerate_numerator = data.max_framerate_numerator();
214 out->max_framerate_denominator = data.max_framerate_denominator();
215 return data.ReadProfile(&out->profile) &&
216 data.ReadMaxResolution(&out->max_resolution);
217 }
218
60 } // namespace mojo 219 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698