mkvparser: Make omitted values detectable in the Colour element.

Add constants that allow users to determine when an element or value
was omitted from Colour and its child elements.

Change-Id: If909274850127938a456f2d0a1e490dcbb9c1bde
This commit is contained in:
Tom Finegan 2016-02-10 09:14:34 -08:00
parent 41a9147f2a
commit ae4ae7ef77
2 changed files with 19 additions and 10 deletions

View File

@ -14,6 +14,7 @@
#endif
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstring>
@ -28,6 +29,8 @@
#endif
namespace mkvparser {
const double MasteringMetadata::kValueNotPresent = DBL_MAX;
const long long Colour::kValueNotPresent = LLONG_MAX;
#ifdef MSC_COMPAT
inline bool isnan(double val) { return !!_isnan(val); }

View File

@ -403,13 +403,15 @@ struct PrimaryChromaticity {
};
struct MasteringMetadata {
static const double kValueNotPresent;
MasteringMetadata()
: r(NULL),
g(NULL),
b(NULL),
white_point(NULL),
luminance_max(0),
luminance_min(0) {}
luminance_max(kValueNotPresent),
luminance_min(kValueNotPresent) {}
~MasteringMetadata() {
delete r;
delete g;
@ -430,17 +432,21 @@ struct MasteringMetadata {
};
struct Colour {
static const long long kValueNotPresent;
// 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),
: matrix(kValueNotPresent),
bits_per_channel(kValueNotPresent),
chroma_subsampling(kValueNotPresent),
chroma_siting_horz(kValueNotPresent),
chroma_siting_vert(kValueNotPresent),
range(kValueNotPresent),
transfer_function(kValueNotPresent),
primaries(kValueNotPresent),
max_cll(kValueNotPresent),
max_fall(kValueNotPresent),
mastering_metadata(NULL) {}
~Colour() {
delete mastering_metadata;