diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-18 12:40:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-18 12:40:38 +0100 |
| commit | c6113e09ca546d5a739b36aa0d198581958d9ded (patch) | |
| tree | 3747f83e86ec7fcfd5475d39486e7f6547c9c568 /src/lib | |
| parent | 5ad79869f79c8fa140974e89b3c67b8eefc7d067 (diff) | |
Speculative 4K support.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 26 | ||||
| -rw-r--r-- | src/lib/film.h | 11 | ||||
| -rw-r--r-- | src/lib/types.cc | 33 | ||||
| -rw-r--r-- | src/lib/types.h | 8 |
4 files changed, 75 insertions, 3 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index e76030efd..3ee8a416f 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -88,6 +88,7 @@ Film::Film (string d) , _use_dci_name (true) , _dcp_content_type (Config::instance()->default_dcp_content_type ()) , _container (Config::instance()->default_container ()) + , _resolution (RESOLUTION_2K) , _scaler (Scaler::from_id ("bicubic")) , _with_subtitles (false) , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ()) @@ -131,6 +132,7 @@ Film::video_identifier () const stringstream s; s << container()->id() + << "_" << resolution_to_string (_resolution) << "_" << _playlist->video_identifier() << "_" << _dcp_video_frame_rate << "_" << scaler()->id() @@ -314,6 +316,7 @@ Film::write_metadata () const root->add_child("Container")->add_child_text (_container->id ()); } + root->add_child("Resolution")->add_child_text (resolution_to_string (_resolution)); root->add_child("Scaler")->add_child_text (_scaler->id ()); root->add_child("WithSubtitles")->add_child_text (_with_subtitles ? "1" : "0"); root->add_child("J2KBandwidth")->add_child_text (lexical_cast<string> (_j2k_bandwidth)); @@ -358,6 +361,7 @@ Film::read_metadata () } } + _resolution = string_to_resolution (f.string_child ("Resolution")); _scaler = Scaler::from_id (f.string_child ("Scaler")); _with_subtitles = f.bool_child ("WithSubtitles"); _j2k_bandwidth = f.number_child<int> ("J2KBandwidth"); @@ -452,7 +456,7 @@ Film::dci_name (bool if_created_now) const } } - d << "_51_2K"; + d << "_51_" << resolution_to_string (_resolution); if (!dm.studio.empty ()) { d << "_" << dm.studio; @@ -536,6 +540,16 @@ Film::set_container (Ratio const * c) } void +Film::set_resolution (Resolution r) +{ + { + boost::mutex::scoped_lock lm (_state_mutex); + _resolution = r; + } + signal_changed (RESOLUTION); +} + +void Film::set_scaler (Scaler const * s) { { @@ -821,5 +835,13 @@ Film::set_sequence_video (bool s) libdcp::Size Film::full_frame () const { - return libdcp::Size (2048, 1080); + switch (_resolution) { + case RESOLUTION_2K: + return libdcp::Size (2048, 1080); + case RESOLUTION_4K: + return libdcp::Size (4096, 2160); + } + + assert (false); + return libdcp::Size (); } diff --git a/src/lib/film.h b/src/lib/film.h index f4065757b..bd9dcc88d 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -47,7 +47,7 @@ class Player; * @brief A representation of some audio and video content, and details of * how they should be presented in a DCP. * - * The content of a Film is held in a Playlist (created and managed by the Film) + * The content of a Film is held in a Playlist (created and managed by the Film). */ class Film : public boost::enable_shared_from_this<Film>, public boost::noncopyable { @@ -129,6 +129,7 @@ public: LOOP, DCP_CONTENT_TYPE, CONTAINER, + RESOLUTION, SCALER, WITH_SUBTITLES, J2K_BANDWIDTH, @@ -165,6 +166,11 @@ public: return _container; } + Resolution resolution () const { + boost::mutex::scoped_lock lm (_state_mutex); + return _resolution; + } + Scaler const * scaler () const { boost::mutex::scoped_lock lm (_state_mutex); return _scaler; @@ -206,6 +212,7 @@ public: void remove_content (boost::shared_ptr<Content>); void set_dcp_content_type (DCPContentType const *); void set_container (Ratio const *); + void set_resolution (Resolution); void set_scaler (Scaler const *); void set_with_subtitles (bool); void set_j2k_bandwidth (int); @@ -251,6 +258,8 @@ private: DCPContentType const * _dcp_content_type; /** The container to put this Film in (flat, scope, etc.) */ Ratio const * _container; + /** DCP resolution (2K or 4K) */ + Resolution _resolution; /** Scaler algorithm to use */ Scaler const * _scaler; /** True if subtitles should be shown for this film */ diff --git a/src/lib/types.cc b/src/lib/types.cc index 035c8363d..bc4f5f8d9 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -21,6 +21,7 @@ using std::max; using std::min; +using std::string; bool operator== (Crop const & a, Crop const & b) { @@ -32,3 +33,35 @@ bool operator!= (Crop const & a, Crop const & b) return !(a == b); } +/** @param r Resolution. + * @return Untranslated string representation. + */ +string +resolution_to_string (Resolution r) +{ + switch (r) { + case RESOLUTION_2K: + return "2K"; + case RESOLUTION_4K: + return "4K"; + } + + assert (false); + return ""; +} + + +Resolution +string_to_resolution (string s) +{ + if (s == "2K") { + return RESOLUTION_2K; + } + + if (s == "4K") { + return RESOLUTION_4K; + } + + assert (false); + return RESOLUTION_2K; +} diff --git a/src/lib/types.h b/src/lib/types.h index fcf45ffa0..aeaa82ec6 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -53,4 +53,12 @@ struct Crop extern bool operator== (Crop const & a, Crop const & b); extern bool operator!= (Crop const & a, Crop const & b); +enum Resolution { + RESOLUTION_2K, + RESOLUTION_4K +}; + +std::string resolution_to_string (Resolution); +Resolution string_to_resolution (std::string); + #endif |
