Actually use YUV->RGB setting when converting.
[dcpomatic.git] / src / lib / ffmpeg.cc
index 4fe1c04484ab38527db8bf67a051904e8fb60eee..08349fba40c0008f01c96461221249c8af07d7d3 100644 (file)
@@ -22,20 +22,19 @@ extern "C" {
 #include <libavformat/avformat.h>
 #include <libswscale/swscale.h>
 }
-#include <dcp/raw_convert.h>
 #include "ffmpeg.h"
 #include "ffmpeg_content.h"
 #include "ffmpeg_audio_stream.h"
 #include "ffmpeg_subtitle_stream.h"
 #include "exceptions.h"
 #include "util.h"
+#include "raw_convert.h"
 
 #include "i18n.h"
 
 using std::string;
 using std::cout;
 using boost::shared_ptr;
-using dcp::raw_convert;
 
 boost::mutex FFmpeg::_mutex;
 
@@ -152,7 +151,15 @@ FFmpeg::setup_decoders ()
                
                AVCodec* codec = avcodec_find_decoder (context->codec_id);
                if (codec) {
-                       if (avcodec_open2 (context, codec, 0) < 0) {
+
+                       /* This option disables decoding of DCA frame footers in our patched version
+                          of FFmpeg.  I believe these footers are of no use to us, and they can cause
+                          problems when FFmpeg fails to decode them (mantis #352).
+                       */
+                       AVDictionary* options = 0;
+                       av_dict_set (&options, "disable_footer", "1", 0);
+                       
+                       if (avcodec_open2 (context, codec, &options) < 0) {
                                throw DecodeError (N_("could not open decoder"));
                        }
                }