Fix build with newer FFmpeg.
authorCarl Hetherington <cth@carlh.net>
Tue, 3 Aug 2021 19:24:51 +0000 (21:24 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 3 Aug 2021 19:24:51 +0000 (21:24 +0200)
src/lib/ffmpeg_examiner.cc
src/lib/ffmpeg_file_encoder.cc
src/lib/util.cc
wscript

index bd6a9b20d475b6b23a7781a735bf52f09b19281e..853db90be3e3ef1ec36cc834a51f0ff6754468e9 100644 (file)
@@ -33,8 +33,9 @@ extern "C" {
 #include <libavformat/avformat.h>
 #include <libavutil/pixfmt.h>
 #include <libavutil/pixdesc.h>
-#include <libavutil/eval.h>
+#include <libavutil/channel_layout.h>
 #include <libavutil/display.h>
+#include <libavutil/eval.h>
 }
 DCPOMATIC_ENABLE_WARNINGS
 #include <iostream>
index 83e707725718aeb14f3c0b19bd6ba368f251da11..533fd151c648cb083e6b6e57b3db80edf27ae19d 100644 (file)
@@ -29,6 +29,9 @@
 #include "image.h"
 #include "cross.h"
 #include "compose.hpp"
+extern "C" {
+#include <libavutil/channel_layout.h>
+}
 #include <iostream>
 
 #include "i18n.h"
index 2d2a63c35aaac629ab5496438180f7f4d6b81e25..4ce677bf63a666b2fceacceb490eb297af7133ff 100644 (file)
@@ -367,10 +367,12 @@ dcpomatic_setup ()
        SetUnhandledExceptionFilter(exception_handler);
 #endif
 
+#ifdef DCPOMATIC_HAVE_AVREGISTER
 DCPOMATIC_DISABLE_WARNINGS
        av_register_all ();
        avfilter_register_all ();
 DCPOMATIC_ENABLE_WARNINGS
+#endif
 
 #ifdef DCPOMATIC_OSX
        /* Add our library directory to the libltdl search path so that
diff --git a/wscript b/wscript
index b7ea7de6ca054d1ea171223ddbf81db2e42008b3..bfc84112da9053ab54e48fd6ecee0cce4d550138 100644 (file)
--- a/wscript
+++ b/wscript
@@ -437,6 +437,19 @@ def configure(conf):
                    define_name='DCPOMATIC_HAVE_AVCOMPONENTDESCRIPTOR_DEPTH_MINUS1',
                    mandatory=False)
 
+    # See if we have av_register_all and avfilter_register_all
+    conf.check_cxx(fragment="""
+                            extern "C" {\n
+                            #include <libavformat/avformat.h>\n
+                            #include <libavfilter/avfilter.h>\n
+                            }\n
+                            int main () { av_register_all(); avfilter_register_all(); }\n
+                            """,
+                   msg='Checking for av_register_all and avfilter_register_all',
+                   uselib='AVFORMAT AVFILTER',
+                   define_name='DCPOMATIC_HAVE_AVREGISTER',
+                   mandatory=False)
+
     # Hack: the previous two check_cxx calls end up copying their (necessary) cxxflags
     # to these variables.  We don't want to use these for the actual build, so clean them out.
     conf.env['CXXFLAGS_AVCODEC'] = []