Merge master.
authorCarl Hetherington <cth@carlh.net>
Thu, 12 Jun 2014 21:27:50 +0000 (22:27 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 12 Jun 2014 21:27:50 +0000 (22:27 +0100)
1  2 
ChangeLog
src/lib/video_content.cc
src/lib/video_content.h
src/tools/dcpomatic.cc

diff --cc ChangeLog
index 126730e27f8e232e481b470e7fda00549606f49e,41713f4d27a2097bfbf6c72472b51eac33c8fa7b..3194262ef06886fa797af33075cf0ad15cf0948f
+++ b/ChangeLog
@@@ -1,9 -1,12 +1,16 @@@
 +2014-03-07  Carl Hetherington  <cth@carlh.net>
 +
 +      * Add subtitle view.
 +
  2014-06-12  Carl Hetherington  <cth@carlh.net>
  
+       * Version 1.69.27 released.
+ 2014-06-12  Carl Hetherington  <cth@carlh.net>
+       * Add Content menu with "scale to fit width" and "scale
+       to fit height" options.
        * Version 1.69.26 released.
  
  2014-06-12  Carl Hetherington  <cth@carlh.net>
index f871f2df666438a1846d465642f8cb991e729723,6f6b2c4415cdfe9ae6440b21853b82bc9baffed6..05f5c538eee2a81c6344f603ab2bfa3e60dfd2cb
@@@ -377,9 -369,42 +379,35 @@@ VideoContent::dcp_time_to_content_time 
  {
        shared_ptr<const Film> 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<const Film> 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<const Film> 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)
index 8313c73eeb8a32b8d65a79e2caa6d22466966042,f23bf0abe87980746b892def1244ff7241f38c0d..4206efc2c487d047a744d6634271f810d6d447e2
@@@ -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<VideoExaminer>);
  
Simple merge