Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
[dcpomatic.git] / src / lib / player_video.cc
index 8075b7b7d437dee5f6cf94c27fb6f2ab78d1a249..6f0977e628091fa3885acfa3324b4910139d12ac 100644 (file)
@@ -41,7 +41,6 @@ using dcp::raw_convert;
 
 PlayerVideo::PlayerVideo (
        shared_ptr<const ImageProxy> in,
-       DCPTime time,
        Crop crop,
        boost::optional<double> fade,
        dcp::Size inter_size,
@@ -51,7 +50,6 @@ PlayerVideo::PlayerVideo (
        optional<ColourConversion> colour_conversion
        )
        : _in (in)
-       , _time (time)
        , _crop (crop)
        , _fade (fade)
        , _inter_size (inter_size)
@@ -65,7 +63,6 @@ PlayerVideo::PlayerVideo (
 
 PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket)
 {
-       _time = DCPTime (node->number_child<DCPTime::Type> ("Time"));
        _crop = Crop (node);
        _fade = node->optional_number_child<double> ("Fade");
 
@@ -102,11 +99,13 @@ PlayerVideo::set_subtitle (PositionImage image)
  *  @param pixel_format Function which is called to decide what pixel format the output image should be;
  *  it is passed the pixel format of the input image from the ImageProxy, and should return the desired
  *  output pixel format.  Two functions always_rgb and keep_xyz_or_rgb are provided for use here.
+ *  @param aligned true if the output image should be aligned to 32-byte boundaries.
+ *  @param fast true to be fast at the expense of quality.
  */
 shared_ptr<Image>
 PlayerVideo::image (dcp::NoteHandler note, function<AVPixelFormat (AVPixelFormat)> pixel_format, bool aligned, bool fast) const
 {
-       shared_ptr<Image> im = _in->image (optional<dcp::NoteHandler> (note));
+       shared_ptr<Image> im = _in->image (optional<dcp::NoteHandler> (note), _inter_size);
 
        Crop total_crop = _crop;
        switch (_part) {
@@ -136,7 +135,7 @@ PlayerVideo::image (dcp::NoteHandler note, function<AVPixelFormat (AVPixelFormat
                );
 
        if (_subtitle) {
-               out->alpha_blend (_subtitle->image, _subtitle->position);
+               out->alpha_blend (Image::ensure_aligned (_subtitle->image), _subtitle->position);
        }
 
        if (_fade) {
@@ -149,7 +148,6 @@ PlayerVideo::image (dcp::NoteHandler note, function<AVPixelFormat (AVPixelFormat
 void
 PlayerVideo::add_metadata (xmlpp::Node* node) const
 {
-       node->add_child("Time")->add_child_text (raw_convert<string> (_time.get ()));
        _crop.as_xml (node);
        if (_fade) {
                node->add_child("Fade")->add_child_text (raw_convert<string> (_fade.get ()));
@@ -208,9 +206,7 @@ PlayerVideo::inter_position () const
        return Position<int> ((_out_size.width - _inter_size.width) / 2, (_out_size.height - _inter_size.height) / 2);
 }
 
-/** @return true if this PlayerVideo is definitely the same as another
- * (apart from _time), false if it is probably not
- */
+/** @return true if this PlayerVideo is definitely the same as another, false if it is probably not */
 bool
 PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
 {