xref: /aosp_15_r20/external/libwebm/webm_parser/src/colour_parser.h (revision 103e46e4cd4b6efcf6001f23fa8665fb110abf8d)
1*103e46e4SHarish Mahendrakar // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2*103e46e4SHarish Mahendrakar //
3*103e46e4SHarish Mahendrakar // Use of this source code is governed by a BSD-style license
4*103e46e4SHarish Mahendrakar // that can be found in the LICENSE file in the root of the source
5*103e46e4SHarish Mahendrakar // tree. An additional intellectual property rights grant can be found
6*103e46e4SHarish Mahendrakar // in the file PATENTS.  All contributing project authors may
7*103e46e4SHarish Mahendrakar // be found in the AUTHORS file in the root of the source tree.
8*103e46e4SHarish Mahendrakar #ifndef SRC_COLOUR_PARSER_H_
9*103e46e4SHarish Mahendrakar #define SRC_COLOUR_PARSER_H_
10*103e46e4SHarish Mahendrakar 
11*103e46e4SHarish Mahendrakar #include "src/int_parser.h"
12*103e46e4SHarish Mahendrakar #include "src/master_value_parser.h"
13*103e46e4SHarish Mahendrakar #include "src/mastering_metadata_parser.h"
14*103e46e4SHarish Mahendrakar #include "webm/dom_types.h"
15*103e46e4SHarish Mahendrakar #include "webm/id.h"
16*103e46e4SHarish Mahendrakar 
17*103e46e4SHarish Mahendrakar namespace webm {
18*103e46e4SHarish Mahendrakar 
19*103e46e4SHarish Mahendrakar // Spec reference:
20*103e46e4SHarish Mahendrakar // http://matroska.org/technical/specs/index.html#Colour
21*103e46e4SHarish Mahendrakar // http://www.webmproject.org/docs/container/#Colour
22*103e46e4SHarish Mahendrakar class ColourParser : public MasterValueParser<Colour> {
23*103e46e4SHarish Mahendrakar  public:
ColourParser()24*103e46e4SHarish Mahendrakar   ColourParser()
25*103e46e4SHarish Mahendrakar       : MasterValueParser<Colour>(
26*103e46e4SHarish Mahendrakar             MakeChild<IntParser<MatrixCoefficients>>(
27*103e46e4SHarish Mahendrakar                 Id::kMatrixCoefficients, &Colour::matrix_coefficients),
28*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kBitsPerChannel,
29*103e46e4SHarish Mahendrakar                                          &Colour::bits_per_channel),
30*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kChromaSubsamplingHorz,
31*103e46e4SHarish Mahendrakar                                          &Colour::chroma_subsampling_x),
32*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kChromaSubsamplingVert,
33*103e46e4SHarish Mahendrakar                                          &Colour::chroma_subsampling_y),
34*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kCbSubsamplingHorz,
35*103e46e4SHarish Mahendrakar                                          &Colour::cb_subsampling_x),
36*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kCbSubsamplingVert,
37*103e46e4SHarish Mahendrakar                                          &Colour::cb_subsampling_y),
38*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kChromaSitingHorz,
39*103e46e4SHarish Mahendrakar                                          &Colour::chroma_siting_x),
40*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kChromaSitingVert,
41*103e46e4SHarish Mahendrakar                                          &Colour::chroma_siting_y),
42*103e46e4SHarish Mahendrakar             MakeChild<IntParser<Range>>(Id::kRange, &Colour::range),
43*103e46e4SHarish Mahendrakar             MakeChild<IntParser<TransferCharacteristics>>(
44*103e46e4SHarish Mahendrakar                 Id::kTransferCharacteristics,
45*103e46e4SHarish Mahendrakar                 &Colour::transfer_characteristics),
46*103e46e4SHarish Mahendrakar             MakeChild<IntParser<Primaries>>(Id::kPrimaries, &Colour::primaries),
47*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kMaxCll, &Colour::max_cll),
48*103e46e4SHarish Mahendrakar             MakeChild<UnsignedIntParser>(Id::kMaxFall, &Colour::max_fall),
49*103e46e4SHarish Mahendrakar             MakeChild<MasteringMetadataParser>(Id::kMasteringMetadata,
50*103e46e4SHarish Mahendrakar                                                &Colour::mastering_metadata)) {}
51*103e46e4SHarish Mahendrakar };
52*103e46e4SHarish Mahendrakar 
53*103e46e4SHarish Mahendrakar }  // namespace webm
54*103e46e4SHarish Mahendrakar 
55*103e46e4SHarish Mahendrakar #endif  // SRC_COLOUR_PARSER_H_
56