diff --git a/.gitignore b/.gitignore index b730f6e1..157a954d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.log .svn/ *.o +autom4te.cache .depend motion config.h diff --git a/Makefile.in b/Makefile.in index 32e81f24..6dcc0009 100644 --- a/Makefile.in +++ b/Makefile.in @@ -31,9 +31,9 @@ examplesdir = $(datadir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/examples # These variables contain compiler flags, object files to build and files to # # install. # ################################################################################ -CFLAGS = @CFLAGS@ -Wall -DVERSION=\"@PACKAGE_VERSION@\" -Dsysconfdir=\"$(sysconfdir)\" +CFLAGS = @CFLAGS@ -Wall -DVERSION=\"@PACKAGE_VERSION@\" -Dsysconfdir=\"$(sysconfdir)\" @FFMPEG_CFLAGS@ LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ +LIBS = @LIBS@ @FFMPEG_LIBS@ VIDEO_OBJ = @VIDEO@ OBJ = motion.o logger.o conf.o draw.o jpegutils.o vloopback_motion.o $(VIDEO_OBJ) \ netcam.o netcam_ftp.o netcam_jpeg.o netcam_wget.o track.o \ diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..7d25fb92 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,229 @@ +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR + diff --git a/config.h.in b/config.h.in index ac42b9c1..99cdfd03 100644 --- a/config.h.in +++ b/config.h.in @@ -3,6 +3,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H +/* Define to 1 if FFMPEG is around */ +#undef HAVE_FFMPEG + /* Define to 1 if you have the `get_current_dir_name' function. */ #undef HAVE_GET_CURRENT_DIR_NAME @@ -63,6 +66,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VIDEOIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H diff --git a/configure b/configure index b4c4200c..abe833ce 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for motion Unofficial-Git-d71cebf. +# Generated by GNU Autoconf 2.69 for motion Unofficial-Git-a044b60. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='motion' PACKAGE_TARNAME='motion' -PACKAGE_VERSION='Unofficial-Git-d71cebf' -PACKAGE_STRING='motion Unofficial-Git-d71cebf' +PACKAGE_VERSION='Unofficial-Git-a044b60' +PACKAGE_STRING='motion Unofficial-Git-a044b60' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -624,6 +624,11 @@ LIBOBJS BIN_PATH RTPS_OBJ FFMPEG_OBJ +FFMPEG_LIBS +FFMPEG_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG SDL_OBJ VIDEO EGREP @@ -685,8 +690,6 @@ with_sdl with_jpeg_turbo with_jpeg_mmx with_ffmpeg -with_ffmpeg_headers -with_ffmpeg_libs with_sqlite3 with_mysql with_mysql_lib @@ -705,7 +708,12 @@ CFLAGS LDFLAGS LIBS CPPFLAGS -CPP' +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +FFMPEG_CFLAGS +FFMPEG_LIBS' # Initialize some variables set by options. @@ -1246,7 +1254,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures motion Unofficial-Git-d71cebf to adapt to many kinds of systems. +\`configure' configures motion Unofficial-Git-a044b60 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1307,7 +1315,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of motion Unofficial-Git-d71cebf:";; + short | recursive ) echo "Configuration of motion Unofficial-Git-a044b60:";; esac cat <<\_ACEOF @@ -1337,16 +1345,7 @@ Optional Packages: If this is not specified motion will try to find the library /usr/lib/libjpeg-mmx.a /usr/local/lib/libjpeg-mmx.a. - --with-ffmpeg=DIR Specify the prefix for the install path for - libavcodec/libavformat (part of ffmpeg) be able to - encode mpeg movies realtime. - If this is not specified motion will try to find - the libraries in /usr and /usr/local. - - --with-ffmpeg-headers=DIR Specify the prefix for ffmpeg headers. - - --with-ffmpeg-libs=libs Specify the extra libs for ffmpeg - + --with-ffmpeg=DIR Build with FFMPEG support --without-sqlite3 Disable sqlite3 support in motion. --without-mysql Disable mysql support in motion. @@ -1390,6 +1389,14 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + FFMPEG_CFLAGS + C compiler flags for FFMPEG, overriding pkg-config + FFMPEG_LIBS linker flags for FFMPEG, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1457,7 +1464,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -motion configure Unofficial-Git-d71cebf +motion configure Unofficial-Git-a044b60 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2059,7 +2066,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by motion $as_me Unofficial-Git-d71cebf, which was +It was created by motion $as_me Unofficial-Git-a044b60, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -5278,250 +5285,248 @@ fi # # Check for libavcodec and libavformat from ffmpeg # - -FFMPEG_DIR="yes" -FFMPEG_OK="no_found" FFMPEG_OBJ="" # Check whether --with-ffmpeg was given. if test "${with_ffmpeg+set}" = set; then : - withval=$with_ffmpeg; FFMPEG_DIR="$withval" - -fi - - -# -# ffmpeg headers custom location -# -FFMPEG_HEADERS_DIR="yes" - -# Check whether --with-ffmpeg_headers was given. -if test "${with_ffmpeg_headers+set}" = set; then : - withval=$with_ffmpeg_headers; FFMPEG_HEADERS_DIR="$withval" - -fi - - -# -# ffmpeg custom extra libraries -# -FFMPEG_EXTRALIBS=" -lavformat -lavcodec -lavutil -lm -lz -lswscale " - -# Check whether --with-ffmpeg-libs was given. -if test "${with_ffmpeg_libs+set}" = set; then : - withval=$with_ffmpeg_libs; FFMPEG_EXTRALIBS="$withval" - -fi - - -# -# --without-ffmpeg or with-ffmpeg=no -# -if test "${FFMPEG_DIR}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg" >&5 -$as_echo_n "checking for ffmpeg... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping" >&5 -$as_echo "skipping" >&6; } -# -# with-ffmpeg= or nothing -# -else if test "${FFMPEG_DIR}" = "yes"; then - # AUTODETECT STATIC/SHARED LIB - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg autodetecting libraries" >&5 -$as_echo_n "checking for ffmpeg autodetecting libraries... " >&6; } - - if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib64" >&5 -$as_echo "found in /usr/lib64" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib64" - FFMPEG_DIR="/usr" - elif test -f /usr/lib/libavcodec.a -o -f /usr/lib/libavcodec.so && test -f /usr/lib/libavformat.a -o -f /usr/lib/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib" >&5 -$as_echo "found in /usr/lib" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib" - FFMPEG_DIR="/usr" - elif test -f /usr/local/lib/libavcodec.a -o -f /usr/local/lib/libavcodec.so && test -f /usr/local/lib/libavformat.a -o -f /usr/local/lib/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/local/lib" >&5 -$as_echo "found in /usr/local/lib" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/local/lib" - FFMPEG_DIR="/usr/local" - elif test -f /usr/lib/x86_64-linux-gnu/libavcodec.a -o -f /usr/lib/x86_64-linux-gnu/libavcodec.so && test /usr/lib/x86_64-linux-gnu/libavformat.a -o -f /usr/lib/x86_64-linux-gnu/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib/x86_64-linux-gnu" >&5 -$as_echo "found in /usr/lib/x86_64-linux-gnu" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib/x86_64-linux-gnu" - FFMPEG_DIR="/usr" - elif test -f /usr/lib/i386-linux-gnu/libavcodec.a -o -f /usr/lib/i386-linux-gnu/libavcodec.so && test /usr/lib/i386-linux-gnu/libavformat.a -o -f /usr/lib/i386-linux-gnu/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib/i386-linux-gnu" >&5 -$as_echo "found in /usr/lib/i386-linux-gnu" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib/i386-linux-gnu" - FFMPEG_DIR="/usr" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi + withval=$with_ffmpeg; with_ffmpeg=$withval else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg libraries in -> ${FFMPEG_DIR} <-" >&5 -$as_echo_n "checking for ffmpeg libraries in -> ${FFMPEG_DIR} <-... " >&6; } - if test -f ${FFMPEG_DIR}/lib/libavcodec.a -o -f ${FFMPEG_DIR}/lib/libavcodec.so && test -f ${FFMPEG_DIR}/lib/libavformat.a -o -f ${FFMPEG_DIR}/lib/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="${FFMPEG_DIR}/lib" - elif test -f ${FFMPEG_DIR}/libavcodec.a -o -f ${FFMPEG_DIR}/libavcodec.so && test -f ${FFMPEG_DIR}/libavformat.a -o -f ${FFMPEG_DIR}/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - FFMPEG_LIB="${FFMPEG_DIR}" - FFMPEG_OK="found" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - if test "${FFMPEG_OK}" != "found"; then - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - fi + with_ffmpeg=no fi -# -# Now check for ffmpeg headers ( avformat.h ) if ffmpeg libs were found -# - -AVFORMAT_DIR="" - -if test "${FFMPEG_OK}" = "found"; then - if test "${FFMPEG_HEADERS_DIR}" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg headers in ${FFMPEG_DIR}" >&5 -$as_echo_n "checking for ffmpeg headers in ${FFMPEG_DIR}... " >&6; } - AVFORMAT_DIR="${FFMPEG_DIR}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg headers in ${FFMPEG_HEADERS_DIR}" >&5 -$as_echo_n "checking for ffmpeg headers in ${FFMPEG_HEADERS_DIR}... " >&6; } - FFMPEG_DIR="${FFMPEG_HEADERS_DIR}" - AVFORMAT_DIR="${FFMPEG_DIR}" - fi - - if test -f ${FFMPEG_DIR}/include/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include" - AVFORMAT_DIR="${FFMPEG_DIR}/include/avformat.h" - elif test -f ${FFMPEG_DIR}/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}" - AVFORMAT_DIR="${FFMPEG_DIR}/avformat.h" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/ffmpeg/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/ffmpeg/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg" - AVFORMAT_DIR="${FFMPEG_DIR}/include/ffmpeg/avformat.h" - elif test -f ${FFMPEG_DIR}/include/libavformat/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/libavformat/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/libavformat/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/libavformat" - AVFORMAT_DIR="${FFMPEG_DIR}/include/libavformat/avformat.h" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/ffmpeg/libavformat" - AVFORMAT_DIR="${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h" - elif test -f ${FFMPEG_DIR}/libavformat/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/libavformat/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/libavformat/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR} -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I{FFMPEG_DIR}/libavformat" - AVFORMAT_DIR="${FFMPEG_DIR}/libavformat/avformat.h" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - FFMPEG_OK="no_found" - AVFORMAT_DIR="avformat.h" - echo "**********************************************" - echo "* avformat.h not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - -# -# If ffmpeg libs and headers have been found -# - - if test "${FFMPEG_OK}" = "found"; then - TEMP_LIBS="$TEMP_LIBS -L${FFMPEG_LIB} ${FFMPEG_EXTRALIBS}" - TEMP_LDFLAGS="${TEMP_LDFLAGS} -L${FFMPEG_LIB}" - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG ${FFMPEG_CFLAGS}" - - FFMPEG_OBJ="ffmpeg.o" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking file_protocol is defined in ffmpeg ?" >&5 -$as_echo_n "checking file_protocol is defined in ffmpeg ?... " >&6; } - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - - CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" - LIBS="$TEMP_LIBS" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include <${AVFORMAT_DIR}> - URLProtocol test_file_protocol; - int main(void){ - test_file_protocol.url_read = file_protocol.url_read; - return 0; - } -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_NEW" +fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS - fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi +if test "x$with_ffmpeg" != "xno"; then : + + if test "x$with_ffmpeg" != "xyes"; then : + + PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${with_ffmpeg}/lib/pkgconfig + export PKG_CONFIG_PATH + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FFMPEG" >&5 +$as_echo_n "checking for FFMPEG... " >&6; } + +if test -n "$FFMPEG_CFLAGS"; then + pkg_cv_FFMPEG_CFLAGS="$FFMPEG_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavutil libavformat libavcodec libswscale\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libavutil libavformat libavcodec libswscale") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FFMPEG_CFLAGS=`$PKG_CONFIG --cflags "libavutil libavformat libavcodec libswscale" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$FFMPEG_LIBS"; then + pkg_cv_FFMPEG_LIBS="$FFMPEG_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavutil libavformat libavcodec libswscale\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libavutil libavformat libavcodec libswscale") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FFMPEG_LIBS=`$PKG_CONFIG --libs "libavutil libavformat libavcodec libswscale" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + FFMPEG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libavutil libavformat libavcodec libswscale" 2>&1` + else + FFMPEG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libavutil libavformat libavcodec libswscale" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$FFMPEG_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libavutil libavformat libavcodec libswscale) were not met: + +$FFMPEG_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables FFMPEG_CFLAGS +and FFMPEG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables FFMPEG_CFLAGS +and FFMPEG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + FFMPEG_CFLAGS=$pkg_cv_FFMPEG_CFLAGS + FFMPEG_LIBS=$pkg_cv_FFMPEG_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_FFMPEG=yes +fi + +fi + +if test "${HAVE_FFMPEG}" = "yes" ; then : + + FFMPEG_OBJ="ffmpeg.o" + +$as_echo "#define HAVE_FFMPEG 1" >>confdefs.h + + +fi + + # Revised RTSP module so that it can be included # whether or not FFMPEG is found. @@ -7319,7 +7324,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by motion $as_me Unofficial-Git-d71cebf, which was +This file was extended by motion $as_me Unofficial-Git-a044b60, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7381,7 +7386,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -motion config.status Unofficial-Git-d71cebf +motion config.status Unofficial-Git-a044b60 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -8167,8 +8172,10 @@ else echo "SDL support: No" fi -if test "${FFMPEG_OK}" = "found"; then +if test "${HAVE_FFMPEG}" = "yes"; then echo "FFmpeg support: Yes" + echo " ... FFMPEG_CFLAGS: $FFMPEG_CFLAGS" + echo " ... FFMPEG_LIBS: $FFMPEG_LIBS" else echo "FFmpeg support: No" fi diff --git a/configure.ac b/configure.ac index a426ec44..2076f7a2 100755 --- a/configure.ac +++ b/configure.ac @@ -376,215 +376,25 @@ fi # # Check for libavcodec and libavformat from ffmpeg # - -FFMPEG_DIR="yes" -FFMPEG_OK="no_found" FFMPEG_OBJ="" -AC_ARG_WITH(ffmpeg, -[ --with-ffmpeg[=DIR] Specify the prefix for the install path for - libavcodec/libavformat (part of ffmpeg) be able to - encode mpeg movies realtime. - If this is not specified motion will try to find - the libraries in /usr and /usr/local. - ], -FFMPEG_DIR="$withval" -) +AC_ARG_WITH([ffmpeg], + AS_HELP_STRING([--with-ffmpeg[=DIR]], [Build with FFMPEG support]), + [with_ffmpeg=$withval], + [with_ffmpeg=no]) -# -# ffmpeg headers custom location -# -FFMPEG_HEADERS_DIR="yes" -AC_ARG_WITH(ffmpeg_headers, -[ --with-ffmpeg-headers[=DIR] Specify the prefix for ffmpeg headers. - ], -FFMPEG_HEADERS_DIR="$withval" -) +AS_IF([test "x$with_ffmpeg" != "xno"], [ + AS_IF([test "x$with_ffmpeg" != "xyes"], [ + PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${with_ffmpeg}/lib/pkgconfig + export PKG_CONFIG_PATH + ]) + PKG_CHECK_MODULES([FFMPEG], libavutil libavformat libavcodec libswscale, HAVE_FFMPEG=yes) +]) -# -# ffmpeg custom extra libraries -# -FFMPEG_EXTRALIBS=" -lavformat -lavcodec -lavutil -lm -lz -lswscale " -AC_ARG_WITH(ffmpeg-libs, -[ --with-ffmpeg-libs[=libs] Specify the extra libs for ffmpeg - ], -FFMPEG_EXTRALIBS="$withval" -) - -# -# --without-ffmpeg or with-ffmpeg=no -# -if test "${FFMPEG_DIR}" = "no"; then - AC_MSG_CHECKING(for ffmpeg) - AC_MSG_RESULT(skipping) -# -# with-ffmpeg= or nothing -# -else if test "${FFMPEG_DIR}" = "yes"; then - # AUTODETECT STATIC/SHARED LIB - AC_MSG_CHECKING(for ffmpeg autodetecting libraries) - - if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then - AC_MSG_RESULT(found in /usr/lib64) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib64" - FFMPEG_DIR="/usr" - elif test -f /usr/lib/libavcodec.a -o -f /usr/lib/libavcodec.so && test -f /usr/lib/libavformat.a -o -f /usr/lib/libavformat.so ; then - AC_MSG_RESULT(found in /usr/lib) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib" - FFMPEG_DIR="/usr" - elif test -f /usr/local/lib/libavcodec.a -o -f /usr/local/lib/libavcodec.so && test -f /usr/local/lib/libavformat.a -o -f /usr/local/lib/libavformat.so ; then - AC_MSG_RESULT(found in /usr/local/lib) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/local/lib" - FFMPEG_DIR="/usr/local" - elif test -f /usr/lib/x86_64-linux-gnu/libavcodec.a -o -f /usr/lib/x86_64-linux-gnu/libavcodec.so && test /usr/lib/x86_64-linux-gnu/libavformat.a -o -f /usr/lib/x86_64-linux-gnu/libavformat.so ; then - AC_MSG_RESULT(found in /usr/lib/x86_64-linux-gnu) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib/x86_64-linux-gnu" - FFMPEG_DIR="/usr" - elif test -f /usr/lib/i386-linux-gnu/libavcodec.a -o -f /usr/lib/i386-linux-gnu/libavcodec.so && test /usr/lib/i386-linux-gnu/libavformat.a -o -f /usr/lib/i386-linux-gnu/libavformat.so ; then - AC_MSG_RESULT(found in /usr/lib/i386-linux-gnu) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib/i386-linux-gnu" - FFMPEG_DIR="/usr" - else - AC_MSG_RESULT(not found) - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi -else - AC_MSG_CHECKING(for ffmpeg libraries in -> [${FFMPEG_DIR}] <-) - if test -f ${FFMPEG_DIR}/lib/libavcodec.a -o -f ${FFMPEG_DIR}/lib/libavcodec.so && test -f ${FFMPEG_DIR}/lib/libavformat.a -o -f ${FFMPEG_DIR}/lib/libavformat.so ; then - AC_MSG_RESULT(found) - FFMPEG_OK="found" - FFMPEG_LIB="${FFMPEG_DIR}/lib" - elif test -f ${FFMPEG_DIR}/libavcodec.a -o -f ${FFMPEG_DIR}/libavcodec.so && test -f ${FFMPEG_DIR}/libavformat.a -o -f ${FFMPEG_DIR}/libavformat.so ; then - AC_MSG_RESULT(found) - FFMPEG_LIB="${FFMPEG_DIR}" - FFMPEG_OK="found" - else - AC_MSG_RESULT(not found) - if test "${FFMPEG_OK}" != "found"; then - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - fi -fi - - -# -# Now check for ffmpeg headers ( avformat.h ) if ffmpeg libs were found -# - -AVFORMAT_DIR="" - -if test "${FFMPEG_OK}" = "found"; then - if test "${FFMPEG_HEADERS_DIR}" = "yes"; then - AC_MSG_CHECKING(for ffmpeg headers in ${FFMPEG_DIR}) - AVFORMAT_DIR="${FFMPEG_DIR}" - else - AC_MSG_CHECKING(for ffmpeg headers in ${FFMPEG_HEADERS_DIR}) - FFMPEG_DIR="${FFMPEG_HEADERS_DIR}" - AVFORMAT_DIR="${FFMPEG_DIR}" - fi - - if test -f ${FFMPEG_DIR}/include/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include" - AVFORMAT_DIR="${FFMPEG_DIR}/include/avformat.h" - elif test -f ${FFMPEG_DIR}/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}" - AVFORMAT_DIR="${FFMPEG_DIR}/avformat.h" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg" - AVFORMAT_DIR="${FFMPEG_DIR}/include/ffmpeg/avformat.h" - elif test -f ${FFMPEG_DIR}/include/libavformat/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/libavformat/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/libavformat" - AVFORMAT_DIR="${FFMPEG_DIR}/include/libavformat/avformat.h" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/ffmpeg/libavformat" - AVFORMAT_DIR="${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h" - elif test -f ${FFMPEG_DIR}/libavformat/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/libavformat/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR} -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I{FFMPEG_DIR}/libavformat" - AVFORMAT_DIR="${FFMPEG_DIR}/libavformat/avformat.h" - else - AC_MSG_RESULT(not found) - FFMPEG_OK="no_found" - AVFORMAT_DIR="avformat.h" - echo "**********************************************" - echo "* avformat.h not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - -# -# If ffmpeg libs and headers have been found -# - - if test "${FFMPEG_OK}" = "found"; then - TEMP_LIBS="$TEMP_LIBS -L${FFMPEG_LIB} ${FFMPEG_EXTRALIBS}" - TEMP_LDFLAGS="${TEMP_LDFLAGS} -L${FFMPEG_LIB}" - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG ${FFMPEG_CFLAGS}" - - FFMPEG_OBJ="ffmpeg.o" - AC_SUBST(FFMPEG_OBJ) - - AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?]) - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - - CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" - LIBS="$TEMP_LIBS" - - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - [ - #include <${AVFORMAT_DIR}> - URLProtocol test_file_protocol; - int main(void){ - test_file_protocol.url_read = file_protocol.url_read; - return 0; - } - ]])], - [AC_MSG_RESULT(yes)], - [ - AC_MSG_RESULT(no) - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_NEW" - ] - ) - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS - fi -fi -fi +AS_IF([test "${HAVE_FFMPEG}" = "yes" ], [ + FFMPEG_OBJ="ffmpeg.o" + AC_DEFINE([HAVE_FFMPEG], 1, [Define to 1 if FFMPEG is around]) +]) +AC_SUBST(FFMPEG_OBJ) # Revised RTSP module so that it can be included # whether or not FFMPEG is found. @@ -1357,8 +1167,10 @@ else echo "SDL support: No" fi -if test "${FFMPEG_OK}" = "found"; then +if test "${HAVE_FFMPEG}" = "yes"; then echo "FFmpeg support: Yes" + echo " ... FFMPEG_CFLAGS: $FFMPEG_CFLAGS" + echo " ... FFMPEG_LIBS: $FFMPEG_LIBS" else echo "FFmpeg support: No" fi diff --git a/ffmpeg.c b/ffmpeg.c index 2c2505c5..34ba74a4 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -12,6 +12,7 @@ * 53 are supported. */ +#include "config.h" #ifdef HAVE_FFMPEG @@ -273,7 +274,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_video_codec, char *filename, c->time_base.num = 1; c->time_base.den = rate; c->gop_size = 12; - c->pix_fmt = PIX_FMT_YUV420P; + c->pix_fmt = AV_PIX_FMT_YUV420P; c->max_b_frames = 0; if (strcmp(ffmpeg_video_codec, "ffv1") == 0) c->strict_std_compliance = -2; diff --git a/ffmpeg.h b/ffmpeg.h index 46737d4e..3557ca22 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -4,6 +4,8 @@ #include #include +#include "config.h" + #ifdef HAVE_FFMPEG #include diff --git a/netcam_rtsp.c b/netcam_rtsp.c index 0bcaca08..7fc57701 100644 --- a/netcam_rtsp.c +++ b/netcam_rtsp.c @@ -36,8 +36,8 @@ int netcam_check_pixfmt(netcam_context_ptr netcam){ retcd = -1; - if ((netcam->rtsp->codec_context->pix_fmt == PIX_FMT_YUV420P) || - (netcam->rtsp->codec_context->pix_fmt == PIX_FMT_YUVJ420P)) retcd = 0; + if ((netcam->rtsp->codec_context->pix_fmt == AV_PIX_FMT_YUV420P) || + (netcam->rtsp->codec_context->pix_fmt == AV_PIX_FMT_YUVJ420P)) retcd = 0; return retcd; @@ -565,7 +565,7 @@ int netcam_rtsp_open_sws(netcam_context_ptr netcam){ ,netcam->rtsp->codec_context->pix_fmt ,netcam->width ,netcam->height - ,PIX_FMT_YUV420P + ,AV_PIX_FMT_YUV420P ,SWS_BICUBIC,NULL,NULL,NULL); if (netcam->rtsp->swsctx == NULL) { if (netcam->rtsp->status == RTSP_NOTCONNECTED){ @@ -576,7 +576,7 @@ int netcam_rtsp_open_sws(netcam_context_ptr netcam){ } netcam->rtsp->swsframe_size = avpicture_get_size( - PIX_FMT_YUV420P + AV_PIX_FMT_YUV420P ,netcam->width ,netcam->height); if (netcam->rtsp->swsframe_size <= 0) { @@ -632,7 +632,7 @@ int netcam_rtsp_resize(unsigned char *image , netcam_context_ptr netcam){ retcd = avpicture_fill( (AVPicture*)netcam->rtsp->swsframe_out ,buffer_out - ,PIX_FMT_YUV420P + ,AV_PIX_FMT_YUV420P ,netcam->width ,netcam->height); if (retcd < 0) { @@ -663,7 +663,7 @@ int netcam_rtsp_resize(unsigned char *image , netcam_context_ptr netcam){ retcd = avpicture_layout( (const AVPicture*)netcam->rtsp->swsframe_out - ,PIX_FMT_YUV420P + ,AV_PIX_FMT_YUV420P ,netcam->width ,netcam->height ,(unsigned char *)image