mkvparser: Add support for the Colour element and its children.

Change-Id: Idffafaee221e2949c21f56c81df6e4d1c3e959a5
This commit is contained in:
Tom Finegan
2016-02-04 10:02:18 -08:00
parent 22bfdf7d99
commit fb1406ec3b
3 changed files with 300 additions and 1 deletions

View File

@@ -392,6 +392,78 @@ class Track {
ContentEncoding** content_encoding_entries_end_;
};
struct PrimaryChromaticity {
PrimaryChromaticity() : x(0), y(0) {}
~PrimaryChromaticity() {}
static bool Parse(IMkvReader* reader, long long read_pos,
long long value_size, bool is_x,
PrimaryChromaticity** chromaticity);
double x;
double y;
};
struct MasteringMetadata {
MasteringMetadata()
: r(NULL),
g(NULL),
b(NULL),
white_point(NULL),
luminance_max(0),
luminance_min(0) {}
~MasteringMetadata() {
delete r;
delete g;
delete b;
delete white_point;
}
static bool Parse(IMkvReader* reader, long long element_start,
long long element_size,
MasteringMetadata** mastering_metadata);
PrimaryChromaticity* r;
PrimaryChromaticity* g;
PrimaryChromaticity* b;
PrimaryChromaticity* white_point;
double luminance_max;
double luminance_min;
};
struct Colour {
// Unless otherwise noted all values assigned upon construction are the
// equivalent of unspecified/default.
Colour()
: matrix(2),
bits_per_channel(0),
chroma_subsampling(0),
chroma_siting_horz(0),
chroma_siting_vert(0),
range(0),
transfer_function(2),
primaries(2),
mastering_metadata(NULL) {}
~Colour() {
delete mastering_metadata;
mastering_metadata = NULL;
}
static bool Parse(IMkvReader* reader, long long element_start,
long long element_size, Colour** colour);
long long matrix;
long long bits_per_channel;
long long chroma_subsampling;
long long chroma_siting_horz;
long long chroma_siting_vert;
long long range;
long long transfer_function;
long long primaries;
long long max_cll;
long long max_fall;
MasteringMetadata* mastering_metadata;
};
class VideoTrack : public Track {
VideoTrack(const VideoTrack&);
VideoTrack& operator=(const VideoTrack&);
@@ -399,6 +471,7 @@ class VideoTrack : public Track {
VideoTrack(Segment*, long long element_start, long long element_size);
public:
virtual ~VideoTrack();
static long Parse(Segment*, const Info&, long long element_start,
long long element_size, VideoTrack*&);
@@ -413,6 +486,8 @@ class VideoTrack : public Track {
bool VetEntry(const BlockEntry*) const;
long Seek(long long time_ns, const BlockEntry*&) const;
Colour* GetColour() const;
private:
long long m_width;
long long m_height;
@@ -422,6 +497,8 @@ class VideoTrack : public Track {
long long m_stereo_mode;
double m_rate;
Colour* m_colour;
};
class AudioTrack : public Track {