未验证 提交 458bd165 编写于 作者: V Vadim Levin 提交者: GitHub

Merge pull request #18146 from VadimLevin:dev/vlevin/ffmpeg-remove-obsolte-versions-support

Remove obsolete FFMPEG versions support

* refactor: removed obsolete FFMPEG version support

 - Oldest available version via official FFMPEG repository mirror has tag v.0.5
 LIBAVFORMAT version for this tag is 52.31.0

* refactor: prefer std::min function to MIN macro

* refactor: use appropriate macro instead of manual version calculation

* refactor: remove macros for versions prior 0.5.15 release

* refactor: remove libavcodec macros for versions < 54.35.1 (default to Ubuntu 14.04)

* refactor: remove libavformat macro for versions < 54.20.4 (default ubuntu 14.04)

* refactor: remove libavutil macro for versions < 52.3.0 (default ubuntu 14.04)

* refactor: remove missed macros for libavcodec and libavformat

* refactor: remove unused _opencv_ffmpeg_free function

* build: add FFMPEG libraries versions checks

 - Add verbose message about what FFMPEG libraries are missing.
 - Add minimal versions check set to libav 9.20 release (default ubuntu 14.04) and FFMPEG 1.1.16 release.
   If the check is failed CMake produces user-friendly message instead of build error.

* fix: libavcodec version guard for AVDISCARD_NONINTRA

* fix: libav check of libavcodec version guard for AVDISCARD_NONINTRA

* fix: version check for AV_CODEC_FLAG_GLOBAL_HEADER

* fix: missing FFMPEG libraries output
上级 e5e08ec5
......@@ -24,17 +24,56 @@ if(NOT HAVE_FFMPEG AND WIN32 AND NOT ARM AND NOT OPENCV_FFMPEG_SKIP_DOWNLOAD)
endif()
endif()
set(_required_ffmpeg_libraries libavcodec libavformat libavutil libswscale)
set(_used_ffmpeg_libraries ${_required_ffmpeg_libraries})
if(NOT HAVE_FFMPEG AND PKG_CONFIG_FOUND)
ocv_check_modules(FFMPEG libavcodec libavformat libavutil libswscale)
if(FFMPEG_FOUND)
ocv_check_modules(FFMPEG_libavresample libavresample) # optional
if(FFMPEG_libavresample_FOUND)
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_libavresample_LIBRARIES})
list(APPEND _used_ffmpeg_libraries libavresample)
endif()
set(HAVE_FFMPEG TRUE)
else()
set(_missing_ffmpeg_libraries "")
foreach (ffmpeg_lib ${_required_ffmpeg_libraries})
if (NOT FFMPEG_${ffmpeg_lib}_FOUND)
list(APPEND _missing_ffmpeg_libraries ${ffmpeg_lib})
endif()
endforeach ()
message(STATUS "FFMPEG is disabled. Required libraries: ${_required_ffmpeg_libraries}."
" Missing libraries: ${_missing_ffmpeg_libraries}")
unset(_missing_ffmpeg_libraries)
endif()
endif()
#=================================
# Versions check.
if(HAVE_FFMPEG AND NOT HAVE_FFMPEG_WRAPPER)
set(_min_libavcodec_version 54.35.1)
set(_min_libavformat_version 54.20.4)
set(_min_libavutil_version 52.3.0)
set(_min_libswscale_version 2.1.1)
set(_min_libavresample_version 1.0.1)
foreach(ffmpeg_lib ${_used_ffmpeg_libraries})
if(FFMPEG_${ffmpeg_lib}_VERSION VERSION_LESS _min_${ffmpeg_lib}_version)
message(STATUS "FFMPEG is disabled. Can't find suitable ${ffmpeg_lib} library"
" (minimal ${_min_${ffmpeg_lib}_version}, found ${FFMPEG_${ffmpeg_lib}_VERSION}).")
set(HAVE_FFMPEG FALSE)
endif()
endforeach()
if(NOT HAVE_FFMPEG)
message(STATUS "FFMPEG libraries version check failed "
"(minimal libav release 9.20, minimal FFMPEG release 1.1.16).")
endif()
unset(_min_libavcodec_version)
unset(_min_libavformat_version)
unset(_min_libavutil_version)
unset(_min_libswscale_version)
unset(_min_libavresample_version)
endif()
#==================================
if(HAVE_FFMPEG AND NOT HAVE_FFMPEG_WRAPPER AND NOT OPENCV_FFMPEG_SKIP_BUILD_CHECK)
......@@ -53,6 +92,8 @@ if(HAVE_FFMPEG AND NOT HAVE_FFMPEG_WRAPPER AND NOT OPENCV_FFMPEG_SKIP_BUILD_CHEC
endif()
#==================================
unset(_required_ffmpeg_libraries)
unset(_used_ffmpeg_libraries)
if(HAVE_FFMPEG_WRAPPER)
ocv_add_external_target(ffmpeg "" "" "HAVE_FFMPEG_WRAPPER")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册