4
# FFMPEG_FOUND, if false, do not try to link to ffmpeg
5
# FFMPEG_INCLUDE_DIR, where to find the headers
7
# $FFMPEG_DIR is an environment variable that would
8
# correspond to the ./configure --prefix=$FFMPEG_DIR
10
# Created by Robert Osfield.
11
# Modified by Lukas Lalinsky.
14
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
15
#In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg
17
#We have to search the path which contain the header.h (usefull for old version)
18
#and search the path which contain the libname/header.h (usefull for new version)
20
#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code)
21
# (in new version case, use by ffmpeg header)
22
#and ${FFMPEG_libname_INCLUDE_DIRS/libname} (in new version case, use by osg plugin code)
24
# Macro to find header and lib directories
25
# example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
26
MACRO(FFMPEG_FIND varname shortname headername)
28
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
30
${FFMPEG_ROOT}/include
31
$ENV{FFMPEG_DIR}/include
37
/opt/local/include # DarwinPorts
38
/opt/csw/include # Blastwave
43
DOC "Location of FFMPEG Headers"
45
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
47
DOC "Location of FFMPEG Headers"
50
FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
67
DOC "Location of FFMPEG Libraries"
69
FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
71
DOC "Location of FFMPEG Libraries"
74
IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
75
SET(FFMPEG_${varname}_FOUND 1)
76
ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
80
SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG")
83
FIND_PATH(FFMPEG_STDINT_INCLUDE_DIR stdint.h
85
${FFMPEG_ROOT}/include
86
$ENV{FFMPEG_DIR}/include
92
/opt/local/include # DarwinPorts
93
/opt/csw/include # Blastwave
97
DOC "Location of FFMPEG stdint.h Header"
100
FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
101
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
102
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
103
FFMPEG_FIND(LIBAVCODEC_FFT avcodec avfft.h)
104
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
105
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here.
107
SET(FFMPEG_FOUND "NO")
108
# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional.
109
IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND FFMPEG_STDINT_INCLUDE_DIR)
111
SET(FFMPEG_FOUND "YES")
113
SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
115
SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
117
# Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later.
119
${FFMPEG_LIBAVFORMAT_LIBRARIES}
120
${FFMPEG_LIBAVDEVICE_LIBRARIES}
121
${FFMPEG_LIBAVCODEC_LIBRARIES}
122
${FFMPEG_LIBAVUTIL_LIBRARIES})
126
# MESSAGE(STATUS "Could not find FFMPEG")