fixed system ffmpeg detection

This commit is contained in:
Lukas Cone 2022-03-06 20:34:19 +01:00
parent 78f6ecf660
commit e7e6365bdd
No known key found for this signature in database
GPG Key ID: 75BE27B2D5567A20

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()