summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc8
-rw-r--r--src/lib/config.h7
-rw-r--r--src/lib/video_content.cc17
-rw-r--r--src/lib/video_content.h1
4 files changed, 24 insertions, 9 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 1f5a25ae4..114fc5c27 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -67,7 +67,7 @@ Config::Config ()
, _cinema_sound_processor (CinemaSoundProcessor::from_id (N_("dolby_cp750")))
, _allow_any_dcp_frame_rate (false)
, _default_still_length (10)
- , _default_scale (Ratio::from_id ("185"))
+ , _default_scale (VideoContentScale (Ratio::from_id ("185")))
, _default_container (Ratio::from_id ("185"))
, _default_dcp_content_type (DCPContentType::from_isdcf_name ("TST"))
, _default_j2k_bandwidth (100000000)
@@ -147,7 +147,7 @@ Config::read ()
c = f.optional_string_child ("DefaultScale");
if (c) {
- _default_scale = Ratio::from_id (c.get ());
+ _default_scale = VideoContentScale::from_id (c.get ());
}
c = f.optional_string_child ("DefaultContainer");
@@ -329,9 +329,7 @@ Config::write () const
if (_language) {
root->add_child("Language")->add_child_text (_language.get());
}
- if (_default_scale) {
- root->add_child("DefaultScale")->add_child_text (_default_scale->id ());
- }
+ root->add_child("DefaultScale")->add_child_text (_default_scale.id ());
if (_default_container) {
root->add_child("DefaultContainer")->add_child_text (_default_container->id ());
}
diff --git a/src/lib/config.h b/src/lib/config.h
index 9a1808682..99b3eb621 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -33,6 +33,7 @@
#include <dcp/signer.h>
#include "isdcf_metadata.h"
#include "colour_conversion.h"
+#include "video_content.h"
class ServerDescription;
class Scaler;
@@ -134,7 +135,7 @@ public:
return _default_still_length;
}
- Ratio const * default_scale () const {
+ VideoContentScale default_scale () const {
return _default_scale;
}
@@ -307,7 +308,7 @@ public:
changed ();
}
- void set_default_scale (Ratio const * s) {
+ void set_default_scale (VideoContentScale s) {
_default_scale = s;
changed ();
}
@@ -468,7 +469,7 @@ private:
ISDCFMetadata _default_isdcf_metadata;
boost::optional<std::string> _language;
int _default_still_length;
- Ratio const * _default_scale;
+ VideoContentScale _default_scale;
Ratio const * _default_container;
DCPContentType const * _default_dcp_content_type;
std::string _dcp_issuer;
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 796e6575a..9822d7763 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -482,7 +482,7 @@ VideoContentScale::id () const
SafeStringStream s;
if (_ratio) {
- s << _ratio->id () << "_";
+ s << _ratio->id ();
} else {
s << (_scale ? "S1" : "S0");
}
@@ -504,6 +504,21 @@ VideoContentScale::name () const
return _("No scale");
}
+VideoContentScale
+VideoContentScale::from_id (string id)
+{
+ Ratio const * r = Ratio::from_id (id);
+ if (r) {
+ return VideoContentScale (r);
+ }
+
+ if (id == "S0") {
+ return VideoContentScale (false);
+ }
+
+ return VideoContentScale (true);
+}
+
/** @param display_container Size of the container that we are displaying this content in.
* @param film_container The size of the film's image.
*/
diff --git a/src/lib/video_content.h b/src/lib/video_content.h
index 27b36e9bc..d32769b5a 100644
--- a/src/lib/video_content.h
+++ b/src/lib/video_content.h
@@ -62,6 +62,7 @@ public:
static std::vector<VideoContentScale> all () {
return _scales;
}
+ static VideoContentScale from_id (std::string id);
private:
/** a ratio to stretch the content to, or 0 for no stretch */