From 3211d38835cfb4338eedbceaaa8cdf284cff553a Mon Sep 17 00:00:00 2001 From: Roman Gaufman Date: Mon, 13 Feb 2012 12:03:00 +0000 Subject: [PATCH 1/9] Make Smooth Videos --- .gitignore | 14 +++++ conf.c | 14 +++++ conf.h | 1 + event.c | 2 + motion.c | 163 ++++++++++++++++++++++++++++++++++++++--------------- motion.h | 9 +++ 6 files changed, 157 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 9e38ca5..103fdc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,17 @@ *.log .svn/ *.o +.depend +Makefile +config.h +config.status +motion +motion-dist.conf +motion.init-Debian +motion.init-Fedora +motion.init-FreeBSD.sh +motion.spec +thread1.conf +thread2.conf +thread3.conf +thread4.conf diff --git a/conf.c b/conf.c index 2581c80..e7342bb 100644 --- a/conf.c +++ b/conf.c @@ -79,6 +79,7 @@ struct config conf_template = { ffmpeg_output: 0, extpipe: NULL, useextpipe: 0, + smooth_video: 0, ffmpeg_output_debug: 0, ffmpeg_bps: DEF_FFMPEG_BPS, ffmpeg_vbr: DEF_FFMPEG_VBR, @@ -803,6 +804,19 @@ config_param config_params[] = { print_string }, { + "smooth_video", + "\n############################################################\n" + "# Normally, video is recorded as __precap+motion+postcap____\n" + "# This option changes the default behavior of the video \n" + "# capturing so that it is __precap+event-start-->event-end__ \n" + "############################################################\n" + "# Use smooth_video on to enable this feature. \n", + 0, + CONF_OFFSET(smooth_video), + copy_bool, + print_bool + }, + { "snapshot_interval", "\n############################################################\n" "# Snapshots (Traditional Periodic Webcam File Output)\n" diff --git a/conf.h b/conf.h index b03397e..4b37ea6 100644 --- a/conf.h +++ b/conf.h @@ -42,6 +42,7 @@ struct config { int frame_limit; int quiet; int useextpipe; /* ext_pipe on or off */ + int smooth_video; const char *extpipe; /* full Command-line for pipe -- must accept YUV420P images */ const char *picture_type; int noise; diff --git a/event.c b/event.c index e93c8d5..d23ecb0 100644 --- a/event.c +++ b/event.c @@ -526,6 +526,8 @@ static void event_new_video(struct context *cnt, int type ATTRIBUTE_UNUSED, cnt->movie_fps = 30; else if (cnt->movie_fps < 2) cnt->movie_fps = 2; + + cnt->usinterval = 1000000 / cnt->movie_fps; /* less calculations are good... */ } #ifdef HAVE_FFMPEG diff --git a/motion.c b/motion.c index 5666770..3e5b807 100644 --- a/motion.c +++ b/motion.c @@ -556,60 +556,51 @@ static void process_image_ring(struct context *cnt, unsigned int max_images) cnt->imgs.width, t, cnt->conf.text_double); } - /* Output the picture to jpegs and ffmpeg */ - event(cnt, EVENT_IMAGE_DETECTED, - cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, NULL, NULL, + //smoothvideo: payne 10/15/2008 + //located in two places + /* process this only if we're outputting to a movie */ + if (cnt->conf.smooth_video && (cnt->ffmpeg_output || cnt->conf.useextpipe)) { + if (cnt->prevtv.tv_sec > 0) { + time_t elapsedus = ((cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_sec - cnt->prevtv.tv_sec) * 1000000) + + (cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_usec - cnt->prevtv.tv_usec); + int myinsertnum = ((elapsedus + cnt->leftovers) / cnt->usinterval); + /* the larger loop we're in is only called to process + * motion -- there will be one frame processed later + * REGARDLESS of what we do here, so, account for it */ + cnt->leftovers += elapsedus - (cnt->usinterval*(myinsertnum+1)); + + if (cnt_list[0]->conf.log_level >= 2) + motion_log(LOG_INFO, 0, "current, prev, fps, us, interval, insertnum, leftovers: " + "%d.%06ld, %d.%06ld, %d, %d, %d, %d, %d", + cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_sec, + cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_usec, + cnt->prevtv.tv_sec, cnt->prevtv.tv_usec, cnt->movie_fps, elapsedus, + cnt->usinterval, myinsertnum, cnt->leftovers); + + while (myinsertnum > 0) { + event(cnt, EVENT_FFMPEG_PUT, cnt->previmg, NULL, NULL, &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm); + myinsertnum--; - /* - * Check if we must add any "filler" frames into movie to keep up fps - * Only if we are recording videos ( ffmpeg or extenal pipe ) - */ - if ((cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot == 0) && -#ifdef HAVE_FFMPEG - (cnt->ffmpeg_output || (cnt->conf.useextpipe && cnt->extpipe))) { -#else - (cnt->conf.useextpipe && cnt->extpipe)) { -#endif - /* - * movie_last_shoot is -1 when file is created, - * we don't know how many frames there is in first sec - */ - if (cnt->movie_last_shot >= 0) { - if (cnt_list[0]->log_level >= DBG) { - int frames = cnt->movie_fps - (cnt->movie_last_shot + 1); - if (frames > 0) { - char tmp[15]; - MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "%s: Added %d fillerframes into movie", - frames); - sprintf(tmp, "Fillerframes %d", frames); - draw_text(cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, 10, 40, - cnt->imgs.width, tmp, cnt->conf.text_double); + + } } + cnt->prevtv = cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv; + memcpy(cnt->previmg, cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, cnt->imgs.size); } - /* Check how many frames it was last sec */ - while ((cnt->movie_last_shot + 1) < cnt->movie_fps) { - /* Add a filler frame into encoder */ + /* Output the picture to jpegs (if motion), ffmpeg and extpipe (regardless)*/ + if ((cnt->imgs.image_ring[cnt->imgs.image_ring_out].flags & IMAGE_MOTION) && + ! (cnt->imgs.image_ring[cnt->imgs.image_ring_out].flags & IMAGE_PRECAP)) { + event(cnt, EVENT_IMAGE_DETECTED, + cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, NULL, NULL, + &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm); + } else { event(cnt, EVENT_FFMPEG_PUT, cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, NULL, NULL, &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm); - - cnt->movie_last_shot++; } } - cnt->movie_last_shot = 0; - } else if (cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot != (cnt->movie_last_shot + 1)) { - /* We are out of sync! Propably we got motion - no motion - motion */ - cnt->movie_last_shot = -1; - } - /* - * Save last shot added to movie - * only when we not are within first sec - */ - if (cnt->movie_last_shot >= 0) - cnt->movie_last_shot = cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot; - } /* Mark the image as saved */ cnt->imgs.image_ring[cnt->imgs.image_ring_out].flags |= IMAGE_SAVED; @@ -673,7 +664,9 @@ static int motion_init(struct context *cnt) cnt->currenttime_tm = mymalloc(sizeof(struct tm)); cnt->eventtime_tm = mymalloc(sizeof(struct tm)); /* Init frame time */ - cnt->currenttime = time(NULL); + gettimeofday(&cnt->tv, NULL); + cnt->currenttime = cnt->tv.tv_sec; + localtime_r(&cnt->currenttime, cnt->currenttime_tm); cnt->smartmask_speed = 0; @@ -716,6 +709,10 @@ static int motion_init(struct context *cnt) return -3; } + /* setup cnt->previmg (previous img for ffmpeg streaming) */ + cnt->previmg = mymalloc(cnt->imgs.size); + memset(cnt->previmg, 0x80, cnt->imgs.size); /* initialize to grey */ + image_ring_resize(cnt, 1); /* Create a initial precapture ring buffer with 1 frame */ cnt->imgs.ref = mymalloc(cnt->imgs.size); @@ -1067,6 +1064,12 @@ static void motion_cleanup(struct context *cnt) sqlite3_close(cnt->database_sqlite3); #endif /* HAVE_SQLITE3 */ } + + /* Cleanup the previmg buffer */ + if (cnt->previmg) { + free(cnt->previmg); + cnt->previmg = NULL; + } } /** @@ -1221,7 +1224,9 @@ static void *motion_loop(void *arg) image_ring_resize(cnt, frame_buffer_size); /* Get time for current frame */ - cnt->currenttime = time(NULL); + gettimeofday(&cnt->tv, NULL); + cnt->currenttime = cnt->tv.tv_sec; + /* * localtime returns static data and is not threadsafe @@ -1301,6 +1306,7 @@ static void *motion_loop(void *arg) /* Store time with pre_captured image */ cnt->current_image->timestamp = cnt->currenttime; + cnt->current_image->tv = cnt->tv; localtime_r(&cnt->current_image->timestamp, &cnt->current_image->timestamp_tm); /* Store shot number with pre_captured image */ @@ -1928,11 +1934,57 @@ static void *motion_loop(void *arg) * images get a timestamp from previous event. */ cnt->text_event_string[0] = '\0'; + + cnt->gapfix = 0; + if ((cnt->currenttime - cnt->lasttime < cnt->conf.event_gap) && cnt->conf.event_gap > 0) { + cnt->current_image->flags |= (IMAGE_TRIGGER); + cnt->postcap = cnt->conf.post_capture; + motion_detected(cnt, cnt->video_dev, cnt->current_image); + cnt->gapfix = 1; + } else { + /* And, finally again, we reset the prevtv structure. */ + cnt->prevtv.tv_sec = 0; + cnt->prevtv.tv_usec = 0; + } } } /* Save/send to movie some images */ process_image_ring(cnt, 2); + /* For movie realtime sync. code needed here so we don't run into issues + with high numbers of queued images, which would slow down processing */ + if (cnt->conf.smooth_video && (cnt->ffmpeg_output || (cnt->conf.useextpipe))) { + /* process this if we're outputting to a movie only.. */ + if (cnt->prevtv.tv_sec > 0) { /* only run through this block of code if we're in an event -- + minimal processing is KEY =) */ + time_t elapsedus = ((cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_sec - cnt->prevtv.tv_sec) * 1000000) + + (cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_usec - cnt->prevtv.tv_usec); + int myinsertnum = ((elapsedus + cnt->leftovers) / cnt->usinterval); + + if (myinsertnum > 0) { + cnt->leftovers += elapsedus - (cnt->usinterval*(myinsertnum)); + + if (cnt_list[0]->conf.log_level >= 2) + motion_log(LOG_INFO, 0, "KEEPUP: current, prev, fps, us, interval, insertnum, leftovers: " + "%d.%06ld, %d.%06ld, %d, %d, %d, %d, %d", + cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_sec, + cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_usec, + cnt->prevtv.tv_sec, cnt->prevtv.tv_usec, cnt->movie_fps, elapsedus, + cnt->usinterval, myinsertnum, cnt->leftovers); + + while (myinsertnum > 0) { + event(cnt, EVENT_FFMPEG_PUT, cnt->previmg, NULL, NULL, + &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm); + myinsertnum--; + } + + cnt->prevtv = cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv; + memcpy(cnt->previmg, cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, cnt->imgs.size); + } + } + } + + /***** MOTION LOOP - SETUP MODE CONSOLE OUTPUT SECTION *****/ @@ -3220,6 +3272,25 @@ size_t mystrftime(const struct context *cnt, char *s, size_t max, const char *us ++pos_userformat; break; + case 'u': // tv_usec -- really "us" for micro time, returns microsecond part + // ux = two decimals + switch(*++pos_userformat) { + case 's': // %us, return microseconds (6 digits padded) + sprintf(tempstr, "%06ld",cnt->current_image->tv.tv_usec); + break; + case 'x': // %ux, return microseconds (2 digits padded) + sprintf(tempstr, "%02d",cnt->current_image->tv.tv_usec/10000); + break; + case 'g': // %ug, debugging, gapfix active? + sprintf(tempstr, "%d",cnt->gapfix); + break; + + } + if (tempstr[0]) //if %ut or %us + break; + else + --pos_userformat; + default: // Any other code is copied with the %-sign *format++ = '%'; *format++ = *pos_userformat; diff --git a/motion.h b/motion.h index 8789edd..c505250 100644 --- a/motion.h +++ b/motion.h @@ -237,6 +237,7 @@ struct images; struct image_data { unsigned char *image; int diffs; + struct timeval tv; time_t timestamp; /* Timestamp when image was captured */ struct tm timestamp_tm; int shot; /* Sub second timestamp count */ @@ -351,6 +352,7 @@ struct context { struct config conf; struct images imgs; + unsigned char *previmg; struct trackoptions track; struct netcam_context *netcam; struct image_data *current_image; /* Pointer to a structure where the image, diffs etc is stored */ @@ -389,6 +391,11 @@ struct context { struct tm *currenttime_tm; struct tm *eventtime_tm; + int gapfix; /* set to 1 if gap not fulfilled; used for output */ + struct timeval tv; + struct timeval prevtv; /* previous pic tv.. needs to stick around */ + struct timeval prevmotiontv; /* previous pic detection tv.. needs to stick around */ + time_t leftovers; /* leftover microseconds */ time_t currenttime; time_t lasttime; time_t eventtime; @@ -428,6 +435,8 @@ struct context { #endif int movie_fps; + time_t usinterval; /* microsecond interval, 1000000 / movie_fps */ + char newfilename[PATH_MAX]; char extpipefilename[PATH_MAX]; int movie_last_shot; From 802a031c783aeb1661bcf626386a273d85a99075 Mon Sep 17 00:00:00 2001 From: Roman Gaufman Date: Thu, 1 Mar 2012 22:36:51 +0000 Subject: [PATCH 2/9] Add force framerate option --- conf.c | 11 +++++++++++ conf.h | 1 + event.c | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/conf.c b/conf.c index e7342bb..f2a3728 100644 --- a/conf.c +++ b/conf.c @@ -353,6 +353,17 @@ config_param config_params[] = { print_int }, { + "force_framerate", + "# Force the number of frames per second set in framerate.\n" + "# This is useful for capture cards on busy system where motion\n" + "# often failed to detect the correct framerate.\n" + "# Valid range: 2-100. Default: 100 (almost no limit).", + 0, + CONF_OFFSET(force_framerate), + copy_bool, + print_bool + }, + { "minimum_frame_time", "# Minimum time in seconds between capturing picture frames from the camera.\n" "# Default: 0 = disabled - the capture rate is given by the camera framerate.\n" diff --git a/conf.h b/conf.h index 4b37ea6..96b002f 100644 --- a/conf.h +++ b/conf.h @@ -41,6 +41,7 @@ struct config { int norm; int frame_limit; int quiet; + int force_framerate; int useextpipe; /* ext_pipe on or off */ int smooth_video; const char *extpipe; /* full Command-line for pipe -- must accept YUV420P images */ diff --git a/event.c b/event.c index d23ecb0..44c7b30 100644 --- a/event.c +++ b/event.c @@ -522,7 +522,9 @@ static void event_new_video(struct context *cnt, int type ATTRIBUTE_UNUSED, MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO, "%s FPS %d", cnt->movie_fps); - if (cnt->movie_fps > 30) + if (cnt->conf.force_framerate) + cnt->movie_fps = cnt->conf.frame_limit; + else if (cnt->movie_fps > 30) cnt->movie_fps = 30; else if (cnt->movie_fps < 2) cnt->movie_fps = 2; From 86390a32f4f4c7bbfd8ffe005a624dd03dcf2993 Mon Sep 17 00:00:00 2001 From: Roman Gaufman Date: Sun, 11 Mar 2012 19:27:06 +0000 Subject: [PATCH 3/9] Fix compile problems on latest ubuntu --- configure | 279 ++++++++++++++++++++++++++++----------------------- configure.in | 7 +- 2 files changed, 160 insertions(+), 126 deletions(-) diff --git a/configure b/configure index 6398d64..2caf744 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7. +# Generated by GNU Autoconf 2.68 for motion trunkREVUNKNOWN. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -89,6 +89,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -214,11 +215,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -549,8 +557,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='motion' PACKAGE_TARNAME='motion' -PACKAGE_VERSION='Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7' -PACKAGE_STRING='motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7' +PACKAGE_VERSION='trunkREVUNKNOWN' +PACKAGE_STRING='motion trunkREVUNKNOWN' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1079,7 +1087,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1217,7 +1225,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7 to adapt to many kinds of systems. +\`configure' configures motion trunkREVUNKNOWN to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1278,7 +1286,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7:";; + short | recursive ) echo "Configuration of motion trunkREVUNKNOWN:";; esac cat <<\_ACEOF @@ -1424,8 +1432,8 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -motion configure Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7 -generated by GNU Autoconf 2.67 +motion configure trunkREVUNKNOWN +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1471,7 +1479,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1517,7 +1525,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1554,7 +1562,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1596,7 +1604,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1609,10 +1617,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1675,7 +1683,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1684,7 +1692,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1697,7 +1705,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1715,7 +1723,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1727,7 +1735,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1782,7 +1790,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -1795,7 +1803,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1836,7 +1844,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -2013,7 +2021,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f conftest.val fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2021,8 +2029,8 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by motion $as_me Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7, which was -generated by GNU Autoconf 2.67. Invocation command line was +It was created by motion $as_me trunkREVUNKNOWN, which was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2280,7 +2288,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2382,7 +2390,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2422,7 +2430,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2475,7 +2483,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2515,7 +2523,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2574,7 +2582,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2618,7 +2626,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2673,7 +2681,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -2788,7 +2796,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -2831,7 +2839,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -2890,7 +2898,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -2901,7 +2909,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2942,7 +2950,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -2952,7 +2960,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2989,7 +2997,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3067,7 +3075,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3257,7 +3265,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3297,7 +3305,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3350,7 +3358,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3390,7 +3398,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3449,7 +3457,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3493,7 +3501,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3548,7 +3556,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3577,7 +3585,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3614,7 +3622,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3692,7 +3700,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4028,7 +4036,7 @@ if test "${JPEG_TURBO_OK}" = "found"; then LIBS="$LIBS -L${JPEG_TURBO}/lib -ljpeg" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_compress in -ljpeg" >&5 $as_echo_n "checking for jpeg_start_compress in -ljpeg... " >&6; } -if test "${ac_cv_lib_jpeg_jpeg_start_compress+set}" = set; then : +if ${ac_cv_lib_jpeg_jpeg_start_compress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4062,7 +4070,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_start_compress" >&5 $as_echo "$ac_cv_lib_jpeg_jpeg_start_compress" >&6; } -if test "x$ac_cv_lib_jpeg_jpeg_start_compress" = x""yes; then : +if test "x$ac_cv_lib_jpeg_jpeg_start_compress" = xyes; then : TEMP_LIBS="$LIBS" TEMP_CFLAGS="${CFLAGS}" TEMP_LDFLAGS="$TEMP_LDFLAGS $LDFLAGS" @@ -4137,7 +4145,7 @@ if test "${JPEG_MMX_OK}" = "found"; then LIBS="$LIBS -L${JPEG_MMX}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_compress in -ljpeg-mmx" >&5 $as_echo_n "checking for jpeg_start_compress in -ljpeg-mmx... " >&6; } -if test "${ac_cv_lib_jpeg_mmx_jpeg_start_compress+set}" = set; then : +if ${ac_cv_lib_jpeg_mmx_jpeg_start_compress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4171,7 +4179,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_mmx_jpeg_start_compress" >&5 $as_echo "$ac_cv_lib_jpeg_mmx_jpeg_start_compress" >&6; } -if test "x$ac_cv_lib_jpeg_mmx_jpeg_start_compress" = x""yes; then : +if test "x$ac_cv_lib_jpeg_mmx_jpeg_start_compress" = xyes; then : TEMP_LIBS="$TEMP_LIBS -ljpeg-mmx" TEMP_CFLAGS="${TEMP_CFLAGS} -I${JPEG_MMX}" JPEG_SUPPORT="yes" @@ -4191,7 +4199,7 @@ if test x$JPEG_SUPPORT != xyes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_set_defaults in -ljpeg" >&5 $as_echo_n "checking for jpeg_set_defaults in -ljpeg... " >&6; } -if test "${ac_cv_lib_jpeg_jpeg_set_defaults+set}" = set; then : +if ${ac_cv_lib_jpeg_jpeg_set_defaults+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4225,7 +4233,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_set_defaults" >&5 $as_echo "$ac_cv_lib_jpeg_jpeg_set_defaults" >&6; } -if test "x$ac_cv_lib_jpeg_jpeg_set_defaults" = x""yes; then : +if test "x$ac_cv_lib_jpeg_jpeg_set_defaults" = xyes; then : TEMP_LIBS="$TEMP_LIBS -ljpeg" JPEG_SUPPORT="yes" @@ -4271,7 +4279,13 @@ else if test "${FFMPEG_DIR}" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg autodetecting libraries" >&5 $as_echo_n "checking for ffmpeg autodetecting libraries... " >&6; } - if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then + if test -f /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libavcodec.so ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)" >&5 +$as_echo "found in /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)" >&6; } + FFMPEG_OK="found" + FFMPEG_LIB="/usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)" + FFMPEG_DIR="/usr" + elif test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib64" >&5 $as_echo "found in /usr/lib64" >&6; } FFMPEG_OK="found" @@ -4455,7 +4469,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqlite3" >&5 $as_echo_n "checking for sqlite3_open in -lsqlite3... " >&6; } -if test "${ac_cv_lib_sqlite3_sqlite3_open+set}" = set; then : +if ${ac_cv_lib_sqlite3_sqlite3_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4489,7 +4503,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqlite3_sqlite3_open" >&5 $as_echo "$ac_cv_lib_sqlite3_sqlite3_open" >&6; } -if test "x$ac_cv_lib_sqlite3_sqlite3_open" = x""yes; then : +if test "x$ac_cv_lib_sqlite3_sqlite3_open" = xyes; then : TEMP_LIBS="$TEMP_LIBS -lsqlite3" SQLITE3_SUPPORT="yes" @@ -4655,7 +4669,7 @@ $as_echo "$MYSQL_LIBDIR" >&6; } LIBS="-L$MYSQL_LIBDIR" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_init in -lmysqlclient" >&5 $as_echo_n "checking for mysql_init in -lmysqlclient... " >&6; } -if test "${ac_cv_lib_mysqlclient_mysql_init+set}" = set; then : +if ${ac_cv_lib_mysqlclient_mysql_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4689,7 +4703,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mysqlclient_mysql_init" >&5 $as_echo "$ac_cv_lib_mysqlclient_mysql_init" >&6; } -if test "x$ac_cv_lib_mysqlclient_mysql_init" = x""yes; then : +if test "x$ac_cv_lib_mysqlclient_mysql_init" = xyes; then : TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient -lz" TEMP_CFLAGS="$TEMP_CFLAGS -I$MYSQL_INCDIR" @@ -4851,7 +4865,7 @@ $as_echo "not found" >&6; } LIBS="-L$PGSQL_LIBDIR" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQconnectStart in -lpq" >&5 $as_echo_n "checking for PQconnectStart in -lpq... " >&6; } -if test "${ac_cv_lib_pq_PQconnectStart+set}" = set; then : +if ${ac_cv_lib_pq_PQconnectStart+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4885,7 +4899,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQconnectStart" >&5 $as_echo "$ac_cv_lib_pq_PQconnectStart" >&6; } -if test "x$ac_cv_lib_pq_PQconnectStart" = x""yes; then : +if test "x$ac_cv_lib_pq_PQconnectStart" = xyes; then : PGSQL_SUPPORT="yes" TEMP_LIBS="$TEMP_LIBS -L$PGSQL_LIBDIR -lpq" @@ -4922,7 +4936,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -5038,7 +5052,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -5050,7 +5064,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -5113,7 +5127,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -5180,7 +5194,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5324,7 +5338,7 @@ done for ac_func in get_current_dir_name do : ac_fn_c_check_func "$LINENO" "get_current_dir_name" "ac_cv_func_get_current_dir_name" -if test "x$ac_cv_func_get_current_dir_name" = x""yes; then : +if test "x$ac_cv_func_get_current_dir_name" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GET_CURRENT_DIR_NAME 1 _ACEOF @@ -5346,7 +5360,7 @@ else ac_fn_c_check_type "$LINENO" "struct v4l2_buffer" "ac_cv_type_struct_v4l2_buffer" "#include #include " -if test "x$ac_cv_type_struct_v4l2_buffer" = x""yes; then : +if test "x$ac_cv_type_struct_v4l2_buffer" = xyes; then : SUPPORTED_V4L2=true else SUPPORTED_V4L2=false @@ -5374,7 +5388,7 @@ $as_echo "testing" >&6; } do : ac_fn_c_check_header_compile "$LINENO" "linux/videodev2.h" "ac_cv_header_linux_videodev2_h" "#include " -if test "x$ac_cv_header_linux_videodev2_h" = x""yes; then : +if test "x$ac_cv_header_linux_videodev2_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_VIDEODEV2_H 1 _ACEOF @@ -5401,7 +5415,7 @@ fi # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then : +if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -5411,7 +5425,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi @@ -5434,7 +5448,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : +if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -5444,7 +5458,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi @@ -5467,7 +5481,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long int" >&5 $as_echo_n "checking size of long int... " >&6; } -if test "${ac_cv_sizeof_long_int+set}" = set; then : +if ${ac_cv_sizeof_long_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long int))" "ac_cv_sizeof_long_int" "$ac_includes_default"; then : @@ -5477,7 +5491,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_int=0 fi @@ -5500,7 +5514,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if test "${ac_cv_sizeof_long_long+set}" = set; then : +if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -5510,7 +5524,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi @@ -5533,7 +5547,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5 $as_echo_n "checking size of int *... " >&6; } -if test "${ac_cv_sizeof_int_p+set}" = set; then : +if ${ac_cv_sizeof_int_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p" "$ac_includes_default"; then : @@ -5543,7 +5557,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int *) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int_p=0 fi @@ -5566,7 +5580,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } -if test "${ac_cv_sizeof_void_p+set}" = set; then : +if ${ac_cv_sizeof_void_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : @@ -5576,7 +5590,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_void_p=0 fi @@ -5630,7 +5644,7 @@ fi # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then : +if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5974,28 +5988,28 @@ LDFLAGS="${TEMP_LDFLAGS}" ac_fn_c_check_func "$LINENO" "avformat_alloc_context" "ac_cv_func_avformat_alloc_context" -if test "x$ac_cv_func_avformat_alloc_context" = x""yes; then : +if test "x$ac_cv_func_avformat_alloc_context" = xyes; then : $as_echo "#define have_avformat_alloc_context 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "av_avformat_alloc_context" "ac_cv_func_av_avformat_alloc_context" -if test "x$ac_cv_func_av_avformat_alloc_context" = x""yes; then : +if test "x$ac_cv_func_av_avformat_alloc_context" = xyes; then : $as_echo "#define have_av_avformat_alloc_context 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "av_register_protocol2" "ac_cv_func_av_register_protocol2" -if test "x$ac_cv_func_av_register_protocol2" = x""yes; then : +if test "x$ac_cv_func_av_register_protocol2" = xyes; then : $as_echo "#define have_av_register_protocol2 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "av_register_protocol" "ac_cv_func_av_register_protocol" -if test "x$ac_cv_func_av_register_protocol" = x""yes; then : +if test "x$ac_cv_func_av_register_protocol" = xyes; then : $as_echo "#define have_av_register_protocol 1" >>confdefs.h @@ -6089,10 +6103,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -6124,7 +6149,7 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -6225,6 +6250,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -6531,8 +6557,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by motion $as_me Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7, which was -generated by GNU Autoconf 2.67. Invocation command line was +This file was extended by motion $as_me trunkREVUNKNOWN, which was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6593,8 +6619,8 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -motion config.status Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7 -configured by $0, generated by GNU Autoconf 2.67, +motion config.status trunkREVUNKNOWN +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -6726,7 +6752,7 @@ do "motion.spec") CONFIG_FILES="$CONFIG_FILES motion.spec" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -6748,9 +6774,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -6758,12 +6785,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -6785,7 +6813,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -6813,7 +6841,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -6861,7 +6889,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -6893,7 +6921,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -6927,7 +6955,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -6939,8 +6967,8 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -7041,7 +7069,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -7060,7 +7088,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -7069,7 +7097,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -7095,8 +7123,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -7221,21 +7249,22 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -7246,20 +7275,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/configure.in b/configure.in index 48a081e..8aa1fc9 100644 --- a/configure.in +++ b/configure.in @@ -401,7 +401,12 @@ else if test "${FFMPEG_DIR}" = "yes"; then # AUTODETECT STATIC/SHARED LIB AC_MSG_CHECKING(for ffmpeg autodetecting libraries) - if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then + if test -f /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libavcodec.so ; then + AC_MSG_RESULT(found in /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)) + FFMPEG_OK="found" + FFMPEG_LIB="/usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)" + FFMPEG_DIR="/usr" + elif test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then AC_MSG_RESULT(found in /usr/lib64) FFMPEG_OK="found" FFMPEG_LIB="/usr/lib64" From 20ec3eae4cbd5defdddf06a4ccc30f98534def78 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 6 Dec 2012 18:49:38 +0000 Subject: [PATCH 4/9] Remove unused components --- conf.c | 167 ------------------------------------------------- motion.c | 186 +------------------------------------------------------ 2 files changed, 3 insertions(+), 350 deletions(-) diff --git a/conf.c b/conf.c index f2a3728..1fa0db3 100644 --- a/conf.c +++ b/conf.c @@ -84,9 +84,6 @@ struct config conf_template = { ffmpeg_bps: DEF_FFMPEG_BPS, ffmpeg_vbr: DEF_FFMPEG_VBR, ffmpeg_video_codec: DEF_FFMPEG_CODEC, -#ifdef HAVE_SDL - sdl_threadnr: 0, -#endif ipv6_enabled: 0, stream_port: 0, stream_quality: 50, @@ -104,9 +101,6 @@ struct config conf_template = { tuner_number: 0, timelapse: 0, timelapse_mode: DEF_TIMELAPSE_MODE, -#if (defined(BSD)) - tuner_device: NULL, -#endif video_device: VIDEO_DEVICE, v4l2_palette: DEF_PALETTE, vidpipe: NULL, @@ -119,22 +113,6 @@ struct config conf_template = { on_event_end: NULL, mask_file: NULL, smart_mask_speed: 0, -#if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) - sql_log_image: 1, - sql_log_snapshot: 1, - sql_log_movie: 0, - sql_log_timelapse: 0, - sql_query: DEF_SQL_QUERY, - database_type: NULL, - database_dbname: NULL, - database_host: "localhost", - database_user: NULL, - database_password: NULL, - database_port: 0, -#ifdef HAVE_SQLITE3 - sqlite3_db: NULL, -#endif -#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || define(HAVE_SQLITE3) */ on_picture_save: NULL, on_motion_detected: NULL, on_area_detected: NULL, @@ -687,7 +665,6 @@ config_param config_params[] = { copy_string, print_string }, -#ifdef HAVE_FFMPEG { "ffmpeg_output_movies", "\n############################################################\n" @@ -777,20 +754,6 @@ config_param config_params[] = { copy_bool, print_bool }, -#endif /* HAVE_FFMPEG */ -#ifdef HAVE_SDL - { - "sdl_threadnr", - "\n############################################################\n" - "# SDL Window\n" - "############################################################\n\n" - "# Number of motion thread to show in SDL Window (default: 0 = disabled)", - 1, - CONF_OFFSET(sdl_threadnr), - copy_int, - print_int - }, -#endif /* HAVE_SDL */ { "use_extpipe", "\n############################################################\n" @@ -984,7 +947,6 @@ config_param config_params[] = { copy_string, print_string }, -#ifdef HAVE_FFMPEG { "movie_filename", "# File path for motion triggered ffmpeg films (movies) relative to target_dir\n" @@ -1010,7 +972,6 @@ config_param config_params[] = { copy_string, print_string }, -#endif /* HAVE_FFMPEG */ { "ipv6_enabled", "\n############################################################\n" @@ -1363,7 +1324,6 @@ config_param config_params[] = { copy_string, print_string }, -#ifdef HAVE_FFMPEG { "on_movie_start", "# Command to be executed when a movie file (.mpg|.avi) is created. (default: none)\n" @@ -1382,7 +1342,6 @@ config_param config_params[] = { copy_string, print_string }, -#endif /* HAVE_FFMPEG */ { "on_camera_lost", "# Command to be executed when a camera can't be opened or if it is lost\n" @@ -1395,132 +1354,6 @@ config_param config_params[] = { print_string }, -#if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) - { - "sql_log_picture", - "\n############################################################\n" - "# Common Options for database features.\n" - "# Options require the database options to be active also.\n" - "############################################################\n\n" - "# Log to the database when creating motion triggered image file (default: on)", - 0, - CONF_OFFSET(sql_log_image), - copy_bool, - print_bool - }, - { - "sql_log_snapshot", - "# Log to the database when creating a snapshot image file (default: on)", - 0, - CONF_OFFSET(sql_log_snapshot), - copy_bool, - print_bool - }, - { - "sql_log_movie", - "# Log to the database when creating motion triggered movie file (default: off)", - 0, - CONF_OFFSET(sql_log_movie), - copy_bool, - print_bool - }, - { - "sql_log_timelapse", - "# Log to the database when creating timelapse movie file (default: off)", - 0, - CONF_OFFSET(sql_log_timelapse), - copy_bool, - print_bool - }, - { - "sql_query", - "# SQL query string that is sent to the database\n" - "# Use same conversion specifiers has for text features\n" - "# Additional special conversion specifiers are\n" - "# %n = the number representing the file_type\n" - "# %f = filename with full path\n" - "# Create tables :\n" - "##\n" - "# Mysql\n" - "# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), event_time_stamp timestamp(14));\n" - "#\n" - "# Postgresql\n" - "# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp without time zone, event_time_stamp timestamp without time zone);\n" - "#\n" - "# Default value:\n" - "# insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')", - 0, - CONF_OFFSET(sql_query), - copy_string, - print_string - }, - { - "database_type", - "\n############################################################\n" - "# Database Options \n" - "############################################################\n\n" - "# database type : mysql, postgresql, sqlite3 (default : not defined)", - 0, - CONF_OFFSET(database_type), - copy_string, - print_string - }, - { - "database_dbname", - "# database to log to (default: not defined)", - 0, - CONF_OFFSET(database_dbname), - copy_string, - print_string - }, - { - "database_host", - "# The host on which the database is located (default: not defined)", - 0, - CONF_OFFSET(database_host), - copy_string, - print_string - }, - { - "database_user", - "# User account name for database (default: not defined)", - 0, - CONF_OFFSET(database_user), - copy_string, - print_string - }, - { - "database_password", - "# User password for database (default: not defined)", - 0, - CONF_OFFSET(database_password), - copy_string, - print_string - }, - { - "database_port", - "# Port on which the database is located (default: not defined)\n" - "# mysql 3306 , postgresql 5432 (default: not defined)", - 0, - CONF_OFFSET(database_port), - copy_int, - print_int - }, -#ifdef HAVE_SQLITE3 - { - "sqlite3_db", - "\n############################################################\n" - "# Database Options For SQLite3\n" - "############################################################\n\n" - "# SQLite3 database to log to (default: not defined)", - 0, - CONF_OFFSET(sqlite3_db), - copy_string, - print_string - }, -#endif /* HAVE_SQLITE3 */ - -#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) */ { "video_pipe", "\n############################################################\n" diff --git a/motion.c b/motion.c index 3e5b807..0f8be94 100644 --- a/motion.c +++ b/motion.c @@ -6,7 +6,7 @@ * See also the file 'COPYING'. * */ -#include "ffmpeg.h" +// #include "ffmpeg.h" #include "motion.h" #if (defined(BSD) && !defined(PWCBSD)) @@ -559,7 +559,7 @@ static void process_image_ring(struct context *cnt, unsigned int max_images) //smoothvideo: payne 10/15/2008 //located in two places /* process this only if we're outputting to a movie */ - if (cnt->conf.smooth_video && (cnt->ffmpeg_output || cnt->conf.useextpipe)) { + if (cnt->conf.smooth_video && cnt->conf.useextpipe) { if (cnt->prevtv.tv_sec > 0) { time_t elapsedus = ((cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_sec - cnt->prevtv.tv_sec) * 1000000) + (cnt->imgs.image_ring[cnt->imgs.image_ring_out].tv.tv_usec - cnt->prevtv.tv_usec); @@ -802,85 +802,6 @@ static int motion_init(struct context *cnt) } #endif /* !WITHOUT_V4L && !BSD */ -#if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) - if (cnt->conf.database_type) { - MOTION_LOG(NTC, TYPE_DB, NO_ERRNO, "%s: Database backend %s", - cnt->conf.database_type); - -#ifdef HAVE_SQLITE3 - if ((!strcmp(cnt->conf.database_type, "sqlite3")) && cnt->conf.sqlite3_db) { - MOTION_LOG(NTC, TYPE_DB, NO_ERRNO, "%s: DB %s", - cnt->conf.sqlite3_db); - - if (sqlite3_open(cnt->conf.sqlite3_db, &cnt->database_sqlite3) != SQLITE_OK) { - MOTION_LOG(ERR, TYPE_DB, NO_ERRNO, "%s: Can't open database %s : %s\n", - cnt->conf.sqlite3_db, sqlite3_errmsg(cnt->database_sqlite3)); - sqlite3_close(cnt->database_sqlite3); - exit(1); - } - } -#endif /* HAVE_SQLITE3 */ - -#ifdef HAVE_MYSQL - if ((!strcmp(cnt->conf.database_type, "mysql")) && (cnt->conf.database_dbname)) { - // close database to be sure that we are not leaking - mysql_close(cnt->database); - - cnt->database = (MYSQL *) mymalloc(sizeof(MYSQL)); - mysql_init(cnt->database); - - if (!mysql_real_connect(cnt->database, cnt->conf.database_host, cnt->conf.database_user, - cnt->conf.database_password, cnt->conf.database_dbname, 0, NULL, 0)) { - MOTION_LOG(ERR, TYPE_DB, NO_ERRNO, "%s: Cannot connect to MySQL database %s on host %s with user %s", - cnt->conf.database_dbname, cnt->conf.database_host, - cnt->conf.database_user); - MOTION_LOG(ERR, TYPE_DB, NO_ERRNO, "%s: MySQL error was %s", mysql_error(cnt->database)); - return -2; - } -#if (defined(MYSQL_VERSION_ID)) && (MYSQL_VERSION_ID > 50012) - my_bool my_true = TRUE; - mysql_options(cnt->database, MYSQL_OPT_RECONNECT, &my_true); -#endif - } -#endif /* HAVE_MYSQL */ - -#ifdef HAVE_PGSQL - if ((!strcmp(cnt->conf.database_type, "postgresql")) && (cnt->conf.database_dbname)) { - char connstring[255]; - - /* - * Create the connection string. - * Quote the values so we can have null values (blank) - */ - snprintf(connstring, 255, - "dbname='%s' host='%s' user='%s' password='%s' port='%d'", - cnt->conf.database_dbname, /* dbname */ - (cnt->conf.database_host ? cnt->conf.database_host : ""), /* host (may be blank) */ - (cnt->conf.database_user ? cnt->conf.database_user : ""), /* user (may be blank) */ - (cnt->conf.database_password ? cnt->conf.database_password : ""), /* password (may be blank) */ - cnt->conf.database_port - ); - - cnt->database_pg = PQconnectdb(connstring); - if (PQstatus(cnt->database_pg) == CONNECTION_BAD) { - MOTION_LOG(ERR, TYPE_DB, NO_ERRNO, "%s: Connection to PostgreSQL database '%s' failed: %s", - cnt->conf.database_dbname, PQerrorMessage(cnt->database_pg)); - return -2; - } - } -#endif /* HAVE_PGSQL */ - - - /* Set the sql mask file according to the SQL config options*/ - - cnt->sql_mask = cnt->conf.sql_log_image * (FTYPE_IMAGE + FTYPE_IMAGE_MOTION) + - cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT + - cnt->conf.sql_log_movie * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + - cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE; - } - -#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) */ - /* Load the mask file if any */ if (cnt->conf.mask_file) { if ((picture = myfopen(cnt->conf.mask_file, "r", 0))) { @@ -1046,23 +967,6 @@ static void motion_cleanup(struct context *cnt) } if (cnt->conf.database_type) { -#ifdef HAVE_MYSQL - if ( (!strcmp(cnt->conf.database_type, "mysql")) && (cnt->conf.database_dbname)) { - mysql_close(cnt->database); - } -#endif /* HAVE_MYSQL */ - -#ifdef HAVE_PGSQL - if ((!strcmp(cnt->conf.database_type, "postgresql")) && (cnt->conf.database_dbname)) { - PQfinish(cnt->database_pg); - } -#endif /* HAVE_PGSQL */ - -#ifdef HAVE_SQLITE3 - /* Close the SQLite database */ - if (cnt->conf.sqlite3_db) - sqlite3_close(cnt->database_sqlite3); -#endif /* HAVE_SQLITE3 */ } /* Cleanup the previmg buffer */ @@ -1166,16 +1070,6 @@ static void *motion_loop(void *arg) if (cnt->track.type) cnt->moved = track_center(cnt, cnt->video_dev, 0, 0, 0); -#ifdef __OpenBSD__ - /* - * FIXMARK - * Fixes zombie issue on OpenBSD 4.6 - */ - struct sigaction sig_handler_action; - struct sigaction sigchild_action; - setup_signals(&sig_handler_action, &sigchild_action); -#endif - /* * MAIN MOTION LOOP BEGINS HERE * Should go on forever... unless you bought vaporware :) @@ -1372,12 +1266,6 @@ static void *motion_loop(void *arg) } cnt->missing_frame_counter = 0; -#ifdef HAVE_FFMPEG - /* Deinterlace the image with ffmpeg, before the image is modified. */ - if (cnt->conf.ffmpeg_deinterlace) - ffmpeg_deinterlace(cnt->current_image->image, cnt->imgs.width, cnt->imgs.height); -#endif - /* * Save the newly captured still virgin image to a buffer * which we will not alter with text and location graphics @@ -1767,11 +1655,7 @@ static void *motion_loop(void *arg) if (cnt->conf.emulate_motion && (cnt->startup_frames == 0)) { cnt->detecting_motion = 1; MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "%s: Emulating motion"); -#ifdef HAVE_FFMPEG - if (cnt->ffmpeg_output || (cnt->conf.useextpipe && cnt->extpipe)) { -#else if (cnt->conf.useextpipe && cnt->extpipe) { -#endif /* Setup the postcap counter */ cnt->postcap = cnt->conf.post_capture; MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "%s: (Em) Init post capture %d", @@ -1816,11 +1700,7 @@ static void *motion_loop(void *arg) cnt->imgs.image_ring[i].flags |= IMAGE_SAVE; } else if ((cnt->postcap) && -#ifdef HAVE_FFMPEG - (cnt->ffmpeg_output || (cnt->conf.useextpipe && cnt->extpipe))) { -#else (cnt->conf.useextpipe && cnt->extpipe)) { -#endif /* we have motion in this frame, but not enought frames for trigger. Check postcap */ cnt->current_image->flags |= (IMAGE_POSTCAP | IMAGE_SAVE); cnt->postcap--; @@ -1833,11 +1713,7 @@ static void *motion_loop(void *arg) /* Always call motion_detected when we have a motion image */ motion_detected(cnt, cnt->video_dev, cnt->current_image); } else if ((cnt->postcap) && -#ifdef HAVE_FFMPEG - (cnt->ffmpeg_output || (cnt->conf.useextpipe && cnt->extpipe))) { -#else (cnt->conf.useextpipe && cnt->extpipe)) { -#endif /* No motion, doing postcap */ cnt->current_image->flags |= (IMAGE_POSTCAP | IMAGE_SAVE); cnt->postcap--; @@ -1953,7 +1829,7 @@ static void *motion_loop(void *arg) process_image_ring(cnt, 2); /* For movie realtime sync. code needed here so we don't run into issues with high numbers of queued images, which would slow down processing */ - if (cnt->conf.smooth_video && (cnt->ffmpeg_output || (cnt->conf.useextpipe))) { + if (cnt->conf.smooth_video && cnt->conf.useextpipe) { /* process this if we're outputting to a movie only.. */ if (cnt->prevtv.tv_sec > 0) { /* only run through this block of code if we're in an event -- minimal processing is KEY =) */ @@ -2045,8 +1921,6 @@ static void *motion_loop(void *arg) /***** MOTION LOOP - TIMELAPSE FEATURE SECTION *****/ -#ifdef HAVE_FFMPEG - if (cnt->conf.timelapse) { /* @@ -2105,17 +1979,8 @@ static void *motion_loop(void *arg) time_last_frame % cnt->conf.timelapse) event(cnt, EVENT_TIMELAPSE, cnt->current_image->image, NULL, NULL, &cnt->current_image->timestamp_tm); - } else if (cnt->ffmpeg_timelapse) { - /* - * If timelapse movie is in progress but conf.timelapse is zero then close timelapse file - * This is an important feature that allows manual roll-over of timelapse file using the http - * remote control via a cron job. - */ - event(cnt, EVENT_TIMELAPSEEND, NULL, NULL, NULL, cnt->currenttime_tm); } -#endif /* HAVE_FFMPEG */ - time_last_frame = time_current_frame; @@ -2134,10 +1999,6 @@ static void *motion_loop(void *arg) if (cnt->conf.setup_mode) { event(cnt, EVENT_IMAGE, cnt->imgs.out, NULL, &cnt->pipe, cnt->currenttime_tm); event(cnt, EVENT_STREAM, cnt->imgs.out, NULL, NULL, cnt->currenttime_tm); -#ifdef HAVE_SDL - if (cnt_list[0]->conf.sdl_threadnr == cnt->threadnr) - event(cnt, EVENT_SDL_PUT, cnt->imgs.out, NULL, NULL, cnt->currenttime_tm); -#endif } else { event(cnt, EVENT_IMAGE, cnt->current_image->image, NULL, &cnt->pipe, &cnt->current_image->timestamp_tm); @@ -2145,11 +2006,6 @@ static void *motion_loop(void *arg) if (!cnt->conf.stream_motion || cnt->shots == 1) event(cnt, EVENT_STREAM, cnt->current_image->image, NULL, NULL, &cnt->current_image->timestamp_tm); -#ifdef HAVE_SDL - if (cnt_list[0]->conf.sdl_threadnr == cnt->threadnr) - event(cnt, EVENT_SDL_PUT, cnt->current_image->image, NULL, NULL, - &cnt->current_image->timestamp_tm); -#endif } event(cnt, EVENT_IMAGEM, cnt->imgs.out, NULL, &cnt->mpipe, cnt->currenttime_tm); @@ -2209,19 +2065,6 @@ static void *motion_loop(void *arg) smartmask_ratio = 5 * cnt->lastrate * (11 - cnt->smartmask_speed); } -#if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) - - /* - * Set the sql mask file according to the SQL config options - * We update it for every frame in case the config was updated - * via remote control. - */ - cnt->sql_mask = cnt->conf.sql_log_image * (FTYPE_IMAGE + FTYPE_IMAGE_MOTION) + - cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT + - cnt->conf.sql_log_movie * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + - cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE; -#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3) */ - } @@ -2515,11 +2358,7 @@ static void motion_startup(int daemonize, int argc, char *argv[]) //set_log_level(cnt_list[0]->log_level); -#ifdef HAVE_SDL - MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Motion "VERSION" Started with SDL support"); -#else MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Motion "VERSION" Started"); -#endif if ((cnt_list[0]->conf.log_file) && (strncmp(cnt_list[0]->conf.log_file, "syslog", 6))) { set_log_mode(LOGMODE_FILE); @@ -2713,14 +2552,6 @@ int main (int argc, char **argv) motion_startup(1, argc, argv); -#ifdef HAVE_FFMPEG - /* - * FFMpeg initialization is only performed if FFMpeg support was found - * and not disabled during the configure phase. - */ - ffmpeg_init(); -#endif /* HAVE_FFMPEG */ - /* * In setup mode, Motion is very communicative towards the user, which * allows the user to experiment with the config parameters in order to @@ -2780,12 +2611,6 @@ int main (int argc, char **argv) start_motion_thread(cnt_list[i], &thread_attr); } -#ifdef HAVE_SDL - if (cnt_list[0]->conf.sdl_threadnr > 0) - sdl_start(cnt_list[cnt_list[1] != NULL ? cnt_list[0]->conf.sdl_threadnr : 0]->conf.width, - cnt_list[cnt_list[1] != NULL ? cnt_list[0]->conf.sdl_threadnr : 0]->conf.height); -#endif - /* * Create a thread for the control interface if requested. Create it * detached and with 'motion_web_control' as the thread function. @@ -2866,11 +2691,6 @@ int main (int argc, char **argv) } while (restart); /* loop if we're supposed to restart */ -#ifdef HAVE_SDL - sdl_stop(); -#endif - - // Be sure that http control exits fine cnt_list[0]->finish = 1; SLEEP(1, 0); From a6d98d8dfeb633321503c18842a9a06f9cd11110 Mon Sep 17 00:00:00 2001 From: hackeron Date: Fri, 22 Feb 2013 22:25:08 +0000 Subject: [PATCH 5/9] Update netcam.c --- netcam.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netcam.c b/netcam.c index 85e398a..3cf4840 100644 --- a/netcam.c +++ b/netcam.c @@ -1314,6 +1314,11 @@ static int netcam_read_html_jpeg(netcam_context_ptr netcam) MOTION_LOG(WRN, TYPE_NETCAM, SHOW_ERRNO, "%s: gettimeofday"); netcam->receiving->image_time = curtime; + + /* Fix starting of JPEG if needed , some cameras introduce thrash before + * SOI 0xFFD8 Start Of Image + */ + netcam_fix_jpeg_header(netcam); /* * Calculate our "running average" time for this netcam's From cf61feed11d43ba3635c1ae1bf46675bea727e59 Mon Sep 17 00:00:00 2001 From: hackeron Date: Fri, 22 Feb 2013 22:25:53 +0000 Subject: [PATCH 6/9] Update netcam.h --- netcam.h | 1 + 1 file changed, 1 insertion(+) diff --git a/netcam.h b/netcam.h index f335304..fb6276e 100644 --- a/netcam.h +++ b/netcam.h @@ -287,6 +287,7 @@ typedef struct { */ /* Within netcam_jpeg.c */ int netcam_proc_jpeg (struct netcam_context *, unsigned char *); +void netcam_fix_jpeg_header(struct netcam_context *); void netcam_get_dimensions (struct netcam_context *); /* Within netcam.c */ int netcam_start (struct context *); From 95bd461bfb8bdb166f38521522616a57df64f681 Mon Sep 17 00:00:00 2001 From: hackeron Date: Fri, 22 Feb 2013 22:27:32 +0000 Subject: [PATCH 7/9] Handle junk data at beginning of JPEG images --- netcam_jpeg.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/netcam_jpeg.c b/netcam_jpeg.c index 20fbda2..f5c0614 100644 --- a/netcam_jpeg.c +++ b/netcam_jpeg.c @@ -484,6 +484,42 @@ int netcam_proc_jpeg(netcam_context_ptr netcam, unsigned char *image) return retval; } +/** + * netcam_fix_jpeg_header + * + * Routine to decode an image received from a netcam into a YUV420P buffer + * suitable for processing by motion. + * + * Parameters: + * netcam pointer to the netcam_context structure + * + * Returns: Nothing + * + */ +void netcam_fix_jpeg_header(netcam_context_ptr netcam) +{ + char *ptr_buffer; + + ptr_buffer = memmem(netcam->receiving->ptr, netcam->receiving->used, "\xff\xd8", 2); + + if (ptr_buffer != NULL) { + size_t soi_position = 0; + + soi_position = ptr_buffer - netcam->receiving->ptr; + + if (soi_position > 0) { + memmove(netcam->receiving->ptr, netcam->receiving->ptr + soi_position, + netcam->receiving->used - soi_position); + netcam->receiving->used -= soi_position; + } + + // if (debug_level > CAMERA_INFO) + // motion_log(LOG_INFO, 0, "%s: SOI found , position %d", + // __FUNCTION__, soi_position); + } +} + + /** * netcam_get_dimensions * From ca0f326a865ff9e55bf4652450bad78f04d07cdc Mon Sep 17 00:00:00 2001 From: Roman Gaufman Date: Wed, 27 Mar 2013 09:15:59 +0000 Subject: [PATCH 8/9] Add cookies support for stupid chinese cameras --- conf.c | 10 ++++++++++ conf.h | 1 + netcam.c | 28 +++++++++++++++++++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/conf.c b/conf.c index 1fa0db3..5ab2abd 100644 --- a/conf.c +++ b/conf.c @@ -122,6 +122,7 @@ struct config conf_template = { motionvidpipe: NULL, netcam_url: NULL, netcam_userpass: NULL, + netcam_cookie: NULL, netcam_keepalive: "off", netcam_proxy: NULL, netcam_tolerant_check: 0, @@ -370,6 +371,15 @@ config_param config_params[] = { print_string }, { + "netcam_cookie", + "# HTTP Cookie string for network camera (only if required). Default: not defined\n" + "# Syntax is name1=value1;name2=value2", + 0, + CONF_OFFSET(netcam_cookie), + copy_string, + print_string + }, + { "netcam_keepalive", "# The setting for keep-alive of network socket, should improve performance on compatible net cameras.\n" "# off: The historical implementation using HTTP/1.0, closing the socket after each http request.\n" diff --git a/conf.h b/conf.h index 96b002f..d1c65cc 100644 --- a/conf.h +++ b/conf.h @@ -122,6 +122,7 @@ struct config { const char *motionvidpipe; const char *netcam_url; const char *netcam_userpass; + const char *netcam_cookie; const char *netcam_keepalive; const char *netcam_proxy; unsigned int netcam_tolerant_check; diff --git a/netcam.c b/netcam.c index 3cf4840..f51adf7 100644 --- a/netcam.c +++ b/netcam.c @@ -60,11 +60,13 @@ void file_free_context(tfile_context* ctxt); static const char *connect_req; static const char *connect_req_http10 = "GET %s HTTP/1.0\r\n" - "Host: %s\r\n" + "Host: %s%s\r\n" + "%s" //cookie string "User-Agent: Motion-netcam/" VERSION "\r\n"; static const char *connect_req_http11 = "GET %s HTTP/1.1\r\n" - "Host: %s\r\n" + "Host: %s%s\r\n" + "%s" //cookie string "User-Agent: Motion-netcam/" VERSION "\r\n"; static const char *connect_req_close = "Connection: close\r\n"; @@ -2102,8 +2104,18 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) char *userpass; /* Temp pointer to config value */ char *encuserpass; /* Temp storage for encoded ver */ char *request_pass = NULL; /* Temp storage for base64 conv */ + char *http_cookie = NULL; /* HTTP req cookie string */ + const char *http_cookie_header = "Cookie: %s\r\n"; + char *http_host_port = NULL; /* if port isn't 80 it must be in HTTP Host header */ int ix; + if(url->port!=80){ + char buff[5]; + sprintf(buff,"%d", url->port); + http_host_port = malloc(1+ strlen(buff)); + sprintf(http_host_port, ":%d", url->port); + } + /* First the http context structure. */ netcam->response = (struct rbuf *) mymalloc(sizeof(struct rbuf)); memset(netcam->response, 0, sizeof(struct rbuf)); @@ -2160,6 +2172,10 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) /* Free the working variables. */ free(encuserpass); } + if(cnt->conf.netcam_cookie){ + http_cookie =malloc(strlen(http_cookie_header) + strlen(cnt->conf.netcam_cookie)); + sprintf(http_cookie, http_cookie_header, cnt->conf.netcam_cookie); + } /* * We are now ready to set up the netcam's "connect request". Most of @@ -2176,6 +2192,7 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) * is set, since HTTP 1.0 Keep-alive cannot be transferred through. */ if (cnt->conf.netcam_proxy) { + http_host_port = NULL; /* * Allocate space for a working string to contain the path. * The extra 4 is for "://" and string terminator. @@ -2187,6 +2204,7 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) netcam->connect_keepalive = FALSE; /* Disable Keepalive if proxy */ free((void *)netcam->cnt->conf.netcam_keepalive); netcam->cnt->conf.netcam_keepalive = strdup("off"); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, "%s: " "Removed netcam_keepalive flag due to proxy set." @@ -2202,7 +2220,7 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) url->path = NULL; } - ix += strlen(ptr); + ix += strlen(ptr)+strlen(http_host_port); /* * Now add the required number of characters for the close header @@ -2232,11 +2250,11 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) * for the connect-request string. */ netcam->connect_request = mymalloc(strlen(connect_req) + ix + - strlen(netcam->connect_host)); + strlen(netcam->connect_host) + strlen(http_cookie)); /* Now create the request string with an sprintf. */ sprintf(netcam->connect_request, connect_req, ptr, - netcam->connect_host); + netcam->connect_host,http_host_port,http_cookie); if (netcam->connect_keepalive) strcat(netcam->connect_request, connect_req_keepalive); From 49c7e1c6093aa27233359e7f2581ad3614ffe242 Mon Sep 17 00:00:00 2001 From: Roman Gaufman Date: Wed, 27 Mar 2013 11:12:40 +0000 Subject: [PATCH 9/9] Fix netcam_cookie support --- netcam.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/netcam.c b/netcam.c index f51adf7..07e9036 100644 --- a/netcam.c +++ b/netcam.c @@ -2115,7 +2115,7 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) http_host_port = malloc(1+ strlen(buff)); sprintf(http_host_port, ":%d", url->port); } - + /* First the http context structure. */ netcam->response = (struct rbuf *) mymalloc(sizeof(struct rbuf)); memset(netcam->response, 0, sizeof(struct rbuf)); @@ -2172,10 +2172,12 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) /* Free the working variables. */ free(encuserpass); } - if(cnt->conf.netcam_cookie){ + + if (cnt->conf.netcam_cookie) { http_cookie =malloc(strlen(http_cookie_header) + strlen(cnt->conf.netcam_cookie)); sprintf(http_cookie, http_cookie_header, cnt->conf.netcam_cookie); } + /* * We are now ready to set up the netcam's "connect request". Most of @@ -2219,8 +2221,8 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) */ url->path = NULL; } - - ix += strlen(ptr)+strlen(http_host_port); + + ix += strlen(ptr); /* * Now add the required number of characters for the close header @@ -2228,6 +2230,8 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) * there is a problem (rather than the flag in the conf structure * which is read-only. */ + if (http_host_port) + ix += strlen(http_host_port); if (netcam->connect_keepalive) ix += strlen(connect_req_keepalive); @@ -2249,12 +2253,23 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) * Now that we know how much space we need, we can allocate space * for the connect-request string. */ - netcam->connect_request = mymalloc(strlen(connect_req) + ix + + if (http_cookie) { + netcam->connect_request = mymalloc(strlen(connect_req) + ix + strlen(netcam->connect_host) + strlen(http_cookie)); + /* Now create the request string with an sprintf. */ + sprintf(netcam->connect_request, connect_req, ptr, + netcam->connect_host,http_host_port,http_cookie); + } else { + netcam->connect_request = mymalloc(strlen(connect_req) + ix + + strlen(netcam->connect_host)); + /* Now create the request string with an sprintf. */ + sprintf(netcam->connect_request, connect_req, ptr, + netcam->connect_host); + } - /* Now create the request string with an sprintf. */ - sprintf(netcam->connect_request, connect_req, ptr, - netcam->connect_host,http_host_port,http_cookie); + // fprintf(stderr, "Hackeron %s\n", netcam->connect_request); + // fprintf(stderr, "Hackeron %s\n", ptr); + // fprintf(stderr, "Hackeron %s\n", netcam->connect_host); if (netcam->connect_keepalive) strcat(netcam->connect_request, connect_req_keepalive);