update ffmpeg wrapper binaries

Scripts are updated for Linux-based (Ubuntu 14.04) mingw cross-compilation (full stack of scripts provided)
Part of these scripts may work under Windows installation of MinGW, but it is not supported.

FFMPEG update: 2.7.1
Added OpenH264 Cisco binaries support for H264 encoding: v1.4.0
This commit is contained in:
Alexander Alekhin
2015-06-05 12:39:56 +03:00
parent ca8312b0b3
commit 56ad207d37
11 changed files with 113 additions and 64 deletions

View File

@@ -190,7 +190,7 @@ endif(WITH_XIMEA)
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_FFMPEG_RESAMPLE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
if(WITH_FFMPEG)
if(WIN32 AND NOT ARM)
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake")
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg.cmake")
elseif(UNIX)
CHECK_MODULE(libavcodec HAVE_FFMPEG_CODEC)
CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)

View File

@@ -836,3 +836,76 @@ macro(ocv_get_all_libs _modules _extra _3rdparty)
ocv_list_reverse(${lst})
endforeach()
endmacro()
function(ocv_download)
cmake_parse_arguments(DL "" "PACKAGE;HASH;URL;DESTINATION_DIR;DOWNLOAD_DIR" "" ${ARGN})
if(NOT DL_DOWNLOAD_DIR)
set(DL_DOWNLOAD_DIR "${DL_DESTINATION_DIR}/downloads")
endif()
if(DEFINED DL_DESTINATION_DIR)
set(DESTINATION_TARGET "${DL_DESTINATION_DIR}/${DL_PACKAGE}")
if(EXISTS "${DESTINATION_TARGET}")
file(MD5 "${DESTINATION_TARGET}" target_md5)
if(NOT target_md5 STREQUAL DL_HASH)
file(REMOVE "${DESTINATION_TARGET}")
else()
set(DOWNLOAD_PACKAGE_LOCATION "" PARENT_SCOPE)
unset(DOWNLOAD_PACKAGE_LOCATION)
return()
endif()
endif()
endif()
set(DOWNLOAD_TARGET "${DL_DOWNLOAD_DIR}/${DL_HASH}/${DL_PACKAGE}")
get_filename_component(DOWNLOAD_TARGET_DIR "${DOWNLOAD_TARGET}" PATH)
if(EXISTS "${DOWNLOAD_TARGET}")
file(MD5 "${DOWNLOAD_TARGET}" target_md5)
if(NOT target_md5 STREQUAL DL_HASH)
message(WARNING "Download: Local copy of ${DL_PACKAGE} has invalid MD5 hash: ${target_md5} (expected: ${DL_HASH})")
file(REMOVE "${DOWNLOAD_TARGET}")
file(REMOVE_RECURSE "${DOWNLOAD_TARGET_DIR}")
endif()
endif()
if(NOT EXISTS "${DOWNLOAD_TARGET}")
set(__url "")
foreach(__url_i ${DL_URL})
if(NOT ("${__url_i}" STREQUAL ""))
set(__url "${__url_i}")
break()
endif()
endforeach()
if("${__url}" STREQUAL "")
message(FATAL_ERROR "Download URL is not specified for package ${DL_PACKAGE}")
endif()
if(NOT EXISTS "${DOWNLOAD_TARGET_DIR}")
file(MAKE_DIRECTORY ${DOWNLOAD_TARGET_DIR})
endif()
message(STATUS "Downloading ${DL_PACKAGE}...")
#message(STATUS " ${__url}${DL_PACKAGE}")
file(DOWNLOAD "${__url}${DL_PACKAGE}" "${DOWNLOAD_TARGET}"
TIMEOUT 600 STATUS __status
EXPECTED_MD5 ${DL_HASH})
if(NOT __status EQUAL 0)
message(FATAL_ERROR "Failed to download ${DL_PACKAGE}. Status=${__status}")
else()
# Don't remove this code, because EXPECTED_MD5 parameter doesn't fail "file(DOWNLOAD)" step on wrong hash
file(MD5 "${DOWNLOAD_TARGET}" target_md5)
if(NOT target_md5 STREQUAL DL_HASH)
message(FATAL_ERROR "Downloaded copy of ${DL_PACKAGE} has invalid MD5 hash: ${target_md5} (expected: ${DL_HASH})")
endif()
endif()
message(STATUS "Downloading ${DL_PACKAGE}... Done")
endif()
if(DEFINED DL_DESTINATION_DIR)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${DOWNLOAD_TARGET}" "${DL_DESTINATION_DIR}/"
RESULT_VARIABLE __result)
if(NOT __result EQUAL 0)
message(FATAL_ERROR "Downloader: Failed to copy package from ${DOWNLOAD_TARGET} to ${DL_DESTINATION_DIR} with error ${__result}")
endif()
endif()
set(DOWNLOAD_PACKAGE_LOCATION ${DOWNLOAD_TARGET} PARENT_SCOPE)
endfunction()