summaryrefslogtreecommitdiff
path: root/src/lib/player_video.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-10-29 16:57:33 +0000
committerCarl Hetherington <cth@carlh.net>2015-10-29 18:44:04 +0000
commitaa7edc3114fa3b7868088a9f8f22b5ee195a8668 (patch)
tree5e5fef8156320f47aaa7626e557f85e8eb236ff5 /src/lib/player_video.cc
parente1c23a19b93d7bb66bd439af511d6666e56a7d29 (diff)
Fix incorrect colourspace conversion of XYZ content
when it is not being passed through as untouched JPEG2000 (#730).
Diffstat (limited to 'src/lib/player_video.cc')
-rw-r--r--src/lib/player_video.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc
index c654abdde..9cdc6c564 100644
--- a/src/lib/player_video.cc
+++ b/src/lib/player_video.cc
@@ -23,6 +23,9 @@
#include "j2k_image_proxy.h"
#include "film.h"
#include "raw_convert.h"
+extern "C" {
+#include <libavutil/pixfmt.h>
+}
#include <libxml++/libxml++.h>
#include <iostream>
@@ -91,7 +94,7 @@ PlayerVideo::set_subtitle (PositionImage image)
}
shared_ptr<Image>
-PlayerVideo::image (AVPixelFormat pixel_format, dcp::NoteHandler note) const
+PlayerVideo::image (dcp::NoteHandler note) const
{
shared_ptr<Image> im = _in->image (optional<dcp::NoteHandler> (note));
@@ -118,7 +121,10 @@ PlayerVideo::image (AVPixelFormat pixel_format, dcp::NoteHandler note) const
yuv_to_rgb = _colour_conversion.get().yuv_to_rgb();
}
- shared_ptr<Image> out = im->crop_scale_window (total_crop, _inter_size, _out_size, yuv_to_rgb, pixel_format, true);
+ /* If the input is XYZ, keep it otherwise convert to RGB */
+ AVPixelFormat const p = _in->pixel_format() == AV_PIX_FMT_XYZ12LE ? AV_PIX_FMT_XYZ12LE : AV_PIX_FMT_RGB48LE;
+
+ shared_ptr<Image> out = im->crop_scale_window (total_crop, _inter_size, _out_size, yuv_to_rgb, p, true);
if (_subtitle) {
out->alpha_blend (_subtitle->image, _subtitle->position);