From 3526e0baa3f179a8f34e12f4b4de52cde9a2b550 Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Thu, 9 Sep 2021 00:32:30 +0300 Subject: [PATCH] (#7204) ffmpeg/all: Fix postproc and test_package.c bugs. Conanfile changes: * Changed invalid 'with_postproc' flag usage to correct 'postproc'. * Removed 'postproc' dependency from 'avdevice' requires list. Actually the 'postproc' dependency is already correctly handled few lines down in 'if self.options.postproc' block. Test changes: * Functions 'avcodec_register_all', 'av_register_all' and 'avfilter_register_all' are deprecated and are should not be used since version 4.0. Hence they were removed. * Instead print out FFmpeg configuration string and module version numbers. * Replace 'libx264' encoder search with 'rawvideo' encoder. The reason is that when 'with_libx264' is False then the encoder cannot be found. The 'rawvideo' should always be found if FFmpeg is compiled correctly. --- recipes/ffmpeg/all/conanfile.py | 4 ++-- recipes/ffmpeg/all/test_package/test_package.c | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/recipes/ffmpeg/all/conanfile.py b/recipes/ffmpeg/all/conanfile.py index 893f89b475..a463278549 100644 --- a/recipes/ffmpeg/all/conanfile.py +++ b/recipes/ffmpeg/all/conanfile.py @@ -269,7 +269,7 @@ class FFMpegConan(ConanFile): "--disable-cuvid", # FIXME: CUVID support # Licenses opt_enable_disable("nonfree", self.options.with_libfdk_aac), - opt_enable_disable("gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.with_postproc) + opt_enable_disable("gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.postproc) ] if self._arch: args.append("--arch={}".format(self._arch)) @@ -332,7 +332,7 @@ class FFMpegConan(ConanFile): def package_info(self): self.cpp_info.components["avdevice"].libs = ["avdevice"] - self.cpp_info.components["avdevice"].requires = ["avfilter", "swscale", "postproc", "avformat", "avcodec", "swresample", "avutil"] + self.cpp_info.components["avdevice"].requires = ["avfilter", "swscale", "avformat", "avcodec", "swresample", "avutil"] self.cpp_info.components["avdevice"].names["pkg_config"] = "libavdevice" self.cpp_info.components["avfilter"].libs = ["avfilter"] diff --git a/recipes/ffmpeg/all/test_package/test_package.c b/recipes/ffmpeg/all/test_package/test_package.c index de175bd6c3..10a1772b3e 100644 --- a/recipes/ffmpeg/all/test_package/test_package.c +++ b/recipes/ffmpeg/all/test_package/test_package.c @@ -9,14 +9,18 @@ #include int main() { - avcodec_register_all(); - av_register_all(); - avfilter_register_all(); avdevice_register_all(); - swresample_version(); - swscale_version(); - if (avcodec_find_encoder_by_name("libx264") == NULL) { - printf("Unable to find libx264 encoder\n"); + + printf("configuration: %s\n", avcodec_configuration()); + + printf("avcodec version: %d.%d.%d\n", AV_VERSION_MAJOR(avcodec_version()), AV_VERSION_MINOR(avcodec_version()), AV_VERSION_MICRO(avcodec_version())); + printf("avfilter version: %d.%d.%d\n", AV_VERSION_MAJOR(avfilter_version()), AV_VERSION_MINOR(avfilter_version()), AV_VERSION_MICRO(avfilter_version())); + printf("avdevice version: %d.%d.%d\n", AV_VERSION_MAJOR(avdevice_version()), AV_VERSION_MINOR(avdevice_version()), AV_VERSION_MICRO(avdevice_version())); + printf("swresample version: %d.%d.%d\n", AV_VERSION_MAJOR(swresample_version()), AV_VERSION_MINOR(swresample_version()), AV_VERSION_MICRO(swresample_version())); + printf("swscale version: %d.%d.%d\n", AV_VERSION_MAJOR(swscale_version()), AV_VERSION_MINOR(swscale_version()), AV_VERSION_MICRO(swscale_version())); + + if (avcodec_find_encoder_by_name("rawvideo") == NULL) { + printf("Unable to find rawvideo encoder\n"); return -1; } return 0;