blob: 990e1e5c1c95fa170db949598d8e06b03794022a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_
#define MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_
#include "media/base/video_color_space.h"
#include "media/formats/webm/webm_parser.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/hdr_metadata.h"
namespace media {
// WebM color information, containing HDR metadata:
// http://www.webmproject.org/docs/container/#Colour
struct MEDIA_EXPORT WebMColorMetadata {
unsigned BitsPerChannel = 0;
unsigned ChromaSubsamplingHorz = 0;
unsigned ChromaSubsamplingVert = 0;
unsigned CbSubsamplingHorz = 0;
unsigned CbSubsamplingVert = 0;
unsigned ChromaSitingHorz = 0;
unsigned ChromaSitingVert = 0;
VideoColorSpace color_space;
absl::optional<gfx::HDRMetadata> hdr_metadata;
WebMColorMetadata();
WebMColorMetadata(const WebMColorMetadata& rhs);
};
// Parser for WebM MasteringMetadata within Colour element:
// http://www.webmproject.org/docs/container/#MasteringMetadata
class WebMColorVolumeMetadataParser : public WebMParserClient {
public:
WebMColorVolumeMetadataParser();
WebMColorVolumeMetadataParser(const WebMColorVolumeMetadataParser&) = delete;
WebMColorVolumeMetadataParser& operator=(
const WebMColorVolumeMetadataParser&) = delete;
~WebMColorVolumeMetadataParser() override;
gfx::ColorVolumeMetadata GetColorVolumeMetadata() const {
return color_volume_metadata_;
}
private:
// WebMParserClient implementation.
bool OnFloat(int id, double val) override;
gfx::ColorVolumeMetadata color_volume_metadata_;
};
// Parser for WebM Colour element:
// http://www.webmproject.org/docs/container/#colour
class WebMColourParser : public WebMParserClient {
public:
WebMColourParser();
WebMColourParser(const WebMColourParser&) = delete;
WebMColourParser& operator=(const WebMColourParser&) = delete;
~WebMColourParser() override;
void Reset();
WebMColorMetadata GetWebMColorMetadata() const;
private:
// WebMParserClient implementation.
WebMParserClient* OnListStart(int id) override;
bool OnListEnd(int id) override;
bool OnUInt(int id, int64_t val) override;
int64_t matrix_coefficients_;
int64_t bits_per_channel_;
int64_t chroma_subsampling_horz_;
int64_t chroma_subsampling_vert_;
int64_t cb_subsampling_horz_;
int64_t cb_subsampling_vert_;
int64_t chroma_siting_horz_;
int64_t chroma_siting_vert_;
int64_t range_;
int64_t transfer_characteristics_;
int64_t primaries_;
int64_t max_content_light_level_;
int64_t max_frame_average_light_level_;
WebMColorVolumeMetadataParser color_volume_metadata_parser_;
bool color_volume_metadata_parsed_ = false;
};
} // namespace media
#endif // MEDIA_FORMATS_WEBM_WEBM_COLOUR_PARSER_H_
|