summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc9
-rw-r--r--src/lib/config.h9
-rw-r--r--src/lib/video_content.cc12
3 files changed, 26 insertions, 4 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index a19a60f55..1baba956e 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -88,6 +88,7 @@ Config::set_defaults ()
_language = optional<string> ();
_default_still_length = 10;
_default_container = Ratio::from_id ("185");
+ _default_scale_to = 0;
_default_dcp_content_type = DCPContentType::from_isdcf_name ("FTR");
_default_dcp_audio_channels = 6;
_default_j2k_bandwidth = 100000000;
@@ -221,6 +222,11 @@ try
_default_container = Ratio::from_id (c.get ());
}
+ c = f.optional_string_child ("DefaultScaleTo");
+ if (c) {
+ _default_scale_to = Ratio::from_id (c.get ());
+ }
+
c = f.optional_string_child ("DefaultDCPContentType");
if (c) {
_default_dcp_content_type = DCPContentType::from_isdcf_name (c.get ());
@@ -439,6 +445,9 @@ Config::write_config () const
if (_default_container) {
root->add_child("DefaultContainer")->add_child_text (_default_container->id ());
}
+ if (_default_scale_to) {
+ root->add_child("DefaultScaleTo")->add_child_text (_default_scale_to->id ());
+ }
if (_default_dcp_content_type) {
root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->isdcf_name ());
}
diff --git a/src/lib/config.h b/src/lib/config.h
index fc6315242..4406f1649 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -163,6 +163,10 @@ public:
return _default_container;
}
+ Ratio const * default_scale_to () const {
+ return _default_scale_to;
+ }
+
DCPContentType const * default_dcp_content_type () const {
return _default_dcp_content_type;
}
@@ -431,6 +435,10 @@ public:
maybe_set (_default_container, c);
}
+ void set_default_scale_to (Ratio const * c) {
+ maybe_set (_default_scale_to, c);
+ }
+
void set_default_dcp_content_type (DCPContentType const * t) {
maybe_set (_default_dcp_content_type, t);
}
@@ -697,6 +705,7 @@ private:
/** Default length of still image content (seconds) */
int _default_still_length;
Ratio const * _default_container;
+ Ratio const * _default_scale_to;
DCPContentType const * _default_dcp_content_type;
int _default_dcp_audio_channels;
std::string _dcp_issuer;
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 36438fc2a..8ccb921d0 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -241,10 +241,14 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d)
_sample_aspect_ratio = ar;
_yuv = yuv;
- /* Guess correct scale from size and sample aspect ratio */
- _scale = VideoContentScale (
- Ratio::nearest_from_ratio (double (_size.width) * ar.get_value_or (1) / _size.height)
- );
+ if (Config::instance()->default_scale_to ()) {
+ _scale = VideoContentScale (Config::instance()->default_scale_to ());
+ } else {
+ /* Guess correct scale from size and sample aspect ratio */
+ _scale = VideoContentScale (
+ Ratio::nearest_from_ratio (double (_size.width) * ar.get_value_or (1) / _size.height)
+ );
+ }
}
LOG_GENERAL ("Video length obtained from header as %1 frames", _length);