diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-04-13 17:09:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-05-18 11:50:29 +0100 |
| commit | 7749e3cc9ac7b51c2a77ee4f2c3c99e381747716 (patch) | |
| tree | 418045669301470f11371032615bb7bcfbf8ef86 /src/lib/video_content.cc | |
| parent | 775ae0e37bbec115d742feade0adc614a9a2301c (diff) | |
Add maybe_set to ContentPart.
Diffstat (limited to 'src/lib/video_content.cc')
| -rw-r--r-- | src/lib/video_content.cc | 217 |
1 files changed, 66 insertions, 151 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 4059c29d1..561ebb62c 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -236,82 +236,6 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d) _parent->signal_changed (ContentProperty::LENGTH); } -void -VideoContent::set_left_crop (int c) -{ - { - boost::mutex::scoped_lock lm (_mutex); - - if (_crop.left == c) { - return; - } - - _crop.left = c; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_CROP); -} - -void -VideoContent::set_right_crop (int c) -{ - { - boost::mutex::scoped_lock lm (_mutex); - if (_crop.right == c) { - return; - } - - _crop.right = c; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_CROP); -} - -void -VideoContent::set_top_crop (int c) -{ - { - boost::mutex::scoped_lock lm (_mutex); - if (_crop.top == c) { - return; - } - - _crop.top = c; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_CROP); -} - -void -VideoContent::set_bottom_crop (int c) -{ - { - boost::mutex::scoped_lock lm (_mutex); - if (_crop.bottom == c) { - return; - } - - _crop.bottom = c; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_CROP); -} - -void -VideoContent::set_scale (VideoContentScale s) -{ - { - boost::mutex::scoped_lock lm (_mutex); - if (_scale == s) { - return; - } - - _scale = s; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_SCALE); -} - /** @return string which includes everything about how this content looks */ string VideoContent::identifier () const @@ -332,17 +256,6 @@ VideoContent::identifier () const return s.str (); } -void -VideoContent::set_video_frame_type (VideoFrameType t) -{ - { - boost::mutex::scoped_lock lm (_mutex); - _video_frame_type = t; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_TYPE); -} - string VideoContent::technical_summary () const { @@ -380,50 +293,6 @@ VideoContent::video_size_after_3d_split () const DCPOMATIC_ASSERT (false); } -void -VideoContent::unset_colour_conversion () -{ - { - boost::mutex::scoped_lock lm (_mutex); - _colour_conversion = boost::optional<ColourConversion> (); - } - - _parent->signal_changed (VideoContentProperty::COLOUR_CONVERSION); -} - -void -VideoContent::set_colour_conversion (ColourConversion c) -{ - { - boost::mutex::scoped_lock lm (_mutex); - _colour_conversion = c; - } - - _parent->signal_changed (VideoContentProperty::COLOUR_CONVERSION); -} - -void -VideoContent::set_fade_in (Frame t) -{ - { - boost::mutex::scoped_lock lm (_mutex); - _fade_in = t; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_FADE_IN); -} - -void -VideoContent::set_fade_out (Frame t) -{ - { - boost::mutex::scoped_lock lm (_mutex); - _fade_out = t; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_FADE_OUT); -} - /** @return Video size after 3D split and crop */ dcp::Size VideoContent::video_size_after_crop () const @@ -459,21 +328,6 @@ VideoContent::scale_and_crop_to_fit_height () set_bottom_crop (0); } -void -VideoContent::set_video_frame_rate (double r) -{ - { - boost::mutex::scoped_lock lm (_mutex); - if (_video_frame_rate == r) { - return; - } - - _video_frame_rate = r; - } - - _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_RATE); -} - /** @param f Frame index within the whole (untrimmed) content */ optional<double> VideoContent::fade (Frame f) const @@ -580,10 +434,71 @@ VideoContent::video_frame_rate () const void VideoContent::set_video_length (Frame len) { - { - boost::mutex::scoped_lock lm (_mutex); - _video_length = len; - } + maybe_set (_video_length, len, ContentProperty::LENGTH); +} - _parent->signal_changed (ContentProperty::LENGTH); +void +VideoContent::set_left_crop (int c) +{ + maybe_set (_crop.left, c, VideoContentProperty::VIDEO_CROP); +} + +void +VideoContent::set_right_crop (int c) +{ + maybe_set (_crop.right, c, VideoContentProperty::VIDEO_CROP); +} + +void +VideoContent::set_top_crop (int c) +{ + maybe_set (_crop.top, c, VideoContentProperty::VIDEO_CROP); +} + +void +VideoContent::set_bottom_crop (int c) +{ + maybe_set (_crop.bottom, c, VideoContentProperty::VIDEO_CROP); +} + +void +VideoContent::set_scale (VideoContentScale s) +{ + maybe_set (_scale, s, VideoContentProperty::VIDEO_SCALE); +} + +void +VideoContent::set_video_frame_rate (double r) +{ + maybe_set (_video_frame_rate, r, VideoContentProperty::VIDEO_FRAME_RATE); +} + +void +VideoContent::set_video_frame_type (VideoFrameType t) +{ + maybe_set (_video_frame_type, t, VideoContentProperty::VIDEO_FRAME_TYPE); +} + +void +VideoContent::unset_colour_conversion () +{ + maybe_set (_colour_conversion, boost::optional<ColourConversion> (), VideoContentProperty::COLOUR_CONVERSION); +} + +void +VideoContent::set_colour_conversion (ColourConversion c) +{ + maybe_set (_colour_conversion, c, VideoContentProperty::COLOUR_CONVERSION); +} + +void +VideoContent::set_fade_in (Frame t) +{ + maybe_set (_fade_in, t, VideoContentProperty::VIDEO_FADE_IN); +} + +void +VideoContent::set_fade_out (Frame t) +{ + maybe_set (_fade_out, t, VideoContentProperty::VIDEO_FADE_OUT); } |
