diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-10-24 22:34:45 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-10-24 22:34:45 +0100 |
| commit | 819590f9f8217235ebf4467b1d24e1aec1f97c29 (patch) | |
| tree | f493c7f715e646a332431a510eff58e09b0a9d59 /src/lib/video_content.cc | |
| parent | 360f49fad409d1e37318ffcf3069c4111c19c7b8 (diff) | |
Add basics of colourspace conversion bypass (#266).
Diffstat (limited to 'src/lib/video_content.cc')
| -rw-r--r-- | src/lib/video_content.cc | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 13f2cf516..3094a70c8 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -61,7 +61,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f) , _video_frame_type (VIDEO_FRAME_TYPE_2D) , _scale (Config::instance()->default_scale ()) { - setup_default_colour_conversion (); + set_default_colour_conversion (); } VideoContent::VideoContent (shared_ptr<const Film> f, Time s, VideoContent::Frame len) @@ -72,7 +72,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, Time s, VideoContent::Fram , _video_frame_type (VIDEO_FRAME_TYPE_2D) , _scale (Config::instance()->default_scale ()) { - setup_default_colour_conversion (); + set_default_colour_conversion (); } VideoContent::VideoContent (shared_ptr<const Film> f, boost::filesystem::path p) @@ -83,7 +83,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, boost::filesystem::path p) , _video_frame_type (VIDEO_FRAME_TYPE_2D) , _scale (Config::instance()->default_scale ()) { - setup_default_colour_conversion (); + set_default_colour_conversion (); } VideoContent::VideoContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version) @@ -108,8 +108,10 @@ VideoContent::VideoContent (shared_ptr<const Film> f, shared_ptr<const cxml::Nod } else { _scale = VideoContentScale (node->node_child ("Scale")); } - - _colour_conversion = ColourConversion (node->node_child ("ColourConversion")); + + if (node->optional_node_child ("ColourConversion")) { + _colour_conversion = ColourConversion (node->node_child ("ColourConversion")); + } } VideoContent::VideoContent (shared_ptr<const Film> f, vector<shared_ptr<Content> > c) @@ -170,13 +172,15 @@ VideoContent::as_xml (xmlpp::Node* node) const node->add_child("VideoFrameType")->add_child_text (raw_convert<string> (static_cast<int> (_video_frame_type))); _crop.as_xml (node); _scale.as_xml (node->add_child("Scale")); - _colour_conversion.as_xml (node->add_child("ColourConversion")); + if (_colour_conversion) { + _colour_conversion.get().as_xml (node->add_child("ColourConversion")); + } } void -VideoContent::setup_default_colour_conversion () +VideoContent::set_default_colour_conversion () { - _colour_conversion = PresetColourConversion (_("sRGB"), 2.4, true, libdcp::colour_matrix::srgb_to_xyz, 2.6).conversion; + set_colour_conversion (PresetColourConversion (_("sRGB"), 2.4, true, libdcp::colour_matrix::srgb_to_xyz, 2.6).conversion); } void @@ -303,8 +307,11 @@ VideoContent::identifier () const << "_" << crop().right << "_" << crop().top << "_" << crop().bottom - << "_" << scale().id() - << "_" << colour_conversion().identifier (); + << "_" << scale().id(); + + if (colour_conversion()) { + s << "_" << colour_conversion().get().identifier (); + } return s.str (); } @@ -349,6 +356,17 @@ VideoContent::video_size_after_3d_split () const } void +VideoContent::unset_colour_conversion () +{ + { + boost::mutex::scoped_lock lm (_mutex); + _colour_conversion = boost::optional<ColourConversion> (); + } + + signal_changed (VideoContentProperty::COLOUR_CONVERSION); +} + +void VideoContent::set_colour_conversion (ColourConversion c) { { |
