2021-05-10 19:58:14 +00:00
|
|
|
# Locate ffmpeg
|
|
|
|
# This module defines
|
|
|
|
# FFMPEG_LIBRARIES
|
|
|
|
# FFMPEG_FOUND, if false, do not try to link to ffmpeg
|
|
|
|
# FFMPEG_INCLUDE_DIR, where to find the headers
|
2021-05-09 20:52:26 +00:00
|
|
|
#
|
2021-05-10 19:58:14 +00:00
|
|
|
# $FFMPEG_DIR is an environment variable that would
|
|
|
|
# correspond to the ./configure --prefix=$FFMPEG_DIR
|
2021-05-09 20:52:26 +00:00
|
|
|
#
|
2021-05-10 19:58:14 +00:00
|
|
|
# Created by Robert Osfield.
|
|
|
|
# Modified by Lukas Lalinsky.
|
2021-05-13 09:56:18 +00:00
|
|
|
# Modified by Leon Styhre.
|
2021-05-10 19:58:14 +00:00
|
|
|
|
|
|
|
# In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
|
|
|
|
# In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg
|
|
|
|
|
|
|
|
# We have to search the path which contain the header.h (usefull for old version)
|
|
|
|
# and search the path which contain the libname/header.h (usefull for new version)
|
|
|
|
|
|
|
|
# Then we need to include ${FFMPEG_libname_INCLUDE_DIRS}
|
|
|
|
# (in old version case, use by ffmpeg header and osg plugin code)
|
|
|
|
# (in new version case, use by ffmpeg header)
|
|
|
|
# and ${FFMPEG_libname_INCLUDE_DIRS/libname}
|
|
|
|
# (in new version case, use by osg plugin code)
|
|
|
|
|
|
|
|
# Macro to find header and lib directories
|
|
|
|
# example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
|
|
|
|
MACRO(FFMPEG_FIND varname shortname headername)
|
|
|
|
|
|
|
|
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
|
|
|
|
PATHS
|
|
|
|
${FFMPEG_ROOT}/include
|
|
|
|
$ENV{FFMPEG_DIR}/include
|
|
|
|
~/Library/Frameworks
|
|
|
|
/Library/Frameworks
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include/
|
|
|
|
/sw/include # Fink
|
|
|
|
/opt/local/include # DarwinPorts
|
|
|
|
/opt/csw/include # Blastwave
|
|
|
|
/opt/include
|
|
|
|
/usr/freeware/include
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
PATH_SUFFIXES ffmpeg
|
|
|
|
DOC "Location of FFMPEG Headers"
|
|
|
|
)
|
|
|
|
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
|
|
|
|
PATH_SUFFIXES ffmpeg
|
|
|
|
DOC "Location of FFMPEG Headers"
|
|
|
|
)
|
|
|
|
|
2021-05-13 09:56:18 +00:00
|
|
|
pkg_check_modules(FFMPEG_${varname} lib${shortname} REQUIRED)
|
2021-05-10 19:58:14 +00:00
|
|
|
|
|
|
|
IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
|
|
|
|
SET(FFMPEG_${varname}_FOUND 1)
|
2021-05-13 11:00:11 +00:00
|
|
|
MESSAGE("-- " ${FFMPEG_${varname}_LINK_LIBRARIES})
|
2021-05-10 19:58:14 +00:00
|
|
|
ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
|
|
|
|
|
|
|
|
ENDMACRO(FFMPEG_FIND)
|
|
|
|
|
|
|
|
SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG")
|
|
|
|
|
|
|
|
# find stdint.h
|
|
|
|
FIND_PATH(FFMPEG_STDINT_INCLUDE_DIR stdint.h
|
|
|
|
PATHS
|
|
|
|
${FFMPEG_ROOT}/include
|
|
|
|
$ENV{FFMPEG_DIR}/include
|
|
|
|
~/Library/Frameworks
|
|
|
|
/Library/Frameworks
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include
|
|
|
|
/sw/include # Fink
|
|
|
|
/opt/local/include # DarwinPorts
|
|
|
|
/opt/csw/include # Blastwave
|
|
|
|
/opt/include
|
|
|
|
/usr/freeware/include
|
|
|
|
PATH_SUFFIXES ffmpeg
|
|
|
|
DOC "Location of FFMPEG stdint.h Header"
|
|
|
|
)
|
|
|
|
|
|
|
|
FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
|
|
|
|
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
|
|
|
|
FFMPEG_FIND(LIBAVCODEC_FFT avcodec avfft.h)
|
|
|
|
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
|
|
|
|
FFMPEG_FIND(LIBSWRESAMPLE swresample swresample.h)
|
|
|
|
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # Not sure about the header to look for here.
|
|
|
|
|
|
|
|
SET(FFMPEG_FOUND "NO")
|
|
|
|
|
2021-05-11 15:29:14 +00:00
|
|
|
IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND
|
|
|
|
FFMPEG_LIBSWRESAMPLE_FOUND AND FFMPEG_LIBSWSCALE_FOUND AND FFMPEG_STDINT_INCLUDE_DIR)
|
2021-05-10 19:58:14 +00:00
|
|
|
|
|
|
|
SET(FFMPEG_FOUND "YES")
|
|
|
|
SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
|
|
|
|
SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
|
|
|
|
|
|
|
|
SET(FFMPEG_LIBRARIES
|
2021-05-13 11:00:11 +00:00
|
|
|
${FFMPEG_LIBAVFORMAT_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBAVCODEC_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBAVUTIL_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBSWRESAMPLE_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBSWSCALE_LINK_LIBRARIES})
|
2021-05-10 19:58:14 +00:00
|
|
|
ELSE ()
|
|
|
|
|
|
|
|
# MESSAGE(STATUS "Could not find FFMPEG")
|
|
|
|
|
|
|
|
ENDIF()
|