mirror of
https://github.com/Motion-Project/motion.git
synced 2026-05-24 14:37:31 -04:00
Fixed stepper when used with track_auto on and merge 3.2.10 changes from trunk -r325
This commit is contained in:
@@ -40,7 +40,11 @@ Bugfixes
|
||||
LIBAVCODEC_BUILD uses LIBAVFORMAT_VERSION_INT ((49<<16)+(0<<8)+0) and LIBAVCODEC_VERSION_INT ((49<<16)+(0<<8)+0)
|
||||
(Angel Carpintero)
|
||||
* Fix choose v4l2 palette , http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x01x21x043812 (Onakra)
|
||||
|
||||
* Get current directory to allow write motion.conf properly
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x02x25x013419 (John Bray)
|
||||
* Fix broken PostgreSQL detection for custom location,
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x02x25x025134 ( Angel Carpintero )
|
||||
* Fixed stepper when is used track_auto on ( Angel Carpintero ).
|
||||
|
||||
3.2.9 Formal Release - Summary of Changes
|
||||
|
||||
|
||||
10
CREDITS
10
CREDITS
@@ -95,6 +95,10 @@ William M Brack
|
||||
handling when it fails. Motion would end in infinite loops.
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x03x10x000151
|
||||
|
||||
John Bray
|
||||
* Get current directory to allow write motion.conf properly
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x02x25x013419
|
||||
|
||||
Andy Brown
|
||||
* Add swf codec to video creation (on behalf of Bowser Pete).
|
||||
|
||||
@@ -384,10 +388,12 @@ Angel Carpintero
|
||||
* Avoid random errors , initialising some structs for V4L1
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x11x26x010755 (Jason Sharpee & Angel Carpintero)
|
||||
* Fix motion segfaul because ffmpeg API change
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2007x12x29x175530 (Angel Carpintero)
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2007x12x29x17553
|
||||
* Little fix in ffmpeg.c comparing version of LIBAVFORMAT_BUILD, since ffmpeg svn -r4486 LIBAVFORMAT_BUILD and
|
||||
LIBAVCODEC_BUILD uses LIBAVFORMAT_VERSION_INT ((49<<16)+(0<<8)+0) and LIBAVCODEC_VERSION_INT ((49<<16)+(0<<8)+0)
|
||||
(Angel Carpintero)
|
||||
* Fix broken PostgreSQL detection for custom location,
|
||||
http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x02x25x025134
|
||||
* Fixed stepper when is used track_auto on.
|
||||
|
||||
Jared D
|
||||
* Change bayer2rgb24() to fix a problem with sn9c102 driver
|
||||
|
||||
@@ -30,7 +30,7 @@ examplesdir = $(docdir)/examples
|
||||
# These variables contain compiler flags, object files to build and files to #
|
||||
# install. #
|
||||
################################################################################
|
||||
CFLAGS = @CFLAGS@ -Wall -D_REENTRANT -DVERSION=\"@PACKAGE_VERSION@\" \
|
||||
CFLAGS = @CFLAGS@ -Wall -DVERSION=\"@PACKAGE_VERSION@\" \
|
||||
-Dsysconfdir=\"$(sysconfdir)\" -Ddocdir=\"$(docdir)\"
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
89
conf.c
89
conf.c
@@ -143,10 +143,12 @@ struct config conf_template = {
|
||||
|
||||
static struct context **copy_bool(struct context **, const char *, int);
|
||||
static struct context **copy_int(struct context **, const char *, int);
|
||||
static struct context **copy_short(struct context **, const char *, int);
|
||||
static struct context **config_thread(struct context **cnt, const char *str, int val);
|
||||
|
||||
static const char *print_bool(struct context **, char **, int, unsigned short int);
|
||||
static const char *print_int(struct context **, char **, int, unsigned short int);
|
||||
static const char *print_short(struct context **, char **, int, unsigned short int);
|
||||
static const char *print_string(struct context **, char **, int, unsigned short int);
|
||||
static const char *print_thread(struct context **, char **, int, unsigned short int);
|
||||
|
||||
@@ -222,8 +224,8 @@ config_param config_params[] = {
|
||||
"# V4L2_PIX_FMT_YUV420 : 8 'YU12'",
|
||||
0,
|
||||
CONF_OFFSET(v4l2_palette),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
#if (defined(BSD))
|
||||
{
|
||||
@@ -957,8 +959,8 @@ config_param config_params[] = {
|
||||
"# be used with the conversion specifiers for options like on_motion_detected",
|
||||
0,
|
||||
TRACK_OFFSET(type),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_auto",
|
||||
@@ -981,40 +983,40 @@ config_param config_params[] = {
|
||||
"# Motor number for x-axis (default: 0)",
|
||||
0,
|
||||
TRACK_OFFSET(motorx),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_motory",
|
||||
"# Motor number for y-axis (default: 0)",
|
||||
0,
|
||||
TRACK_OFFSET(motory),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_maxx",
|
||||
"# Maximum value on x-axis (default: 0)",
|
||||
0,
|
||||
TRACK_OFFSET(maxx),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_maxy",
|
||||
"# Maximum value on y-axis (default: 0)",
|
||||
0,
|
||||
TRACK_OFFSET(maxy),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_iomojo_id",
|
||||
"# ID of an iomojo camera if used (default: 0)",
|
||||
0,
|
||||
TRACK_OFFSET(iomojo_id),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_step_angle_x",
|
||||
@@ -1023,8 +1025,8 @@ config_param config_params[] = {
|
||||
"# Currently only used with pwc type cameras",
|
||||
0,
|
||||
TRACK_OFFSET(step_angle_x),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_step_angle_y",
|
||||
@@ -1033,8 +1035,8 @@ config_param config_params[] = {
|
||||
"# Currently only used with pwc type cameras",
|
||||
0,
|
||||
TRACK_OFFSET(step_angle_y),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_move_wait",
|
||||
@@ -1042,24 +1044,24 @@ config_param config_params[] = {
|
||||
"# of picture frames (default: 10)",
|
||||
0,
|
||||
TRACK_OFFSET(move_wait),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_speed",
|
||||
"# Speed to set the motor to (stepper motor option) (default: 255)",
|
||||
0,
|
||||
TRACK_OFFSET(speed),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"track_stepsize",
|
||||
"# Number of steps to make (stepper motor option) (default: 40)",
|
||||
0,
|
||||
TRACK_OFFSET(stepsize),
|
||||
copy_int,
|
||||
print_int
|
||||
copy_short,
|
||||
print_short
|
||||
},
|
||||
{
|
||||
"quiet",
|
||||
@@ -1403,6 +1405,7 @@ struct context **conf_cmdparse(struct context **cnt, const char *cmd, const char
|
||||
/* We call the function given by the pointer config_params[i].copy
|
||||
* If the option is a bool, copy_bool is called.
|
||||
* If the option is an int, copy_int is called.
|
||||
* If the option is a short, copy_short is called.
|
||||
* If the option is a string, copy_string is called.
|
||||
* If the option is a thread, config_thread is called.
|
||||
* The arguments to the function are:
|
||||
@@ -1617,7 +1620,7 @@ struct context ** conf_load (struct context **cnt)
|
||||
if (!fp){ /* Commandline didn't work, try current dir */
|
||||
if (cnt[0]->conf_filename[0])
|
||||
motion_log(-1, 1, "Configfile %s not found - trying defaults.", filename);
|
||||
sprintf(filename, "motion.conf");
|
||||
snprintf(filename, PATH_MAX, "%s/motion.conf", get_current_dir_name());
|
||||
fp = fopen (filename, "r");
|
||||
}
|
||||
if (!fp) { /* specified file does not exist... try default file */
|
||||
@@ -1694,6 +1697,7 @@ void malloc_strings (struct context * cnt)
|
||||
*
|
||||
* copy_bool - convert a bool representation to int
|
||||
* copy_int - convert a string to int
|
||||
* copy_short - convert a string to short
|
||||
* copy_string - just a string copy
|
||||
*
|
||||
* @param str - A char *, pointing to a string representation of the
|
||||
@@ -1754,6 +1758,24 @@ static struct context ** copy_int(struct context **cnt, const char *str, int val
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/* copy_short assigns a config option to a new short value.
|
||||
* The integer is given as a string in str which is converted to short by the function.
|
||||
*/
|
||||
static struct context ** copy_short(struct context **cnt, const char *str, int val_ptr)
|
||||
{
|
||||
void *tmp;
|
||||
int i;
|
||||
|
||||
i=-1;
|
||||
while(cnt[++i]) {
|
||||
tmp = (char *)cnt[i]+val_ptr;
|
||||
*((short int *)tmp) = atoi(str);
|
||||
if (cnt[0]->threadnr)
|
||||
return cnt;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/* copy_string assigns a new string value to a config option.
|
||||
* Strings are handled differently from bool and int.
|
||||
* the char *conf->option that we are working on is free()'d
|
||||
@@ -1851,6 +1873,8 @@ const char *config_type(config_param *configparam)
|
||||
return "string";
|
||||
if (configparam->copy == copy_int)
|
||||
return "int";
|
||||
if (configparam->copy == copy_short)
|
||||
return "short";
|
||||
if (configparam->copy == copy_bool)
|
||||
return "bool";
|
||||
return "unknown";
|
||||
@@ -1908,6 +1932,21 @@ static const char *print_int(struct context **cnt, char **str ATTRIBUTE_UNUSED,
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static const char *print_short(struct context **cnt, char **str ATTRIBUTE_UNUSED,
|
||||
int parm, unsigned short int threadnr)
|
||||
{
|
||||
static char retval[20];
|
||||
int val = config_params[parm].conf_value;
|
||||
|
||||
if (threadnr &&
|
||||
*(short int*)((char *)cnt[threadnr] + val) == *(short int*)((char *)cnt[0] + val))
|
||||
return NULL;
|
||||
sprintf(retval, "%d", *(short int*)((char *)cnt[threadnr] + val));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static const char *print_thread(struct context **cnt, char **str,
|
||||
int parm ATTRIBUTE_UNUSED, unsigned short int threadnr)
|
||||
{
|
||||
|
||||
17
config.h.in
17
config.h.in
@@ -15,21 +15,12 @@
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* */
|
||||
/* Define to 1 if you have MySQL support */
|
||||
#undef HAVE_MYSQL
|
||||
|
||||
/* Define to 1 if you have PostgreSQL support */
|
||||
#undef HAVE_PGSQL
|
||||
|
||||
/* */
|
||||
#undef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
|
||||
|
||||
/* */
|
||||
#undef HAVE_PQCLIENTENCODING
|
||||
|
||||
/* */
|
||||
#undef HAVE_PQCMDTUPLES
|
||||
|
||||
/* */
|
||||
#undef HAVE_PQOIDVALUE
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#undef HAVE_SIGNAL_H
|
||||
|
||||
|
||||
664
configure
vendored
664
configure
vendored
@@ -1246,7 +1246,7 @@ if test -n "$ac_init_help"; then
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||
--with-linuxthreads Use linuxthreads in BSD instead of native phtreads
|
||||
--with-linuxthreads Use linuxthreads in BSD instead of native pthreads
|
||||
|
||||
|
||||
--without-bktr Exclude to use bktr subsystem , that usually useful
|
||||
@@ -1270,18 +1270,26 @@ Optional Packages:
|
||||
--without-mysql Disable mysql support in motion.
|
||||
|
||||
--with-mysql-lib=DIR Normally, configure will scan all possible default
|
||||
installation paths for mysql libs. When its fail, use
|
||||
installation paths for mysql libs. When it fails, use
|
||||
this command to tell configure where mysql libs
|
||||
installation root directory is.
|
||||
|
||||
--with-mysql-include=DIR Normally, configure will scan all possible default
|
||||
installation paths for mysql include. When its fail, use
|
||||
installation paths for mysql include. When it fails, use
|
||||
this command to tell configure where mysql include
|
||||
installation root directory is.
|
||||
|
||||
--with-pgsql=DIR Include PostgreSQL support. DIR is the PostgreSQL
|
||||
base install directory. If not specified configure will
|
||||
search in /usr, /usr/local and /usr/local/pgsql.
|
||||
--without-pgsql Disable PostgreSQL support in motion.
|
||||
|
||||
--with-pgsql-lib=DIR Normally, configure will scan all possible default
|
||||
installation paths for pgsql libs. When it fails, use
|
||||
this command to tell configure where pgsql libs
|
||||
installation root directory is.
|
||||
|
||||
--with-pgsql-include=DIR Normally, configure will scan all possible default
|
||||
installation paths for pgsql include. When it fails, use
|
||||
this command to tell configure where pgsql include
|
||||
installation root directory is.
|
||||
|
||||
--without-optimizecpu Exclude autodetecting platform and cpu type.
|
||||
This will disable the compilation of gcc
|
||||
@@ -1736,7 +1744,7 @@ ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
THREAD_CFLAGS=""
|
||||
THREAD_CHECK="pthread.h"
|
||||
THREAD_CHECK="/usr/include/pthread.h"
|
||||
|
||||
Darwin=""
|
||||
FreeBSD=""
|
||||
@@ -1790,6 +1798,7 @@ else
|
||||
VIDEO="video_freebsd.o"
|
||||
FINK_LIB="-L/sw/lib"
|
||||
Darwin="yes"
|
||||
V4L="no"
|
||||
{ echo "$as_me:$LINENO: result: $Darwin" >&5
|
||||
echo "${ECHO_T}$Darwin" >&6; }
|
||||
fi
|
||||
@@ -1797,6 +1806,7 @@ fi
|
||||
|
||||
|
||||
|
||||
# Checks for programs.
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@@ -2736,6 +2746,9 @@ echo "${ECHO_T}no" >&6; }
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -DOLD_BKTR"
|
||||
fi
|
||||
|
||||
#
|
||||
# Check to Exclude BKTR
|
||||
#
|
||||
BKTR="yes"
|
||||
|
||||
# Check whether --with-bktr was given.
|
||||
@@ -2752,6 +2765,9 @@ fi
|
||||
|
||||
else
|
||||
|
||||
#
|
||||
# Check to Exclude V4L
|
||||
#
|
||||
V4L="yes"
|
||||
|
||||
# Check whether --with-v4l was given.
|
||||
@@ -2764,10 +2780,6 @@ fi
|
||||
fi
|
||||
|
||||
|
||||
if test "${Darwin}" = "yes"; then
|
||||
V4L="no"
|
||||
fi
|
||||
|
||||
if test "${V4L}" = "no"; then
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L"
|
||||
fi
|
||||
@@ -2778,6 +2790,9 @@ if test "${FreeBSD}" != "" && test "${LINUXTHREADS}" != "no" ; then
|
||||
{ echo "$as_me:$LINENO: checking for linuxthreads" >&5
|
||||
echo $ECHO_N "checking for linuxthreads... $ECHO_C" >&6; }
|
||||
|
||||
#
|
||||
# Check for thread header
|
||||
#
|
||||
if test -f "${THREAD_CHECK}"; then
|
||||
HEADERS_THREAD_CFLAGS="-I/usr/local/include/pthread/linuxthreads"
|
||||
THREADS="yes"
|
||||
@@ -2785,6 +2800,9 @@ echo $ECHO_N "checking for linuxthreads... $ECHO_C" >&6; }
|
||||
THREADS="no"
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for thread lib
|
||||
#
|
||||
if test -f "${THREAD_LIB_CHECK}" ; then
|
||||
THREADS="yes"
|
||||
LIB_THREAD="-llthread -llgcc_r"
|
||||
@@ -2792,6 +2810,13 @@ echo $ECHO_N "checking for linuxthreads... $ECHO_C" >&6; }
|
||||
THREADS="no"
|
||||
fi
|
||||
|
||||
# Checks for Library linuxthreads for FreeBSD
|
||||
#
|
||||
# linuxthreads on freeBSD, ports collection
|
||||
# /usr/local/include/pthreads/linuxthreads/pthread.h
|
||||
# #include <linuxthreads/pthread.h>
|
||||
# /usr/local/lib/libpthread.so
|
||||
#
|
||||
|
||||
if test "${THREADS}" = "yes"; then
|
||||
TEMP_CFLAGS="${HEADERS_THREAD_CFLAGS} $TEMP_CFLAGS -DWITH_LINUXTREADS"
|
||||
@@ -2805,38 +2830,29 @@ echo "${ECHO_T}$THREADS" >&6; }
|
||||
{ echo "$as_me:$LINENO: result: $THREADS" >&5
|
||||
echo "${ECHO_T}$THREADS" >&6; }
|
||||
echo
|
||||
echo You do not have linuxthread installed
|
||||
echo "You do not have linuxthread installed"
|
||||
echo
|
||||
fi
|
||||
|
||||
else
|
||||
elif test -f "${THREAD_CHECK}"; then
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
|
||||
echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lpthread $LIBS"
|
||||
{ echo "$as_me:$LINENO: checking threads" >&5
|
||||
echo $ECHO_N "checking threads... $ECHO_C" >&6; }
|
||||
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char pthread_create ();
|
||||
#include <pthread.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return pthread_create ();
|
||||
pthread_t th; pthread_join(th, 0);
|
||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -2859,39 +2875,42 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_pthread_pthread_create=yes
|
||||
PTHREAD_LIB=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_pthread_pthread_create=no
|
||||
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6; }
|
||||
if test $ac_cv_lib_pthread_pthread_create = yes; then
|
||||
|
||||
if test x$PTHREAD_LIB != xyes; then
|
||||
|
||||
if test "${FreeBSD}" != ""; then
|
||||
TEMP_LIBS="$TEMP_LIBS -pthread"
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
|
||||
else
|
||||
TEMP_LIBS="$TEMP_LIBS -lpthread"
|
||||
PTHREAD_SUPPORT="yes"
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -D_REENTRANT"
|
||||
fi
|
||||
PTHREAD_SUPPORT="yes"
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $PTHREAD_SUPPORT" >&5
|
||||
echo "${ECHO_T}$PTHREAD_SUPPORT" >&6; }
|
||||
|
||||
else
|
||||
|
||||
echo
|
||||
echo You do not have pthread installed
|
||||
echo
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "You do not have threads support"
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Check for the special mmx accelerated jpeg library
|
||||
#
|
||||
JPEG_MMX="no"
|
||||
JPEG_MMX_OK="not_found"
|
||||
|
||||
@@ -2902,6 +2921,9 @@ if test "${with_jpeg_mmx+set}" = set; then
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# --without-jpeg-mmx or with-jpeg-mmx=no
|
||||
#
|
||||
|
||||
if test "${JPEG_MMX}" = "no"; then
|
||||
{ echo "$as_me:$LINENO: checking for libjpeg-mmx" >&5
|
||||
@@ -2909,7 +2931,8 @@ echo $ECHO_N "checking for libjpeg-mmx... $ECHO_C" >&6; }
|
||||
{ echo "$as_me:$LINENO: result: skipping" >&5
|
||||
echo "${ECHO_T}skipping" >&6; }
|
||||
elif test "${JPEG_MMX}" = "yes"; then
|
||||
{ echo "$as_me:$LINENO: checking for libjpeg-mmx autodetecting" >&5
|
||||
# AUTODETECT STATIC LIB
|
||||
{ echo "$as_me:$LINENO: checking for libjpeg-mmx autodetecting" >&5
|
||||
echo $ECHO_N "checking for libjpeg-mmx autodetecting... $ECHO_C" >&6; }
|
||||
|
||||
if test -f /usr/lib/libjpeg-mmx.a ; then
|
||||
@@ -2940,8 +2963,8 @@ echo "${ECHO_T}not found" >&6; }
|
||||
fi
|
||||
|
||||
if test "${JPEG_MMX_OK}" = "found"; then
|
||||
OLD_CFLAGS="$CFLAGS"
|
||||
OLD_LIBS="$LIBS"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS -I${JPEG_MMX}"
|
||||
LIBS="$LIBS -L${JPEG_MMX}"
|
||||
{ echo "$as_me:$LINENO: checking for jpeg_start_compress in -ljpeg-mmx" >&5
|
||||
@@ -3011,13 +3034,17 @@ if test $ac_cv_lib_jpeg_mmx_jpeg_start_compress = yes; then
|
||||
JPEG_SUPPORT="yes"
|
||||
fi
|
||||
|
||||
LIBS="$OLD_LIBS"
|
||||
CFLAGS="$OLD_CFLAGS"
|
||||
LIBS="$saved_LIBS"
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
JPEG_SUPPORT_MMX="yes"
|
||||
fi
|
||||
|
||||
#
|
||||
# Look for _a_ jpeg lib that will work.
|
||||
#
|
||||
if test x$JPEG_SUPPORT != xyes ; then
|
||||
LDFLAGS=$TEMP_LDFLAGS
|
||||
# Checks for libraries
|
||||
LDFLAGS=$TEMP_LDFLAGS
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for jpeg_set_defaults in -ljpeg" >&5
|
||||
echo $ECHO_N "checking for jpeg_set_defaults in -ljpeg... $ECHO_C" >&6; }
|
||||
@@ -3088,7 +3115,7 @@ if test $ac_cv_lib_jpeg_jpeg_set_defaults = yes; then
|
||||
else
|
||||
|
||||
echo
|
||||
echo You do not have libjpeg installed
|
||||
echo "You do not have libjpeg installed"
|
||||
echo
|
||||
|
||||
|
||||
@@ -4087,6 +4114,9 @@ echo $ECHO_N "checking mjpegtools... $ECHO_C" >&6; }
|
||||
echo "${ECHO_T}$MJPEG_SUPPORT" >&6; }
|
||||
|
||||
|
||||
#
|
||||
# Check for libavcodec and libavformat from ffmpeg
|
||||
#
|
||||
FFMPEG="yes"
|
||||
FFMPEG_OK="no_found"
|
||||
FFMPEG_OBJ=""
|
||||
@@ -4097,13 +4127,20 @@ if test "${with_ffmpeg+set}" = set; then
|
||||
|
||||
fi
|
||||
|
||||
#
|
||||
# --without-ffmpeg or with-ffmpeg=no
|
||||
#
|
||||
if test "${FFMPEG}" = "no"; then
|
||||
{ echo "$as_me:$LINENO: checking for ffmpeg" >&5
|
||||
echo $ECHO_N "checking for ffmpeg... $ECHO_C" >&6; }
|
||||
{ echo "$as_me:$LINENO: result: skipping" >&5
|
||||
echo "${ECHO_T}skipping" >&6; }
|
||||
#
|
||||
# with-ffmpeg=<dir> or nothing
|
||||
#
|
||||
else if test "${FFMPEG}" = "yes"; then
|
||||
{ echo "$as_me:$LINENO: checking for ffmpeg autodetecting" >&5
|
||||
# AUTODETECT STATIC/SHARED LIB
|
||||
{ echo "$as_me:$LINENO: checking for ffmpeg autodetecting" >&5
|
||||
echo $ECHO_N "checking for ffmpeg autodetecting... $ECHO_C" >&6; }
|
||||
|
||||
# weird hack to fix debian problem TO BE REMOVED
|
||||
@@ -4323,6 +4360,8 @@ echo "${ECHO_T}not found" >&6; }
|
||||
|
||||
{ echo "$as_me:$LINENO: checking file_protocol is defined in ffmpeg ?" >&5
|
||||
echo $ECHO_N "checking file_protocol is defined in ffmpeg ?... $ECHO_C" >&6; }
|
||||
saved_CFLAGS=$CFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CFLAGS="${FFMPEG_CFLAGS}"
|
||||
LIBS="$TEMP_LIBS"
|
||||
|
||||
@@ -4368,6 +4407,8 @@ echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS=$saved_CFLAGS
|
||||
LIBS=$saved_LIBS
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -4389,6 +4430,7 @@ echo $ECHO_N "checking for mysql support... $ECHO_C" >&6; }
|
||||
# Check whether --with-mysql was given.
|
||||
if test "${with_mysql+set}" = set; then
|
||||
withval=$with_mysql; MYSQL="$withval"
|
||||
# if not given argument, assume standard
|
||||
|
||||
fi
|
||||
|
||||
@@ -4397,6 +4439,7 @@ fi
|
||||
# Check whether --with-mysql-lib was given.
|
||||
if test "${with_mysql_lib+set}" = set; then
|
||||
withval=$with_mysql_lib; MYSQL_LIBS="$withval"
|
||||
# if not given argument, assume standard
|
||||
|
||||
fi
|
||||
|
||||
@@ -4406,6 +4449,7 @@ fi
|
||||
# Check whether --with-mysql-include was given.
|
||||
if test "${with_mysql_include+set}" = set; then
|
||||
withval=$with_mysql_include; MYSQL_HEADERS="$withval"
|
||||
# if not given argument, assume standard
|
||||
|
||||
fi
|
||||
|
||||
@@ -4458,7 +4502,7 @@ echo $ECHO_N "checking for mysql headers in $MYSQL_HEADERS... $ECHO_C" >&6; }
|
||||
MYSQL_HEADERS="no"
|
||||
{ echo "$as_me:$LINENO: result: not found" >&5
|
||||
echo "${ECHO_T}not found" >&6; }
|
||||
echo Invalid MySQL directory - unable to find mysql.h.
|
||||
echo "Invalid MySQL directory - unable to find mysql.h."
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6; }
|
||||
@@ -4508,15 +4552,93 @@ echo $ECHO_N "checking for mysql libs in $MYSQL_LIBS... $ECHO_C" >&6; }
|
||||
if test -z "$MYSQL_LIBDIR" ; then
|
||||
{ echo "$as_me:$LINENO: result: not found" >&5
|
||||
echo "${ECHO_T}not found" >&6; }
|
||||
echo Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so.
|
||||
echo "Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so."
|
||||
else
|
||||
TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient"
|
||||
#Add -lz for some mysql installs....
|
||||
TEMP_LIBS="$TEMP_LIBS -lz"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -DHAVE_MYSQL -I$MYSQL_INCDIR"
|
||||
{ echo "$as_me:$LINENO: result: found" >&5
|
||||
echo "${ECHO_T}found" >&6; }
|
||||
MYSQL_SUPPORT="yes"
|
||||
#LDFLAGS="-L$MYSQL_LIBDIR"
|
||||
saved_CFLAGS=$CFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CFLAGS="-I$MYSQL_INCDIR"
|
||||
LIBS="-L$MYSQL_LIBDIR"
|
||||
{ echo "$as_me:$LINENO: checking for mysql_init in -lmysqlclient" >&5
|
||||
echo $ECHO_N "checking for mysql_init in -lmysqlclient... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_mysqlclient_mysql_init+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lmysqlclient $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char mysql_init ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return mysql_init ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_mysqlclient_mysql_init=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_mysqlclient_mysql_init=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_init" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_init" >&6; }
|
||||
if test $ac_cv_lib_mysqlclient_mysql_init = yes; then
|
||||
|
||||
TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient -lz"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -I$MYSQL_INCDIR"
|
||||
MYSQL_SUPPORT="yes"
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_MYSQL 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
else
|
||||
{ { echo "$as_me:$LINENO: error: MySQL support can't build without MySQL libraries" >&5
|
||||
echo "$as_me: error: MySQL support can't build without MySQL libraries" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
CFLAGS=$saved_CFLAGS
|
||||
LIBS=$saved_LIBS
|
||||
fi
|
||||
|
||||
# end mysql-include , mysql-libs
|
||||
@@ -4526,44 +4648,143 @@ echo "${ECHO_T}found" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Check PostgreSQL
|
||||
#
|
||||
PGSQL="yes"
|
||||
PGSQL_SUPPORT="no"
|
||||
PGSQL_HEADERS="yes"
|
||||
PGSQL_LIBS="yes"
|
||||
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for PostgreSQL" >&5
|
||||
echo $ECHO_N "checking for PostgreSQL... $ECHO_C" >&6; }
|
||||
|
||||
# Check whether --with-pgsql was given.
|
||||
if test "${with_pgsql+set}" = set; then
|
||||
withval=$with_pgsql; PGSQL="$withval"
|
||||
# if not given argument, assume standard
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --with-pgsql-lib was given.
|
||||
if test "${with_pgsql_lib+set}" = set; then
|
||||
withval=$with_pgsql_lib; PGSQL_LIBS="$withval"
|
||||
# if not given argument, assume standard
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --with-pgsql-include was given.
|
||||
if test "${with_pgsql_include+set}" = set; then
|
||||
withval=$with_pgsql_include; PGSQL_HEADERS="$withval"
|
||||
# if not given argument, assume standard
|
||||
|
||||
fi
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for PostgreSQL" >&5
|
||||
echo $ECHO_N "checking for PostgreSQL... $ECHO_C" >&6; }
|
||||
|
||||
if test "${PGSQL}" = "no"; then
|
||||
{ echo "$as_me:$LINENO: result: skipped" >&5
|
||||
echo "${ECHO_T}skipped" >&6; }
|
||||
fi
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: testing" >&5
|
||||
echo "${ECHO_T}testing" >&6; }
|
||||
|
||||
if test "${PGSQL}" = "yes"; then
|
||||
for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
|
||||
if test -r $i/include/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i/include
|
||||
elif test -r $i/include/pgsql/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i/include/pgsql
|
||||
elif test -r $i/include/postgresql/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i/include/postgresql
|
||||
fi
|
||||
done
|
||||
# ******* Search pgsql headers *******
|
||||
if test "${PGSQL_HEADERS}" = "yes"; then
|
||||
|
||||
if test -z "$PGSQL_DIR"; then
|
||||
{ echo "$as_me:$LINENO: result: Cannot find libpq-fe.h. Please specify the installation path of PostgreSQL" >&5
|
||||
echo "${ECHO_T}Cannot find libpq-fe.h. Please specify the installation path of PostgreSQL" >&6; }
|
||||
{ echo "$as_me:$LINENO: checking autodect pgsql headers" >&5
|
||||
echo $ECHO_N "checking autodect pgsql headers... $ECHO_C" >&6; }
|
||||
# Autodetect
|
||||
for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
|
||||
if test -r $i/include/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i/include
|
||||
elif test -r $i/include/pgsql/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i/include/pgsql
|
||||
elif test -r $i/include/postgresql/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i/include/postgresql
|
||||
fi
|
||||
done
|
||||
|
||||
elif test "${PGSQL_HEADERS}" = "no"; then
|
||||
{ echo "$as_me:$LINENO: checking for pgsql headers" >&5
|
||||
echo $ECHO_N "checking for pgsql headers... $ECHO_C" >&6; }
|
||||
{ echo "$as_me:$LINENO: result: skipped" >&5
|
||||
echo "${ECHO_T}skipped" >&6; }
|
||||
else
|
||||
PGSQL_INCLUDE="-I$PGSQL_INCDIR"
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib
|
||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6; }
|
||||
test -d $PGSQL_DIR/lib/pgsql && PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
|
||||
LDFLAGS="$TEMP_LDFLAGS -L$PGSQL_LIBDIR"
|
||||
{ echo "$as_me:$LINENO: checking for PQcmdTuples in -lpq" >&5
|
||||
echo $ECHO_N "checking for PQcmdTuples in -lpq... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_pq_PQcmdTuples+set}" = set; then
|
||||
{ echo "$as_me:$LINENO: checking for pgsql headers in $PGSQL_HEADERS" >&5
|
||||
echo $ECHO_N "checking for pgsql headers in $PGSQL_HEADERS... $ECHO_C" >&6; }
|
||||
# Manual detection for <withval>
|
||||
if test -f $PGSQL_HEADERS/libpq-fe.h; then
|
||||
PGSQL_INCDIR=$PGSQL_HEADERS
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$PGSQL_INCDIR" ; then
|
||||
PGSQL_HEADERS="no"
|
||||
{ echo "$as_me:$LINENO: result: not found" >&5
|
||||
echo "${ECHO_T}not found" >&6; }
|
||||
echo "Invalid PostgreSQL directory - unable to find libpq-fe.h."
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: yes $PGSQL_INCDIR" >&5
|
||||
echo "${ECHO_T}yes $PGSQL_INCDIR" >&6; }
|
||||
PGSQL_HEADERS="yes"
|
||||
fi
|
||||
|
||||
|
||||
if test "${PGSQL_HEADERS}" = "yes"; then
|
||||
|
||||
# ******* Search pgsql libs *********
|
||||
if test "${PGSQL_LIBS}" = "yes"; then
|
||||
{ echo "$as_me:$LINENO: checking autodect pgsql libs" >&5
|
||||
echo $ECHO_N "checking autodect pgsql libs... $ECHO_C" >&6; }
|
||||
# Autodetect
|
||||
PGSQL_INCLUDE="-I$PGSQL_INCDIR"
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib
|
||||
|
||||
if test -f $PGSQL_DIR/lib/pgsql/libpq.so ; then
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
|
||||
elif test -f $PGSQL_DIR/lib/postgresql/libpq.so ; then
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib/postgresql
|
||||
elif test -f $PGSQL_DIR/lib/libpq.so ; then
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib
|
||||
else
|
||||
PGSQL_LIBDIR=""
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: result: $PGSQL_LIBDIR" >&5
|
||||
echo "${ECHO_T}$PGSQL_LIBDIR" >&6; }
|
||||
|
||||
elif test "${PGSQL_LIBS}" = "no"; then
|
||||
{ echo "$as_me:$LINENO: checking for pgsql libs" >&5
|
||||
echo $ECHO_N "checking for pgsql libs... $ECHO_C" >&6; }
|
||||
{ echo "$as_me:$LINENO: result: skipped" >&5
|
||||
echo "${ECHO_T}skipped" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: checking for pgsql libs in $PGSQL_LIBS" >&5
|
||||
echo $ECHO_N "checking for pgsql libs in $PGSQL_LIBS... $ECHO_C" >&6; }
|
||||
# Manual detection for <withval>
|
||||
if test -f $PGSQL_LIBS/libpq.a -o -f $PGSQL_LIBS/libpq.so; then
|
||||
PGSQL_LIBDIR=$PGSQL_LIBS
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test -z "$PGSQL_LIBDIR" ; then
|
||||
{ echo "$as_me:$LINENO: result: not found" >&5
|
||||
echo "${ECHO_T}not found" >&6; }
|
||||
echo "Invalid PostgreSQL directory $PGSQL_LIBDIR - unable to find libpq.a or libpq.so."
|
||||
else
|
||||
#LDFLAGS="$TEMP_LDFLAGS -L$PGSQL_LIBDIR"
|
||||
saved_CFLAGS=$CFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CFLAGS="-I$PGSQL_INCDIR"
|
||||
LIBS="-L$PGSQL_LIBDIR"
|
||||
{ echo "$as_me:$LINENO: checking for PQconnectStart in -lpq" >&5
|
||||
echo $ECHO_N "checking for PQconnectStart in -lpq... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_pq_PQconnectStart+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
@@ -4581,11 +4802,11 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char PQcmdTuples ();
|
||||
char PQconnectStart ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return PQcmdTuples ();
|
||||
return PQconnectStart ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -4608,247 +4829,51 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_pq_PQcmdTuples=yes
|
||||
ac_cv_lib_pq_PQconnectStart=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_pq_PQcmdTuples=no
|
||||
ac_cv_lib_pq_PQconnectStart=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQcmdTuples" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_pq_PQcmdTuples" >&6; }
|
||||
if test $ac_cv_lib_pq_PQcmdTuples = yes; then
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQconnectStart" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_pq_PQconnectStart" >&6; }
|
||||
if test $ac_cv_lib_pq_PQconnectStart = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_PQCMDTUPLES 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for PQoidValue in -lpq" >&5
|
||||
echo $ECHO_N "checking for PQoidValue in -lpq... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_pq_PQoidValue+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lpq $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char PQoidValue ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return PQoidValue ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_pq_PQoidValue=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_pq_PQoidValue=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQoidValue" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_pq_PQoidValue" >&6; }
|
||||
if test $ac_cv_lib_pq_PQoidValue = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_PQOIDVALUE 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for PQclientEncoding in -lpq" >&5
|
||||
echo $ECHO_N "checking for PQclientEncoding in -lpq... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_pq_PQclientEncoding+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lpq $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char PQclientEncoding ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return PQclientEncoding ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_pq_PQclientEncoding=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_pq_PQclientEncoding=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQclientEncoding" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_pq_PQclientEncoding" >&6; }
|
||||
if test $ac_cv_lib_pq_PQclientEncoding = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_PQCLIENTENCODING 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for pg_encoding_to_char in -lpq" >&5
|
||||
echo $ECHO_N "checking for pg_encoding_to_char in -lpq... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_pq_pg_encoding_to_char+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lpq $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char pg_encoding_to_char ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return pg_encoding_to_char ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_pq_pg_encoding_to_char=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_pq_pg_encoding_to_char=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_pg_encoding_to_char" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_pq_pg_encoding_to_char" >&6; }
|
||||
if test $ac_cv_lib_pq_pg_encoding_to_char = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
LDFLAGS=""
|
||||
PGSQL_SUPPORT="yes"
|
||||
TEMP_LIBS="$TEMP_LIBS -L$PGSQL_LIBDIR -lpq"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -I$PGSQL_INCDIR"
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_PGSQL 1
|
||||
_ACEOF
|
||||
|
||||
TEMP_LIBS="$TEMP_LIBS -L$PGSQL_LIBDIR -lpq"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -DHAVE_PGSQL $PGSQL_INCLUDE"
|
||||
PostgreSQL_SUPPORT="yes"
|
||||
fi
|
||||
|
||||
else
|
||||
{ { echo "$as_me:$LINENO: error: PostgreSQL support can't build without PostgreSQL libraries" >&5
|
||||
echo "$as_me: error: PostgreSQL support can't build without PostgreSQL libraries" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
LDFLAGS=""
|
||||
{ echo "$as_me:$LINENO: result: $PGSQL_SUPPORT" >&5
|
||||
echo "${ECHO_T}$PGSQL_SUPPORT" >&6; }
|
||||
CFLAGS=$saved_CFLAGS
|
||||
LIBS=$saved_LIBS
|
||||
fi
|
||||
|
||||
fi # end pgsql-include , pgsql-libs
|
||||
|
||||
# end PostgreSQL detection
|
||||
fi
|
||||
|
||||
|
||||
#Checks for header files.
|
||||
{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
|
||||
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_header_stdc+set}" = set; then
|
||||
@@ -5176,6 +5201,7 @@ done
|
||||
|
||||
|
||||
|
||||
# Check if v4l2 is available
|
||||
SUPPORTED_V4L2=false
|
||||
SUPPORTED_V4L2_old=false
|
||||
|
||||
@@ -5259,7 +5285,8 @@ echo "${ECHO_T}yes" >&6; }
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
if test x$SUPPORTED_V4L2 = xfalse; then
|
||||
# linux/videodev.h doesn't include videodev2.h
|
||||
if test x$SUPPORTED_V4L2 = xfalse; then
|
||||
{ echo "$as_me:$LINENO: checking for V42L *old* support" >&5
|
||||
echo $ECHO_N "checking for V42L *old* support... $ECHO_C" >&6; }
|
||||
{ echo "$as_me:$LINENO: result: testing" >&5
|
||||
@@ -5333,6 +5360,7 @@ done
|
||||
fi
|
||||
|
||||
|
||||
# Check sizes of integer types
|
||||
{ echo "$as_me:$LINENO: checking for short int" >&5
|
||||
echo $ECHO_N "checking for short int... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_type_short_int+set}" = set; then
|
||||
@@ -6582,6 +6610,7 @@ if test "${with_developer_flags+set}" = set; then
|
||||
fi
|
||||
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
|
||||
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_c_const+set}" = set; then
|
||||
@@ -6695,6 +6724,7 @@ fi
|
||||
|
||||
if test "${OPTIMIZECPU}" = "yes"; then
|
||||
|
||||
# Try to autodetect cpu type
|
||||
CPU_NAME="unknown"
|
||||
CPU_TYPE="unknown"
|
||||
if test -e "/proc/cpuinfo" ; then
|
||||
@@ -6877,6 +6907,7 @@ if test "x${CPU_TYPE}" = "xunknown"; then
|
||||
fi
|
||||
fi
|
||||
echo "Detected CPU: $CPU_NAME"
|
||||
# Now we check if the compiler supports the detected cpu
|
||||
COMPILER=$CC
|
||||
for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
|
||||
test "$I" && break
|
||||
@@ -6971,6 +7002,9 @@ CFLAGS="${TEMP_CFLAGS} $UNAME_DEFS $CPU_OPTIONS"
|
||||
LIBS="${TEMP_LIBS}"
|
||||
LDFLAGS="${TEMP_LDFLAGS}"
|
||||
|
||||
#
|
||||
# Add the right exec path for rc scripts
|
||||
#
|
||||
if test $prefix = "NONE";then
|
||||
BIN_PATH="$ac_default_prefix"
|
||||
if test $exec_prefix = "NONE"; then
|
||||
@@ -8103,7 +8137,7 @@ echo " *********************"
|
||||
echo " Configure status "
|
||||
echo " ${PACKAGE_NAME} ${PACKAGE_VERSION}"
|
||||
echo " *********************"
|
||||
echo ""
|
||||
echo
|
||||
|
||||
|
||||
if test "${Darwin}" != ""; then
|
||||
@@ -8174,12 +8208,12 @@ else
|
||||
echo "MYSQL Support: No"
|
||||
fi
|
||||
|
||||
if test "${PostgreSQL_SUPPORT}" = "yes"; then
|
||||
if test "${PGSQL_SUPPORT}" = "yes"; then
|
||||
echo "PostgreSQL Support: Yes"
|
||||
else
|
||||
echo "PostgreSQL Support: No"
|
||||
fi
|
||||
echo ""
|
||||
echo
|
||||
|
||||
echo "CFLAGS: $CFLAGS"
|
||||
echo "LIBS: $LIBS"
|
||||
|
||||
362
configure.in
362
configure.in
@@ -1,17 +1,18 @@
|
||||
dnl Process this file with autoconf to produce a configure script
|
||||
# Process this file with autoconf to produce a configure script
|
||||
|
||||
AC_INIT(motion,3.2.10)
|
||||
AC_CONFIG_SRCDIR([motion.c])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
THREAD_CFLAGS=""
|
||||
THREAD_CHECK="pthread.h"
|
||||
THREAD_CHECK="/usr/include/pthread.h"
|
||||
|
||||
Darwin=""
|
||||
FreeBSD=""
|
||||
|
||||
LINUXTHREADS="no"
|
||||
AC_ARG_WITH(linuxthreads,
|
||||
[ --with-linuxthreads Use linuxthreads in BSD instead of native phtreads
|
||||
[ --with-linuxthreads Use linuxthreads in BSD instead of native pthreads
|
||||
]
|
||||
,
|
||||
LINUXTHREADS="$withval"
|
||||
@@ -50,13 +51,14 @@ else
|
||||
VIDEO="video_freebsd.o"
|
||||
FINK_LIB="-L/sw/lib"
|
||||
Darwin="yes"
|
||||
V4L="no"
|
||||
AC_MSG_RESULT($Darwin)
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST(VIDEO)
|
||||
|
||||
dnl Checks for programs.
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
||||
TEMP_LIBS="-lm ${TEMP_LIBS}"
|
||||
@@ -75,9 +77,9 @@ else
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -DOLD_BKTR"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check to Exclude BKTR
|
||||
dnl
|
||||
#
|
||||
# Check to Exclude BKTR
|
||||
#
|
||||
BKTR="yes"
|
||||
AC_ARG_WITH(bktr,
|
||||
[ --without-bktr Exclude to use bktr subsystem , that usually useful
|
||||
@@ -94,9 +96,9 @@ BKTR="$withval"
|
||||
|
||||
else
|
||||
|
||||
dnl
|
||||
dnl Check to Exclude V4L
|
||||
dnl
|
||||
#
|
||||
# Check to Exclude V4L
|
||||
#
|
||||
V4L="yes"
|
||||
AC_ARG_WITH(v4l,
|
||||
[ --without-v4l Exclude using v4l (video4linux) subsystem.
|
||||
@@ -108,10 +110,6 @@ V4L="$withval"
|
||||
fi
|
||||
|
||||
|
||||
if test "${Darwin}" = "yes"; then
|
||||
V4L="no"
|
||||
fi
|
||||
|
||||
if test "${V4L}" = "no"; then
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L"
|
||||
fi
|
||||
@@ -121,9 +119,9 @@ if test "${FreeBSD}" != "" && test "${LINUXTHREADS}" != "no" ; then
|
||||
|
||||
AC_MSG_CHECKING(for linuxthreads)
|
||||
|
||||
dnl
|
||||
dnl Check for thread header
|
||||
dnl
|
||||
#
|
||||
# Check for thread header
|
||||
#
|
||||
if test -f "${THREAD_CHECK}"; then
|
||||
HEADERS_THREAD_CFLAGS="-I/usr/local/include/pthread/linuxthreads"
|
||||
THREADS="yes"
|
||||
@@ -131,9 +129,9 @@ dnl
|
||||
THREADS="no"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for thread lib
|
||||
dnl
|
||||
#
|
||||
# Check for thread lib
|
||||
#
|
||||
if test -f "${THREAD_LIB_CHECK}" ; then
|
||||
THREADS="yes"
|
||||
LIB_THREAD="-llthread -llgcc_r"
|
||||
@@ -141,13 +139,13 @@ dnl
|
||||
THREADS="no"
|
||||
fi
|
||||
|
||||
dnl Checks for Library linuxthreads for FreeBSD
|
||||
dnl
|
||||
dnl linuxthreads on freeBSD, ports collection
|
||||
dnl /usr/local/include/pthreads/linuxthreads/pthread.h
|
||||
dnl #include <linuxthreads/pthread.h>
|
||||
dnl /usr/local/lib/libpthread.so
|
||||
dnl
|
||||
# Checks for Library linuxthreads for FreeBSD
|
||||
#
|
||||
# linuxthreads on freeBSD, ports collection
|
||||
# /usr/local/include/pthreads/linuxthreads/pthread.h
|
||||
# #include <linuxthreads/pthread.h>
|
||||
# /usr/local/lib/libpthread.so
|
||||
#
|
||||
|
||||
if test "${THREADS}" = "yes"; then
|
||||
TEMP_CFLAGS="${HEADERS_THREAD_CFLAGS} $TEMP_CFLAGS -DWITH_LINUXTREADS"
|
||||
@@ -159,30 +157,44 @@ dnl
|
||||
PTHREAD_SUPPORT="no"
|
||||
AC_MSG_RESULT($THREADS)
|
||||
echo
|
||||
echo You do not have linuxthread installed
|
||||
echo "You do not have linuxthread installed"
|
||||
echo
|
||||
fi
|
||||
|
||||
else
|
||||
elif test -f "${THREAD_CHECK}"; then
|
||||
|
||||
dnl Checks for Library pthread ( no cross platform )
|
||||
AC_CHECK_LIB(pthread,pthread_create,[
|
||||
|
||||
AC_MSG_CHECKING(threads)
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_t th; pthread_join(th, 0);
|
||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||
[PTHREAD_LIB=yes])
|
||||
|
||||
if test x$PTHREAD_LIB != xyes; then
|
||||
|
||||
if test "${FreeBSD}" != ""; then
|
||||
TEMP_LIBS="$TEMP_LIBS -pthread"
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
|
||||
else
|
||||
TEMP_LIBS="$TEMP_LIBS -lpthread"
|
||||
PTHREAD_SUPPORT="yes"
|
||||
],[
|
||||
echo
|
||||
echo You do not have pthread installed
|
||||
echo
|
||||
]
|
||||
)
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -D_REENTRANT"
|
||||
fi
|
||||
PTHREAD_SUPPORT="yes"
|
||||
fi
|
||||
AC_MSG_RESULT($PTHREAD_SUPPORT)
|
||||
|
||||
else
|
||||
echo
|
||||
echo "You do not have threads support"
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
|
||||
dnl
|
||||
dnl Check for the special mmx accelerated jpeg library
|
||||
dnl
|
||||
#
|
||||
# Check for the special mmx accelerated jpeg library
|
||||
#
|
||||
JPEG_MMX="no"
|
||||
JPEG_MMX_OK="not_found"
|
||||
AC_ARG_WITH(jpeg-mmx,
|
||||
@@ -194,15 +206,15 @@ AC_ARG_WITH(jpeg-mmx,
|
||||
JPEG_MMX="$withval"
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl --without-jpeg-mmx or with-jpeg-mmx=no
|
||||
dnl
|
||||
#
|
||||
# --without-jpeg-mmx or with-jpeg-mmx=no
|
||||
#
|
||||
|
||||
if test "${JPEG_MMX}" = "no"; then
|
||||
AC_MSG_CHECKING(for libjpeg-mmx)
|
||||
AC_MSG_RESULT(skipping)
|
||||
elif test "${JPEG_MMX}" = "yes"; then
|
||||
dnl AUTODETECT STATIC LIB
|
||||
# AUTODETECT STATIC LIB
|
||||
AC_MSG_CHECKING(for libjpeg-mmx autodetecting)
|
||||
|
||||
if test -f /usr/lib/libjpeg-mmx.a ; then
|
||||
@@ -227,24 +239,24 @@ else
|
||||
fi
|
||||
|
||||
if test "${JPEG_MMX_OK}" = "found"; then
|
||||
OLD_CFLAGS="$CFLAGS"
|
||||
OLD_LIBS="$LIBS"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS -I${JPEG_MMX}"
|
||||
LIBS="$LIBS -L${JPEG_MMX}"
|
||||
AC_CHECK_LIB(jpeg-mmx, jpeg_start_compress,
|
||||
[ TEMP_LIBS="$TEMP_LIBS -ljpeg-mmx"
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -I${JPEG_MMX}"
|
||||
JPEG_SUPPORT="yes"],,)
|
||||
LIBS="$OLD_LIBS"
|
||||
CFLAGS="$OLD_CFLAGS"
|
||||
LIBS="$saved_LIBS"
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
JPEG_SUPPORT_MMX="yes"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Look for _a_ jpeg lib that will work.
|
||||
dnl
|
||||
#
|
||||
# Look for _a_ jpeg lib that will work.
|
||||
#
|
||||
if test x$JPEG_SUPPORT != xyes ; then
|
||||
dnl Checks for libraries
|
||||
# Checks for libraries
|
||||
LDFLAGS=$TEMP_LDFLAGS
|
||||
|
||||
AC_CHECK_LIB(jpeg, jpeg_set_defaults, [
|
||||
@@ -252,7 +264,7 @@ if test x$JPEG_SUPPORT != xyes ; then
|
||||
JPEG_SUPPORT="yes"
|
||||
], [
|
||||
echo
|
||||
echo You do not have libjpeg installed
|
||||
echo "You do not have libjpeg installed"
|
||||
echo
|
||||
]
|
||||
)
|
||||
@@ -285,9 +297,9 @@ AC_MSG_CHECKING(mjpegtools)
|
||||
AC_MSG_RESULT($MJPEG_SUPPORT)
|
||||
|
||||
|
||||
dnl
|
||||
dnl Check for libavcodec and libavformat from ffmpeg
|
||||
dnl
|
||||
#
|
||||
# Check for libavcodec and libavformat from ffmpeg
|
||||
#
|
||||
FFMPEG="yes"
|
||||
FFMPEG_OK="no_found"
|
||||
FFMPEG_OBJ=""
|
||||
@@ -300,17 +312,17 @@ AC_ARG_WITH(ffmpeg,
|
||||
],
|
||||
FFMPEG="$withval"
|
||||
)
|
||||
dnl
|
||||
dnl --without-ffmpeg or with-ffmpeg=no
|
||||
dnl
|
||||
#
|
||||
# --without-ffmpeg or with-ffmpeg=no
|
||||
#
|
||||
if test "${FFMPEG}" = "no"; then
|
||||
AC_MSG_CHECKING(for ffmpeg)
|
||||
AC_MSG_RESULT(skipping)
|
||||
dnl
|
||||
dnl with-ffmpeg=<dir> or nothing
|
||||
dnl
|
||||
#
|
||||
# with-ffmpeg=<dir> or nothing
|
||||
#
|
||||
else if test "${FFMPEG}" = "yes"; then
|
||||
dnl AUTODETECT STATIC/SHARED LIB
|
||||
# AUTODETECT STATIC/SHARED LIB
|
||||
AC_MSG_CHECKING(for ffmpeg autodetecting)
|
||||
|
||||
# weird hack to fix debian problem TO BE REMOVED
|
||||
@@ -425,6 +437,8 @@ if test "${FFMPEG_OK}" = "found"; then
|
||||
AC_SUBST(FFMPEG_OBJ)
|
||||
|
||||
AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?])
|
||||
saved_CFLAGS=$CFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CFLAGS="${FFMPEG_CFLAGS}"
|
||||
LIBS="$TEMP_LIBS"
|
||||
|
||||
@@ -443,6 +457,8 @@ if test "${FFMPEG_OK}" = "found"; then
|
||||
TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_NEW"
|
||||
]
|
||||
)
|
||||
CFLAGS=$saved_CFLAGS
|
||||
LIBS=$saved_LIBS
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -463,28 +479,28 @@ AC_ARG_WITH(mysql,
|
||||
[ --without-mysql Disable mysql support in motion.
|
||||
],
|
||||
MYSQL="$withval"
|
||||
dnl if not given argument, assume standard
|
||||
# if not given argument, assume standard
|
||||
)
|
||||
|
||||
AC_ARG_WITH(mysql-lib,
|
||||
[ --with-mysql-lib[=DIR] Normally, configure will scan all possible default
|
||||
installation paths for mysql libs. When its fail, use
|
||||
installation paths for mysql libs. When it fails, use
|
||||
this command to tell configure where mysql libs
|
||||
installation root directory is.
|
||||
],
|
||||
MYSQL_LIBS="$withval"
|
||||
dnl if not given argument, assume standard
|
||||
# if not given argument, assume standard
|
||||
)
|
||||
|
||||
|
||||
AC_ARG_WITH(mysql-include,
|
||||
[ --with-mysql-include[=DIR] Normally, configure will scan all possible default
|
||||
installation paths for mysql include. When its fail, use
|
||||
installation paths for mysql include. When it fails, use
|
||||
this command to tell configure where mysql include
|
||||
installation root directory is.
|
||||
],
|
||||
MYSQL_HEADERS="$withval"
|
||||
dnl if not given argument, assume standard
|
||||
# if not given argument, assume standard
|
||||
)
|
||||
|
||||
|
||||
@@ -528,7 +544,7 @@ else
|
||||
if test -z "$MYSQL_INCDIR" ; then
|
||||
MYSQL_HEADERS="no"
|
||||
AC_MSG_RESULT(not found)
|
||||
echo Invalid MySQL directory - unable to find mysql.h.
|
||||
echo "Invalid MySQL directory - unable to find mysql.h."
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
MYSQL_HEADERS="yes"
|
||||
@@ -572,14 +588,22 @@ else
|
||||
|
||||
if test -z "$MYSQL_LIBDIR" ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
echo Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so.
|
||||
echo "Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so."
|
||||
else
|
||||
TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient"
|
||||
#Add -lz for some mysql installs....
|
||||
TEMP_LIBS="$TEMP_LIBS -lz"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -DHAVE_MYSQL -I$MYSQL_INCDIR"
|
||||
AC_MSG_RESULT(found)
|
||||
MYSQL_SUPPORT="yes"
|
||||
#LDFLAGS="-L$MYSQL_LIBDIR"
|
||||
saved_CFLAGS=$CFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CFLAGS="-I$MYSQL_INCDIR"
|
||||
LIBS="-L$MYSQL_LIBDIR"
|
||||
AC_CHECK_LIB(mysqlclient,mysql_init,[
|
||||
TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient -lz"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -I$MYSQL_INCDIR"
|
||||
MYSQL_SUPPORT="yes"
|
||||
AC_DEFINE([HAVE_MYSQL],1,[Define to 1 if you have MySQL support])
|
||||
],
|
||||
AC_MSG_ERROR(MySQL support can't build without MySQL libraries))
|
||||
CFLAGS=$saved_CFLAGS
|
||||
LIBS=$saved_LIBS
|
||||
fi
|
||||
|
||||
# end mysql-include , mysql-libs
|
||||
@@ -589,58 +613,150 @@ else
|
||||
fi
|
||||
|
||||
|
||||
dnl Start Check for Postgresql
|
||||
AC_DEFUN(PGSQL_INC_CHK,[if test -r $i$1/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i$1])
|
||||
#
|
||||
# Check PostgreSQL
|
||||
#
|
||||
PGSQL="yes"
|
||||
PGSQL_SUPPORT="no"
|
||||
PGSQL_HEADERS="yes"
|
||||
PGSQL_LIBS="yes"
|
||||
|
||||
AC_DEFUN(PGSQL_INC_CHK,[if test -r $i$1/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i$1])
|
||||
|
||||
AC_MSG_CHECKING(for PostgreSQL)
|
||||
AC_ARG_WITH(pgsql,
|
||||
[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
|
||||
base install directory. If not specified configure will
|
||||
search in /usr, /usr/local and /usr/local/pgsql.
|
||||
[ --without-pgsql Disable PostgreSQL support in motion.
|
||||
],
|
||||
PGSQL="$withval"
|
||||
dnl if not given argument, assume standard
|
||||
# if not given argument, assume standard
|
||||
)
|
||||
|
||||
AC_ARG_WITH(pgsql-lib,
|
||||
[ --with-pgsql-lib[=DIR] Normally, configure will scan all possible default
|
||||
installation paths for pgsql libs. When it fails, use
|
||||
this command to tell configure where pgsql libs
|
||||
installation root directory is.
|
||||
],
|
||||
PGSQL_LIBS="$withval"
|
||||
# if not given argument, assume standard
|
||||
)
|
||||
|
||||
AC_ARG_WITH(pgsql-include,
|
||||
[ --with-pgsql-include[=DIR] Normally, configure will scan all possible default
|
||||
installation paths for pgsql include. When it fails, use
|
||||
this command to tell configure where pgsql include
|
||||
installation root directory is.
|
||||
],
|
||||
PGSQL_HEADERS="$withval"
|
||||
# if not given argument, assume standard
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for PostgreSQL)
|
||||
|
||||
if test "${PGSQL}" = "no"; then
|
||||
AC_MSG_RESULT(skipped)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(testing)
|
||||
|
||||
if test "${PGSQL}" = "yes"; then
|
||||
for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
|
||||
PGSQL_INC_CHK(/include)
|
||||
el[]PGSQL_INC_CHK(/include/pgsql)
|
||||
el[]PGSQL_INC_CHK(/include/postgresql)
|
||||
fi
|
||||
done
|
||||
# ******* Search pgsql headers *******
|
||||
if test "${PGSQL_HEADERS}" = "yes"; then
|
||||
|
||||
if test -z "$PGSQL_DIR"; then
|
||||
AC_MSG_RESULT(Cannot find libpq-fe.h. Please specify the installation path of PostgreSQL)
|
||||
AC_MSG_CHECKING(autodect pgsql headers)
|
||||
# Autodetect
|
||||
for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
|
||||
PGSQL_INC_CHK(/include)
|
||||
el[]PGSQL_INC_CHK(/include/pgsql)
|
||||
el[]PGSQL_INC_CHK(/include/postgresql)
|
||||
fi
|
||||
done
|
||||
|
||||
elif test "${PGSQL_HEADERS}" = "no"; then
|
||||
AC_MSG_CHECKING(for pgsql headers)
|
||||
AC_MSG_RESULT(skipped)
|
||||
else
|
||||
PGSQL_INCLUDE="-I$PGSQL_INCDIR"
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib
|
||||
AC_MSG_RESULT(yes)
|
||||
test -d $PGSQL_DIR/lib/pgsql && PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
|
||||
LDFLAGS="$TEMP_LDFLAGS -L$PGSQL_LIBDIR"
|
||||
AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[ ]))
|
||||
AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[ ]))
|
||||
AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[ ]))
|
||||
AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[ ]))
|
||||
LDFLAGS=""
|
||||
AC_DEFINE(HAVE_PGSQL,1,[ ])
|
||||
TEMP_LIBS="$TEMP_LIBS -L$PGSQL_LIBDIR -lpq"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -DHAVE_PGSQL $PGSQL_INCLUDE"
|
||||
PostgreSQL_SUPPORT="yes"
|
||||
AC_MSG_CHECKING(for pgsql headers in $PGSQL_HEADERS)
|
||||
# Manual detection for <withval>
|
||||
if test -f $PGSQL_HEADERS/libpq-fe.h; then
|
||||
PGSQL_INCDIR=$PGSQL_HEADERS
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
dnl End Postgresql
|
||||
|
||||
dnl Checks for header files.
|
||||
if test -z "$PGSQL_INCDIR" ; then
|
||||
PGSQL_HEADERS="no"
|
||||
AC_MSG_RESULT(not found)
|
||||
echo "Invalid PostgreSQL directory - unable to find libpq-fe.h."
|
||||
else
|
||||
AC_MSG_RESULT(yes [$PGSQL_INCDIR])
|
||||
PGSQL_HEADERS="yes"
|
||||
fi
|
||||
|
||||
|
||||
if test "${PGSQL_HEADERS}" = "yes"; then
|
||||
|
||||
# ******* Search pgsql libs *********
|
||||
if test "${PGSQL_LIBS}" = "yes"; then
|
||||
AC_MSG_CHECKING(autodect pgsql libs)
|
||||
# Autodetect
|
||||
PGSQL_INCLUDE="-I$PGSQL_INCDIR"
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib
|
||||
|
||||
if test -f $PGSQL_DIR/lib/pgsql/libpq.so ; then
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
|
||||
elif test -f $PGSQL_DIR/lib/postgresql/libpq.so ; then
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib/postgresql
|
||||
elif test -f $PGSQL_DIR/lib/libpq.so ; then
|
||||
PGSQL_LIBDIR=$PGSQL_DIR/lib
|
||||
else
|
||||
PGSQL_LIBDIR=""
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT($PGSQL_LIBDIR)
|
||||
|
||||
elif test "${PGSQL_LIBS}" = "no"; then
|
||||
AC_MSG_CHECKING(for pgsql libs)
|
||||
AC_MSG_RESULT(skipped)
|
||||
else
|
||||
AC_MSG_CHECKING(for pgsql libs in $PGSQL_LIBS)
|
||||
# Manual detection for <withval>
|
||||
if test -f $PGSQL_LIBS/libpq.a -o -f $PGSQL_LIBS/libpq.so; then
|
||||
PGSQL_LIBDIR=$PGSQL_LIBS
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test -z "$PGSQL_LIBDIR" ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
echo "Invalid PostgreSQL directory [$PGSQL_LIBDIR] - unable to find libpq.a or libpq.so."
|
||||
else
|
||||
#LDFLAGS="$TEMP_LDFLAGS -L$PGSQL_LIBDIR"
|
||||
saved_CFLAGS=$CFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CFLAGS="-I$PGSQL_INCDIR"
|
||||
LIBS="-L$PGSQL_LIBDIR"
|
||||
AC_CHECK_LIB(pq, PQconnectStart, [
|
||||
PGSQL_SUPPORT="yes"
|
||||
TEMP_LIBS="$TEMP_LIBS -L$PGSQL_LIBDIR -lpq"
|
||||
TEMP_CFLAGS="$TEMP_CFLAGS -I$PGSQL_INCDIR"
|
||||
AC_DEFINE([HAVE_PGSQL],1,[Define to 1 if you have PostgreSQL support])
|
||||
],
|
||||
AC_MSG_ERROR(PostgreSQL support can't build without PostgreSQL libraries))
|
||||
LDFLAGS=""
|
||||
AC_MSG_RESULT($PGSQL_SUPPORT)
|
||||
CFLAGS=$saved_CFLAGS
|
||||
LIBS=$saved_LIBS
|
||||
fi
|
||||
|
||||
fi # end pgsql-include , pgsql-libs
|
||||
|
||||
# end PostgreSQL detection
|
||||
fi
|
||||
|
||||
|
||||
#Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h)
|
||||
|
||||
|
||||
dnl check if v4l2 is available
|
||||
# Check if v4l2 is available
|
||||
SUPPORTED_V4L2=false
|
||||
SUPPORTED_V4L2_old=false
|
||||
|
||||
@@ -663,7 +779,7 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl linux/videodev.h doesn't include videodev2.h
|
||||
# linux/videodev.h doesn't include videodev2.h
|
||||
if test x$SUPPORTED_V4L2 = xfalse; then
|
||||
AC_MSG_CHECKING(for V42L *old* support)
|
||||
AC_MSG_RESULT(testing)
|
||||
@@ -679,7 +795,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
dnl Check sizes of integer types
|
||||
# Check sizes of integer types
|
||||
AC_CHECK_SIZEOF(short int)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long int)
|
||||
@@ -716,7 +832,7 @@ AC_ARG_WITH(developer-flags,
|
||||
DEVELOPER_FLAGS="$withval"
|
||||
)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
if test "${FreeBSD}" != ""; then
|
||||
@@ -725,7 +841,7 @@ fi
|
||||
|
||||
if test "${OPTIMIZECPU}" = "yes"; then
|
||||
|
||||
dnl Try to autodetect cpu type
|
||||
# Try to autodetect cpu type
|
||||
CPU_NAME="unknown"
|
||||
CPU_TYPE="unknown"
|
||||
if test -e "/proc/cpuinfo" ; then
|
||||
@@ -908,7 +1024,7 @@ if test "x${CPU_TYPE}" = "xunknown"; then
|
||||
fi
|
||||
fi
|
||||
echo "Detected CPU: $CPU_NAME"
|
||||
dnl Now we check if the compiler supports the detected cpu
|
||||
# Now we check if the compiler supports the detected cpu
|
||||
COMPILER=$CC
|
||||
for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
|
||||
test "$I" && break
|
||||
@@ -961,9 +1077,9 @@ CFLAGS="${TEMP_CFLAGS} $UNAME_DEFS $CPU_OPTIONS"
|
||||
LIBS="${TEMP_LIBS}"
|
||||
LDFLAGS="${TEMP_LDFLAGS}"
|
||||
|
||||
dnl
|
||||
dnl Add the right exec path for rc scripts
|
||||
dnl
|
||||
#
|
||||
# Add the right exec path for rc scripts
|
||||
#
|
||||
if test $prefix = "NONE";then
|
||||
BIN_PATH="$ac_default_prefix"
|
||||
if test $exec_prefix = "NONE"; then
|
||||
@@ -1004,7 +1120,7 @@ echo " *********************"
|
||||
echo " Configure status "
|
||||
echo " ${PACKAGE_NAME} ${PACKAGE_VERSION}"
|
||||
echo " *********************"
|
||||
echo ""
|
||||
echo
|
||||
|
||||
|
||||
if test "${Darwin}" != ""; then
|
||||
@@ -1075,12 +1191,12 @@ else
|
||||
echo "MYSQL Support: No"
|
||||
fi
|
||||
|
||||
if test "${PostgreSQL_SUPPORT}" = "yes"; then
|
||||
if test "${PGSQL_SUPPORT}" = "yes"; then
|
||||
echo "PostgreSQL Support: Yes"
|
||||
else
|
||||
echo "PostgreSQL Support: No"
|
||||
fi
|
||||
echo ""
|
||||
echo
|
||||
|
||||
echo "CFLAGS: $CFLAGS"
|
||||
echo "LIBS: $LIBS"
|
||||
|
||||
10
event.c
10
event.c
@@ -361,7 +361,7 @@ static void event_ffmpeg_newfile(struct context *cnt, int type ATTRIBUTE_UNUSED,
|
||||
int width=cnt->imgs.width;
|
||||
int height=cnt->imgs.height;
|
||||
unsigned char *convbuf, *y, *u, *v;
|
||||
int fps;
|
||||
int fps=0;
|
||||
char stamp[PATH_MAX];
|
||||
const char *mpegpath;
|
||||
|
||||
@@ -396,6 +396,10 @@ static void event_ffmpeg_newfile(struct context *cnt, int type ATTRIBUTE_UNUSED,
|
||||
v=u+(width*height)/4;
|
||||
}
|
||||
fps=cnt->lastrate;
|
||||
|
||||
if (debug_level >= CAMERA_DEBUG)
|
||||
motion_log(LOG_DEBUG, 0, "%s FPS %d",__FUNCTION__,fps);
|
||||
|
||||
if (fps>30)
|
||||
fps=30;
|
||||
if (fps<2)
|
||||
@@ -424,6 +428,10 @@ static void event_ffmpeg_newfile(struct context *cnt, int type ATTRIBUTE_UNUSED,
|
||||
v=u+(width*height)/4;
|
||||
convbuf=NULL;
|
||||
}
|
||||
|
||||
if (debug_level >= CAMERA_DEBUG)
|
||||
motion_log(LOG_DEBUG, 0, "%s FPS %d",__FUNCTION__,fps);
|
||||
|
||||
fps=cnt->lastrate;
|
||||
if (fps>30)
|
||||
fps=30;
|
||||
|
||||
6
ffmpeg.c
6
ffmpeg.c
@@ -362,7 +362,6 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_video_codec, char *filename,
|
||||
c->codec_type = CODEC_TYPE_VIDEO;
|
||||
is_mpeg1 = c->codec_id == CODEC_ID_MPEG1VIDEO;
|
||||
|
||||
|
||||
if (strcmp(ffmpeg_video_codec, "ffv1") == 0)
|
||||
c->strict_std_compliance = -2;
|
||||
|
||||
@@ -381,7 +380,10 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_video_codec, char *filename,
|
||||
c->frame_rate = rate;
|
||||
c->frame_rate_base = 1;
|
||||
#endif /* LIBAVCODEC_BUILD >= 4754 */
|
||||
|
||||
|
||||
if (debug_level >= CAMERA_DEBUG)
|
||||
motion_log(LOG_DEBUG, 0, "%s FPS %d",__FUNCTION__,rate);
|
||||
|
||||
if (vbr)
|
||||
c->flags |= CODEC_FLAG_QSCALE;
|
||||
|
||||
|
||||
33
motion.c
33
motion.c
@@ -587,6 +587,7 @@ static int motion_init(struct context *cnt)
|
||||
|
||||
cnt->imgs.ref = mymalloc(cnt->imgs.size);
|
||||
cnt->imgs.out = mymalloc(cnt->imgs.size);
|
||||
memset(cnt->imgs.out, 0, cnt->imgs.size);
|
||||
cnt->imgs.ref_dyn = mymalloc(cnt->imgs.motionsize * sizeof(cnt->imgs.ref_dyn)); /* contains the moving objects of ref. frame */
|
||||
cnt->imgs.image_virgin = mymalloc(cnt->imgs.size);
|
||||
cnt->imgs.smartmask = mymalloc(cnt->imgs.motionsize);
|
||||
@@ -753,6 +754,8 @@ static int motion_init(struct context *cnt)
|
||||
|
||||
/* Prevent first few frames from triggering motion... */
|
||||
cnt->moved = 8;
|
||||
/* 2 sec startup delay so FPS is calculated correct */
|
||||
cnt->startup_frames = cnt->conf.frame_limit * 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -987,6 +990,9 @@ static void *motion_loop(void *arg)
|
||||
/* Increase the shots variable for each frame captured within this second */
|
||||
cnt->shots++;
|
||||
|
||||
if (cnt->startup_frames > 0)
|
||||
cnt->startup_frames--;
|
||||
|
||||
if (get_image){
|
||||
if (cnt->conf.minimum_frame_time) {
|
||||
minimum_frame_time_downcounter = cnt->conf.minimum_frame_time;
|
||||
@@ -1123,7 +1129,7 @@ static void *motion_loop(void *arg)
|
||||
*/
|
||||
} else {
|
||||
|
||||
if (debug_level)
|
||||
if (debug_level >= CAMERA_VERBOSE)
|
||||
motion_log(-1, 0, "vid_return_code %d", vid_return_code);
|
||||
|
||||
/* Netcams that change dimensions while Motion is running will
|
||||
@@ -1429,13 +1435,13 @@ static void *motion_loop(void *arg)
|
||||
* If post_capture is enabled we also take care of this in the this
|
||||
* code section.
|
||||
*/
|
||||
if (cnt->conf.output_all) {
|
||||
if ( cnt->conf.output_all && (cnt->startup_frames == 0) ) {
|
||||
cnt->detecting_motion = 1;
|
||||
/* Setup the postcap counter */
|
||||
cnt->postcap = cnt->conf.post_capture;
|
||||
cnt->current_image->flags |= (IMAGE_TRIGGER | IMAGE_SAVE);
|
||||
motion_detected(cnt, cnt->video_dev, cnt->current_image);
|
||||
} else if (cnt->current_image->flags & IMAGE_MOTION) {
|
||||
} else if ( (cnt->current_image->flags & IMAGE_MOTION) && (cnt->startup_frames == 0) ) {
|
||||
/* Did we detect motion (like the cat just walked in :) )?
|
||||
* If so, ensure the motion is sustained if minimum_motion_frames
|
||||
*/
|
||||
@@ -2259,8 +2265,20 @@ int main (int argc, char **argv)
|
||||
/* Crude way of waiting for all threads to finish - check the thread
|
||||
* counter (because we cannot do join on the detached threads).
|
||||
*/
|
||||
while( (threads_running > 0) || (!finish) ) {
|
||||
while (1) {
|
||||
SLEEP(1,0);
|
||||
|
||||
/* Calculate how many threads runnig or wants to run
|
||||
* if zero and we want to finish, break out
|
||||
*/
|
||||
int motion_threads_running = 0;
|
||||
for (i = (cnt_list[1] != NULL ? 1 : 0); cnt_list[i]; i++) {
|
||||
if (cnt_list[i]->running || cnt_list[i]->restart)
|
||||
motion_threads_running++;
|
||||
}
|
||||
if ( (motion_threads_running == 0 ) && finish )
|
||||
break;
|
||||
|
||||
for (i = (cnt_list[1] != NULL ? 1 : 0); cnt_list[i]; i++) {
|
||||
/* Check if threads wants to be restarted */
|
||||
if ( (!cnt_list[i]->running) && (cnt_list[i]->restart) ) {
|
||||
@@ -2275,8 +2293,8 @@ int main (int argc, char **argv)
|
||||
cnt_list[i]->finish = 1;
|
||||
}
|
||||
if (cnt_list[i]->watchdog == -60) {
|
||||
motion_log(LOG_ERR, 0, "Thread %d - Watchdog timeout, did NOT restart graceful, killing it!",
|
||||
cnt_list[i]->threadnr);
|
||||
motion_log(LOG_ERR, 0, "Thread %d - Watchdog timeout, did NOT restart graceful,"
|
||||
"killing it!", cnt_list[i]->threadnr);
|
||||
pthread_cancel(cnt_list[i]->thread_id);
|
||||
pthread_mutex_lock(&global_lock);
|
||||
threads_running--;
|
||||
@@ -2300,6 +2318,9 @@ int main (int argc, char **argv)
|
||||
|
||||
} while (restart); /* loop if we're supposed to restart */
|
||||
|
||||
// Be sure that http control exits fine
|
||||
cnt_list[0]->finish = 1;
|
||||
SLEEP(1,0);
|
||||
motion_log(LOG_INFO, 0, "Motion terminating");
|
||||
|
||||
/* Perform final cleanup. */
|
||||
|
||||
7
motion.h
7
motion.h
@@ -103,9 +103,11 @@
|
||||
|
||||
/* Debug levels FIXME */
|
||||
#define CAMERA_WARNINGS 3 /* warnings only */
|
||||
#define CAMERA_INFO 5 /* debug level to activate everything */
|
||||
#define CAMERA_DEBUG 7 /* debug but not verbose */
|
||||
#define CAMERA_INFO 5 /* info debug */
|
||||
#define CAMERA_DEBUG 7 /* debug but not verbose */
|
||||
#define CAMERA_VERBOSE 8 /* verbose level */
|
||||
#define CAMERA_ALL 9 /* everything */
|
||||
|
||||
|
||||
/* Default picture settings */
|
||||
#define DEF_WIDTH 352
|
||||
@@ -348,6 +350,7 @@ struct context {
|
||||
time_t connectionlosttime; /* timestamp from connection lost */
|
||||
|
||||
int lastrate;
|
||||
unsigned short int startup_frames;
|
||||
unsigned short int moved;
|
||||
unsigned short int pause;
|
||||
int missing_frame_counter; /* counts failed attempts to fetch picture frame from camera */
|
||||
|
||||
119
netcam.c
119
netcam.c
@@ -583,12 +583,13 @@ static int netcam_read_first_header(netcam_context_ptr netcam)
|
||||
motion_log(-1, 0, "HTTP Result code %d", ret);
|
||||
free(header);
|
||||
if (netcam->connect_keepalive) {
|
||||
/* Cannot unset netcam->cnt->conf.netcam_keepalive as it is assigned const */
|
||||
/* But we do unset the netcam structure flag which was set in netcam_start */
|
||||
netcam->connect_keepalive = 0;
|
||||
if (debug_level > CAMERA_INFO)
|
||||
motion_log(LOG_DEBUG, 0, "Removed netcam_keepalive flag "
|
||||
"due to apparent closed HTTP connection.");
|
||||
/* Cannot unset netcam->cnt->conf.netcam_http as it is assigned const */
|
||||
/* But we do unset the netcam keepalive flag which was set in netcam_start */
|
||||
/* This message is logged as Information as it would be useful to know */
|
||||
/* if your netcam often returns bad HTTP result codes */
|
||||
netcam->connect_keepalive = 0;
|
||||
motion_log(LOG_INFO, 0, "Removed netcam Keep-Alive flag"
|
||||
"due to apparent closed HTTP connection.");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -666,6 +667,7 @@ static int netcam_read_first_header(netcam_context_ptr netcam)
|
||||
} else if (netcam_check_keepalive(header) == TRUE) {
|
||||
/* Note that we have received a Keep-Alive header, and thus the socket can be left open */
|
||||
aliveflag=TRUE;
|
||||
netcam->keepalive_thisconn = TRUE;
|
||||
/* This flag will not be set when a Streaming cam is in use, but that */
|
||||
/* does not matter as the test below looks at Streaming state also. */
|
||||
} else if (netcam_check_close(header) == TRUE) {
|
||||
@@ -679,33 +681,75 @@ static int netcam_read_first_header(netcam_context_ptr netcam)
|
||||
}
|
||||
free(header);
|
||||
|
||||
if (!netcam->caps.streaming && !aliveflag && netcam->connect_keepalive) {
|
||||
if (!netcam->caps.streaming && netcam->connect_keepalive) {
|
||||
|
||||
/*
|
||||
* If not a streaming cam, and keepalive is set, and the flag shows we
|
||||
* did not see a Keep-Alive field returned from netcam.
|
||||
* Then we want to cease keep-alive for this cam. We cannot just
|
||||
* unset netcam->cnt->conf.netcam_keepalive as it is assigned const
|
||||
* But we do unset the flag in the netcam structure (was set in netcam_start)
|
||||
* That will unset keep-alive until the camera is restarted, when
|
||||
* it will get another bite of the cherry (if keepalive configured).
|
||||
* If we are a non-streaming (ie. Jpeg) netcam and keepalive is configured
|
||||
*/
|
||||
netcam->connect_keepalive = 0;
|
||||
if (debug_level > CAMERA_INFO)
|
||||
motion_log(LOG_DEBUG, 0, "Removed netcam_keepalive flag because no Keep-Alive header received.");
|
||||
}
|
||||
if (!netcam->caps.streaming && closeflag && netcam->connect_keepalive) {
|
||||
/*
|
||||
* If not a streaming cam, and keepalive is set, and the flag shows we
|
||||
* received a 'Connection: close' field returned from netcam.
|
||||
* Then we want to cease keep-alive for this cam, method as above.
|
||||
* This situation will occur in 2 situations:
|
||||
* (a) in HTTP 1.1 when the client wants to stop the keep-alive
|
||||
* (b) in HTTP 1.0 with keepalive, when the client does not support it
|
||||
* Due to that, we accept a Connection: close header in HTTP 1.0 & 1.1 modes
|
||||
*/
|
||||
netcam->connect_keepalive = 0;
|
||||
if (debug_level > CAMERA_INFO)
|
||||
motion_log(LOG_DEBUG, 0, "Removed netcam_keepalive flag because 'Connection: close' header received.");
|
||||
|
||||
if (aliveflag){
|
||||
if (closeflag) {
|
||||
/*
|
||||
* If not a streaming cam, and keepalive is set, and the flag shows we
|
||||
* did not see a Keep-Alive field returned from netcam and a Close field.
|
||||
* Not quite sure what the correct course of action is here. In for testing.
|
||||
*/
|
||||
motion_log(LOG_INFO, 0, "Info: Both 'Connection: Keep-Alive' and 'Connection: close' "
|
||||
"header received. Motion continues unchanged.");
|
||||
}else{
|
||||
/* aliveflag && !closeflag
|
||||
*
|
||||
* If not a streaming cam, and keepalive is set, and the flag shows we
|
||||
* just got a Keep-Alive field returned from netcam and no Close field.
|
||||
* No action, as this is the normal case. In debug we print a notification.
|
||||
*/
|
||||
|
||||
if (debug_level > CAMERA_INFO)
|
||||
motion_log(LOG_INFO, 0, "Info: Received a Keep-Alive field in this set of headers.");
|
||||
}
|
||||
}else{ /* !aliveflag */
|
||||
if (!closeflag) {
|
||||
/*
|
||||
* If not a streaming cam, and keepalive is set, and the flag shows we
|
||||
* did not see a Keep-Alive field returned from netcam nor a Close field.
|
||||
* Not quite sure what the correct course of action is here. In for testing.
|
||||
*/
|
||||
motion_log(LOG_INFO, 0, "Info: No 'Connection: Keep-Alive' nor 'Connection: close' "
|
||||
"header received. Motion continues unchanged.");
|
||||
}else{
|
||||
/* !aliveflag & closeflag
|
||||
* If not a streaming cam, and keepalive is set, and the flag shows we
|
||||
* received a 'Connection: close' field returned from netcam. It is not likely
|
||||
* we will get a Keep-Alive and Close header together - this is picked up by
|
||||
* the test code above.
|
||||
* If we receive a Close header, then we want to cease keep-alive for this cam.
|
||||
* This situation will occur in 2 situations:
|
||||
* (a) in HTTP 1.1 when the client wants to stop the keep-alive
|
||||
* (and in this case it would be correct to close connection and then
|
||||
* make a new one, with keep-alive set again).
|
||||
* (b) in HTTP 1.0 with keepalive, when the client does not support it.
|
||||
* In this case we should not attempt to re-start Keep-Alive.
|
||||
* Due to that, we accept a Connection: close header in HTTP 1.0 & 1.1 modes
|
||||
*
|
||||
* To tell between the sitation where a camera has been in Keep-Alive mode and
|
||||
* is now finishing (and will want to be re-started in Keep-Alive) and the other
|
||||
* case when a cam does not support it, we have a flag which says if the netcam
|
||||
* has returned a Keep-Alive flag during this connection. If that's set, we
|
||||
* set ourselves up to re-connect with Keep-Alive after the socket is closed.
|
||||
* If it's not set, then we will not try again to use Keep-Alive.
|
||||
*/
|
||||
if (!netcam->keepalive_thisconn) {
|
||||
netcam->connect_keepalive = FALSE; /* No further attempts at keep-alive */
|
||||
motion_log(LOG_INFO, 0, "Removed netcam Keep-Alive flag because 'Connection: close' "
|
||||
"header received. Netcam does not support Keep-Alive. Motion "
|
||||
"continues in non-Keep-Alive.");
|
||||
} else {
|
||||
netcam->keepalive_timeup = TRUE; /* We will close and re-open keep-alive */
|
||||
motion_log(LOG_INFO, 0, "Keep-Alive has reached end of valid period. Motion will close "
|
||||
"netcam, then resume Keep-Alive with a new socket.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@@ -788,6 +832,9 @@ static int netcam_connect(netcam_context_ptr netcam, int err_flag)
|
||||
motion_log(LOG_DEBUG, 0, "netcam_connect with keepalive set, invalid socket."
|
||||
"This could be first time, created a new one with fd %d", netcam->sock);
|
||||
|
||||
/* Record that this connection has not yet received a Keep-Alive header */
|
||||
netcam->keepalive_thisconn = FALSE;
|
||||
|
||||
/* Check the socket status for the keepalive option */
|
||||
if (getsockopt(netcam->sock, SOL_SOCKET, SO_KEEPALIVE, &optval, &optlen) < 0) {
|
||||
motion_log(LOG_ERR, 1, "netcam_connect : getsockopt()");
|
||||
@@ -1544,7 +1591,15 @@ static void *netcam_handler_loop(void *arg)
|
||||
if (netcam->response) { /* if html input */
|
||||
if (!netcam->caps.streaming) {
|
||||
/* Non-streaming ie. jpeg */
|
||||
if (!netcam->connect_keepalive) {
|
||||
if (!netcam->connect_keepalive || (netcam->connect_keepalive && netcam->keepalive_timeup)) {
|
||||
/* If keepalive flag set but time up, time to close this socket */
|
||||
if (netcam->connect_keepalive && netcam->keepalive_timeup) {
|
||||
motion_log(LOG_INFO, 0, "Closing netcam socket as Keep-Alive time is up "
|
||||
"(camera sent Close field). A reconnect should happen.");
|
||||
netcam_disconnect(netcam);
|
||||
netcam->keepalive_timeup = FALSE;
|
||||
}
|
||||
/* And the netcam_connect call below will open a new one */
|
||||
if (netcam_connect(netcam, open_error) < 0) {
|
||||
if (!open_error) { /* log first error */
|
||||
motion_log(LOG_ERR, 0,
|
||||
|
||||
6
netcam.h
6
netcam.h
@@ -162,6 +162,12 @@ typedef struct netcam_context {
|
||||
after a request, otherwise FALSE to
|
||||
close down the socket each time */
|
||||
|
||||
int keepalive_thisconn; /* set to TRUE if cam has sent 'Keep-Alive' in this connection */
|
||||
|
||||
int keepalive_timeup; /* set to TRUE if it is time to close netcam's socket,
|
||||
and then re-open it with Keep-Alive set again.
|
||||
Even Keep-Alive netcams need a close/open sometimes. */
|
||||
|
||||
char *connect_request; /* contains the complete string
|
||||
required for connection to the
|
||||
camera */
|
||||
|
||||
22
track.c
22
track.c
@@ -34,7 +34,7 @@ struct trackoptions track_template = {
|
||||
|
||||
/* Add your own center and move functions here: */
|
||||
static unsigned short int stepper_center(struct context *cnt, int xoff, int yoff ATTRIBUTE_UNUSED);
|
||||
static unsigned short int stepper_move(struct context *cnt, int dev, struct coord *cent, struct images *imgs);
|
||||
static unsigned short int stepper_move(struct context *cnt, struct coord *cent, struct images *imgs);
|
||||
static unsigned short int iomojo_center(struct context *cnt, int xoff, int yoff);
|
||||
static unsigned short int iomojo_move(struct context *cnt, int dev, struct coord *cent, struct images *imgs);
|
||||
#ifndef WITHOUT_V4L
|
||||
@@ -84,7 +84,7 @@ unsigned short int track_move(struct context *cnt, int dev, struct coord *cent,
|
||||
if (!manual && !cnt->track.active)
|
||||
return 0;
|
||||
if (cnt->track.type == TRACK_TYPE_STEPPER)
|
||||
return stepper_move(cnt, dev, cent, imgs);
|
||||
return stepper_move(cnt, cent, imgs);
|
||||
#ifndef WITHOUT_V4L
|
||||
else if (cnt->track.type == TRACK_TYPE_PWC)
|
||||
return lqos_move(cnt, dev, cent, imgs, manual);
|
||||
@@ -121,7 +121,8 @@ static unsigned short int stepper_command(struct context *cnt, unsigned short in
|
||||
buffer[1]=command;
|
||||
buffer[2]=data;
|
||||
if (write(cnt->track.dev, buffer, 3)!=3){
|
||||
motion_log(LOG_ERR, 1, "stepper_command");
|
||||
motion_log(LOG_ERR, 1, "stepper_command port %s dev fd %i, motor %hu command %hu data %hu",
|
||||
cnt->track.port, cnt->track.dev, motor, command, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -166,7 +167,7 @@ static unsigned short int stepper_center(struct context *cnt, int x_offset, int
|
||||
motion_log(LOG_ERR, 1, "Unable to initialize serial device %s", cnt->track.port);
|
||||
return 0;
|
||||
}
|
||||
motion_log(LOG_INFO, 0, "Opened serial device %s and initialize", cnt->track.port);
|
||||
motion_log(LOG_INFO, 0, "Opened serial device %s and initialize, fd %i", cnt->track.port, cnt->track.dev);
|
||||
}
|
||||
|
||||
/* x-axis */
|
||||
@@ -196,19 +197,20 @@ static unsigned short int stepper_center(struct context *cnt, int x_offset, int
|
||||
return cnt->track.move_wait;
|
||||
}
|
||||
|
||||
static unsigned short int stepper_move(struct context *cnt, int dev, struct coord *cent, struct images *imgs)
|
||||
static unsigned short int stepper_move(struct context *cnt, struct coord *cent, struct images *imgs)
|
||||
{
|
||||
unsigned short int command = 0, data = 0;
|
||||
|
||||
if (dev < 0){
|
||||
motion_log(LOG_INFO, 0, "No device started yet , trying stepper_center()");
|
||||
if (cnt->track.dev < 0){
|
||||
motion_log(LOG_INFO, 0, "No device %s started yet , trying stepper_center()", cnt->track.port);
|
||||
if (!stepper_center(cnt, 0, 0)){
|
||||
motion_log(LOG_ERR, 1, "Stepper_center() failed to initialize stepper device.");
|
||||
motion_log(LOG_ERR, 1, "Stepper_center() failed to initialize stepper device on %s , fd [%i].",
|
||||
cnt->track.port, cnt->track.dev);
|
||||
return 0;
|
||||
}
|
||||
motion_log(LOG_INFO, 0, "stepper_center() succeed , device started");
|
||||
motion_log(LOG_INFO, 0, "stepper_center() succeed , device started %s , fd [%i]", cnt->track.port, cnt->track.dev);
|
||||
}
|
||||
|
||||
|
||||
/* x-axis */
|
||||
|
||||
if (cent->x < imgs->width / 2) {
|
||||
|
||||
@@ -851,7 +851,10 @@ int vid_start(struct context *cnt)
|
||||
cnt->netcam = NULL;
|
||||
}
|
||||
}
|
||||
#ifndef WITHOUT_V4L
|
||||
#ifdef WITHOUT_V4L
|
||||
else
|
||||
motion_log(LOG_ERR, 0,"You must setup netcam_url");
|
||||
#else
|
||||
else
|
||||
dev = vid_v4lx_start(cnt);
|
||||
#endif /*WITHOUT_V4L */
|
||||
|
||||
280
video_freebsd.c
280
video_freebsd.c
@@ -69,8 +69,18 @@ static const struct camparam_st {
|
||||
#define CONTR 1
|
||||
#define CHROMA 2
|
||||
|
||||
/* Not tested yet */
|
||||
volatile sig_atomic_t bktr_frame_waiting;
|
||||
|
||||
//sigset_t sa_mask;
|
||||
|
||||
|
||||
static void catchsignal(int sig)
|
||||
{
|
||||
bktr_frame_waiting++;
|
||||
}
|
||||
|
||||
|
||||
/* Not tested yet */
|
||||
static void yuv422to420p(unsigned char *map, unsigned char *cap_map, int width, int height)
|
||||
{
|
||||
unsigned char *src, *dest, *src2, *dest2;
|
||||
@@ -79,28 +89,28 @@ static void yuv422to420p(unsigned char *map, unsigned char *cap_map, int width,
|
||||
/* Create the Y plane */
|
||||
src=cap_map;
|
||||
dest=map;
|
||||
for (i=width*height; i; i--) {
|
||||
*dest++=*src;
|
||||
src+=2;
|
||||
for (i= width * height; i; i--) {
|
||||
*dest++ = *src;
|
||||
src += 2;
|
||||
}
|
||||
/* Create U and V planes */
|
||||
src=cap_map+1;
|
||||
src2=cap_map+width*2+1;
|
||||
dest=map+width*height;
|
||||
dest2=dest+(width*height)/4;
|
||||
for (i=height/2; i; i--) {
|
||||
for (j=width/2; j; j--) {
|
||||
*dest=((int)*src+(int)*src2)/2;
|
||||
src+=2;
|
||||
src2+=2;
|
||||
src = cap_map + 1;
|
||||
src2 = cap_map + width * 2 + 1;
|
||||
dest = map + width* height;
|
||||
dest2 = dest + (width * height) / 4;
|
||||
for (i = height / 2; i; i--) {
|
||||
for (j = width / 2; j; j--) {
|
||||
*dest = ((int)*src + (int)*src2) / 2;
|
||||
src += 2;
|
||||
src2 += 2;
|
||||
dest++;
|
||||
*dest2=((int)*src+(int)*src2)/2;
|
||||
src+=2;
|
||||
src2+=2;
|
||||
*dest2 = ((int)*src + (int)*src2) / 2;
|
||||
src += 2;
|
||||
src2 += 2;
|
||||
dest2++;
|
||||
}
|
||||
src+=width*2;
|
||||
src2+=width*2;
|
||||
src += width * 2;
|
||||
src2 += width * 2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -113,14 +123,14 @@ static void rgb24toyuv420p(unsigned char *map, unsigned char *cap_map, int width
|
||||
unsigned char *r, *g, *b;
|
||||
int i, loop;
|
||||
|
||||
b=cap_map;
|
||||
g=b+1;
|
||||
r=g+1;
|
||||
y=map;
|
||||
u=y+width*height;
|
||||
v=u+(width*height)/4;
|
||||
memset(u, 0, width*height/4);
|
||||
memset(v, 0, width*height/4);
|
||||
b = cap_map;
|
||||
g = b + 1;
|
||||
r = g + 1;
|
||||
y = map;
|
||||
u = y + width * height;
|
||||
v = u + (width * height) / 4;
|
||||
memset(u, 0, width * height / 4);
|
||||
memset(v, 0, width * height / 4);
|
||||
|
||||
for(loop=0; loop<height; loop++) {
|
||||
for(i=0; i<width; i+=2) {
|
||||
@@ -172,7 +182,7 @@ static int camparam_normalize( int param, int cfg_value, int *ioctl_val )
|
||||
|
||||
static int set_hue( int viddev, int new_hue )
|
||||
{
|
||||
signed char ioctlval=new_hue;
|
||||
signed char ioctlval = new_hue;
|
||||
|
||||
if( ioctl( viddev, METEORSHUE, &ioctlval ) < 0 ) {
|
||||
motion_log(LOG_ERR, 1, "METEORSHUE Error setting hue [%d]",new_hue);
|
||||
@@ -307,7 +317,9 @@ static int set_freq(struct video_dev *viddev, unsigned long freq)
|
||||
{
|
||||
int tuner_fd = viddev->fd_tuner;
|
||||
int old_audio;
|
||||
|
||||
|
||||
motion_log(LOG_DEBUG, 0, "Not implemented");
|
||||
return 0;
|
||||
/* HACK maybe not need it , but seems that is needed to mute before changing frequency */
|
||||
|
||||
if ( ioctl( tuner_fd, BT848_GAUDIO, &old_audio ) < 0 ) {
|
||||
@@ -395,7 +407,7 @@ static int set_geometry(struct video_dev *viddev, int width, int height)
|
||||
geom.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||
}
|
||||
|
||||
geom.frames = 1;
|
||||
geom.frames = 1;
|
||||
|
||||
if( ioctl( viddev->fd_bktr, METEORSETGEO, &geom ) < 0 ) {
|
||||
motion_log(LOG_ERR, 1, "Couldn't set the geometry");
|
||||
@@ -523,7 +535,7 @@ statict int setup_pixelformat( int bktr )
|
||||
|
||||
static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev)
|
||||
{
|
||||
int dev=viddev->fd_bktr;
|
||||
int dev = viddev->fd_bktr;
|
||||
|
||||
if ( (cnt->conf.contrast) && (cnt->conf.contrast != viddev->contrast) ){
|
||||
set_contrast(dev,cnt->conf.contrast);
|
||||
@@ -566,14 +578,14 @@ static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev)
|
||||
*/
|
||||
static unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, int width, int height, unsigned short input, unsigned short norm, unsigned long freq)
|
||||
{
|
||||
int dev_bktr=viddev->fd_bktr;
|
||||
int dev_bktr = viddev->fd_bktr;
|
||||
struct sigaction act, old;
|
||||
//int dev_tunner=viddev->fd_tuner;
|
||||
/* to ensure that all device will be support the capture mode
|
||||
_TODO_ : Autodected the best capture mode .
|
||||
*/
|
||||
int dummy = 1;
|
||||
// int pixelformat = BSD_VIDFMT_I420;
|
||||
int single = METEOR_CAP_SINGLE;
|
||||
|
||||
void *map;
|
||||
|
||||
@@ -647,13 +659,13 @@ static unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, i
|
||||
|
||||
/* FIXME double buffer */
|
||||
if (0) {
|
||||
viddev->v4l_maxbuffer=2;
|
||||
viddev->v4l_buffers[0]=map;
|
||||
viddev->v4l_buffers[1]=(unsigned char *)map+0; /* 0 is not valid just a test */
|
||||
viddev->v4l_maxbuffer = 2;
|
||||
viddev->v4l_buffers[0] = map;
|
||||
viddev->v4l_buffers[1] = (unsigned char *)map+0; /* 0 is not valid just a test */
|
||||
//viddev->v4l_buffers[1]=map+vid_buf.offsets[1];
|
||||
} else {
|
||||
viddev->v4l_buffers[0]=map;
|
||||
viddev->v4l_maxbuffer=1;
|
||||
viddev->v4l_buffers[0] = map;
|
||||
viddev->v4l_maxbuffer = 1;
|
||||
}
|
||||
|
||||
viddev->v4l_curbuffer=0;
|
||||
@@ -665,18 +677,47 @@ static unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, i
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* signal handler to know when data is ready to be read() */
|
||||
|
||||
memset(&act, 0, sizeof(act));
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_handler = catchsignal;
|
||||
sigaction(SIGUSR2, &act, &old);
|
||||
|
||||
dummy = SIGUSR2;
|
||||
|
||||
viddev->capture_method = METEOR_CAP_CONTINOUS;
|
||||
|
||||
if (ioctl(dev_bktr, METEORSSIGNAL, &dummy) < 0) {
|
||||
motion_log(LOG_ERR, 1, "METEORSSIGNAL");
|
||||
motion_log(LOG_INFO, 0 , "METEORSSIGNAL");
|
||||
viddev->capture_method = METEOR_CAP_SINGLE;
|
||||
if (ioctl(dev_bktr, METEORCAPTUR, &viddev->capture_method) < 0){
|
||||
motion_log(LOG_ERR, 1, "METEORCAPTUR using single method Error capturing");
|
||||
motion_log(LOG_INFO, 0, "METEORCAPTUR using single method Error capturing");
|
||||
}
|
||||
}else{
|
||||
if (ioctl(dev_bktr, METEORCAPTUR, &viddev->capture_method) < 0) {
|
||||
viddev->capture_method = METEOR_CAP_SINGLE;
|
||||
if (ioctl(dev_bktr, METEORCAPTUR, &viddev->capture_method) < 0){
|
||||
motion_log(LOG_ERR, 1, "METEORCAPTUR using single method Error capturing");
|
||||
motion_log(LOG_INFO,0, "METEORCAPTUR using single method Error capturing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (viddev->capture_method == METEOR_CAP_CONTINOUS)
|
||||
motion_log(LOG_INFO, 0, "METEORCAPTUR METEOR_CAP_CONTINOUS");
|
||||
else
|
||||
motion_log(LOG_INFO, 0, "METEORCAPTUR METEOR_CAP_SINGLE");
|
||||
|
||||
// settle , sleep(1) replaced
|
||||
SLEEP(1,0)
|
||||
|
||||
if (ioctl(dev_bktr, METEORCAPTUR, &single) < 0){
|
||||
motion_log(LOG_ERR, 1, "METEORCAPTUR using single method Error capturing");
|
||||
}else viddev->capture_method = CAPTURE_SINGLE;
|
||||
|
||||
/* FIXME*/
|
||||
switch (viddev->v4l_fmt) {
|
||||
case VIDEO_PALETTE_YUV420P:
|
||||
viddev->v4l_bufsize=(width*height*3)/2;
|
||||
motion_log(-1, 0, "VIDEO_PALETTE_YUV420P palette setting bufsize");
|
||||
break;
|
||||
case VIDEO_PALETTE_YUV422:
|
||||
viddev->v4l_bufsize=(width*height*2);
|
||||
@@ -689,13 +730,11 @@ static unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, i
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
int val;
|
||||
motion_log(LOG_INFO,0,"HUE [%d]",get_hue(dev_bktr,&val));
|
||||
motion_log(LOG_INFO,0,"SATURATION [%d]",get_saturation(dev_bktr,&val));
|
||||
motion_log(LOG_INFO,0,"BRIGHTNESS [%d]",get_brightness(dev_bktr,&val));
|
||||
motion_log(LOG_INFO,0,"CONTRAST [%d]",get_contrast(dev_bktr,&val));
|
||||
}
|
||||
motion_log(LOG_INFO,0,"HUE [%d]",get_hue(dev_bktr,&dummy));
|
||||
motion_log(LOG_INFO,0,"SATURATION [%d]",get_saturation(dev_bktr,&dummy));
|
||||
motion_log(LOG_INFO,0,"BRIGHTNESS [%d]",get_brightness(dev_bktr,&dummy));
|
||||
motion_log(LOG_INFO,0,"CONTRAST [%d]",get_contrast(dev_bktr,&dummy));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -718,7 +757,6 @@ static int v4l_next(struct video_dev *viddev,unsigned char *map, int width, int
|
||||
int dev_bktr=viddev->fd_bktr;
|
||||
unsigned char *cap_map=NULL;
|
||||
int single = METEOR_CAP_SINGLE;
|
||||
int continous = METEOR_CAP_CONTINOUS;
|
||||
sigset_t set, old;
|
||||
|
||||
|
||||
@@ -740,20 +778,15 @@ static int v4l_next(struct video_dev *viddev,unsigned char *map, int width, int
|
||||
viddev->v4l_curbuffer=0;
|
||||
|
||||
/* capture */
|
||||
|
||||
if (viddev->capture_method == CAPTURE_CONTINOUS){
|
||||
if (ioctl(dev_bktr, METEORCAPTUR, &continous) < 0) {
|
||||
motion_log(LOG_ERR, 1, "Error capturing using continuous method");
|
||||
sigprocmask (SIG_UNBLOCK, &old, NULL);
|
||||
return (-1);
|
||||
}
|
||||
}else{
|
||||
|
||||
if (ioctl(dev_bktr, METEORCAPTUR, &single) < 0) {
|
||||
motion_log(LOG_ERR, 1, "Error capturing using single method");
|
||||
sigprocmask (SIG_UNBLOCK, &old, NULL);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (viddev->capture_method == METEOR_CAP_CONTINOUS){
|
||||
if (bktr_frame_waiting) {
|
||||
bktr_frame_waiting = 0;
|
||||
}
|
||||
}else if (ioctl(dev_bktr, METEORCAPTUR, &single) < 0) {
|
||||
motion_log(LOG_ERR, 1, "Error capturing using single method");
|
||||
sigprocmask (SIG_UNBLOCK, &old, NULL);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*undo the signal blocking*/
|
||||
@@ -811,10 +844,10 @@ static void v4l_set_input(struct context *cnt, struct video_dev *viddev, unsigne
|
||||
|
||||
v4l_picture_controls(cnt, viddev);
|
||||
|
||||
viddev->input=input;
|
||||
viddev->width=width;
|
||||
viddev->height=height;
|
||||
viddev->freq=freq;
|
||||
viddev->input = input;
|
||||
viddev->width = width;
|
||||
viddev->height = height;
|
||||
viddev->freq = freq;
|
||||
|
||||
/* skip a few frames if needed */
|
||||
for (i=0; i<skip; i++)
|
||||
@@ -916,9 +949,16 @@ void vid_close(struct context *cnt)
|
||||
|
||||
if( --dev->usage_count == 0) {
|
||||
motion_log(LOG_INFO, 0, "Closing video device %s", dev->video_device);
|
||||
//close(dev->fd);
|
||||
close(dev->fd_bktr);
|
||||
close(dev->fd_tuner);
|
||||
if (dev->fd_tuner > 0)
|
||||
close(dev->fd_tuner);
|
||||
|
||||
if (dev->fd_bktr > 0){
|
||||
dev->fd_tuner = METEOR_CAP_STOP_CONT;
|
||||
ioctl(dev->fd_bktr, METEORCAPTUR, &dev->fd_tuner);
|
||||
close(dev->fd_bktr);
|
||||
dev->fd_tuner = -1;
|
||||
}
|
||||
|
||||
|
||||
munmap(viddevs->v4l_buffers[0],viddevs->v4l_bufsize);
|
||||
viddevs->v4l_buffers[0] = MAP_FAILED;
|
||||
@@ -953,20 +993,30 @@ void vid_close(struct context *cnt)
|
||||
|
||||
int vid_start(struct context *cnt)
|
||||
{
|
||||
struct config *conf=&cnt->conf;
|
||||
int fd_bktr=-1;
|
||||
|
||||
if (conf->netcam_url)
|
||||
return netcam_start(cnt);
|
||||
struct config *conf = &cnt->conf;
|
||||
int fd_bktr = -1;
|
||||
|
||||
#ifndef WITHOUT_V4L
|
||||
{
|
||||
if (conf->netcam_url) {
|
||||
fd_bktr = netcam_start(cnt);
|
||||
if (fd_bktr < 0) {
|
||||
netcam_cleanup(cnt->netcam, 1);
|
||||
cnt->netcam = NULL;
|
||||
}
|
||||
}
|
||||
#ifdef WITHOUT_V4L
|
||||
else
|
||||
motion_log(LOG_ERR, 0,"You must setup netcam_url");
|
||||
#else
|
||||
else{
|
||||
struct video_dev *dev;
|
||||
int fd_tuner=-1;
|
||||
int fd_tuner =-1;
|
||||
int width, height;
|
||||
unsigned short input, norm;
|
||||
unsigned long frequency;
|
||||
|
||||
|
||||
motion_log(-1, 0, "vid_start [%s]", conf->video_device);
|
||||
|
||||
/* We use width and height from conf in this function. They will be assigned
|
||||
* to width and height in imgs here, and cap_width and cap_height in
|
||||
* rotate_data won't be set until in rotate_init.
|
||||
@@ -996,8 +1046,8 @@ int vid_start(struct context *cnt)
|
||||
* that is used internally in Motion. That way, setting width and height via
|
||||
* http remote control won't screw things up.
|
||||
*/
|
||||
cnt->imgs.width=width;
|
||||
cnt->imgs.height=height;
|
||||
cnt->imgs.width = width;
|
||||
cnt->imgs.height = height;
|
||||
|
||||
/* First we walk through the already discovered video devices to see
|
||||
* if we have already setup the same device before. If this is the case
|
||||
@@ -1008,21 +1058,21 @@ int vid_start(struct context *cnt)
|
||||
while (dev) {
|
||||
if (!strcmp(conf->video_device, dev->video_device)) {
|
||||
dev->usage_count++;
|
||||
cnt->imgs.type=dev->v4l_fmt;
|
||||
cnt->imgs.type = dev->v4l_fmt;
|
||||
motion_log(-1, 0, "vid_start cnt->imgs.type [%i]", cnt->imgs.type);
|
||||
switch (cnt->imgs.type) {
|
||||
case VIDEO_PALETTE_GREY:
|
||||
cnt->imgs.motionsize=width*height;
|
||||
cnt->imgs.size=width*height;
|
||||
cnt->imgs.motionsize = width * height;
|
||||
cnt->imgs.size = width * height;
|
||||
break;
|
||||
case VIDEO_PALETTE_RGB24:
|
||||
case VIDEO_PALETTE_YUV422:
|
||||
cnt->imgs.type=VIDEO_PALETTE_YUV420P;
|
||||
cnt->imgs.type = VIDEO_PALETTE_YUV420P;
|
||||
case VIDEO_PALETTE_YUV420P:
|
||||
motion_log(-1, 0,
|
||||
" VIDEO_PALETTE_YUV420P setting imgs.size and imgs.motionsize");
|
||||
cnt->imgs.motionsize=width*height;
|
||||
cnt->imgs.size=(width*height*3)/2;
|
||||
cnt->imgs.motionsize = width * height;
|
||||
cnt->imgs.size = (width * height * 3) / 2;
|
||||
break;
|
||||
}
|
||||
pthread_mutex_unlock(&vid_mutex);
|
||||
@@ -1037,7 +1087,7 @@ int vid_start(struct context *cnt)
|
||||
|
||||
fd_bktr=open(conf->video_device, O_RDWR);
|
||||
|
||||
if (fd_bktr <0) {
|
||||
if (fd_bktr < 0) {
|
||||
motion_log(LOG_ERR, 1, "open video device %s",conf->video_device);
|
||||
free(dev);
|
||||
pthread_mutex_unlock(&vid_mutex);
|
||||
@@ -1048,7 +1098,7 @@ int vid_start(struct context *cnt)
|
||||
/* Only open tuner if conf->tuner_device has set , freq and input is 1 */
|
||||
if ( (conf->tuner_device != NULL) && (frequency > 0) && ( input == IN_TV )) {
|
||||
fd_tuner=open(conf->tuner_device, O_RDWR);
|
||||
if (fd_tuner <0) {
|
||||
if (fd_tuner < 0) {
|
||||
motion_log(LOG_ERR, 1, "open tuner device %s",conf->tuner_device);
|
||||
free(dev);
|
||||
pthread_mutex_unlock(&vid_mutex);
|
||||
@@ -1060,30 +1110,30 @@ int vid_start(struct context *cnt)
|
||||
pthread_mutex_init(&dev->mutex, &dev->attr);
|
||||
|
||||
dev->usage_count = 1;
|
||||
dev->video_device=conf->video_device;
|
||||
dev->tuner_device=conf->tuner_device;
|
||||
dev->fd_bktr=fd_bktr;
|
||||
dev->fd_tuner=fd_tuner;
|
||||
dev->input=input;
|
||||
dev->height=height;
|
||||
dev->width=width;
|
||||
dev->freq=frequency;
|
||||
dev->owner=-1;
|
||||
dev->video_device = conf->video_device;
|
||||
dev->tuner_device = conf->tuner_device;
|
||||
dev->fd_bktr = fd_bktr;
|
||||
dev->fd_tuner = fd_tuner;
|
||||
dev->input = input;
|
||||
dev->height = height;
|
||||
dev->width = width;
|
||||
dev->freq = frequency;
|
||||
dev->owner = -1;
|
||||
|
||||
/* We set brightness, contrast, saturation and hue = 0 so that they only get
|
||||
* set if the config is not zero.
|
||||
*/
|
||||
|
||||
dev->brightness=0;
|
||||
dev->contrast=0;
|
||||
dev->saturation=0;
|
||||
dev->hue=0;
|
||||
dev->owner=-1;
|
||||
dev->brightness = 0;
|
||||
dev->contrast = 0;
|
||||
dev->saturation = 0;
|
||||
dev->hue = 0;
|
||||
dev->owner = -1;
|
||||
|
||||
/* default palette */
|
||||
dev->v4l_fmt=VIDEO_PALETTE_YUV420P;
|
||||
dev->v4l_curbuffer=0;
|
||||
dev->v4l_maxbuffer=1;
|
||||
dev->v4l_fmt = VIDEO_PALETTE_YUV420P;
|
||||
dev->v4l_curbuffer = 0;
|
||||
dev->v4l_maxbuffer = 1;
|
||||
|
||||
if (!v4l_start (cnt, dev, width, height, input, norm, frequency)){
|
||||
close(dev->fd_bktr);
|
||||
@@ -1099,16 +1149,16 @@ int vid_start(struct context *cnt)
|
||||
|
||||
switch (cnt->imgs.type) {
|
||||
case VIDEO_PALETTE_GREY:
|
||||
cnt->imgs.size=width*height;
|
||||
cnt->imgs.motionsize=width*height;
|
||||
cnt->imgs.size = width * height;
|
||||
cnt->imgs.motionsize = width * height;
|
||||
break;
|
||||
case VIDEO_PALETTE_RGB24:
|
||||
case VIDEO_PALETTE_YUV422:
|
||||
cnt->imgs.type=VIDEO_PALETTE_YUV420P;
|
||||
cnt->imgs.type = VIDEO_PALETTE_YUV420P;
|
||||
case VIDEO_PALETTE_YUV420P:
|
||||
motion_log(-1, 0, "VIDEO_PALETTE_YUV420P imgs.type");
|
||||
cnt->imgs.size=(width*height*3)/2;
|
||||
cnt->imgs.motionsize=width*height;
|
||||
cnt->imgs.size = (width * height * 3) / 2;
|
||||
cnt->imgs.motionsize = width * height;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1118,7 +1168,7 @@ int vid_start(struct context *cnt)
|
||||
|
||||
pthread_mutex_unlock(&vid_mutex);
|
||||
}
|
||||
#endif /*WITHOUT_V4L*/
|
||||
#endif /* WITHOUT_V4L */
|
||||
|
||||
/* FIXME needed tuner device ?! */
|
||||
return fd_bktr;
|
||||
@@ -1176,8 +1226,8 @@ int vid_next(struct context *cnt, unsigned char *map)
|
||||
|
||||
if (dev->owner!=cnt->threadnr) {
|
||||
pthread_mutex_lock(&dev->mutex);
|
||||
dev->owner=cnt->threadnr;
|
||||
dev->frames=conf->roundrobin_frames;
|
||||
dev->owner = cnt->threadnr;
|
||||
dev->frames = conf->roundrobin_frames;
|
||||
}
|
||||
|
||||
|
||||
@@ -1187,7 +1237,7 @@ int vid_next(struct context *cnt, unsigned char *map)
|
||||
ret = v4l_next(dev, map, width, height);
|
||||
|
||||
if (--dev->frames <= 0) {
|
||||
dev->owner=-1;
|
||||
dev->owner = -1;
|
||||
dev->frames = 0;
|
||||
pthread_mutex_unlock(&dev->mutex);
|
||||
}
|
||||
|
||||
@@ -526,6 +526,10 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
free(type);
|
||||
type = strdup("0");
|
||||
conf_cmdparse(cnt+thread, config_params[i].param_name, type);
|
||||
} else if (!strcmp(type,"short")) {
|
||||
free(type);
|
||||
type = strdup("0");
|
||||
conf_cmdparse(cnt+thread, config_params[i].param_name, type);
|
||||
} else if (!strcmp(type,"bool")) {
|
||||
free(type);
|
||||
type = strdup("off");
|
||||
@@ -2395,5 +2399,6 @@ void *motion_web_control(void *arg)
|
||||
{
|
||||
struct context **cnt=arg;
|
||||
httpd_run(cnt);
|
||||
motion_log(LOG_DEBUG, 0, "httpd thread exit");
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user