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

View File

@@ -403,13 +403,15 @@ struct PrimaryChromaticity {
}; };
struct MasteringMetadata { struct MasteringMetadata {
static const double kValueNotPresent;
MasteringMetadata() MasteringMetadata()
: r(NULL), : r(NULL),
g(NULL), g(NULL),
b(NULL), b(NULL),
white_point(NULL), white_point(NULL),
luminance_max(0), luminance_max(kValueNotPresent),
luminance_min(0) {} luminance_min(kValueNotPresent) {}
~MasteringMetadata() { ~MasteringMetadata() {
delete r; delete r;
delete g; delete g;
@@ -430,17 +432,21 @@ struct MasteringMetadata {
}; };
struct Colour { struct Colour {
static const long long kValueNotPresent;
// Unless otherwise noted all values assigned upon construction are the // Unless otherwise noted all values assigned upon construction are the
// equivalent of unspecified/default. // equivalent of unspecified/default.
Colour() Colour()
: matrix(2), : matrix(kValueNotPresent),
bits_per_channel(0), bits_per_channel(kValueNotPresent),
chroma_subsampling(0), chroma_subsampling(kValueNotPresent),
chroma_siting_horz(0), chroma_siting_horz(kValueNotPresent),
chroma_siting_vert(0), chroma_siting_vert(kValueNotPresent),
range(0), range(kValueNotPresent),
transfer_function(2), transfer_function(kValueNotPresent),
primaries(2), primaries(kValueNotPresent),
max_cll(kValueNotPresent),
max_fall(kValueNotPresent),
mastering_metadata(NULL) {} mastering_metadata(NULL) {}
~Colour() { ~Colour() {
delete mastering_metadata; delete mastering_metadata;