diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-06-28 16:17:39 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-06-29 11:26:56 +0100 |
| commit | 29377b18a8cef724c8e2de2316a66ceae89a2e9a (patch) | |
| tree | 10bf8a39b26282274382e1d74aefa1603f10711e /src/lib | |
| parent | cb845fc94ce2015138ddecb6c5a94e722361642a (diff) | |
Offer only flat/scope/full-frame as container choices and differentiate
the names from the UI for content ratios.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ratio.cc | 38 | ||||
| -rw-r--r-- | src/lib/ratio.h | 20 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/video_content_scale.cc | 2 | ||||
| -rw-r--r-- | src/lib/writer.cc | 2 |
5 files changed, 45 insertions, 19 deletions
diff --git a/src/lib/ratio.cc b/src/lib/ratio.cc index 82602d2f2..60384892d 100644 --- a/src/lib/ratio.cc +++ b/src/lib/ratio.cc @@ -27,22 +27,23 @@ using std::string; using std::vector; +using boost::optional; vector<Ratio const *> Ratio::_ratios; void Ratio::setup_ratios () { - _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "119")); - _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "133")); - _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("Academy"), "137")); - _ratios.push_back (new Ratio (float(1544) / 1080, "143", _("IMAX"), "143")); - _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "166")); - _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "178")); - _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("Flat"), "F")); - _ratios.push_back (new Ratio (float(2048) / 872, "235", _("2.35"), "S")); - _ratios.push_back (new Ratio (float(2048) / 858, "239", _("Scope"), "S")); - _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("Full frame"), "C")); + _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), optional<string>(), "119")); + _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("1.33 (4:3)"), optional<string>(), "133")); + _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.38 (Academy)"), optional<string>(), "137")); + _ratios.push_back (new Ratio (float(1544) / 1080, "143", _("1.43 (IMAX)"), optional<string>(), "143")); + _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), optional<string>(), "166")); + _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("1.78 (16:9 or HD)"), optional<string>(), "178")); + _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("1.85 (Flat)"), string(_("DCI Flat")), "F")); + _ratios.push_back (new Ratio (float(2048) / 872, "235", _("2.35"), optional<string>(), "S")); + _ratios.push_back (new Ratio (float(2048) / 858, "239", _("2.39 (Scope)"), string(_("DCI Scope")), "S")); + _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("1.90 (Full frame)"), string(_("Full frame")), "C")); } Ratio const * @@ -97,3 +98,20 @@ Ratio::nearest_from_ratio (float r) return nearest; } + +vector<Ratio const *> +Ratio::containers () +{ + vector<Ratio const *> r; + r.push_back (Ratio::from_id ("185")); + r.push_back (Ratio::from_id ("239")); + r.push_back (Ratio::from_id ("full-frame")); + return r; +} + +string +Ratio::container_nickname () const +{ + DCPOMATIC_ASSERT (_container_nickname); + return *_container_nickname; +} diff --git a/src/lib/ratio.h b/src/lib/ratio.h index 9e9d58a40..42f29458a 100644 --- a/src/lib/ratio.h +++ b/src/lib/ratio.h @@ -28,10 +28,11 @@ class Ratio : public boost::noncopyable { public: - Ratio (float ratio, std::string id, std::string n, std::string d) + Ratio (float ratio, std::string id, std::string in, boost::optional<std::string> cn, std::string d) : _ratio (ratio) , _id (id) - , _nickname (n) + , _image_nickname (in) + , _container_nickname (cn) , _isdcf_name (d) {} @@ -39,10 +40,12 @@ public: return _id; } - std::string nickname () const { - return _nickname; + std::string image_nickname () const { + return _image_nickname; } + std::string container_nickname () const; + std::string isdcf_name () const { return _isdcf_name; } @@ -55,16 +58,21 @@ public: static Ratio const * from_id (std::string i); static Ratio const * from_ratio (float r); static Ratio const * nearest_from_ratio (float r); + static std::vector<Ratio const *> all () { return _ratios; } + static std::vector<Ratio const *> containers (); + private: float _ratio; /** id for use in metadata */ std::string _id; - /** nickname (e.g. Flat, Scope) */ - std::string _nickname; + /** nickname when used to describe an image ratio (e.g. Flat, Scope) */ + std::string _image_nickname; + /** nickname when used to describe a container ratio */ + boost::optional<std::string> _container_nickname; std::string _isdcf_name; static std::vector<Ratio const *> _ratios; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 8ccb921d0..30a463089 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -434,7 +434,7 @@ VideoContent::processing_description () const if (scaled != container_size) { d += String::compose ( _("\nPadded with black to fit container %1 (%2x%3)"), - film->container()->nickname (), + film->container()->container_nickname (), container_size.width, container_size.height ); diff --git a/src/lib/video_content_scale.cc b/src/lib/video_content_scale.cc index c86ba6ef8..636f0e807 100644 --- a/src/lib/video_content_scale.cc +++ b/src/lib/video_content_scale.cc @@ -95,7 +95,7 @@ string VideoContentScale::name () const { if (_ratio) { - return _ratio->nickname (); + return _ratio->image_nickname (); } if (_scale) { diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 5e8f8fc9f..b5123ad74 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -554,7 +554,7 @@ Writer::write_cover_sheet () string text = Config::instance()->cover_sheet (); boost::algorithm::replace_all (text, "$CPL_NAME", _film->name()); boost::algorithm::replace_all (text, "$TYPE", _film->dcp_content_type()->pretty_name()); - boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->nickname()); + boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->container_nickname()); boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", _film->isdcf_metadata().audio_language); boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", _film->isdcf_metadata().subtitle_language); |
