summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-10 21:08:49 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-10 21:08:49 +0000
commit6a77e41813c542f6f6a6c528941d4b2bdc7eb3ca (patch)
tree75088c09db13a65eb25ca06b0de5d3246beea34e /src/lib
parent88e187267df754a99dba3222a94e01362986f720 (diff)
Add trust content header switch.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc23
-rw-r--r--src/lib/film.h8
2 files changed, 30 insertions, 1 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 3f9210080..563147f68 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -86,6 +86,7 @@ int const Film::state_version = 1;
Film::Film (string d, bool must_exist)
: _use_dci_name (true)
+ , _trust_content_header (true)
, _dcp_content_type (0)
, _format (0)
, _scaler (Scaler::from_id ("bicubic"))
@@ -144,6 +145,7 @@ Film::Film (Film const & o)
, _name (o._name)
, _use_dci_name (o._use_dci_name)
, _content (o._content)
+ , _trust_content_header (o._trust_content_header)
, _dcp_content_type (o._dcp_content_type)
, _format (o._format)
, _crop (o._crop)
@@ -404,6 +406,7 @@ Film::write_metadata () const
f << "name " << _name << "\n";
f << "use_dci_name " << _use_dci_name << "\n";
f << "content " << _content << "\n";
+ f << "trust_content_header " << (_trust_content_header ? "1" : "0") << "\n";
if (_dcp_content_type) {
f << "dcp_content_type " << _dcp_content_type->pretty_name () << "\n";
}
@@ -513,6 +516,8 @@ Film::read_metadata ()
_use_dci_name = (v == "1");
} else if (k == "content") {
_content = v;
+ } else if (k == "trust_content_header") {
+ _trust_content_header = (v == "1");
} else if (k == "dcp_content_type") {
_dcp_content_type = DCPContentType::from_pretty_name (v);
} else if (k == "format") {
@@ -976,7 +981,7 @@ Film::set_content (string c)
signal_changed (CONTENT);
set_content_digest (md5_digest (content_path ()));
-
+
examine_content ();
} catch (...) {
@@ -987,6 +992,22 @@ Film::set_content (string c)
}
}
+
+void
+Film::set_trust_content_header (bool t)
+{
+ {
+ boost::mutex::scoped_lock lm (_state_mutex);
+ _trust_content_header = t;
+ }
+
+ signal_changed (TRUST_CONTENT_HEADER);
+
+ if (!_trust_content_header) {
+ /* We just said that we don't trust the content's header */
+ examine_content ();
+ }
+}
void
Film::set_dcp_content_type (DCPContentType const * t)
diff --git a/src/lib/film.h b/src/lib/film.h
index 2e81575e4..8cd55a227 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -110,6 +110,7 @@ public:
NAME,
USE_DCI_NAME,
CONTENT,
+ TRUST_CONTENT_HEADER,
DCP_CONTENT_TYPE,
FORMAT,
CROP,
@@ -160,6 +161,11 @@ public:
return _content;
}
+ bool trust_content_header () const {
+ boost::mutex::scoped_lock lm (_state_mutex);
+ return _trust_content_header;
+ }
+
DCPContentType const * dcp_content_type () const {
boost::mutex::scoped_lock lm (_state_mutex);
return _dcp_content_type;
@@ -329,6 +335,7 @@ public:
void set_name (std::string);
void set_use_dci_name (bool);
void set_content (std::string);
+ void set_trust_content_header (bool);
void set_dcp_content_type (DCPContentType const *);
void set_format (Format const *);
void set_crop (Crop);
@@ -404,6 +411,7 @@ private:
* or an absolute path.
*/
std::string _content;
+ bool _trust_content_header;
/** The type of content that this Film represents (feature, trailer etc.) */
DCPContentType const * _dcp_content_type;
/** The format to present this Film in (flat, scope, etc.) */