diff options
Diffstat (limited to 'src/lib/video_content.cc')
| -rw-r--r-- | src/lib/video_content.cc | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index c3e28fe09..c7764953c 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -222,7 +222,7 @@ VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content>> c) throw JoinError (_("Content to be joined must have the same video frame type.")); } - if (c[i]->video->crop() != ref->crop()) { + if (c[i]->video->requested_crop() != ref->requested_crop()) { throw JoinError (_("Content to be joined must have the same crop.")); } @@ -259,7 +259,7 @@ VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content>> c) _use = ref->use (); _size = ref->size (); _frame_type = ref->frame_type (); - _crop = ref->crop (); + _crop = ref->requested_crop (); _custom_ratio = ref->custom_ratio (); _colour_conversion = ref->colour_conversion (); _fade_in = ref->fade_in (); @@ -345,10 +345,10 @@ VideoContent::identifier () const snprintf ( buffer, sizeof(buffer), "%d_%d_%d_%d_%d_%f_%d_%d%" PRId64 "_%" PRId64 "_%d", (_use ? 1 : 0), - crop().left, - crop().right, - crop().top, - crop().bottom, + actual_crop().left, + actual_crop().right, + actual_crop().top, + actual_crop().bottom, _custom_ratio.get_value_or(0), _custom_size ? _custom_size->width : 0, _custom_size ? _custom_size->height : 0, @@ -407,7 +407,7 @@ VideoContent::size_after_3d_split () const dcp::Size VideoContent::size_after_crop () const { - return crop().apply (size_after_3d_split ()); + return actual_crop().apply(size_after_3d_split()); } @@ -460,8 +460,10 @@ VideoContent::processing_description (shared_ptr<const Film> film) d += buffer; } - if ((crop().left || crop().right || crop().top || crop().bottom) && size() != dcp::Size (0, 0)) { - dcp::Size cropped = size_after_crop (); + auto const crop = actual_crop(); + + if ((crop.left || crop.right || crop.top || crop.bottom) && size() != dcp::Size(0, 0)) { + auto const cropped = size_after_crop(); d += String::compose ( _("\nCropped to %1x%2"), cropped.width, cropped.height @@ -676,3 +678,16 @@ VideoContent::set_custom_size (optional<dcp::Size> size) { maybe_set (_custom_size, size, VideoContentProperty::CUSTOM_SIZE); } + + +Crop +VideoContent::actual_crop () const +{ + return Crop( + round_to_log_2(_crop.left, _log2_chroma_width), + round_to_log_2(_crop.right, _log2_chroma_width), + round_to_log_2(_crop.top, _log2_chroma_height), + round_to_log_2(_crop.bottom, _log2_chroma_height) + ); +} + |
