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

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: Fixed a typo 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 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 // Commented out because
120 // VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN
Fady Samuel 2016/07/19 16:47:40 Delete this comment.
Alex Z. 2016/07/19 17:27:11 Done.
121 // case gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MIN:
122 // *out = gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MIN;
123 // return true;
124 case gpu::mojom::VideoCodecProfile::H264PROFILE_BASELINE:
125 *out = gpu::VideoCodecProfile::H264PROFILE_BASELINE;
126 return true;
127 case gpu::mojom::VideoCodecProfile::H264PROFILE_MAIN:
128 *out = gpu::VideoCodecProfile::H264PROFILE_MAIN;
129 return true;
130 case gpu::mojom::VideoCodecProfile::H264PROFILE_EXTENDED:
131 *out = gpu::VideoCodecProfile::H264PROFILE_EXTENDED;
132 return true;
133 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH:
134 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH;
135 return true;
136 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH10PROFILE:
137 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH10PROFILE;
138 return true;
139 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH422PROFILE:
140 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH422PROFILE;
141 return true;
142 case gpu::mojom::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE:
143 *out = gpu::VideoCodecProfile::H264PROFILE_HIGH444PREDICTIVEPROFILE;
144 return true;
145 case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE:
146 *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEBASELINE;
147 return true;
148 case gpu::mojom::VideoCodecProfile::H264PROFILE_SCALABLEHIGH:
149 *out = gpu::VideoCodecProfile::H264PROFILE_SCALABLEHIGH;
150 return true;
151 case gpu::mojom::VideoCodecProfile::H264PROFILE_STEREOHIGH:
152 *out = gpu::VideoCodecProfile::H264PROFILE_STEREOHIGH;
153 return true;
154 case gpu::mojom::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH:
155 *out = gpu::VideoCodecProfile::H264PROFILE_MULTIVIEWHIGH;
156 return true;
157 case gpu::mojom::VideoCodecProfile::VP8PROFILE_ANY:
158 *out = gpu::VideoCodecProfile::VP8PROFILE_ANY;
159 return true;
160 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE0:
161 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE0;
162 return true;
163 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE1:
164 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE1;
165 return true;
166 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE2:
167 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE2;
168 return true;
169 case gpu::mojom::VideoCodecProfile::VP9PROFILE_PROFILE3:
170 *out = gpu::VideoCodecProfile::VP9PROFILE_PROFILE3;
171 return true;
172 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN:
173 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN;
174 return true;
175 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN10:
176 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN10;
177 return true;
178 case gpu::mojom::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE:
179 *out = gpu::VideoCodecProfile::HEVCPROFILE_MAIN_STILL_PICTURE;
180 return true;
181 // VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE
Fady Samuel 2016/07/19 16:47:40 Just delete these.
Alex Z. 2016/07/19 17:27:11 Done.
182 // case gpu::mojom::VideoCodecProfile::VIDEO_CODEC_PROFILE_MAX:
183 // *out = gpu::VideoCodecProfile::VIDEO_CODEC_PROFILE_MAX;
184 // return true;
185 }
186 NOTREACHED() << "Invalid VideoCodecProfile: " << input;
187 return false;
188 }
189
190 // static
191 bool StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfile,
192 gpu::VideoDecodeAcceleratorSupportedProfile>::
193 Read(gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data,
194 gpu::VideoDecodeAcceleratorSupportedProfile* out) {
195 out->encrypted_only = data.encrypted_only();
196 return data.ReadProfile(&out->profile) &&
197 data.ReadMaxResolution(&out->max_resolution) &&
198 data.ReadMinResolution(&out->min_resolution);
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();
208 return data.ReadProfile(&out->profile) &&
209 data.ReadMaxResolution(&out->max_resolution);
210 }
211
60 } // namespace mojo 212 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698