Fix handling of incorrectly-recognised JPEG2000 files.
authorCarl Hetherington <cth@carlh.net>
Wed, 29 Jun 2016 15:01:14 +0000 (16:01 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 29 Jun 2016 15:01:14 +0000 (16:01 +0100)
commit92c691f29c5da9abca6a06605998e09f9b8103bb
tree1ecd83269fcce0f7bf83279ea4920cdeb5b1a939
parent420b50e7e5130194d8e8f4a51514c005e2df3dd0
Fix handling of incorrectly-recognised JPEG2000 files.

Previously we asked libdcp whether an imported J2K file was
RGB or XYZ.  The answer it gives is sometimes wrong, for reasons
that are not clear (either the files are not marked correctly,
or openjpeg is not parsing whatever metadata correctly).

However it seems that, in general, we use the user's specified
colour conversion to decide what to do with an image, rather than
asking the image what should be done to it.

Hence it makes more sense to assume that if a user specifies no
colour conversion for a J2K file then the file is XYZ.

With preview, the colour conversion from XYZ back to RGB is done
by FFmpeg, so we have to set the pixel format correctly on the
Image that comes back from J2KImageProxy.  Now we get that pixel
format from the configured colourspace conversion rather than
from openjpeg's guess as to the file's colourspace.

It's a bit ugly that the only thing we ask the file about is whether
or not it is in YUV (which governs whether or not FFmpeg applies
the user's configured YUV-to-RGB conversion).  Everything else is
decided by the configured conversion.

I think there's still some uglyness in here that I can't put my
finger on.
ChangeLog
src/lib/dcp_decoder.cc
src/lib/image_decoder.cc
src/lib/j2k_image_proxy.cc
src/lib/j2k_image_proxy.h
src/lib/player.cc
src/lib/video_mxf_decoder.cc
src/wx/film_viewer.cc
test/client_server_test.cc