OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_ |
| 6 #define MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "media/base/hdr_metadata.h" |
| 10 #include "media/formats/webm/webm_parser.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 // WebM color information, containing HDR metadata: |
| 15 // http://www.webmproject.org/docs/container/#Colour |
| 16 struct MEDIA_EXPORT WebMColorMetadata { |
| 17 unsigned BitsPerChannel = 0; |
| 18 unsigned ChromaSubsamplingHorz = 0; |
| 19 unsigned ChromaSubsamplingVert = 0; |
| 20 unsigned CbSubsamplingHorz = 0; |
| 21 unsigned CbSubsamplingVert = 0; |
| 22 unsigned ChromaSitingHorz = 0; |
| 23 unsigned ChromaSitingVert = 0; |
| 24 |
| 25 gfx::ColorSpace color_space; |
| 26 |
| 27 HDRMetadata hdr_metadata; |
| 28 |
| 29 WebMColorMetadata(); |
| 30 WebMColorMetadata(const WebMColorMetadata& rhs); |
| 31 }; |
| 32 |
| 33 // Parser for WebM MasteringMetadata within Colour element: |
| 34 // http://www.webmproject.org/docs/container/#MasteringMetadata |
| 35 class WebMMasteringMetadataParser : public WebMParserClient { |
| 36 public: |
| 37 WebMMasteringMetadataParser(); |
| 38 ~WebMMasteringMetadataParser() override; |
| 39 |
| 40 MasteringMetadata GetMasteringMetadata() const { return mastering_metadata_; } |
| 41 |
| 42 private: |
| 43 // WebMParserClient implementation. |
| 44 bool OnFloat(int id, double val) override; |
| 45 |
| 46 MasteringMetadata mastering_metadata_; |
| 47 DISALLOW_COPY_AND_ASSIGN(WebMMasteringMetadataParser); |
| 48 }; |
| 49 |
| 50 // Parser for WebM Colour element: |
| 51 // http://www.webmproject.org/docs/container/#colour |
| 52 class WebMColourParser : public WebMParserClient { |
| 53 public: |
| 54 WebMColourParser(); |
| 55 ~WebMColourParser() override; |
| 56 |
| 57 void Reset(); |
| 58 |
| 59 WebMColorMetadata GetWebMColorMetadata() const; |
| 60 |
| 61 private: |
| 62 // WebMParserClient implementation. |
| 63 WebMParserClient* OnListStart(int id) override; |
| 64 bool OnListEnd(int id) override; |
| 65 bool OnUInt(int id, int64_t val) override; |
| 66 |
| 67 int64_t matrix_coefficients_; |
| 68 int64_t bits_per_channel_; |
| 69 int64_t chroma_subsampling_horz_; |
| 70 int64_t chroma_subsampling_vert_; |
| 71 int64_t cb_subsampling_horz_; |
| 72 int64_t cb_subsampling_vert_; |
| 73 int64_t chroma_siting_horz_; |
| 74 int64_t chroma_siting_vert_; |
| 75 int64_t range_; |
| 76 int64_t transfer_characteristics_; |
| 77 int64_t primaries_; |
| 78 int64_t max_cll_; |
| 79 int64_t max_fall_; |
| 80 |
| 81 WebMMasteringMetadataParser mastering_metadata_parser_; |
| 82 bool mastering_metadata_parsed_ = false; |
| 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(WebMColourParser); |
| 85 }; |
| 86 |
| 87 } // namespace media |
| 88 |
| 89 #endif // MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_ |
OLD | NEW |