diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 8 | ||||
| -rw-r--r-- | src/lib/config.h | 7 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 17 | ||||
| -rw-r--r-- | src/lib/video_content.h | 1 |
4 files changed, 24 insertions, 9 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 67abc63c2..878fedaa4 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -64,7 +64,7 @@ Config::Config () , _sound_processor (SoundProcessor::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) @@ -137,7 +137,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"); @@ -353,9 +353,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 4f6b57f56..0639382a0 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -31,6 +31,7 @@ #include "isdcf_metadata.h" #include "colour_conversion.h" #include "server.h" +#include "video_content.h" class ServerDescription; class Scaler; @@ -132,7 +133,7 @@ public: return _default_still_length; } - Ratio const * default_scale () const { + VideoContentScale default_scale () const { return _default_scale; } @@ -293,7 +294,7 @@ public: changed (); } - void set_default_scale (Ratio const * s) { + void set_default_scale (VideoContentScale s) { _default_scale = s; changed (); } @@ -441,7 +442,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 b0d4c2de5..5a80dba74 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -476,7 +476,7 @@ VideoContentScale::id () const SafeStringStream s; if (_ratio) { - s << _ratio->id () << "_"; + s << _ratio->id (); } else { s << (_scale ? "S1" : "S0"); } @@ -498,6 +498,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 62459222d..940467680 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 */ |
