From: Carl Hetherington Date: Thu, 12 Jun 2014 21:27:50 +0000 (+0100) Subject: Merge master. X-Git-Tag: v2.0.48~802 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=04533b9cf34ce8089113015715083ee9c5b2b001 Merge master. --- 04533b9cf34ce8089113015715083ee9c5b2b001 diff --cc ChangeLog index 126730e27,41713f4d2..3194262ef --- a/ChangeLog +++ b/ChangeLog @@@ -1,9 -1,12 +1,16 @@@ +2014-03-07 Carl Hetherington + + * Add subtitle view. + 2014-06-12 Carl Hetherington + * Version 1.69.27 released. + + 2014-06-12 Carl Hetherington + + * Add Content menu with "scale to fit width" and "scale + to fit height" options. + * Version 1.69.26 released. 2014-06-12 Carl Hetherington diff --cc src/lib/video_content.cc index f871f2df6,6f6b2c441..05f5c538e --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@@ -377,9 -369,42 +379,35 @@@ VideoContent::dcp_time_to_content_time { shared_ptr film = _film.lock (); assert (film); - - FrameRateChange frc (video_frame_rate(), film->video_frame_rate()); - - /* Here we are converting from time (in the DCP) to a frame number in the content. - Hence we need to use the DCP's frame rate and the double/skip correction, not - the source's rate. - */ - return t * film->video_frame_rate() / (frc.factor() * TIME_HZ); + return ContentTime (t, FrameRateChange (video_frame_rate(), film->video_frame_rate())); } + void + VideoContent::scale_and_crop_to_fit_width () + { + shared_ptr film = _film.lock (); + assert (film); + + set_scale (VideoContentScale (film->container ())); + + int const crop = max (0, int (video_size().height - double (film->frame_size().height) * video_size().width / film->frame_size().width)); + set_top_crop (crop / 2); + set_bottom_crop (crop / 2); + } + + void + VideoContent::scale_and_crop_to_fit_height () + { + shared_ptr film = _film.lock (); + assert (film); + + set_scale (VideoContentScale (film->container ())); + + int const crop = max (0, int (video_size().width - double (film->frame_size().width) * video_size().height / film->frame_size().height)); + set_left_crop (crop / 2); + set_right_crop (crop / 2); + } + VideoContentScale::VideoContentScale (Ratio const * r) : _ratio (r) , _scale (true) diff --cc src/lib/video_content.h index 8313c73ee,f23bf0abe..4206efc2c --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@@ -166,11 -166,14 +166,14 @@@ public return _colour_conversion; } - libdcp::Size video_size_after_3d_split () const; - libdcp::Size video_size_after_crop () const; + dcp::Size video_size_after_3d_split () const; + dcp::Size video_size_after_crop () const; - VideoContent::Frame time_to_content_video_frames (Time) const; + ContentTime dcp_time_to_content_time (DCPTime) const; + void scale_and_crop_to_fit_width (); + void scale_and_crop_to_fit_height (); + protected: void take_from_video_examiner (boost::shared_ptr);