More OS X debug.
[dcpomatic.git] / src / lib / player.cc
index bae00d348684bfb7d92012e0d0d726f266f212d2..70d6fa8773a445977da35edd2d2b286a042221dd 100644 (file)
@@ -250,12 +250,15 @@ Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image
        if (content->trimmed (relative_time)) {
                return;
        }
-       
-       shared_ptr<Image> work_image = image->crop (content->crop(), true);
+
+       /* Convert to RGB first, as FFmpeg doesn't seem to like handling YUV images with odd widths */
+       shared_ptr<Image> work_image = image->scale (image->size (), _film->scaler(), PIX_FMT_RGB24, true);
+
+       work_image = work_image->crop (content->crop(), true);
 
        libdcp::Size const image_size = content->ratio()->size (_video_container_size);
        
-       work_image = work_image->scale_and_convert_to_rgb (image_size, _film->scaler(), true);
+       work_image = work_image->scale (image_size, _film->scaler(), PIX_FMT_RGB24, true);
 
        Time time = content->position() + relative_time - content->trim_start ();
            
@@ -640,7 +643,12 @@ Player::update_subtitle ()
        _out_subtitle.position.x = rint (_video_container_size.width * (in_rect.x + (in_rect.width * (1 - sc->subtitle_scale ()) / 2)));
        _out_subtitle.position.y = rint (_video_container_size.height * (in_rect.y + (in_rect.height * (1 - sc->subtitle_scale ()) / 2)));
        
-       _out_subtitle.image = _in_subtitle.image->scale (libdcp::Size (scaled_size.width, scaled_size.height), Scaler::from_id ("bicubic"), true);
+       _out_subtitle.image = _in_subtitle.image->scale (
+               scaled_size,
+               Scaler::from_id ("bicubic"),
+               _in_subtitle.image->pixel_format (),
+               true
+               );
        _out_subtitle.from = _in_subtitle.from + piece->content->position ();
        _out_subtitle.to = _in_subtitle.to + piece->content->position ();
 }