1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
# - Try to find ffmpeg
# Once done this will define
#
# FFMPEG_FOUND - system has ffmpeg
# FFMPEG_INCLUDE_DIRS - the ffmpeg include directory
# FFMPEG_LIBRARIES - Link these to use ffmpeg
# FFMPEG_DEFINITIONS - Compiler switches required for using ffmpeg
#
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
#
# include this to handle the QUIETLY and REQUIRED arguments
include(FindPackageHandleStandardArgs)
include(GetPrerequisites)
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
# in cache already
set(FFMPEG_FOUND TRUE)
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_FFMPEG_AVCODEC libavcodec QUIET)
pkg_check_modules(_FFMPEG_AVFORMAT libavformat QUIET)
pkg_check_modules(_FFMPEG_SWSCALE libswscale QUIET)
pkg_check_modules(_FFMPEG_AVUTIL libavutil QUIET)
endif (PKG_CONFIG_FOUND)
find_path(FFMPEG_AVCODEC_INCLUDE_DIR
NAMES avcodec.h
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/include/ffmpeg-compat /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES ffmpeg libavcodec
)
find_path(FFMPEG_AVUTIL_INCLUDE_DIR
NAMES avutil.h
PATHS ${_FFMPEG_AVUTIL_INCLUDE_DIRS} /usr/include /usr/include/ffmpeg-compat /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES ffmpeg libavutil
)
find_path(FFMPEG_AVFORMAT_INCLUDE_DIR
NAMES avformat.h
PATHS ${_FFMPEG_AVFORMAT_INCLUDE_DIRS} /usr/include /usr/include/ffmpeg-compat /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES ffmpeg libavformat
)
find_path(FFMPEG_SWSCALE_INCLUDE_DIR
NAMES swscale.h
PATHS ${_FFMPEG_SWSCALE_INCLUDE_DIRS} /usr/include /usr/include/ffmpeg-compat /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES ffmpeg libswscale
)
find_library(FFMPEG_AVCODEC_LIBRARY
NAMES avcodec
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/lib/ffmpeg-compat /usr/local/lib /opt/local/lib /sw/lib
)
find_library(FFMPEG_AVUTIL_LIBRARY
NAMES avutil
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/lib/ffmpeg-compat /usr/local/lib /opt/local/lib /sw/lib
)
find_library(FFMPEG_AVFORMAT_LIBRARY
NAMES avformat
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/lib/ffmpeg-compat /usr/local/lib /opt/local/lib /sw/lib
)
find_library(FFMPEG_SWSCALE_LIBRARY
NAMES swscale
PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} /usr/lib /usr/lib/ffmpeg-compat /usr/local/lib /opt/local/lib /sw/lib
)
if (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVUTIL_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY AND FFMPEG_SWSCALE_LIBRARY)
set(FFMPEG_FOUND TRUE)
endif ()
if (FFMPEG_FOUND)
message (STATUS "Found FFmpeg")
get_filename_component(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR} PATH)
set(FFMPEG_INCLUDE_DIRS
${FFMPEG_INCLUDE_DIR}
${FFMPEG_AVCODEC_INCLUDE_DIR}
${FFMPEG_AVFORMAT_INCLUDE_DIR}
${FFMPEG_SWSCALE_INCLUDE_DIR}
)
set(FFMPEG_LIBRARIES
${FFMPEG_AVCODEC_LIBRARY}
${FFMPEG_AVUTIL_LIBRARY}
${FFMPEG_AVFORMAT_LIBRARY}
${FFMPEG_SWSCALE_LIBRARY}
)
else()
message (STATUS "Could NOT find FFmpeg")
endif (FFMPEG_FOUND)
# show the FFMPEG_INCLUDE_DIRS and FFMPEG_LIBRARIES variables only in the advanced view
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)
mark_as_advanced(FFMPEG_SWSCALE_INCLUDE_DIR FFMPEG_SWSCALE_LIBRARY FFMPEG_AVCODEC_INCLUDE_DIR)
mark_as_advanced(FFMPEG_AVCODEC_LIBRARY FFMPEG_AVFORMAT_INCLUDE_DIR FFMPEG_AVFORMAT_LIBRARY)
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
|