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

Side by Side Diff: chromecast/media/cma/base/decoder_config_adapter.cc

Issue 2368573002: [Chromecast] Add color space and HDR data to Chromecast VideoConfig (Closed)
Patch Set: Added static asserts Created 4 years, 3 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
« no previous file with comments | « no previous file | chromecast/public/media/decoder_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chromecast/media/cma/base/decoder_config_adapter.h" 5 #include "chromecast/media/cma/base/decoder_config_adapter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chromecast/media/base/media_codec_support.h" 8 #include "chromecast/media/base/media_codec_support.h"
9 #include "media/base/channel_layout.h" 9 #include "media/base/channel_layout.h"
10 10
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (!config.IsValidConfig()) { 229 if (!config.IsValidConfig()) {
230 return video_config; 230 return video_config;
231 } 231 }
232 232
233 video_config.id = id; 233 video_config.id = id;
234 video_config.codec = ToCastVideoCodec(config.codec()); 234 video_config.codec = ToCastVideoCodec(config.codec());
235 video_config.profile = ToCastVideoProfile(config.profile()); 235 video_config.profile = ToCastVideoProfile(config.profile());
236 video_config.extra_data = config.extra_data(); 236 video_config.extra_data = config.extra_data();
237 video_config.encryption_scheme = ToEncryptionScheme( 237 video_config.encryption_scheme = ToEncryptionScheme(
238 config.encryption_scheme()); 238 config.encryption_scheme());
239
240 // TODO(servolk): gfx::ColorSpace currently doesn't provide getters for color
241 // space components. We'll need to way to fix this. crbug.com/649758
242 // video_config.primaries =
243 // static_cast<PrimaryID>(config.color_space_info().primaries());
244 // video_config.transfer =
245 // static_cast<TransferID>(config.color_space_info().transfer());
246 // video_config.matrix =
247 // static_cast<MatrixID>(config.color_space_info().matrix());
248 // video_config.range =
249 // static_cast<RangeID>(config.color_space_info().range());
250
251 base::Optional<::media::HDRMetadata> hdr_metadata = config.hdr_metadata();
252 if (hdr_metadata) {
253 video_config.have_hdr_metadata = true;
254 video_config.hdr_metadata.max_cll = hdr_metadata->max_cll;
255 video_config.hdr_metadata.max_fall = hdr_metadata->max_fall;
256
257 const auto& mm1 = hdr_metadata->mastering_metadata;
258 auto& mm2 = video_config.hdr_metadata.mastering_metadata;
259 mm2.primary_r_chromaticity_x = mm1.primary_r_chromaticity_x;
260 mm2.primary_r_chromaticity_y = mm1.primary_r_chromaticity_y;
261 mm2.primary_g_chromaticity_x = mm1.primary_g_chromaticity_x;
262 mm2.primary_g_chromaticity_y = mm1.primary_g_chromaticity_y;
263 mm2.primary_b_chromaticity_x = mm1.primary_b_chromaticity_x;
264 mm2.primary_b_chromaticity_y = mm1.primary_b_chromaticity_y;
265 mm2.white_point_chromaticity_x = mm1.white_point_chromaticity_x;
266 mm2.white_point_chromaticity_y = mm1.white_point_chromaticity_y;
267 mm2.luminance_max = mm1.luminance_max;
268 mm2.luminance_min = mm1.luminance_min;
269 }
270
239 return video_config; 271 return video_config;
240 } 272 }
241 273
274 MasteringMetadata::MasteringMetadata() {}
275 MasteringMetadata::MasteringMetadata(const MasteringMetadata& rhs) = default;
276
277 HDRMetadata::HDRMetadata() {}
278 HDRMetadata::HDRMetadata(const HDRMetadata& rhs) = default;
279
280 // Ensure that Chromecast enum values match enums in gfx::ColorSpace.
281 #define STATIC_ASSERT_ENUM(a, b) \
282 static_assert(static_cast<int>(a) == static_cast<int>(gfx::ColorSpace::b), \
283 "mismatching enums: " #a " and " #b)
284
285 STATIC_ASSERT_ENUM(PrimaryID::RESERVED0, PrimaryID::RESERVED0);
286 STATIC_ASSERT_ENUM(PrimaryID::BT709, PrimaryID::BT709);
287 STATIC_ASSERT_ENUM(PrimaryID::UNSPECIFIED, PrimaryID::UNSPECIFIED);
288 STATIC_ASSERT_ENUM(PrimaryID::RESERVED, PrimaryID::RESERVED);
289 STATIC_ASSERT_ENUM(PrimaryID::BT470M, PrimaryID::BT470M);
290 STATIC_ASSERT_ENUM(PrimaryID::BT470BG, PrimaryID::BT470BG);
291 STATIC_ASSERT_ENUM(PrimaryID::SMPTE170M, PrimaryID::SMPTE170M);
292 STATIC_ASSERT_ENUM(PrimaryID::SMPTE240M, PrimaryID::SMPTE240M);
293 STATIC_ASSERT_ENUM(PrimaryID::FILM, PrimaryID::FILM);
294 STATIC_ASSERT_ENUM(PrimaryID::BT2020, PrimaryID::BT2020);
295 STATIC_ASSERT_ENUM(PrimaryID::SMPTEST428_1, PrimaryID::SMPTEST428_1);
296 STATIC_ASSERT_ENUM(PrimaryID::SMPTEST431_2, PrimaryID::SMPTEST431_2);
297 STATIC_ASSERT_ENUM(PrimaryID::SMPTEST431_2, PrimaryID::SMPTEST431_2);
298 STATIC_ASSERT_ENUM(PrimaryID::SMPTEST432_1, PrimaryID::SMPTEST432_1);
299
300 STATIC_ASSERT_ENUM(TransferID::RESERVED0, TransferID::RESERVED0);
301 STATIC_ASSERT_ENUM(TransferID::BT709, TransferID::BT709);
302 STATIC_ASSERT_ENUM(TransferID::UNSPECIFIED, TransferID::UNSPECIFIED);
303 STATIC_ASSERT_ENUM(TransferID::RESERVED, TransferID::RESERVED);
304 STATIC_ASSERT_ENUM(TransferID::GAMMA22, TransferID::GAMMA22);
305 STATIC_ASSERT_ENUM(TransferID::GAMMA28, TransferID::GAMMA28);
306 STATIC_ASSERT_ENUM(TransferID::SMPTE170M, TransferID::SMPTE170M);
307 STATIC_ASSERT_ENUM(TransferID::SMPTE240M, TransferID::SMPTE240M);
308 STATIC_ASSERT_ENUM(TransferID::LINEAR, TransferID::LINEAR);
309 STATIC_ASSERT_ENUM(TransferID::LOG, TransferID::LOG);
310 STATIC_ASSERT_ENUM(TransferID::LOG_SQRT, TransferID::LOG_SQRT);
311 STATIC_ASSERT_ENUM(TransferID::IEC61966_2_4, TransferID::IEC61966_2_4);
312 STATIC_ASSERT_ENUM(TransferID::BT1361_ECG, TransferID::BT1361_ECG);
313 STATIC_ASSERT_ENUM(TransferID::IEC61966_2_1, TransferID::IEC61966_2_1);
314 STATIC_ASSERT_ENUM(TransferID::BT2020_10, TransferID::BT2020_10);
315 STATIC_ASSERT_ENUM(TransferID::BT2020_12, TransferID::BT2020_12);
316 STATIC_ASSERT_ENUM(TransferID::SMPTEST2084, TransferID::SMPTEST2084);
317 STATIC_ASSERT_ENUM(TransferID::SMPTEST428_1, TransferID::SMPTEST428_1);
318 STATIC_ASSERT_ENUM(TransferID::ARIB_STD_B67, TransferID::ARIB_STD_B67);
319
320 STATIC_ASSERT_ENUM(MatrixID::RGB, MatrixID::RGB);
321 STATIC_ASSERT_ENUM(MatrixID::BT709, MatrixID::BT709);
322 STATIC_ASSERT_ENUM(MatrixID::UNSPECIFIED, MatrixID::UNSPECIFIED);
323 STATIC_ASSERT_ENUM(MatrixID::RESERVED, MatrixID::RESERVED);
324 STATIC_ASSERT_ENUM(MatrixID::FCC, MatrixID::FCC);
325 STATIC_ASSERT_ENUM(MatrixID::BT470BG, MatrixID::BT470BG);
326 STATIC_ASSERT_ENUM(MatrixID::SMPTE170M, MatrixID::SMPTE170M);
327 STATIC_ASSERT_ENUM(MatrixID::SMPTE240M, MatrixID::SMPTE240M);
328 STATIC_ASSERT_ENUM(MatrixID::YCOCG, MatrixID::YCOCG);
329 STATIC_ASSERT_ENUM(MatrixID::BT2020_NCL, MatrixID::BT2020_NCL);
330 STATIC_ASSERT_ENUM(MatrixID::BT2020_CL, MatrixID::BT2020_CL);
331
332 STATIC_ASSERT_ENUM(RangeID::UNSPECIFIED, RangeID::UNSPECIFIED);
333 STATIC_ASSERT_ENUM(RangeID::LIMITED, RangeID::LIMITED);
334 STATIC_ASSERT_ENUM(RangeID::FULL, RangeID::FULL);
335 STATIC_ASSERT_ENUM(RangeID::DERIVED, RangeID::DERIVED);
336
242 } // namespace media 337 } // namespace media
243 } // namespace chromecast 338 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | chromecast/public/media/decoder_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698