diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-05-24 23:29:39 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-05-24 23:29:39 +0100 |
| commit | 92784c9c28c48859578cd6e75aa01d5657d0c341 (patch) | |
| tree | 595a34ecd2c59bf9d3dbcfa0c6f0a91b17ecfa5b /src/lib/video_content.cc | |
| parent | 6c78f6d31a457ad34fb14b7c926fb418b4d6790d (diff) | |
Basic ability to set video range (JPEG/MPEG) at least for YUV content. May not work for RGB. See #1509.
Diffstat (limited to 'src/lib/video_content.cc')
| -rw-r--r-- | src/lib/video_content.cc | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index d8d8adbf8..4eda7d967 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -46,6 +46,7 @@ int const VideoContentProperty::SCALE = 3; int const VideoContentProperty::COLOUR_CONVERSION = 4; int const VideoContentProperty::FADE_IN = 5; int const VideoContentProperty::FADE_OUT = 6; +int const VideoContentProperty::RANGE = 7; using std::string; using std::setprecision; @@ -71,6 +72,7 @@ VideoContent::VideoContent (Content* parent) , _yuv (true) , _fade_in (0) , _fade_out (0) + , _range (VIDEO_RANGE_FULL) { } @@ -152,6 +154,11 @@ VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int versio } else { _fade_in = _fade_out = 0; } + + _range = VIDEO_RANGE_FULL; + if (node->optional_string_child("Range").get_value_or("full") == "video") { + _range = VIDEO_RANGE_VIDEO; + } } VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content> > c) @@ -202,6 +209,7 @@ VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content> > c) _colour_conversion = ref->colour_conversion (); _fade_in = ref->fade_in (); _fade_out = ref->fade_out (); + _range = ref->range (); } void @@ -223,6 +231,7 @@ VideoContent::as_xml (xmlpp::Node* node) const node->add_child("YUV")->add_child_text (_yuv ? "1" : "0"); node->add_child("FadeIn")->add_child_text (raw_convert<string> (_fade_in)); node->add_child("FadeOut")->add_child_text (raw_convert<string> (_fade_out)); + node->add_child("Range")->add_child_text(_range == VIDEO_RANGE_FULL ? "full" : "video"); } void @@ -233,10 +242,12 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d) Frame vl = d->video_length (); optional<double> const ar = d->sample_aspect_ratio (); bool const yuv = d->yuv (); + VideoRange const range = d->range (); ChangeSignaller<Content> cc1 (_parent, VideoContentProperty::SIZE); ChangeSignaller<Content> cc2 (_parent, VideoContentProperty::SCALE); ChangeSignaller<Content> cc3 (_parent, ContentProperty::LENGTH); + ChangeSignaller<Content> cc4 (_parent, VideoContentProperty::RANGE); { boost::mutex::scoped_lock lm (_mutex); @@ -244,6 +255,7 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d) _length = vl; _sample_aspect_ratio = ar; _yuv = yuv; + _range = range; if (Config::instance()->default_scale_to ()) { _scale = VideoContentScale (Config::instance()->default_scale_to ()); @@ -268,14 +280,15 @@ VideoContent::identifier () const { char buffer[256]; snprintf ( - buffer, sizeof(buffer), "%d_%d_%d_%d_%s_%" PRId64 "_%" PRId64, + buffer, sizeof(buffer), "%d_%d_%d_%d_%s_%" PRId64 "_%" PRId64 "_%d", crop().left, crop().right, crop().top, crop().bottom, scale().id().c_str(), _fade_in, - _fade_out + _fade_out, + _range == VIDEO_RANGE_FULL ? 0 : 1 ); string s (buffer); @@ -526,6 +539,12 @@ VideoContent::set_fade_out (Frame t) } void +VideoContent::set_range (VideoRange r) +{ + maybe_set (_range, r, VideoContentProperty::RANGE); +} + +void VideoContent::take_settings_from (shared_ptr<const VideoContent> c) { if (c->_colour_conversion) { |
