|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs) |
|
|
|
|
|
|
|
|
if (NOT FFmpeg_FIND_COMPONENTS) |
|
|
set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL SWRESAMPLE) |
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
macro(set_component_found _component ) |
|
|
if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) |
|
|
message(DEBUG " - ${_component} found.") |
|
|
set(${_component}_FOUND TRUE) |
|
|
else () |
|
|
message(DEBUG " - ${_component} not found.") |
|
|
endif () |
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
macro(find_component _component _pkgconfig _library _header) |
|
|
|
|
|
if (NOT WIN32) |
|
|
|
|
|
|
|
|
find_package(PkgConfig) |
|
|
if (PKG_CONFIG_FOUND) |
|
|
pkg_check_modules(PC_${_component} ${_pkgconfig}) |
|
|
message(STATUS "Pkgconfig found: ${PC_${_component}_INCLUDEDIR}") |
|
|
message(STATUS "Pkgconfig found: ${PC_${_component}_INCLUDE_DIRS}") |
|
|
message(STATUS "${PC_${_component}_CFLAGS}") |
|
|
endif () |
|
|
endif (NOT WIN32) |
|
|
|
|
|
|
|
|
find_path(${_component}_INCLUDE_DIRS ${_header} |
|
|
HINTS |
|
|
${PC_${_component}_INCLUDEDIR} |
|
|
${PC_${_component}_INCLUDE_DIRS} |
|
|
PATH_SUFFIXES |
|
|
ffmpeg |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
find_library(${_component}_LIBRARIES NAMES ${_library} lib${_library}.a |
|
|
HINTS |
|
|
${PC_${_component}_LIBDIR} |
|
|
${PC_${_component}_LIBRARY_DIRS} |
|
|
) |
|
|
|
|
|
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.") |
|
|
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.") |
|
|
|
|
|
set_component_found(${_component}) |
|
|
|
|
|
mark_as_advanced( |
|
|
${_component}_INCLUDE_DIRS |
|
|
${_component}_LIBRARIES |
|
|
${_component}_DEFINITIONS |
|
|
${_component}_VERSION) |
|
|
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
if (NOT FFMPEG_LIBRARIES) |
|
|
|
|
|
|
|
|
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) |
|
|
find_component(AVFORMAT libavformat avformat libavformat/avformat.h) |
|
|
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) |
|
|
|
|
|
find_component(AVUTIL libavutil avutil libavutil/avutil.h) |
|
|
find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) |
|
|
find_component(SWSCALE libswscale swscale libswscale/swscale.h) |
|
|
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) |
|
|
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) |
|
|
|
|
|
|
|
|
foreach (_component ${FFmpeg_FIND_COMPONENTS}) |
|
|
if (${_component}_FOUND) |
|
|
|
|
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES}) |
|
|
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS}) |
|
|
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS}) |
|
|
else () |
|
|
|
|
|
endif () |
|
|
endforeach () |
|
|
|
|
|
|
|
|
if (FFMPEG_INCLUDE_DIRS) |
|
|
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) |
|
|
endif () |
|
|
|
|
|
|
|
|
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE) |
|
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE) |
|
|
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE) |
|
|
|
|
|
mark_as_advanced(FFMPEG_INCLUDE_DIRS |
|
|
FFMPEG_LIBRARIES |
|
|
FFMPEG_DEFINITIONS) |
|
|
|
|
|
endif () |
|
|
|
|
|
|
|
|
|
|
|
foreach (_component AVCODEC AVDEVICE AVFORMAT AVRESAMPLE AVUTIL POSTPROCESS) |
|
|
set_component_found(${_component}) |
|
|
endforeach () |
|
|
|
|
|
|
|
|
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) |
|
|
foreach (_component ${FFmpeg_FIND_COMPONENTS}) |
|
|
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS) |
|
|
endforeach () |
|
|
|
|
|
|
|
|
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS}) |
|
|
|
|
|
|