Merge pull request #1089 from PredatorCZ/fix-system-ffmeg

fixed system ffmpeg detection
This commit is contained in:
bnnm 2022-03-12 12:54:49 +01:00 committed by GitHub
commit b1acf3435e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,9 +2,9 @@ if(USE_FFMPEG)
if(NOT FFMPEG_PATH AND NOT BUILD_STATIC)
# FFmpeg detection
if(WIN32)
find_package(FFmpeg)
find_package(FFmpeg COMPONENTS AVFORMAT AVUTIL AVCODEC SWRESAMPLE)
else()
find_package(FFmpeg QUIET)
find_package(FFmpeg QUIET COMPONENTS AVFORMAT AVUTIL AVCODEC SWRESAMPLE)
endif()
if(NOT FFMPEG_LIBRARIES)
@ -15,23 +15,30 @@ if(USE_FFMPEG)
endif()
else()
if(${AVCODEC_VERSION} VERSION_LESS 57)
message("libavcodec version mismatch ${AVCODEC_VERSION} expected >=57")
if(WIN32)
set_ffmpeg(OFF TRUE)
message("libavcodec version mismatch ${AVCODEC_VERSION} expected >=57")
else()
set(FFmpeg_FOUND NO)
endif()
elseif(${AVUTIL_VERSION} VERSION_LESS 55)
message("libavutil version mismatch ${AVUTIL_VERSION} expected >=55")
if(WIN32)
set_ffmpeg(OFF TRUE)
message("libavutil version mismatch ${AVUTIL_VERSION} expected >=55")
else()
set(FFmpeg_FOUND NO)
endif()
elseif(${SWRESAMPLE_VERSION} VERSION_LESS 2)
message("libswresample version mismatch ${SWRESAMPLE_VERSION} expected >=2")
if(WIN32)
set_ffmpeg(OFF TRUE)
else()
set(FFmpeg_FOUND NO)
endif()
elseif(${AVFORMAT_VERSION} VERSION_LESS 57)
message("libavformat version mismatch ${AVFORMAT_VERSION} expected >=57")
if(WIN32)
set_ffmpeg(OFF TRUE)
message("libswresample version mismatch ${SWRESAMPLE_VERSION} expected >=2")
else()
set(FFmpeg_FOUND NO)
endif()