diff --git a/.gitignore b/.gitignore index 9e38ca5..105af30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.log .svn/ *.o +cmakebuild + diff --git a/BUILD-HOWTO b/BUILD-HOWTO new file mode 100644 index 0000000..cf44d90 --- /dev/null +++ b/BUILD-HOWTO @@ -0,0 +1,64 @@ +INTRODUCTION +------------ +This file describes what tools you need to build this experimental Pi specific version of motion, and how to perform the build. + +The current version of the cmake script does not perform full configuration of the build, nor does it check for dependencies. + +Hopefully this document should give you the information you need to get those dependencies; at some time in the future the build script should be made more capable to address this. + +REQUIRED TOOLS +-------------- +* cmake 2.8.x. +* Either native gcc and build essentials on Pi, or Pi-compatible ARM gcc cross compiler. +* git (to obtain some Pi specific files). + +DEPENDENCIES +------------ +The following libraries are required - either natively installed on the Pi, or in a Pi root file system copy on a cross-compilation machine. +They should be installable using packages from the Raspbian repositories. Make sure you install the actual package and the "dev" package. +You can use http://www.debian.org/distrib/packages to search for the package names, or use the suggested ones below: + +* libjpeg (libjpeg62, libjpeg62-dev) +* libavformat (libavformat53, libavformat-dev) +* libavcodec (libavcodec53, libavcodec-dev) +* libavutil (libavutil51, libavutil-dev) +* libm (libc6-dev) +* libz (zlib1g-dev) +* libmysqlclient (libmysqlclient18, libmysqlclient-dev) +* libpq (libpq5, libpq-dev) + +The Pi's VideoCore libraries are also required - these can be acquired (under /opt/vc/lib) by updating a Raspbian install, or from the Pi GitHub firmware repository (https://github.com/raspberrypi/firmware) + +The Pi userland source files are also needed - these can be obtained from the Pi GitHub (https://github.com/raspberrypi/userland) + +BUILDING ON A PI +---------------- +In this package's source directory, run the following: + + USERLANDPATH= cmake . + make + +For example, assuming that the userland source files have been cloned via git into the default user's home directory: + + USERLANDPATH=/home/pi/userland cmake . + make + +CROSS-COMPILING +--------------- +You'll need an ARM cross compilation toolchain that supports the Pi's ARM architecture - you could get that from the Pi GitHub (https://github.com/raspberrypi/tools) into the local folder /opt/cross/Pi. + +You'll also need a copy of /lib, /opt and /usr from the Pi's Raspbian root file system with the above dependencies installed - rsync is good to use for copying these, but may take some time. + +Cross-compilation requires some additional environment variables to be provided when cmake is run: + + TOOLPREFIX ARM cross-compiler tool name prefixes - e.g. arm-linux-gnueabi-hf- + TOOLPATH Path to cross compiler root - e.g. /opt/cross/Pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian + ROOTFSPATH Path to copy of Pi root file system on cross compilation system, e.g. /opt/cross/Pi/rootfs + +So an example execution might be: + + USERLANDPATH=/home/pi/userland TOOLPREFIX=arm-linux-gnueabi-hf- TOOLPATH=/opt/cross/Pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian ROOTFSPATH=/opt/cross/Pi/rootfs cmake . + make + + + diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 7c7f11e..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,2331 +0,0 @@ -SVN trunk Summary of Changes - -Features - * Insert Blanking frames http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2007x12x16x132522 (Dag Erlandsson) - * IPV6 for http-control and webcam stream not netcam yet http://www.lavrsen.dk/twiki/bin/view/Motion/IPv6 - (Jeroen Massar & Angel Carpintero) - * Experimental approach for MJPEG streams (Motion JPEG) for network cameras - http://www.lavrsen.dk/twiki/bin/view/Motion/LinksysWVC200SupportPatch ( ... ) - * Add draw a RED box around the movement as default (Joerg Weber) - * Add write/read nonblock functions in webhttpd( timeout on read/write). (Angel Carpintero) - * More changes in option names from http://www.lavrsen.dk/twiki/bin/view/Motion/IntuitiveOptionNamesDiscussion - (Angel Carpintero) - * motion_locate new parameter names : red , center , redcross instead of only on, off. (Angel Carpintero) - * External pipe to allow external video encoders - http://www.lavrsen.dk/twiki/bin/view/Motion/DarkwindHackeronMotionPatching (Bill Payne, Angel Carpintero) - * Split locate_motion into separate 'mode' and 'style' option to allow all - possible combinations. (Joerg Weber) - * Implement 'gapless' event mode to allow for recording of movies without 'holes'. (Joerg Weber) - * Limit detection rate to 3fps at framerates above 5fps, to reduce CPU load. (Joerg Weber) - * Fix warning for syslog() , Added support for some new bayer palettes introduced in kernel 2.6.27. - http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2008x10x15x130110 - Increased buffer in ffmpeg to allow encoding at 1600x1200 (Angel Carpintero) - * Sqlite3 support http://www.lavrsen.dk/twiki/bin/view/Motion/SQLite3Patch (Giacomo Graziosi) - * New RPM SPEC file and startup scripts compliant with Fedora 10 guidelines and above (Steven Moix) - * Increase write buffer size for writing image files and ffmpegs - http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionWriteBuffersPatch (Craig West) - * Fixed mask overlay in setup mode is now green instead of white (Joerg Weber) - * Add new config option 'ipv6_enabled' to enable/disable IPV6 (Angel Carpintero) - * Remove VIDIOC_S_JPEGCOMP support is deprecated. (Angel Carpintero) - * Use static memory allocation in ffmpeg_deinterlace() (Peter Holik) - http://www.lavrsen.dk/foswiki/bin/view/Motion/FfmpegDeinterlaceStatic - * Atom optimizacion in configure.in (Peter Holik) - http://www.lavrsen.dk/foswiki/bin/view/Motion/AtomOptimizations - * Allow to change Standard method ( PAL / NECAM / SECAM ) (Angel Carpintero) - * Add authentication methods 'Basic Authentication' and 'Digest Authentication' - to the "Live Stream Server". (Michael Finsterbusch) - http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionStreamAuthPatch - * Implemented new logging system - http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionLog (Angel Carpintero) - * Added a macro MOTION_LOG , no need to add __FUNCTION__ anymore. (Angel Carpintero) - * Added EXIF feature for jpeg images , http://www.lavrsen.dk/foswiki/bin/view/Motion/ExifTaggingPatch (Wim Lewis) - * Improve detection of av_register_protocol() for ffmpeg (Angel Carpintero). - * Added support for libjpeg-turbo - http://www.lavrsen.dk/foswiki/bin/view/Motion/FeatureRequest2010x04x14x082244 (Angel Carpintero) - * Added new log type COR , to filter messages from CORE. (Angel Carpintero) - * Added a new starting option -m to disable motion detection. (Angel Carpintero) - * Allow image dimension not 4:3 changing a check of modulo 16 by modulo 8. (Jeroen Massar) - * Added codec Ogg/Theora as new output format for regular movies. - http://www.lavrsen.dk/foswiki/bin/view/Motion/OggTimelapse (Michael Luich) - * Added support for ffmpeg 0.11 new API. - -Bugfixes - * Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero) - * Fix Segfault on reload or quit for vloopback (maybe other v4l1 devices too) (Peter Holik) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2009x06x17x090603 - * Allow compile with NetBSD and make LP64 compliant video_freebsd.c (Andreas Wrede) - * Avoid compile vloopback in BSD (Angel Carpintero) - * V4L2 fourcc GRBG not supported, updated default value for v4l2_palette 17. (Isaac Richter) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2009x10x29x222753 - * Exit when image dimension are not modulo 16. (Angel Carpintero) - * Avoid logs flooding using some options of netcam_keepalive and try to discard images with - weird header Content-Lenght 0. (Angel Carpintero) - * Only use post capture when we setup to record videos with external pipe or ffmpeg. (Angel Carpintero) - * Fix introduced bug for Content-Lenght = 0 in svn r476. (Angel Carpintero) - * Avoid segfault when motion cannot create a logfile. (Angel Carpintero) - * No mysql_close - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2010x11x22x033859 - * No PQfinish() (Angel Carpintero) - * Input for webcams has to be set to -1 - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2011x01x21x162309 - * Added a conditional check for avformat_alloc_context , av_avformat_alloc_context to fix - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2011x10x05x071936 (Angel Carpintero) - * Fix issue with JPEG , adding dinfo.do_fancy_upsampling = FALSE; - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2011x08x20x194659 - * Made micro-lightswitch optional (see lightwitch option in motion.conf) - * Fixed help text for options event_gap and area_detect - * Fixed motion.conf-dist , adding text according with config options. - * Fixed a bug in post_capture. It was missed under certain conditions. - * Fixed configure for SDL. - * Replace malloc() by calloc(). (Jeroen Massar) - * Free file descriptor buffers on exit. - * Avoid segfault when text_left or text_right uses non supported chars. - * Fixed leak in vloopback. - * Fixed a build of motion for some kernel version with not good videodev.h - -3.2.12 Summary of Changes - -Bugfixes - * Fixed name space clash with libjpeg8 (Kenneth Lavrsen) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2010x01x22x084753 - * Fixed FFV1 codec encode with ffmpeg (Angel Carpintero) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2010x04x13x032553 - * Fix conv_uyvyto420p segfault ( William M Brack ) - * Enhancing the palette selection ( William M Brack ) - * Fix zombies on OpenBSD. (Mark Feenstra) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2010x04x28x054348 - - -3.2.11.1 Sumary of Changes - -Bugfixes - * Fix Segfault on reload or quit for vloopback (maybe other v4l1 devices too) (Peter Holik) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2009x06x17x090603 - * Fix fd leaks in external pipe. (Angel Carpintero) - * Avoid possible stack smashing in v4l_open_vidpipe(). (Angel Carpintero) - * Allow compile with OpenSuse ffmpeg package (15594svn-20081010) - http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2008x10x25x070400 (Angel Carpintero) - * Fix warning for syslog(). (Angel Carpintero) - * Better detection of ffmpeg - http://www.lavrsen.dk/foswiki/pub/Motion/ReleaseNoteMotion3x2x11/ffmpeg-detection.diff.gz - (Angel Carpintero) - * Fix warning for __USE_GNU redefined (Peter Holik) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2009x06x17x122137 (Peter Holik) - * Allow compile with NetBSD and make LP64 compliant video_freebsd.c (Andreas Wrede) - * Fix segfault for new libjpeg v7. (Angel Carpintero) - -3.2.11 Summary of Changes - -Features - * Added support for ffmpeg-2008-04-09 port version of FreeBSD. - * Remove mjpegtools dependencies and integrate only needed functions from library. (Angel Carpintero) - * Allow change/setup framerate in FreeBSD using pwcbsd. (Angel Carpintero) - * Get rid of ffmpeg-config in configure.in for debian. (Angel Carpintero) - - -Bugfixes - * Fix Problem Encoding 1280x1024 resolution videos - http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2008x06x11x183727 (Angel Carpintero) - * Add a new parameter netcam_tolerant_check, to be less strict with some buggy network cameras firmwares. - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x06x19x123218 (Angel Carpintero) - * Fix round robin in BSD switching to METEOR_CAP_SINGLE. (Angel Carpintero) - * Fix rotate for v4l2 devices using JPEG / MJPEG palettes. (Angel Carpintero) - * Fix v4l2_palette http://www.lavrsen.dk/twiki/bin/view/Motion/UvcvideoMjpegPatch (Gerrit Hannaert) - * Fix warning for x86_64 in conf.c using pointers LP64 compliant ( Angel Carpintero ). - * Fix Segfault on reload or quit for vloopback (maybe other v4l1 devices too) ( Peter Holik ) - http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2009x06x17x090603 - - -3.2.10.1 Summary of Changes - -Bugfixes - * Fix a security issue in web control interface http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=484572 - (Angel Carpintero) - -3.2.10 Summary of Changes - -Features - * Added the pre_capture buffer redesign to throttle load and enhance pre_capture feature. - http://www.lavrsen.dk/twiki/bin/view/Motion/PreCaptureRedesign (Dag Erlandsson). - * Added preview center feature. - http://www.lavrsen.dk/twiki/bin/view/Motion/PreviewCenter (Dag Erlandsson). - * Removed low_cpu feature, as it is not really compatible with pre_capture and a lot of other - features rely on the pre_capture buffer behind the scenes. (Joerg Weber) - * Removed night_compensate feature. This functionality is covered by noise_tune. (Joerg Weber) - * Implemented a new reference frame algorithm to improve object recognition and location. (Joerg Weber) - * Improved smartmask feature: real moving objects don't trigger the mask anymore. (Joerg Weber) - * Added area_detect feature. New config options: area_detect, on_area_detected. (Joerg Weber) - * Added help in http control - http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2007x11x19x181541 (Angel Carpintero) - * Added Choose V4L2 palette http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2007x11x19x032318 - (Angel Carpintero) - * Improved http control ( 'back' link, select box, show current values when are going to be changed ). - (Angel Carpintero) - * Improved thread handling, single threads can be stopped/restarted (Dag Erlandsson) - * Watchdog, restart hang threads (Dag Erlandsson) - * Added ON_CAMERA_LOST event (Dag Erlandsson) - * Motion start if a camera isn't there at start, retries to connect if lost (Dag Erlandsson) - * Netcam Keepalive and HTTP/1.1 http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2007x01x22x231542 - (Simon Walls) - * Added mov , Quicktime file format (Andrew Hamilton). - * Added to configure.in --with-pwcbsd to allow compile motion in freebsd with webcam support instead of bktr - (Angel Carpintero) - -Bugfixes - * Fixed a problem with locate and fixed mask overlay (Dag Erlandsson). - * Preview pictures get the timestamp of moment they were captured (Dag Erlandsson). - * Fixed http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x10x23x093651 (Angel Carpintero) - * Fix process_id_file when is passed from command line (Angel Carpintero) - * Fix http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x10x27x150419 (Angel Carpintero) - * Fix http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x11x25x102808 (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 segfault because ffmpeg API change - http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2007x12x29x175530 (Angel Carpintero) - * 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 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 ). - * Better debug in netcam for "Error reading image header" - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x02x27x092849 (Simon Walls) - - -3.2.9 Formal Release - Summary of Changes - -Features - * Removed debian ( to avoid conflicts with debian package) and FreeBSD - ( no needed to deploy BSD port here ) directories. ( Angel Carpintero ) - * Added --chuid motion to debian init.d script. ( Angel Carpintero ) - * Added Flash video format (FLV) to ffmpeg. - http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2007x07x19x131921 (Timo Taskinen). - * Added FFV1 ( FF video codec 1 ) codec , Lossless encoding - http://www.lavrsen.dk/twiki/bin/view/Motion/LosslessEncoding (Andrew Hamilton). - - -Bugfixes - * Fix segfault in webhttpd.c on motion restart (Angel Carpintero) - * Fix segfault in debian http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x09x24x175945 - (Angel Carpintero) - * Fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391055 , change - motion man page , -d requires level. (Angel Carpintero) - * Handle mjpeg decoding and fix colour issue adding mjpegtools dependency - http://www.lavrsen.dk/twiki/bin/view/Motion/MjpegColorIssue - http://www.lavrsen.dk/twiki/bin/view/Motion/MjpegToYUV420pPatch - (Marius Rieder, Angel Carpintero). - * Add debug level > 5 to get logs from v4l2_select_input, v4l2_set_control and v4l2_set_input. - (Angel Carpintero) - - -3.2.8 Formal Release - Summary of Changes - -Features - * Added connection status for all devices available from http web interface. - (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2006x11x09x050638 - * Improved deb packaging, install the init.d script. (Angel Carpintero). - * Added swf codec to video creation (Bowser Pete, Andy Brown). - http://www.lavrsen.dk/twiki/bin/view/Motion/FFmpegSWFcreation - * Added V4L2 support (Krzysztof Blaszkowski, Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/VideoForLinuxTwoDiscussion, - * Added support for V4L2_PIX_FMT_SBGGR8 ( bayer ), V4L2_PIX_FMT_SN9C10X, - V4L2_PIX_FMT_MJPEG and V4L2_PIX_FMT_UYVY (Angel Carpintero). - * ucvideo track pan/tilt support ( Michal Licko ,Dirk Wesenberg and - Angel Carpintero ) - http://www.lavrsen.dk/twiki/bin/view/Motion/LinuxUvcTrackingPatch - * Added a FreeBSD directory to allow people from BSD to get a daily version - and create a port. (Angel Carpintero). - * Removed mysql dependency from debian package and added a note to setup - motion to run as daemon to create the pid file. (Angel Carpintero). - * Changed the way configure search mysql headers and libs, added 3 parameters - to configure --without-mysql to disable support, --with-mysql-include - directory of mysql.h and --with-mysql-lib directory of libmysqlclient.a or - libmysqlclient.so (Angel Carpintero). - * Added MYSQL_OPT_RECONNECT flag for mysql connection (MYSQL 5.x only) and - changed default value for mysql_host (Angel Carpintero). - -Bugfixes - * Removed a duplicate call to jpeg_destroy_decompress already is called from - netcam_image_conv (Krzysztof Blaszkowski). - * Fix http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x10x10x081903, - reconnect to mysql if connection dropped (Angel Carpintero). - * Fix memory management in ffmpeg.c (Rafis Khayrullin). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x12x19x062432 - * Fix of ffmpeg_avcodec_log code (Alain Guidez). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x03x25x074612 - * Fix a segfault adding correct size to be used for bayer2rgb24() - (Damian Wrobel) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x03x30x175913 - * Fix an error in FreeBSD, the use of capture even fields depends on height - value. (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x12x03x073610 - * Fixed autodetection for VIA cpu, no needed to use --without-optimizecpu. - Added many others (Angel Carpintero) - * Fix, don't remove pid file when motion reload config file( HUP signal ) - (Angel Carpintero). - * Fix compilation broken by uvc track type. (Angel Carpintero). - * Fixed the thread number assignment which could goof up if netcams started - very quickly before all thread were created at startup. (Kenneth Lavrsen) - * Fix RoundRobin v4l2 buffers in driver when switching input, - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x07x07x182605 - (Dag Erlandsson and Angel Carpintero). - * Check EIO for VIDIOC_DQBUF to workaround saa7134 problem. - (Dag Erlandsson and Angel Carpintero). - * Change bayer2rgb24() to fix a problem with sn9c102 driver - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2007x06x05x012249 - (Jared D and Angel Carpintero). - -3.2.7 Formal Release - Summary of Changes - -Features - * Removed the minimum_gap feature which was utterly useless (Kenneth Lavrsen) - * Added new feature: minimum_frame_time which enables capturing at a lower rate - than 2 frames per second (Kenneth Lavrsen and Angel Carpintero) - * Made the creation of reference frame and the decay mechanism depending - on how much motion was detected relative to threshold setting (Joerg Weber) - http://www.lavrsen.dk/twiki/bin/view/Motion/ReferenceFramePatch - * Added process_id_file feature (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2006x06x06x123003 - -Bugfixes - * Fixed problem related to fetching images from Network camera and error - handling when it fails. Motion would end in infinite loops (Bill Brack). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x03x10x000151 - * Improved reporting of thread numbers during startup in setup mode. - (Peter Smith and Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/SlightlyImprovedThreadCreationLogging - * Ffmpeg code mutex locking fix (Peter Smith) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x04x07x164654 - * Ffmpeg avicodec logging improved (Peter Smith and Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/FfmpegAvicodecLogging - * Improved upon a few ambiguous log messages which may be emitted by the Event - handling code with regards to Ffmpeg (Peter Smith) - http://www.lavrsen.dk/twiki/bin/view/Motion/LoggingEventFix - * Implemented a fix for the rare problem where some experienced that the - move file names would only consist of the extension .mpg or .avi with no - name in front. The root cause was the use of sprintf for appending to - strings. (Mike Kenney and Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2005x09x05x133031 - http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2006x06x19x174238 - * Altered the risky use of sprintf to snprintf in all places related to - use with config strings that can become very long (Kenneth Lavrsen) - * Removed annoying debug messages (v4l_set_input really needed ?) in the FreeBSD - version (Angel Carpintero) - * Fixed the check for ffmpeg version. In rev 5503 of ffmpeg the FFMPEG_VERSION_INT - was removed from libavcodec/avcodec.h. Instead we now use the equivalent - LIBAVFORMAT_BUILD >= 4616 which is the 0.4.9pre1 version of ffmpeg. - (Kenneth Lavrsen) - * Fixed segfault when netcam_url has no service ( http , ftp ) (Angel Carpintero) - * Fixed interlace issue with METEOR_GEO_EVEN_ONLY in FreeBSD (Angel Carpintero) - * Fixed possible syntax error in configure related to MySQL (Angel Carpintero) - * Avoid open file descriptor when connecting to network cameras fails (Peter Holik) - http://www.lavrsen.dk/twiki/bin/view/Motion/AvoidOpenfiledescriptors - * Fixed http pause feature so that pausing thread 0 now pauses all threads. - (GunnarSkjold) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x07x10x111239 - * Put a new global mutex around avcodec_close to avoid problems with not thread - safe functions in ffmpeg (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x04x07x164654 - * On FreeBSD configure defines a redundant freebsd for motion. Fixed by replacing - -D__freebsd_ by BSD macro included in sys/param.h for BSD platforms. - (JukkaUkkonen and Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x07x08x070417 - * For BSD platforms changed to using native pthreads as default and adding - linuxthreads as a optional parameter from configure. (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x07x08x071646 - * Smartmask overlay feature did not set intensity correctly. (Kenneth Lavrsen) - - -3.2.6 Formal Bugfix Release. - * Fixed bug where variables time_last_frame and time_current_frame had been - extended to also be used for snapshot feature but declaration was hidden - between #ifdef HAVE_FFMPEG. (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x03x09x012244 - * Fixed a bug that only allowed remote control of max 9 cameras. Now - Motion can present up to 99 cameras in its http remote control interface - (Angel Carpintero based on idea by Chuck Sheehan) - http://www.lavrsen.dk/twiki/bin/view/Motion/WebHttpManyThreads - * text_changes now shows a '-' when motion detection is paused instead of - just showing 0 (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2006x03x16x095713 - -3.2.5.1 Doc and man page correction - * ffmpeg_filename has changed name to movie_filename to prepare for - alternative movie encoding to the current ffmpeg based implementation - and ffmpeg_filename will then be a bad name (Kenneth Lavrsen) - * Man page corrected. - -3.2.5 Formal Release. Summary of changes - - * Fixed misc problems in FreeBSD. (Angel Carpintero) - * Update README.FreeBSD - * Fix problems with tuner_device and frequency, now by default is not - defined to allow use any input without problem. - * Replace strndup() by memcpy() in netcam.c - * Merged configure.in.freebsd with configure.in (configure.in.freebsd - deleted) - * Remove a warning when used --without-bktr - * Remove cpu optimization (is broken) - * Fixed memory leak in ffmpeg code. (Andrew Hamilton) - * Fixed http control of pan and tilt (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x12x22x122649 - * Fixed netcamera bug related to separating frames in an mjpeg stream. - (Peter Holik). From mailing list 23 Dec 2005. - * Fix related to connecting to the netcam (William Black) - From mailing list 23 Dec 2005. - * Changed CHANGELOG to same bullet format as used by TWiki to make it easier - to write release notes (Kenneth Lavrsen) - * Changed CREDITS to same bullet format as CHANGELOG (Kenneth Lavrsen) - * Fixed sql_mask not initialised correctly (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x01x09x175603 - * Fixed the management of strings from http remote control , setting to NULL - when they are set to "blank" and fixes a problem with despeckle , that didn't - allow to remove labeling action from http remote control. (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/FixStringsAndDisableLabeling - * Fix many typos in comments ( i ran aspell against the code ). Also there's a - fix to free cnt->eventtime_tm when motion exits. (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/FixTypoInComments - * Fix the problem that happens in FreeBSD and Debian Sarge because - version of ffmpeg is LIBAVFORMAT_BUILD < 4629. ( Pete Shipley and Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x01x12x120335 - * Updated motion.spec. Changing D_FORTIFY_SOURCE=2 by D_FORTIFY_SOURCE=1 to fix - problem related to building with ffmpeg. (Angel Carpintero) - * Implemented fix for missed snapshots with slow network cameras (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x02x07x162149 - * Added some constants in video.c function v4l_picture_controls() which can help - people hack an optimal set of values for controlling auto brightness for their - particular camera. For now I am do not want to add all of these to the already - too large number of motion config options. Maybe based on feedback we can - permanently change the constants and add an additional auto brightness option. - Or maybe a combined option that sets more constant based on an algorithm. - (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x02x07x212816 - * Fixed a syntax error in picture.c get_pgm() which caused the program to segfault - when a mask file size did not match the picture size. Now the program - correctly gives an error message and continues without the mask. (Kenneth - Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x10x08x150720 - * Added Tilt support to stepper track. ( Angel Carpintero ). - * CPU VIA Ezra C3 autodetection support added. (James Van Vleet) - http://www.lavrsen.dk/twiki/bin/view/Motion/VIAEzraC3Patch - * Fixed mysql configure auto-detection for x64 systems. ( Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2006x03x02x152208 - * Added the ffmpeg_deinterlace feature (Andrew Hamilton) - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionffmpegDeinterlace - -3.2.4 Formal Release. Summary of changes - -Features - * New text option text_event and new conversion specifier %C. Option - text_event defines the value %C which then can be used in filenames and - text_right/text_left. The text_event/%C uses the time stamp for the first - image detected in a new event. Default value is %Y%m%d%H%M%S. %C is an empty - string when no event is in progress (gap period expired). Pre_captured - and minimum_motion_frames images are time stamped before the event happens - so %C in text_left/right does not have any effect on those images. - * Added new option track_auto which is a boolean option (on or off) - with default value off. This enables people to start Motion with auto - tracking enabled. Changing the config value for track_auto and - enabling the auto tracking via the httpd track/auto has the exact same - effect. - * Added 3 new tracking options: track_step_angle_x, track_step_angle_y, - and track_move_wait. The options track_step_angle control the movement - during auto tracking and are currently only active for the pwc type - tracking. The idea is that they can later also be used for the generic - tracking as it evolves. The track_move_wait controls the number of frames - after the camera has moved (auto or manual) during which motion detection - is disabled. This option should be set so low that the motion detection - is re-enabled the minute the camera is standing still again. - * Added new sql_query option. This in combination with convertion - specifiers incl the two new %f and %n enables the user to use any database - structure they please. Adding fields is now a simple matter of modifying - the sql query. - * Added the %t conversion specifier which is the thread (camera) number. - * Added two new conversion specifiers: %f which is filename (full path) - and %n which is filetype (sqltype) valid in on_picture_save, on_movie_start, - on_movie_end and sql_query. This also means that filename is no longer - appended at the end of the 3 on_xxxx commands. - * http control had a number of small improvements. - * Added the debian sub directory so that people can build the deb package. - * Enhanced netcam compatibility with Lumenera and Pixord Cameras. - * Netcam feature now supports both http and ftp. - * Added an infinite retry scheme for netcams that are not available - when Motion is started. Instead of just dying, Motion now retries every - 10 seconds until the netcam is available. Until the netcam is available - Motion enters a mode showing a grey image with a text information which - is fed to webcam, timelapse, snapshots, vloopback etc. If the actual - height and width of the netcam does not match the dimensions in the - config file Motion will perform a quick restart. - * Added a better error handling of a netcam that changes dimensions - while Motion is running. Instead of just writing error messages Motion - restarts quickly to recover from this change. - * FreeBSD Code improvements including set/get hue, saturation, contrast - and brightness, support large resolutions. - * RPM specs file changed as suggested for use in the Livna repository. - * Changed the sequence of events connected with creating files. Data is - now written to the databases (if used) before an external comments is - on (on_xxxx options) allowing the external program to use the new data - in the database. - * Motion is now also works on MaxOSX with similar feature set as FreeBSD. - -Bugfixes - * netcam code now waits for the next frame to arrive for a limited period - in order to avoid too many duplicate images. - * Motion loop resets its frame timer when the image received is from a netcam. - This lowers the actual framerate of Motion to the rate the netcam can actually - keep up with. - * Removed all warnings when running ./configure --with-developer-flags. - * Fixed error message with unknown config option. - * Fixed small mistake in allocating memory for cnt->imgs.common_buffer. - * Implemented a speed-up patch of the draw text feature. - * Introduced check for device image size being a multiple of 16. - * Switchfilter feature repaired. - * Fixed small bug where motion was detected when using a tracking camera and - the camera moved to center position when gap period expires. - * Implemented fix to configure so that LDFLAGS from the environment are used - when making the Makefile. - * Changed configure so that --with-jpeg-mmx is default off as a reaction to - known problems seen when using the jpeg-mmx library. - * The lightswitch and switchfilter features have changed to ensure that both - algorithms work on raw unfiltered motion pixels which they both were designed - for. - * Fixed bug related to init of mutex in netcam code. - * Fixed small bug where the displayed time in the grey error image - shown during start with unavailable netcam could show a garbage value - under rare circumstances. - * Restored the function sigchild_handler so it contains the same code - as before motion-3.2.1_snap9. They is done in an attempt to fix an old - problem with zombie child processes that has shown up again. - * Added a work-around so people in FreeBSD that uses a capture card - where input 1 is not tuner can use motion if frequency is set -1 in - motion.conf or thread#.conf - - -3.2.4 Detailed changes for 3.2.4 -snap1 - * Removed all warnings originating from the motion sources when running - ./configure --with-developer-flags. - The modifications were done by the following people: Peter Holik, Bill Brack, - Angel Carpintero and Kenneth Lavrsen. - We now encourage developers to ensure that new code is checked with - --with-developer-flags and code made so that no new warnings shows originating - from the motion sources. - http://www.lavrsen.dk/twiki/bin/view/Motion/ReduceWarningsPatch - * Fixed error message with unknown config option (Bill Brack) - * Fixed small mistake in allocating memory for cnt->imgs.common_buffer - (Angel Carpintero). - * Implemented a speed-up patch of the draw text feature (Peter Holik). - http://www.lavrsen.dk/twiki/bin/view/Motion/DrawTextspeedup - * http control updated: (null) messages replaced by "disabled", last parameter - in conf/list are displayed correctly and only in Main thread. When motion runs - with only one thread, it displays "No threads". (Angel Carpintero) - * Enhanced compatibility with Lumenera (Bill Brack) - * http control: selectbox instead of a textfield for changing boolean configs - (Peter Holik and Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/WebhttpEnhancements. - * Introduced check for device image size being a multiple of 16 (Peter Holik). - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamModulo16Patch - * Added the debian sub directory so that people can build the deb package - (Angel Carpintero). - * Sync configure.in.freebsd (adding support for jpeg-mmx, developer-flags and - some cosmetic changes ) (Angel Carpintero) - * Implemented --with-developer-flags fixes in FreeBSD code (Angel Carpintero). - * Implemented Threadnr in TLS (thread-local storage)patch. It puts the thread - number into TLS and modifies motion_log() so that we do not have to drag the - cnt struct around just to be able to print the thread number in the log and - on the console. (Per Jönsson with additional removal of unused cnt by - Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/ThreadNrTlsPatch - * Moved the motion_loop initialization into a new function motion_init - (Bill Brack). - * Removed old unused code related to read mode (not mmap) from V4L devices - (Kenneth Lavrsen). - * In v4l_start change map from unsigned char * to void * to be ANSI C compliant - with mmap (Angel Carpintero) - * http control: Changed disabled to (not defined) when displaying option list - (Angel Carpintero) - * netcam code now waits for the next frame to arrive for a limited period - in order to avoid too many duplicate images (Bill Brack). - * Motion loop resets its frame timer when the image received is from a netcam. - This lowers the actual framerate of Motion to the rate the netcam can actually - keep up with. (Kenneth Lavrsen) - * Last --with-developer-flags warnings eliminated simply by swapping the - order of the #include statements in the sources (Bill Brack and Kenneth Lavrsen). - * FreeBSD Code improvements by Angel Carpintero - * Implemented set/get hue , saturation , contrast and brightness. - * Better support to capture with big resolution ( 640x480 , 768x576 ). - * Update Readme adding information about "how to configure a capture - card and settings" , update packages dependencies . - * Remove support for libjpeg-mmx , motion segfault ( future fix ). - * Cosmetics changes in configure.in.freebsd ( replace --without-v4l by - without-bktr ). - * Cleanup code and fix warnings. - -snap2 - * Simplified rotation code based on the fact that images must have dimensions - that are a multiple of 16 (Per Jönsson) - http://www.lavrsen.dk/twiki/bin/view/Motion/RotateSimplificationPatch - * Switchfilter feature repaired. It was called inside motion_detected() - after overlays on cnt->img.out were added which meant that the feature also - detected all the overlays, smartmasks, fixed mask and text. It is now moved - to the motion_loop right after the lightswitch feature and before any - overlays are added (Kenneth Lavrsen). - * Fixed small bug where motion was detected when using a tracking camera and - the camera moved to center position when gap period expires. The fix includes - gathering the updating of reference frame in one place only in the motion_loop - (Kenneth Lavrsen). - * Implemented the new text option text_event and new conversion specifier %C. - Option text_event defines the value %C which then can be used in filenames - and text_right/text_left. The text_event/%C uses the time stamp for the first - image detected in a new event. Default value is %Y%m%d%H%M%S. %C is an empty - string when no event is in progress (gap period expired). Pre_captured - and minimum_motion_frames images are time stamped before the event happens - so %C in text_left/right does not have any effect on those images (Kenneth - Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/EventConvertionSpecifierDiscussion - * Renamed some variables related to time to be better descriptive of function - and type (Kenneth Lavrsen). - * Added new option 'sql_user_text'. This can be defined with the same - conversion specifiers as text_xxx, on_xxxx and filenames. The SQL field - text_left has been removed and replaced by a field user_text which is - used for storing the interpreted value of sql_user_text (Kenneth Lavrsen) - * Added new SQL field event_time_stamp of the type TIMESTAMP - (Kenneth Lavrsen). - -snap3 - * Enhancement to Netcam Code for Connection to Pixord Cameras (Bill Brack). - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamFixPixordBug - * Implemented fix to configure so that LDFLAGS from the environment are used - when making the Makefile (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x09x15x185558 - * Changed configure so that --with-jpeg-mmx is default off as a reaction to - known problems seen when using the jpeg-mmx library (Angel Carpintero). - * RPM specs file changed as suggested for use in the Livna repository. - (Kenneth Lavrsen) - * The lightswitch and switchfilter features have been moved up before the - despeckle features are run. This should ensure that both algorithms work on - raw unfiltered motion pixels which they both were designed for. (Kenneth - Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x10x05x212444 - -snap4 - * Integrated NetcamWithFtp patch. To use ftp simply use a URL starting with - ftp:// (Bill Brack). Code was additionally cleaned up by Kenneth Lavrsen. - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamWithFTP - * Changed error handling in vid_start so that failing to open the video - device no longer causes an exit but a return with error code -1. (Kenneth - Lavrsen) - * Added the %t conversion specifier to show the thread number. (Angel - Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/ThreadConversionSpecifierPatch - * Added help texts in conf.c and motion-dist.conf describing the %t - specifier. Added a good example of use in motion-dist.conf. (Kenneth - Lavrsen). - * Fixed bug related to init of mutex in netcam code (Angel Carpintero). - * Improved fix for netcam mutex init (Bill Brack). - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamFixPthreadInit - * Netcam_ftp code fixes (Angel Carpintero and Asbjørn Pettersen) - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamWithFtpEnhancements - * Enhanced ffmpeg detection (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/BetterFFmpegDetection - * Added two new conversion specifiers: %f which is filename (full path) - and %n which is filetype (sqltype) valid in on_picture_save, on_movie_start, - on_movie_end and sql_query. This also means that filename is no longer - appended at the end of the 3 on_xxxx commands. (Kenneth Lavrsen) - * Removed the sql_user_text option that was added in snap 2 (Kenneth - Lavrsen) - * Added new sql_query option. This in combination with convertion - specifiers incl the two new %f and %n enables the user to use any database - structure they please. Added fields is now a simple matter of modifying - the sql query. The default is the same as the default in snap1. - (Kenneth Lavrsen). - * Changed the sequence of events connected with creating files. Data is - now written to the databases (if used) before an external comments is - on (on_xxxx options) allowing the external program to use the new data - in the database (Kenneth Lavrsen). - * Added an infinite retry scheme for netcams that are not available - when Motion is started. Instead of just dying, Motion now retries every - 10 seconds until the netcam is available. Until the netcam is available - Motion enters the normal flow with the same grey image with a text - information being fed to webcam, timelapse, snapshots, vloopback etc. - Motion uses the width and height from the config file for this. It is - a good idea to setup width and height so it is the same as the netcam. - If the dimensions are the same Motion will switch over to the netcam - seemlessly. If the dimensions are different Motion will perform a quick - restart so all the many internal buffers can be initialized properly - (Kenneth Lavrsen). - * Added a better error handling of a netcam that changes dimensions - while Motion is running. Instead of just writing error messages Motion - restarts quickly to recover from this change. Note the now more well - defined error coding for vid_next for both netcams and V4L cams. - (Kenneth Lavrsen) - -snap5 - * Fixed small bug where the displayed time in the grey error image - shown during start with unavailable netcam could show a garbage value - under rare circumstances. (Kenneth Lavrsen). - * Restored the function sigchild_handler so it contains the same code - as before motion-3.2.1_snap9. They is done in an attempt to fix an old - problem with zombie child processes that has shown up again. - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x11x13x115016 - (Kenneth Lavrsen). - * Move the declaration of sig_handler_action and sigchild_action from - the setup_signals function where they are local and will be destroyed - and out in main just before setup_signals is called. Changed the - function setup_signals so the two structs are passed as pointers. - (Kenneth Lavrsen) - -Release - * Added new option track_auto which is a boolean option (on or off) - with default value off. This enable people to start Motion with auto - tracking enabled. Changing the config value for track_auto and - enabling the auto tracking via the httpd track/auto has the exact same - effect. (Kenneth Lavrsen) - * Added 3 new tracking options: track_step_angle_x, track_step_angle_y, - and track_move_wait. The options track_step_angle control the movement - during auto tracking and are currently only active for the pwc type - tracking. The idea is that they can later also be used for the generic - tracking as it evolves. The track_move_wait controls the number of frames - after the camera has moved (auto or manual) during which motion detection - is disabled. This option should be set so low that the motion detection - is re-enabled the minute the camera is standing still again. Feature - originally made by Moshe Van Der Sterre. Kenneth Lavrsen extended it to - be more generic. - http://www.lavrsen.dk/twiki/bin/view/Motion/PwcConfiguration - * New Feature: Motion is now also supported on MaxOSX with similar - feature set as for Free BSD. See README.MacOSX for details how to install - it. (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/MacOSXPatch - * Added a work-around so people in FreeBSD that uses a capture card - where input 1 is not tuner can use motion if frequency is set -1 in - motion.conf or thread#.conf (Angel Carpintero). - - -3.2.3 Detailed changes for 3.2.3 - Bugfix release only. No new features. - * Fixed a bug in the http control code that failed to accept a client - connecting in some systems (Peter Holik). - * Fixed a series of bugs where several feature were using the image buffer - after text was added for noise tuning, auto_brightness, reference frame - update when tracking etc. When a netcam failed to produce an image the - text added to the previous image became motion detected also. The code is - not changed so that the ring buffer is used for timestamped images - and the image used for detection is in a buffer cnt->imgs.image_virgin. - (Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x08x15x140701 - * Auto brightness used the first image in ring buffer instead of the - latest image and it used an image with time stamping. It now uses the new - cnt->imgs.image_virgin buffer. - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x08x15x160208 - * Cleaned out unused code from httpd control (Angel Carpintero). - * Option switch_filter used print_int instead of print_bool when motion.conf - was saved (Kenneth Lavrsen). - - -3.2.2 Formal Release. Summary of changes - -Features - * New completely rewritten netcam code. - * Proxy servers are again supported by netcam feature - * New conversion specifier %o for threshold - * New convertion specifier %Q for number of labels - * Drawing of mask and smartmask in setup mode improved - * Compilation of motion on 64 bit machines improved - * RPMs can now be built by non-root user - * Improved the labelling algorithm so that locate feature and tracking features - includes all labelled areas above threshold - * Motion now supports the mjpeg webcam stream while saving PPM images. - * New improved webcam feature. When you set webcam_motion on Motion will now - stream at 1 fps instead of none. When motion is detected the webcam stream - increases to the limit set in the config file. This change makes the - webcam_motion much more interesting. The previous function always ended up - with clients timing out. - * Implemented the libjpeg-mmx patch. Installing the MMX version of libjpeg - can increase performance. Especially for machines with very little CPU power. - It only modifies the configure script. If you do not have the libjpeg-mmx - the configure script with ignore this and use the standard libjpeg. - Note that RPMS will be built without this - * Improved descriptions in motion.conf - * Many small code speed optimizations. - * Added new feature: Double size text. A new config option 'text_double' can - be set 'on' and this scales the text to double size. Default is off. - * Improved error handling of missing picture frames from camera. Especially - network cameras will often not be able to provide a picture frame from time - to time. Motion would retry before and eventually and rather quickly exit - the camera thread and maybe completely exit. The improved handling now - makes a copy of the previous frame for 30 seconds (longer if cpu_low is - activated because the implementation is 30 X framerate frames) and then - show a grey image with a message saying the connection is lost and an ISO - format time stamp of first poor connection. - * Added a configure option --with-developer-flags which enables many compiler - warnings that can be used by developers to make code more robust. Not - for normal users building Motion. - * Included a CODE_STANDARD text file to help new developers make patches - that are easier to integrate without too much manual editing. - -Bug Fixes - * Fixed a bug in the autobrightness algorithm - * Fixed bug reporting errors when creating symlink to last snap - * Improved code so that Motion no longer uses the tmpfile() function for - buffering the frames of the mjpeg stream. - * Implemented a fix/work around to a bug related to building and installing - RPMs on Suse. - * Improved signal handler - * Code commented much more. - * Many bugfixes to get Motion more stable (less segfaults) - * Code improved to remove all warnings when compiled with gcc 4.0 - * Better FreeBSD support - * Replace functions not threadsafe with threadsafe functions. - * Implemented a much easier to use motion_log function which replaces the - calls to printf and syslog. This code change as no impact to the user. - * Fixed a bug in video.c so that VIDEO_PALETTE_GREY cameras now actually work. - * Updated the ffmpeg.c code so that Motion can now be built with ffmpeg CVS - release from the June/July 2005 timeframe. - - - -3.2.2 Detailed changes for 3.2.2 -snap1 - * Pthread deadlock in motion 3.2.1 fixed (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x05x26x125712 - * http lockup bugfixes and ConvertSignalToSigaction only for webhttpd - (Angel Carpintero) - * alg_draw_location: Use temporary variables to store the values used in - for() loops instead of compute them in each loop (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/ImproveAlgDrawLocation - * Small speed boost to the function draw_textn (Andrew Hamilton and - Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/DrawTextnImprovement - * Added two new convertion specifiers: %o for threshold and %Q for number - of labels. (Kenneth Lavrsen) - * Improved the config file description for pre_capture to get people to - use small values (Kenneth Lavrsen). - -snap2 - * Avoid Cleanup Segfault. Avoid Cleanup Segfault. Allocates filepath using - strdup to avoid segfault is target_dir parameter is not supplied in - motion.conf. Moves out from signal handler the cleanup for pipe and mpipe. - (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/AvoidCleanupSegfault - * Major code cleanup concerning signedness of chars all over the code to - allow compilation with gcc4.0 (like in Fedora Core 4) without any - errors or warnings. This will probably require that some of the not yet - included patches will have to be fixed because it it code all over the - place that has been changed. (Kenneth Lavrsen) - -snap3 - * Changed the order of drawing the red mask in setup mode so that the - smartmask is drawn after the fixed mask (Joerg Weber). - * Changed the configure script so that /usr/lib64 is also searched for - the presence of ffmpeg (should fix the problem with 64 bit machines) - (Kenneth Lavrsen). - * Changed the configure script so that rpms can be made by normal non-root - users (Angel Carpintero, Kenneth Lavrsen). - -snap4 - * Fixed the ffmpeg code so that Motion also compiles against libavcodec - build 4754 or later. (Per Jönsson) - * Above change in configure script for 64 bit ffmpeg support also implemented - in the freeBSD configure (Angel Carpintero) - * Webhttp control interface fixed so it also works in FreeBSD (Angel - Carpintero) - * Improved the display of fixed mask. It is now shown as grey instead of - red. This makes it easier to see the smart mask working when you also have - a fixed mask (Joerg Weber). - * Netcam First Header patch. If an error with jpeg decompression occurred at - connecting to a mjpeg streaming webcam, this patch skips this jpeg and tries - to decompress next jpeg up to MAX_HEADER_RETRIES (20) (Peter Holik). - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamFirstHeader - -snap5 - * Small improvement in framerate accuracy (Peter Holik). - http://www.lavrsen.dk/twiki/bin/view/Motion/FramerateAdjust - * Fixed a bug in the autobrightness algorithm (Per Johnsson) - * Fixed a bug in the webhttpd code related to pan/tilt. Bug was introduced in - snap4 (Angel Carpintero, Kenneth Lavrsen). - * Improved the labelling algorithm so that locate feature and tracking features - includes all labelled areas above threshold (Joerg Weber). - http://www.lavrsen.dk/twiki/bin/view/Motion/ImprovedLabellingPatch - * Fixed bug reporting errors when creating symlink to last snap (Bill Maidment) - * Changed all use of localtime to localtime_r which is threadsafe - (Kenneth Lavrsen). - * Implemented a modified version of the WebcamCompressInMemory so that Motion - no longer uses the tmpfile() function for buffering the frames of the mjpeg - stream (Peter Holik). - http://www.lavrsen.dk/twiki/bin/view/Motion/WebcamCompressInMemory - * Modified the WebcamCompressInMemory patch so that Motion now supports the - mjpeg webcam stream while being setup for saving PPM images (Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/WebcamCompressInMemory - * Major clean-up of code in picture.c and webcam.c so that function names and - variable names are less confusing. Also added many comments in picture.c. - (Kenneth Lavrsen). - -snap6 - * Webcam code commented more (Kenneth Lavrsen) - * New improved webcam feature. When you set webcam_motion on Motion will now - stream at 1 fps instead of none. When motion is detected the webcam stream - increases to the limit set in the config file. This change makes the - webcam_motion much more interesting. The previous function always ended up - with clients timing out. (Kenneth Lavrsen). - -snap7 - * Implemented WebcamShortWriteHandling patch (Bill Brack) - http://www.lavrsen.dk/twiki/bin/view/Motion/WebcamShortWriteHandlingPatch - * Implemented the libjpeg-mmx patch. Installing the MMX version of libjpeg - can increase performance. Especially for machines with very little CPU power. - It only modifies the configure script. If you do not have the libjpeg-mmx - the configure script with ignore this and use the standard libjpeg. - Note that RPMS will be built without this (Peter Holik and Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/LibJpegMmx - -snap8 - * Small code cleanup in webcam.c and picture.c and .h for the webcam code - (Peter Holik and Kenneth Lavrsen) - * Small code cleanup in motion.c for the variable holding the number of - microseconds since epoch. The old code worked fine but relied on an integer - overflow every 71 minutes. (Bill Brack and Kenneth Lavrsen) - * Implemented a fix/work around to a bug related to building and installing - RPMs on Suse. (Paul Beltrani) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x07x14x212356 - * Small speed optimization in the creation of reference frame (Peter Holik). - * Complete rewrite of the Netcam code. Should fix many of the reported and - still open netcam bugs. This is first release in a snapshot. Expect to find - bugs. Testing is important. If you have a netcam please test this and report - bugs. - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamCodeRewritePatch - -snap9 - * Fixed bug related to disabled webcam or duplicate webcam port. Error log - accept(): Socket operation on non-socket continuously written to syslog. - (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x08x01x150922 - * Fixed memory leak in webhttpd related to use of strdup (Angel Carpintero). - * Improved the error reporting in the Netcam code and did a few minor - corrections and code cleanups (Bill Brack). - * Implemented a much easier to use motion_log function which replaces the - calls to printf and syslog. The implementation to actually use this has been - implemented in video.c and the Netcam code files. Rest will be in next snap. - This code change as no impact to the user (Bill Brack). - http://www.lavrsen.dk/twiki/bin/view/Motion/ErrorLoggingEnhancementPatch - * Fixed a bug in video.c so that VIDEO_PALETTE_GREY cameras now actually work - (Bill Brack). - * Implemented the conversion of signal to sigaction which should be more - thread safe. Hopefully this still keeps Motion from making Zombies. - (Christophe Grenier). - http://www.lavrsen.dk/twiki/bin/view/Motion/ConvertSignalToSigaction - * Added new feature: Double size text. A new config option 'text_double' can - be set 'on' and this scales the text to double size. Default is off. - (Andrew Hamilton). - http://www.lavrsen.dk/twiki/bin/view/Motion/TextScalingPatch - -snap10 - * Error Logging Enhancement Patch v 1.3 (Angel Carpintero) including: - http://www.lavrsen.dk/twiki/bin/view/Motion/ErrorLoggingEnhancementPatch - * Populate the motion_log to the whole motion source code. - * Fixed FreeBSD compilation. - * Added the possibility to pass NULL as struct context * - * Removed unused errno variables. - * Fixed errno in rotate.c , set to 0. - * Fixed some errno flags in webhttpd.c and motion.c - * Fixed a bug when not motion.conf is found - * Removed printf from all files - * Fixed the conf_list[] index in motion.c - * RotateBswapFix Patch v 2 (Per Jönsson) including: - * cleanup in code comments - * fix for __bswap_32 macro collision - * fixed bug where initialization would be incomplete for invalid degrees - of rotation - * now uses motion_log for error reporting - http://www.lavrsen.dk/twiki/bin/view/Motion/RotateBswapFix - * Re-mplementation of optional Proxy Server for Network Cameras (Bill Brack). - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamProxyServerPatch - * Included a CODE_STANDARD text file to help new developers make patches - that are easier to integrate without too much manual editing. (Kenneth - Lavrsen) - * Added the missing rotate feature in the new netcam code (Bill Brack) - -snap11 - * Updated the ffmpeg.c code so that Motion can now be built with ffmpeg CVS - release from the June/July 2005 timeframe (Per Jönsson). - http://www.lavrsen.dk/twiki/bin/view/Motion/FfmpegCodecPatch - * Improved error handling of missing picture frames from camera. Especially - network cameras will often not be able to provide a picture frame from time - to time. Motion would retry before and eventually and rather quickly exit - the camera thread and maybe completely exit. The improved handling now - makes a copy of the previous frame for 5 seconds (longer if cpu_low is - activated because the implementation is 5 X framerate frames) and then - show a grey image with a message saying the connection is lost and an ISO - format time stamp of first poor connection. (Kenneth Lavrsen). - * Implemented version 2 of the NetcamErrorImprovementPatch which should - work with the improved error handler. Changes include: - * Changes handling of non-streaming camera to include a separate thread. - * Changes the value returned from netcam_next to the motion main loop to - indicate the status of the image returned. - * Many changes to the comments, and some enhancement to the logic, to begin - the implementation of points agreed on the NetcamRetryErrorDiscussion page. - * Implements the triple-buffering scheme proposed by PeterHolik (but not the - "Without Locking" portion of his proposal). - Version 2 however does not seems to recover when an mjpeg stream resumes - after a period of not being available. (Bill Brack) - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamErrorImprovementPatch - * Note: Snap11 release as a developer sync release. Bug reports welcome. - FreeBSD code changes not tested yet. - -Release - * Netcam error handling improvements and cleanup from Valgrind analysis - (Bill Brack). - * Added a configure option --with-developer-flags which enables many compiler - warnings that can be used by developers to make code more robust. Not - for normal users building Motion (Bill Brack) - * http-control: Fixed segfault when motion is restarted from command line - ( kill -s 1 pid_motion ). Improved control code so Motion can Restart and - Finish 'smoothly'. (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionHttpControl - * Changed the 5 second missed camera signal timeout to 30 seconds. (Kenneth - Lavrsen) - * Fixed bug where an extra jpeg is saved if you have output_normal=best - and you stop motion after an event has ended. (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x08x05x173526 - - - -3.2.1 Detailed changes for 3.2.1 since 3.1.19_snap3 -snap1 - * Major new feature. XMLRPC is replaced by a simpler http remote control - interface (implemented by Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionHttpControl - -snap2 - * Fixed netcam->userpass problem (Angel Carpintero) - * Added support in configure for athlon64 from - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x30x190907 - (Angel Carpintero and William M Brack) - * Fixed some gcc warnings (William M Brack) - * Code cleanup from a valgrind analysis (William M. Brack). - -snap3 - * Added Best Preview Patch (Joerg Weber) - http://www.lavrsen.dk/twiki/bin/view/Motion/BestPreviewShot - -snap4 - * Fix for tracking control with http control (Angel Carpintero) - * Added the new feature Setup Mode (Joerg Weber). This also enables - much more error messages given to the console when in non-daemon mode - while still preserving the messages in syslog which are important - for daemon mode debugging. - The patch is still being worked on and is not finished. - Changes in the FreeBSD code are not yet tested. - http://www.lavrsen.dk/twiki/bin/view/Motion/SetupModePatch - Remove most command line options and replace them by an option to specify - location to motion.conf and a few options related to setting up motion. - (Joerg Weber). This is also included in SetupModePatch. - * Small improvement of the http control interface (link to setting itself - on the html response when setting parameter) (Kenneth Lavrsen) - -snap5 - * Fixed a bug in noise tune which was most visible at very low light. - (Joerg Weber and Kenneth Lavrsen) - * Further improvement in the setup mode. Messages are now prefixed by - the thread number in [brackets]. Moved 2 functions from motion.c to - picture.c. The setup mode patch is now considered finished. (Joerg Weber) - -snap6 - * Netcam fixes and debug code by Christopher Price - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamStabilityPatch - snap5_post1_video.c and snap5-post1 patches - * Fixed netcam startup race condition. - * Refactored image handling back to single unified function - * Refactored reconnection algorithm - * Jpeg only based connections should now use less cpu time - * Temporarily removed support for devices that do not support content-length - (in progress) - * Synced syslog/printf style to new motion standard - * Added developer debug trace defines/code - * Defines now used for many constants - -snap7 - * Improved console output in setup mode. Now also outputs threshold. - (Joerg Weber) - * Added some additional text to the motion http messages to the terminal - so that you know where the messages come from. (Kenneth Lavrsen) - Netcam Stability Patch version snap6-post1 (Christopher Price) - * Added support for netcams without content-length header (streaming only) - * Remove memmem from netcam_wget.[c|h] (no longer used) - * Several miscellaneous code cosmetic changes - * TODO: remove tests for memmem from configure - -snap8 - * Added support for non-streaming (image based) netcams without content-length - header. (3.2.1-snap7-post1 version of the Netcam Stability Patch by Christopher - Price). - * Improvement in the noise-tune algorithm (Joerg Weber) - * Re-arranged many of the const char declarations so that they are always - before any statements within a block { }. This is to avoid compiler errors - with older but still used gcc versions such as 2.95. (Kenneth Lavrsen) - * Changed the use of %zd to %llu in printf statements of size_t types. - This is done to avoid compiler errors with older but still used gcc versions - such as 2.95. (Kenneth Lavrsen) - -snap9 - * Fixed even more gcc 2.95 compiler errors (declarations not at beginning - of block) (Kenneth Lavrsen). - * Removed a gcc 2.95 compiler warning (netcam.c:1036: warning: variable `pic' - might be clobbered by `longjmp' or `vfork') (Kenneth Lavrsen) - * The values for cnt->locate and cnt->new_img are now #defines in motion.h - to enhance code readability (Kenneth Lavrsen). - * The setting of sql_mask is now only done once per second to save CPU power - (Kenneth Lavrsen) - * Adding checking for conflict between control port and webcam port. Webcam - port for a thread is disabled if it is set to the same value as the control - port (Kenneth Lavrsen). - * Fixed some file descriptor leaks in webcam.c and netcam.c (Christophe - Grenier) - * Added "motion-http:" prefix to error messages from the http control thread. - (Kenneth Lavrsen) - * Added additional error information when connection to MySQL fails (Kenneth - Lavrsen) - * Initiate cnt->event_nr to 1 to avoid code related to end of events and long - mpeg films to be run during startup of Motion. (Kenneth Lavrsen) - * Added new function in event.c close_anything_open() which is called from - send_sms, send_mail and exec_command in order to prevent file descriptor and - open sockets to be inherited by the shell causing freezing and instability. - Code contributed by Christophe Grenier, Christopher Price and Kenneth Lavrsen. - * Added new context global cnt_list.control_socket_server set by the httpd - thread so that the above mentioned close_anything_open() can close open - control sockets (Kenneth Lavrsen). - * Renamed the top level global context structure to cnt_list so it can be - reached from child threads and by above mentioned close_anything_open() - (Christophe Grenier). - -snap10 - * Fixed a problem when compiling with --without-v4l configuration. - (Philip Marien) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x03x27x112843 - * Threw away the file descriptor leak fix from snap 9 because it caused - more trouble than it fixed. Removed the close_anything_open() and the - cnt_list.control_socket_server field. Replaced it all with a simple - piece of code that all server daemons call when started: setsid() followed - by for (i=getdtablesize(); i>2; --i) close(i). Dirty and simple. - (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x03x21x070534 - * Fixed a bug where rate of fetching picture frames was disturned by - the signal SIG_CHLD from exec_command programs terminating. The symptom - was that the number of post_capture frames became inaccurate and motion - in mpegs did not have constant time between frames. (Kenneth Lavrsen) - * Fixed a bug where motion did not work with gap=1 (Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x30x073616 - * Added the feature gap=0 which now also works. It disables gap completely - so that one single mpeg file is created. You can end the event from the - remote control interface make movie feature using for example cron. - This makes Motion close the mpeg and make a new with event number increased - by one. (Kenneth Lavrsen) - * Improved the http remote control action features so that makemovie - and snapshot for thread 0 (all) works on all threads instead of being - ignored (Kenneth Lavrsen). - * Moved some code in the beginning of the motion_loop to a position later - to improve the accuracy of time calculations for the framerate (Kenneth - Lavrsen) - * Updated code so Motion again runs on FreeBSD (Angel Carpintero). - * Removed check for memmem from configure (Angel Carpintero). - * Updated http control interface so that an additional check is done - before saving config files (Angel Carpintero). - * Fixed a problem with URLs http://192.168.1.3:8080/0 which did not - work without a trailing space (Angel Carpintero). - -snap11 - * Implemented new Generic onxxxx features. - Function --- Old Option --- New Option - Start of event (first motion) --- execute --- on_event_start - End of event (no motion for gap seconds) --- New! --- on_event_end - Picture saved (jpg or ppm) --- onsave --- on_picture_save - Movie starts (mpeg file opened) --- onmpeg --- on_movie_start - Movie ends (mpeg file closed) --- onffmpegclose --- on_movie_end - Motion detected --- New! --- on_motion_detected - http://www.lavrsen.dk/twiki/bin/view/Motion/OnXxxCommandsPatch and - http://www.lavrsen.dk/twiki/bin/view/Motion/OnXxxxFeatureDiscussion - (Joerg Weber) - * More Netcam Stability Fixes (snap10-post1-6) (Christopher Price) - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamStabilityPatch - * Destroy mutexes in netcam_cleanup(). - * Add reconnection for netcam_start() - this may block other cameras - from starting up!. - * Added additional defines for reconnect retries. - * Change reconnection timeouts to 60 seconds. - * Reworked close(sock) in netcam_connect, to insure future changes - won't forget to close the socket. - * Reworked reconnection for netcam_start() - disabled by default, see - source for INIT_RECONNECT_RETRIES. - * Break some long lines in code. - * Replaced sleep with nanosleep per suggestion by Kenneth Lavrsen. - * Added additional header validation check. - * Changed a couple fd references to use RBUF_FD. - * Added error message if jpeglib error occurs. - * Removed additional header validation check. - * Limited times headers will be checked. - * Removed mutex lock around netcam_start() in video.c, hopefully race - conditions are fixed. - * Added additional headers in http request. - * Added back header validation (should fix netcam_read_header lockups). - * Detect when there is no data on socket in netcam_read_ functions - (should fix netcam_read_image_contentlength() and - netcam_read_image_no_contentlength() lockups). - * Rearranged timeout assignments for pthread_cond_timedwait() calls. - * Adjusted TIMEOUT_COND_WHICH to 4 seconds. - * Improvements of motion.conf help comments including improvements in new - onxxxx options. (Kenneth Lavrsen) - -snap12 - * Fixed a bug in the rgb2yuv420p function. (Daniel Ladd) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x03x30x011107 - * Fixed a bug of locate feature for movement images combined with the - new output_normal best feature (Joerg Weber) - * More Netcam Stability Fixes (snap11-post1-4) (Christopher Price) - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamStabilityPatch - * Reworked thread signal/wait conditions, should fix some race conditions. - * Use gettimeofday() to determine thread timeouts, results in better accuracy. - * Adjusted condition timeouts to smaller values due to usage of gettimeofday() - and rework of thread signal/wait conditions. - * Adjusted reconnection retries to 60 (every minute for an hour). - * Fix bug where motion will not quit if requested when reconnecting. - * Cruft, feature creep and redundant code removed. - * Consolidated reconnection capability to unified netcam_reconnect function. - * Rework netcam_start logic, minimize startup variables. - * Rework netcam_stream_read and netcam_single_read logic. - * Minor changes to netcam_next logic. - * Fix bug in streaming camera without content-length, recent mod broke. - * Fix bug in startup of single image reads without content-length. - * Motion Guide refactored completely for 3.2.1 with better web navigation and - auto generation of pages. Makefile updated so that the Motion TWiki topic - MotionGuideOneLargeDocument is fetched when updating the guide and making - releases. (Kenneth Lavrsen). - -snap13 - * Removed the debug_parameter option which had no use. Programmers can still - use it because the code is only commented out. This change required a small - update in the code that rewrites motion.conf so that a remote control command - to write the config files still adds a text header for the thread section at - the end of motion.conf (Kenneth Lavrsen). - * Changed the default values for a few options: quiet on, webcam_maxrate 1, - threshold_tune off, webcam_quality 50 (Kenneth Lavrsen). - * Changed some cosmetics in the way motion.conf is written (space after #) - (Kenneth Lavrsen). - * Updated the motion-dist.conf to use default values unless there is a reason - not to (Kenneth Lavrsen). - * Fix the compile issue with official ffmpeg packages from debian (Angel - Carpintero). - * More Netcam Stability Fixes (snap12-post1) (Christopher Price) - * Newrote url parser, better syntax checking and error handling of urls. - * Userpass now allowed in url (http://user:pass@example.com/). - Netcam_userpass has precedence, it will override a userpass embedded in - the url. - http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamStabilityPatch - -snap14 - * Added basic authentication to the http control interface introducing new - config option control_authentication. (Angel Carpintero) - * Fixed memory leak when restarting Motion from http control (Angel - Carpintero). - * Small improvement in configure script for Debian (Angel Carpintero) - * Added the ability to clear an option to off (bool), 0 (int) or undefined - (string) by submitting blank entry field in the http control interface. - (Angel Carpintero). - -snap15 - * Added new feature which shows the fixed mask (in addition to the smart mask) - in bright red on the Motion type images (Joerg Weber). - http://www.lavrsen.dk/twiki/bin/view/Motion/FixedMaskFileOnMotionImagesPatch - * Added new feature. When you specify a mask file in the config file and start - Motion, and the mask file does not exist, Motion will create a new clear - (white) mask file for you in the right size. Then it is easy to simply - open the file in your favourite paint program and add the masking in black - (Joerg Weber). - http://www.lavrsen.dk/twiki/bin/view/Motion/FixedMaskFileOnMotionImagesPatch - * Fixed a bug in the low_cpu feature where cpu load increased instead of - decreasing because the framerate calculations were completely wrong. This was - an old bug introduced in 3.0.1 (Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x04x24x205933 - * Improved the auto-brightness algorithm. When auto-brightness is enabled - the brightness option becomes a target value for the brightness level. - This should also close a bug report (Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x02x26x195358 - * http interface small fixes (motion-3.2.1_snap14-small-fixes 1.1) incl - Add 'back' link to response_client errors (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionHttpControl - * Started adding tuner_number as option. This is not fully implemented. First - code is added and rest will be done in next snap. (Kenneth Lavrsen) - -snap16 - * Made the http control interface more RFC compliant (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x05x02x180550 - * Made the http control HTML responses nicer to look at as sources and - therefore easier to debug errors (Kenneth Lavrsen). - * Code style cleanup of webhttpd.c (Kenneth Lavrsen). - * Fixed compatibility problem with Palantir. Fixed by making output more - compatible with RFC (\r\n). Original fixes by Roberto Spadim and Angel - Carpintero. However this fix made Firefox flicker even more than it normally - does. Final fix which works in both Palantir client, Firefox and Cambozola - was made by Kenneth Lavrsen. This closes the following bugs: - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x05x02x205307, - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x05x07x042849 - -snap17 - * Fixed small bug when pre_capture buffer is resized during operation. - (Joerg Weber). - * In httpd control code: Fixed RAW syntax following API specs. (Angel - Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionHttpControl - * Added new conversion specifiers: %D (diffs), (noise) %K (motion center x), - %L (motion center y), %i (locate width x) and %J (locate width y). These - changes also required a refactoring of the alg_locate code. This change - is part of the implementation of a generic tracking feature and it enables - implementing external programs that can perform simple prediction features. - (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/ExtendReplaceConversionSpecifiersDiscussion - http://www.lavrsen.dk/twiki/bin/view/Motion/GenericTrackingPatch - * Fixed a bug in switchfilter which caused motion detection to not work - when the feature was enabled (Kenneth Lavrsen). - -Release - * Change the working directory to / in daemon mode. This way you don't have - to kill motion to umount the partition from where you start it. (Christophe - Grenier) - http://www.lavrsen.dk/twiki/bin/view/Motion/ChdirNetCamWgetPatch - * In netcam-wget header_get() didn't always in add a \0 string terminator. - This was fixed by Christophe Grenier - http://www.lavrsen.dk/twiki/bin/view/Motion/ChdirNetCamWgetPatch - * Fix for Unknown content type with lumenera cameras (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x05x06x174416 - * MotionHttpControl Patch motion-3.2.1_snap18-pre1 v,1.0 19 May 2005. - Fixed some HTTP response codes and added header copyrights. (Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionHttpControl - * Implemented pthread fix by Christophe Grenier. - http://www.lavrsen.dk/twiki/bin/view/Motion/PthreadFixPatch - * Fixed problem compiling "ffmpeg reports only YUV420 is supported" when - ffmpeg is a recent CVS version. (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x05x22x213229 - * Man page updated. It is now semi-autogenerated in the Motion TWiki - (Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionOptionsAlphabeticalManpage - * Bug fix in netcam code: Sometimes motion try to free an invalid memory area - (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x05x21x105335 - * Small configure fix related to --without-v4l (Angel Carpintero) - * Fixes for http control HTML code (Angel Carpintero) - * Added init script to RPM (Angel Carpintero) - - -3.1.19 Detailed changes for 3.1.19 snapshot releases since 3.1.18 -snap1 - * Fixed bug which caused Motion 3.1.18 fail to save timelapse mpegs when - setting ffmpeg_timelapse = 1 (fixed by Michael Reuschling) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x31x211756 - * Fixed several bugs in new netcam code introduced in 3.1.18 - (Angel Carpintero) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x16x030209 - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x02x01x071546 - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x02x03x035918 - * Added patch that enables Motion to work with vloopback version 0.94 - and kernel 2.6.10+. (patch by William M Brack). - http://www.lavrsen.dk/twiki/bin/view/Motion/MotionAndVloopbackVideoDotCPatch - -snap2 - * Following bugfixes all by Angel Carpintero - * Netcam code: Change printf() to fprintf(). - * Netcam code: Cleanup memory netcam (netcam.c , motion.c ). - * Netcam code: Redesign of reconnection feature. - * Configure: Added debug , conditional compile of xmlrpc-c - * Fix a non allocated pointer to be freed. - * Added fix to BugReport2005x02x11x170019 - * Added fix to BugReport2005x02x11x150802 - -snap3 - * Bugfixes by Angel Carpintero - * fix motion.spec, motion.spec.in - * typo in configure.in , configure.in.freebsd - * fix version number - - -3.1.18 Formal Release - Summary of changes since 3.1.17. - * Removed the Berkeley mpeg feature - * New brightness, contrast, hue and saturation options. - * Makefile with automatic check of dependencies and nicer user output. - * Improvement of the rotate feature. - * Added the new smart mask feature. - * Added a new config option --without-optimizecpu which disables CPU - specific compiler optimizations. - * Configure help texts improved. - * Added the pwc-10.0.5 version of pwc-ioctl.h. Also good for pwc 10.0.6. - * Changing rotate, height and width via xmlrpc no longer affects the - running program. This change is done because many internal data structures - and memory allocations cannot handle change of image dimensions/size. - * Enabled use of leading spaces when changing text_left and text_right via - xmlrpc by using quotation marks if the value starts with a leading space. - * Speed optimizations for dilate and labelling code. - * Significant speed improvement in the motion detection algorithm. - * Motion images are now gray scale instead of green. Smartmask is shown - in red. - * Implemented FreeBSD auto-detection CPU/ARCH fix. - * Removed the never finished prediction feature. - * Implemented a major improvement of noise_tune. - * Implemented ffmpeg-0.4.9 support. - * Default for option 'ffmpeg_video_codec' is now mpeg4. mpeg1 is now only - supported with the old ffmpeg-0.4.8. - * Option 'output_normal' value set to 'first' makes Motion only save a - jpeg from the first motion detected picture frame in an event. - * Implemented Streaming Netcam Without Curl which enables connecting to - network cameras both with single jpeg frame mode and streaming mjpeg - mode. This enables much higher framerates with Netcams. - * Corrected a small error in the usage help text - * Improved the help and doc texts for config option night_compensate. - * Improved the signal handling of ctrl-C and kill. - * Implemented a POSIX compliant SIGCHLD signal handler to avoid floods of - warnings and script zombies in some RedHat versions. - * Reporting of the changes of noise detection level is now only displayed - in the console (daemon off) when the always_changes option is enabled. - * Made the code in xmlrpc more correct and robust (handling of select()). - * Fixed several bugs in the timelapse feature. - - -Detailed changes for all 3.1.18 snapshot releases since 3.1.17 -snap1 - * Removed the Berkeley mpeg feature (code commented out) - * Implemented a bugfixed version of - http://www.lavrsen.dk/twiki/bin/view/Motion/BrightnessContrastPatch - Released as snapshot for developers to merge other patches. - The snap1 is not recommended for normal use. - -snap2 - * Improved the Makefile with automatic check of dependencies and - nicer output for the user. - http://www.lavrsen.dk/twiki/bin/view/Motion/MakefileWithAutoDependencies - * Implemented first phase of the rotate patch. Need to fix the storage - method for image height and width - http://www.lavrsen.dk/twiki/bin/view/Motion/RotatePatch - -snap3 - * Implemented phase 2 of the rotate patch - * Added brightness patch options to motion-dist.conf - -snap4 - * Added the new smart mask feature. It is working but it is still under - development. It currently outputs an extra smart mask timelapse movie - when the normal timelapse is enabled. This will be removed in the final - version. http://www.lavrsen.dk/twiki/bin/view/Motion/PatchSmartMask - * Added a new config option --without-optimizecpu which disables the - CPU specific compiler optimizations introduced with the rotate phase 2 - patch. The purpose of the new option is to enable a packager to build - an RPM or deb package which is not tied to a specific CPU type. - * Man page updated with the new brightness and smart mask options. - * Configure help texts improved. - * Added the pwc-10.0.5 version of pwc-ioctl.h. - * Changing rotate, height and width via xmlrpc no longer affects the - running program. The user can change the options and write them to the - config files and then restart motion. This change is done because many - internal data structures and memory allocations cannot handle change - of image dimensions/size. - * Fixed the problem with leading spaces of text_left and text_right - getting lost when saving with xmlrpc. For text_left and text_right - Motion now puts the string in quotation marks if the value starts with - a leading space. - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2004x10x24x135840 - -snap5 - * Implemented the November 10 update for smartmask - * Started resolving some of the signed vs unsigned char problems. There - is still much to do here. snap5 is released to make the developers up2date. - -snap6 - * Merged in the DilateNineSpeedPatch - http://www.lavrsen.dk/twiki/bin/view/Motion/DilateNineSpeedPatch - * Changed a few image char definitions to unsigned char. Still many to fix. - -snap7 - * Implemented the 15-Nov-2004 Smartmask patch which removed the smartmask - debugging timelapse code and instead adds the smartmask info to the - motion images and jpegs as red areas. Normal motion is shown in black - and white (greytones). This concludes Joerg Webers smartmask feature. - The patch is now in ReleasedScheduled state for 3.1.18. - * Implemented Angel Carpintero's FreeBSD auto-detection CPU/ARCH fix. - * Merged in Per Johnsson's DilateFiveSpeedPatch - http://www.lavrsen.dk/twiki/bin/view/Motion/DilateFiveSpeedPatch - * Removed the prediction feature from the code (commented out for now). - * Included fix by Jan X. - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2004x11x13x202132 - -snap8 - * Implemented an improvement of Smartmask so that the mask is cleared when - the smart_mask_speed is set from a non-zero to zero (by Joerg Weber) - * Implemented an improvement of noise_tune with smart mask (and probably - also in general) (by Joerg Weber) - * Improved the picture control function so that cameras are only probed - when needed to avoid USB errors. (Kenneth Lavrsen) - * Implemented new ffmpeg patch (Per Jönsson) - http://www.lavrsen.dk/twiki/bin/view/Motion/FfmpegPatch049 - * Implemented new preview patch (Joerg Weber) - http://www.lavrsen.dk/twiki/bin/view/Motion/PreviewShotsPatch - * Removed commented code from obsolete Berkeley and Prediction features - * Implemented labelling speed patch (Per Jönsson) - http://www.lavrsen.dk/twiki/bin/view/Motion/LabelingSpeedPatch - -snap9 - * Implemented Streaming Netcam Without Curl which enables connecting to - network cameras both with single jpeg frame mode and streaming mjpeg - mode. This enables much higher framerates with Netcams. (by Christopher - Price and Angel Carpintero). - http://www.lavrsen.dk/twiki/bin/view/Motion/StreamingNetcamWithoutCurl - * Implemented a significant speed improvement in the motion detection - algorithm (by Per Jönsson). - http://www.lavrsen.dk/twiki/bin/view/Motion/AlgDiffStandardMmxPatch - * Fixed a small bug which caused in jumpy mpeg1 videos with ffmpeg 0.4.8. - -snap10 - * Corrected a small error in the usage help text - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x05x174139 - * Improved the help text for config option night_compensate in docs, - conf.c, motion man pages and config file. - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x06x103939 - * Improved the Netcam patch (Angel Carpintero) - http://www.lavrsen.dk/twiki/pub/Motion/StreamingNetcamWithoutCurl/ - (pre2 patch fixes problem with not detecting Content-length and segfaults - in netcam) - * Improved the signal handling of ctrl-C as suggested by Per Jonsson - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x06x181426 - * Implemented a POSIX compliant SIGCHLD signal handler as replacement for - the traditional signal(SIGCHLD, SIG_IGN) which can cause floods of - warnings in some RedHat versions. (Angel Carpintero and Kenneth Lavrsen) - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2004x10x26x134906 - * Changed the reporting of the changes of noise detection level so that - it is only displayed in the console (daemon off) when the always_changes - option is enabled. (Kenneth Lavrsen) - * Changed the ffmpeg>0.4.8 = no mpeg1 gcc warning message so that it is - clear to people that it is information and not an error message. - -snap11 - * Changed allocation of despeckle buffer to avoid a segfault when using - a netcam where the image is wider than defined in motion.conf width. - * The noise tune value displayed in the upper left corner along with - number of changed pixels is no longer displayed (was there for debugging). - * Improved the Netcam patch (Angel Carpintero) - http://www.lavrsen.dk/twiki/pub/Motion/StreamingNetcamWithoutCurl/ - (pre3 reconnection feature added) - * Changed the SIGCHLD handler introduced in snap10 so that it is a shorter - and faster function. Disabled this handler in the xmlrpc thread as this - caused unnecessary loops of cpu cycles. Additionally made the code in - xmlrpc more correct and robust (handling of select()) (Kenneth Lavrsen) - * Fixed a bug in the timelapse feature. Both the rollover events of the - timelapse video and timelapse shots could be missed if the CPU load was - very high or the time was changes by ntp. Motion will now catch up a few - seconds later if this happens. Also fixed the code for monthly rollover - (Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x23x133554 - -Release - * Fixed a bug in the timelapse feature. Both the rollover events of the - timelapse video and timelapse shots could be missed if the CPU load was - very high or the time was changes by ntp. Motion will now catch up a few - seconds later if this happens. Also fixed the code for monthly rollover - (Kenneth Lavrsen). - http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x01x23x133554 - * Small improvement in timelapse feature so that an image is added when - the new mpeg is created and not waiting till the following timelapse - (Kenneth Lavrsen). - * Small improvement so that the timelapse rollover happens on the hour - and not one timelapse past the hour (Kenneth Lavrsen). - -3.1.17 Bugfix release -snap1 - * Removed annoying debug syslog message (input: #) - * Implemented Peter Ilin's patch for handling vloopback pipes better - when Motion receives SIGTERM or SIGHUB. - * Implemented fix for compiling errors when building the FreeBSD version - without bktr support. - (http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSDFixCompile) - * Commented out many unnecessary syslog debug only messages. The commented - out code was first patched by Mike Lees patch related to syslog causing - instability and hanging motion processes. - (http://www.lavrsen.dk/twiki/bin/view/Motion/SyslogEventPatch). - * Included Kalle Andersson's patch that ensures that Motion detaches from - the stdin and stout devices so that a secure shell that was used to start - Motion in daemon mode does not hang when you exit the shell. - (http://www.lavrsen.dk/twiki/bin/view/Motion/DaemonDetachFromSTDIO) - -snap2 - * Implemented a new lightswitch feature so that is now triggers lightswitch - detected based on the percentage of pixels set by the lightswitch option which - is now an integer instead of a boolean. When lightswitch is detected motion - skips 5 frames to allow camera to settle. - * Fixed a bug in the autobrightness function. - * Fixed a bug in netcam_start() - wrong imgs.size calculation - -Release - * Swapped width and height parameters in some functions. This has no influence - on program execution. Just a cosmetic change. - - -3.1.16 Bugfix release -snap1 - * Fixed a configure error related to xmlrpc. - * Fixed a bug in the SQL code related to file type. - -Release - * Fixed a segfault problem in alg.c related to the locate feature. - * Made motion more robust to whitespace in its config files. It now - accepts CR LF (DOS/Windows) and whitespace only lines no longer - gives warning messages in syslog. Also cleaned up the conf.c - function structure a little bit. - - -3.1.15 Summary of changes from 3.1.14 to 3.1.15. -New features: - * ffmpeg now supports mpeg4 and msmpeg4 in addition to mpeg1. Timelapse - mpegs are always made with mpeg1 because this allows appending to - existing mpeg when motion or timelapse is restarted. This also meant - a change of the configure option --with-libavcodec to --with-ffmpeg - which now needs to point to the parent directory that holds libraries. - * configure has been significantly improved so that most people can - simply run ./configure, make and make install with no parameters and - all libraries should be detected automatically if they are installed - like in most distributions. - * rotation feature added which allows the camera to be mounted upside - down or in portrait. - * SQL (Postgres and MySQL) table format has been changed. The time - related fields such as minute, hour, day, month and year has been - replaced by a timestamp field called 'time_stamp'. Additionally a - field called 'frame' has been added so that each file can be correctly - sorted based on time_stamp and frame (picture frame number within one - second). An additional field called 'text_left' stores the displayed - text given by config option 'text_left'. And a field 'camera' has been - added which stores the thread number. - * The %v (event) prefix has been removed from the default filename - for timelapse mpegs. It makes little sense to have the current event - number as part of the timelapse filename as default. - * A new feature called 'labeling' was added which is a great enhancement - to the motion detection algorithm. It ensures that only the largest - area of movement is included in the detection and it prevents noise - and wind from making false detection. It should also make tracking - work better. - * Angel Carpintero ported motion and it's main features to freeBSD. - The freeBSD is still very much beta and because of limited access to - hardware we need more people to test the various features. - * Motion is now also released as an RPM with both mysql, postgres, - libcurl and ffmpeg support. - -Bugfixes: - * Fixed the problem with default strings being written to thread - config files when using the XMLRPC command motion.conf.write. - * Implemented improvement of vid_putpipe so that Motion does not spend - time writing to a vloopback device which is not there. - * Introduced reporting to syslog of writing to vloopback fails. - * Memory clean-up improvements when Motion exits normally. - * Fixed a small bug related to the filename given for onffmpegclose. - * Provided more improvements of error handling. - * Added additional error reporting to console. - -3.1.15 Snapshot releases -snap1 - * Fixed the problem with default strings being written to thread - config files when using the XMLRPC command motion.conf.write. - -snap2 - * Implemented Ryan Ayers improvement of vid_putpipe so that Motion - does not spend time writing to a vloopback device which is not there. - Also introduced reporting to syslog of writing to vloopback fails. - * Ryan Ayers improved configure's ability to find custom installations - of ffmpeg. - * Ryan Ayers provided misc. cosmetic changes in the code. - * Ryan Ayers rewrote the ffmpeg functions completely added support for - new codecs/formats mpeg4 and msmpeg4. mpeg1 was improved also. - -snap3 - * Implemented Ryan Ayers simplified ffmpeg patch where 10 ffmpeg - functions are reduced to 5. The memory leak related to an unused - filehandle has been resolved. - * Kenneth Lavrsen solved the timelapse related .mpeg.mpeg filename - error. - * Kenneth Lavrsen removed the memory leak in ffmpeg.c related to the - use of strdup without a free. - -snap4 - * Implemented Ryan Ayers snap3 based ffmpeg patch that cleans up the - code significantly, forces timelapse. The list of improvements: - * Forces timelapse to mpeg1 for the time being. - * Removes FILE* f declaration in ffmpeg.h since we no longer need it. - * Removes all picture_buf references. This was carried over from - output_example.c in ffmpeg-0.4.8. However, we don't need it. - That is allocating space for picture->data, but motion already - takes care of this for us with the newimg variable. - * Removed some old commented code ... tmpfilename, picture_buf stuff. - * Included Angel Carpintero's memory clean-up improvements when Motion - exits normally. - -snap5 - * Added Per Jönsson's rotate feature. When set to non-zero some extra - CPU time is used for the rotation. - * Kenneth Lavrsen changed the ffmpeg code so that mpeg1 files are - created using the libavcodec method and mpeg4 and msmpeg4 are created - using the new libavframe method in ffmpeg. - * Kenneth Lavrsen added seconds and frame fields to the database feature. - This means that users must add these two fields to the table "security" - in existing databases when upgrading to 3.1.15. - * Kenneth Lavrsen removed the %v (event) prefix from the default filename - for timelapse mpegs. It makes little sense to have the current event - number as part of the timelapse filename as default. - -snap6 - * Kenneth Lavrsen fixed a small bug related to the filename given for - onffmpegclose. - * Joerg Webers added the new labeling motion detection feature. - * Angel Carpintero provided more improvements of error handling. - -snap7 - * Kenneth Lavrsen changed the configure option --with-libavcodec to - * --with-ffmpeg and updated Guide and man pages and text in code and - config file to match the new shared library way of using ffmpeg - * Angel Carpintero ported motion and it's main features to freeBSD. - The freeBSD is still very much beta and because of limited access to - hardware we need more people to test the various features. - * Angel Carpintero created an updated specs file that enables Kenneth - to build RPMs of Motion. - -snap8 - * Kenneth Lavrsen added the new fields to the SQL security table - camera (thread number), text (text_left) and time (timestamp). - * Angel Carpintero improved error handling for the webcam functions. - -Release - * Kenneth Lavrsen simplified the sql functions (1 instead of 3) - and ensured that the text field is not assigned when text_left is - an empty string. This allows for the field to be auto defaulted. - * Added additional error reporting to console. - - - -3.1.14 2004 May 31 - * Included Ian McConnell's fix for snapshots when using the - "lastsnap" filename. - * Fixed the bug in advanced filename and text feature when event - numbers go higher than 99. - * Included Angel Carpintero's improvement of configure reporting of - missing shared libraries (Kenneth Lavrsen improved it a little - further). - * Included Ian McConnell's timelapse close mpeg file when set to zero - patch. - * Changed motion-control to make a proper output from motion.conf.list. - * Renamed ffmpeg_timelaps to ffmpeg_timelapse (we change now or never) - * Corrected man page (\n). - * Added setting access rights to 644 (755 for configure) when doing - make dist. - * Small improvement on xmlrpc-api.html document. - * Included Angel Carpintero's fix for building motion without ffmpeg - (missing #ifdef round newly added ffmpeg timelapse code) - * Fixed missing init of viddev.frequency causing VIDIOCGCHAN errors. - * Included Angel Carpintero's snap2 based patch for improving configure. - XML-RPC changes of threshold and noise_level are now being used as - long as threshold_tune and noise_level are not enabled. - * Enabled the round robin feature to also work by changing frequency on - the same device and same input. - * Fixed the pre_capture feature so that it also stores the jpegs properly. - * Fixed the ffmpeg_timelapse feature so that the calculated time is - correct and the current image is used instead of an old image from - position 0 in the pre_capture ring buffer. - * Fixed ffmpeg routines so that also graytone images can be - pre_captured and used with ffmpeg_timelapse. - * Fixed the position of the incrementing of shots in the motion_loop - so that it is correct before any functions use it. - * Added quite many comments to the code to make it easier to maintain - (more comments will be added). - * Removed some old debugging printf's that were displayed in non-quiet - mode. - * Changed to snapshot feature from being alarm driven to being timer - driven. This means that each thread can have its own interval - value. The XML-RPC motion.action.snapshot still works. The SIGALRM - method has been changed so that all thread that have the - snapshot_interval non zero will take a snapshot when being signaled - with SIGALRM. A negative value for snapshot_interval will activate - the SIGALRM trigger but not the timing interval. - * Implemented ffmpeg_timelapse_mode feature by James A. Russo. - * Implemented RH (sysV) and Debian type control scripts for /etc/init.d - by Angel Carpintero. - * Implemented enhanced SQL features by James A. Russo. This adds logging - of mpeg and prediction events to MySQL/PostgreSQL. - James patch also replaced the mime file types by a more refined - filetype scheme that allows more refined control for SQL and other - future control. - * Kenneth Lavrsen changed the enhanced SQL config from single sql_mask - option to 5 sql_log_ options for more user friendly control. - * Implemented Daniel Sterlings minimum_motion_frames feature. - * Plugged a memory leak in the pre_capture feature. - * Changed the behaviour of onsave back to original mode where also - snapshots causes onsave command to be run. - * Fixed a bug in frequency setting of V4L device. - * Renamed snapshots_interval and snapshots_filename to snapshot_interval - and snapshot_filename. - * Changed the webcam_port value to 0 in motion-dist.conf to avoid that - people get segmentation faults when having 2 or more cameras and - * webcam_port not set in the thread config files. - * Implemented Daniel Sterlings improved handling of config strings. This - plugs the memory leak when changing string type options via XML-RPC. - * It also makes the memory handling more elegant/optimal and finally - it now allows strings to be as long as allowed by the environment - variable PATH_MAX. - * Kenneth and Daniel added many comments to motion.c and conf.c. - * Daniel Sterling made the XMLRPC able to handle errors without crashing. - * Daniel Sterling and Kenneth Lavrsen added a feature that checks for - two threads having the same webcam_port. If this is the case the last - thread gets its webcam disabled and a warning message is written - to console and syslog. - * Implemented Daniel Sterling's fix for a small calculation error in - alg_diff_fast(). - * Small improvements in messages sent to console and syslog during - startup of Motion. - -3.1.13 - * Included Ian McConnell's despeckle feature (including extra - improvement of the original patch). - * Changed the name of motion.conf to motion-dist.conf to avoid - make install overwrites your perfectly OK working motion.conf - file when you re-install. - * Updated the motion.spec.in. Not tested yet. - * Included Matthias Kilian configure patch which enables configure - to find and use a dynamic library of ffmpegs libavcodec.so . - * Included Steffen Haas improved on screen display patch - (plus some extra characters including a real space). - * Changed the parsing of the motion.conf and thread.conf files so - that spaces are now allowed. This also enables using a space in - the user text. For XML-RPC you put text in "" if you need spaces. - * Changed the XML-RPC function motion.conf.write so that undefined - config options gets written into the main motion.conf file with - the help line and the option prefixed by a '#'. Example - # netcam_url value. - * Added Mike Lees onffmpegclose feature which enabled a command to - be executed each time a file generated by ffmpeg is closed. - * Added Daniel Sterlings night compensate fix. - * Added Angel Carpintero's improved configure process which - automatically detects presence of xmlrpc-c and ffmpeg and makes - the Makefile accordingly. - * Included Ian McConnell's flexible on screen display feature and - flexible strftime based path names. - * Changed conf.c so that xml-rpc command motion.conf.write creates - a much more user friendly motion.conf file. - * Modified Ian's on screen display putting back the config parameter - (draw)text_changes. If enabled the number of changed pixes are shown - in the upper right corner of the image. - * Removed the snap_override feature and reduced the oldlayout to an - Berkeley mpeg_encode feature only renaming it to - berkeley_single_directory. Instead the flexible filename - feature now has oldlayout as default and the "new" directory layout - specified in the motion.conf file. - * Motion.conf sequency re-arranged so the important things comes first. - * Changed names of many options to be more user friendly. - * Renamed the options for displayed text to text_right, text_left and - text_changes. - * Change the parsing of config files so that the argument can be in - quotation marks (" or ') allowing leading spaces for the text_left - and text_right options. This means that you can place the text - anywhere on the picture by using spaces and new lines \n. - - -3.1.12 - * Removed vid_keepalive - * Added reentrant warning to codestyle answer in FAQ. - * Rewrite of PWC tracking code. - * Tracking is inactive by default. - * Motion-control action.quit fix. - * Netcam with mask fixed. - * Added tracking options to xmlrpc interface. - * Ignore SIGPIPE (crashes webcam code). - * Changed fast algorithm to imgs.size/10000 steps. - * Renamed prerecord to pre_capture to be more consistent with - post_capture. - * Redone pre_capture completely. - -3.1.12 -rc1 - * added pre-record. with configparameter n_prerecord one can set - the number of frames that should be recorded *before* the - motion starts. for this feature to work, you need to set - post capture to at the value given for n_prerecord! also: - n_prerecord must be at least 1 - -3.1.11 - * found 2 memory-leaks (two 'FILE *' were not closed) in the - webcam-interface - * started working on support for logitech sphere/orbit tracking - fixed bug in tracking routines (would sometimes use garbage - coordinates) - * added max-number-of-frames-limit to the webcaminterface (patch - by Jeroen Vreeken) - -3.1.10 - * added Kenneth's fixes for ffmpeg instability and the problem - with the "ioctl(VIDIOCGCHAN): Invalid argument" error - * small optimisation of rgb24toyuv420p (about 6% faster) so - for certain video-devices things might be a little faster - * optimized alg_diff_fast: about 50% faster - made it compile again with 2.6.0-test9 - * noise tuning is now only done when there's no motion! - * noise is resetted to the median of the tuned value and the - configured value as soon as no motion is detected - * fixed includes for mysql/psql (thanks Felix Finch!) - -3.1.9 - * motion now logs to syslog instead of stderr, that way it is - still possible to see what is going wrong when motion runs - as a daemon process. - * motion will now exit nicely when memory allocation fails - instead of segfaulting - * low_cpu now takes the number of frames per second to process - when no motion is detected instead of on/off - * "quick motion detection" is now only performed when motion - is in "idle" mode. - * added Kenneth's patch: motion with ffmpeg-0.4.8 now compiles - again! - * small optimisation: if a file is created, the path is now - only recreated when it did not already exist. - - -3.1.8 is the last version release by Jeroen Vreeken. -New maintainers are: Kenneth Lavrsen (http://www.lavrsen.dk/) and Folkert -van Heusden (http://www.vanheusden.com/). - - -3.1.8 Froze 3.1.8 - Can't use the same variable name twice in ppm code... - -3.1.7 Froze 3.1.7 - Added codingstyle answer to faq - yuv to rgb conversion for ppm images. - Webcam close and denial of service fixes. - Renamed roundrobing to roundrobin. - Don't try to compile in xml-rpc support when not defined. - -3.1.6 Froze 3.1.6 - Added output_all option for continuous file saving. - Fixed picture saving on rgb files. - Fixed off-by-one error in framerate calculation. - -3.1.5 Froze 3.1.5 - Added motion.action.quit to xml-rpc api. - Changed v4l code to convert rgb to yuv420p and - removed support for rgb24 from all other files. - Removed read() support from v4l code. - Changed netcam code to output yuv420p images. - Fixed libavcodec.h include in ffmpeg.h - -3.1.4 Froze 3.1.4 - Fixed ffmpeg segfault. - Removed motion.conf* from install section in Makefile - Fixed mail option. - Fixed conf list hang. - -3.1.3 Froze 3.1.3 - Made timelaps interval variable. - Added motion.conf.write to xmlrpc API - Motion can write its own config file. - Changed xmlrpc API to use strings for all option types. - Added comment fields for config options. - Added additional settings for ffmpeg. - -3.1.2 Froze 3.1.2 - Use SO_REUSEADDR on http listen sockets. - Added control_localhost and webcam_localhost options for - binding servers to the loopback interface (default=on). - xmlrpc-httpd now uses nonblocking io allowing for multiple - connections to be handled at the same time. - Set default for 'threshold_tune' and 'noise_tune' to yes. - Added threshold_tune config option. - -3.1.1 Froze 3.1.1 - Sync with 3.0.4 - Added xmlrpc motion-control. - Changed description output to match input format. - Added Server and Connection fields to the webcam code. - Added threshold_tune????? for autotuning the max_changes level. - Added noise_tune option for autotuning the noise level. - Sync with 3.0.3 - -3.1.0 Froze 3.1.0 - Added predict evaluation. - Added predict_description config option. - Started with predict functions. - Forked from 3.0.2 - -3.0.2 Froze 3.0.2 - Changed strtok() call for argument in conf.c arguments with - '=' in them are now allowed. - -3.0.1 Froze 3.0.1 - Added 'dist' and 'updateguide' options to Makefile. - Added motion_guide.html to documentation. - Fixed mpeg names when using oldlayout. - Updated manpage. - Added check to low_cpu frame_delay calculation for a maximum - of 1 second. - -3.0.0 Froze 3.0.0 - Added string.h to ffmpeg.c - -2.9.12 Froze 2.9.12 - Added ffmpeg_bps option. - Fixed devpipe instead of devmpipe in motion.c - -2.9.11 Froze 2.9.11 - Added all config files to examples in Makefile - Fixed YUV422 converter for real :) - Use 2 as minimum fps for ffmpeg (less produces a floating point - exception) - -2.9.10 Froze 2.9.10 - Fixed YUV422 to YUV420 converter. - Fixed oldlayout for ffmpeg files. - Added -lz for mysql. - Removed TODO from makefile. - -2.9.9 Froze 2.9.9 - Fixed leaks in webcam.c - Fixed mask image use (imgs.motionsize instead of imgs.size) - Don't try to detect motion with threshold set to 0. - -2.9.8 Froze 2.9.8 - Always try to remove snapshot link. - Cleaned up config file. - Cleaned up ppm code, now loads pgm greyscale files. - Fixed max_mpeg_time segfault in ffmpeg close event. - Added -lm for libavcodec. - Updated FAQ. - Added timelaps option. - Fixed SIGHUP handling. - Added /usr/local/mysql/include and /usr/local/mysql/lib to - configure script and fixed bogus error message. - Fixed snapshot location (missing filepath) - -2.9.7 Froze 2.9.7 - Fixed some more #endif statements - Use cnt->lastrate for ffmpeg framerate. - Fixed ffmpeg code for RGB and GREY images. - Added YUV422 support (converted to YUV420P) - Added roundrobing on frequency. - -2.9.6 Froze 2.9.6 - Tweaked autobrightness mode. - Added webcam_maxrate option. - Reversed image and boundary in webcam code. - Added framerate control. - Added webcam_motion config option. - New frame_limit code. - Fixed include files for ffmpeg.h - Code cleanup. - Removed SIGHUP handler. - Removed draw on motion images. - Added speed and stepsize options to tracking code. - Reversed the night compensation. - Removed ffmpeg error in max mpegtime code. - Fixed #endif statements in header files. - Changed 'deamon' to 'daemon' - -2.9.5 Froze 2.9.5 - Added missing time.h define in webcam.c - Added 'frequency' option for v4l tuners. - Fixed max mpeg time with ffmpeg encoding - Added path for mpeg_encode (problems with PATH variable) - Fixed deamon mode. - Changed overlay to white on black (more readable). - -2.9.4 Froze 2.9.4 - Added webcam option. - Moved reference image update before draw() - Added fclose() to put_picture() - -2.9.3 Froze 2.9.3 - Added GNU license to all file headers. - New netcam code - Fixed snapshot filenames - Use correct image sizes (no more width*height*3) - -2.9.2 Froze 2.9.2 - Added ffmpeg code (from monitor) for realtime mpeg encoding. - Moved image creation to event.c - Moved put_picture functions to picture.c - Added support for Y plane images (YUV420P and GREYSCALE) - Set default jpeg quality from 50 to 75 - PostgreSQL support - Moved event handlers from motion.c to event.c - Introduced new event() functions. - Updated xml-rpc rmon code. - -2.9.1 Froze 2.9.1 - Fixed lastsnap symlink for new layout. - switchfilter added - post_capture option added - Round robbing_skip added - Added roundrobing_frames option. - -2.9.0 Froze 2.9.0 - Shuffled everything around and added 'struct context', this - should make motion ready for some serious threading. - Added xml-rpc remote monitoring. - Higher quality settings for mpeg. - Added missing w to getopt in conf.c - Removed c++ style '//' comments, they're EVIL. - Removed some old outcommented code. - -2.6.3 froze 2.6.3 - Fixed removal of directories after mpeg creation. - Added new netcam code. - -2.6.2 froze 2.6.2 - Added support for YUV420P palette to video.c, this should fix - problems with the Philips webcams. - -2.6.1 froze 2.6.1 - Changed system() calls into remove() and symlink(). - oldlayout option now also affects snapshots. - Fixed snapshot link name (ppm vs jpg). - Added new snapshot_overwrite option. - Changed directory permissions to 0755 instead of 0750. - Made timestamp overlay better readable, it is now black - or white depending on the back colour. - -2.6.0 froze 2.6.0 - Updated manpage. - Added iomojo Smilecam support. - Added uninstall option to Makefile - Added config file location to the FAQ. - Made timestamp overlay inverse of original pixel instead of - white. - Created 'struct images' to minimize the passing of arguments - between functions. - Move contents of various header files around to make things - more sane. - Made locate box inverse off original pixel instead of white. - Created alg.c and alg.h, they contain all functions that - have something to do with the motion detection algorithms. - Renamed video.c functions to vid_xxxxx. - Created video.h - Improved stepper tracking code. - Tracking code cleanup, multiple tracking interfaces are now - possible. - Added diff_hybrid, a combination of diff_fast and diff_standard - Introduced some pointer magic in the locate functions. - Added experimental diff_fast. - Fixed SIGHUP handling and blocking. - Added auto_bright option. - -2.5.0 froze 2.5.0 - Updated documentation, config files, man page. - Freeing 'line' in decompress_jpeg, this fixes a memory leak - when using Axis cameras. - Implemented SIGHUP handler for reloading config files. - Added realconfig option for starting multiple motion processes - or loading alternative config files. - Added 'jpg_cleanup' to the manpage. - Made 'low_cpu' lower on cpu. - Fixed mpeg creation for old layout. - Moved mpeg movies into year/month/day dir. - Remove empty directories when doing jpg_cleanup. - -2.4.2 froze 2.4.2 - Fixed low_cpu option to be actually low on the cpu. - Fixed missing case for '-w' in conf.c. - -2.4.1 froze 2.4.1 - New version numbering: ala linux kernel - Fixed includes for track.c - -2.4 froze 2.4 - Complete rewrite of the tracking stuff... it now uses a serial - stepper motor interface (and actually works!) - Fixed division by zero in adjust_rate code - Added 'low_cpu' option for minimizing the cpu load while not - detecting any motion. - Added 'oldlayout' option for using the old style filenames. - Added automatic location of vloopback inputs by using - /proc/video/vloopback/vloopbacks. - Fixed '-l' option - Uploaded motion to the sourceforge CVS - Alphabetized CREDITS file. - Added 'pal-nc' norm. - -2.3 froze 2.3 - Started faq. - Included fix for bad 'strtok' in glibc with RH 7.0 - Added \t as a delimiter for config files. - Made mpeg creation checks more sane. - -2.2 froze 2.2 - Fixed segfault bug with filebase creation. - Added creation of mpegs when killed or when getting SIGUSR1 - or when max_mpeg_time has been reached. - -2.1 froze 2.1 - Only create directories if they are going to be used. - Changed SYNC ioctl argument to int in video.c - Added realmotion option - Default config changed: - -gap is now 60 instead of 300 seconds. - -locate is on by default (-l function now works reversed) - -night_compensate is on by default - Added mpeg framerate adjustment. - Added night_compensate for dark pictures. - -2.0 froze 2.0 - Integrated motion tracking. - Improved lightswitch detection. - Added clipcount in video.c, quickcam should work good now. - -1.99 froze 1.99 - Fixed memory leak in mpeg creation. - Created put_picture for saving images. - Moved lightswitch code out of main loop. - Merged exec_externcommand, exec_onsavecommand and - exec_onmpegcommand into exec_command - Added onmpeg command. - -1.81 froze 1.81 - Fixed segfault bug in 'mysql_password' option. - -1.8 froze 1.8 - Added video loopback for motion pictures. - Location box is now only enlarged for heads, not for feet. - Merged in Axis 2100 camera support. - conf.c now also looks for '~/.motion/motion.conf'. - Moved filebase creation to mkfilebase - Minor improvements. - Loopback feed during lightswitch. - -1.7 froze 1.7 - Little bit of code cleanup - Splitted motion.c in motion.c and video.c - Changed config.in to correctly detect the mysql libraries and - include files. - -1.6 froze 1.6 - Motion now has its own mailinglist: motion@frogtown.com - Added MySQL support - Added creation of symbolic link to snapshots - Changed file names of snapshots - -1.5 froze 1.5 - Added video loopback support for realtime viewing. - Fixed division by zero bug. - Added install option to Makefile. - Fixed bug that prevented external commands, mail and sms from - being called at the first event. - -1.4 froze 1.4 - Added lightswitch filter - Updated manpage - -1.3 froze 1.3 - Added minimum gap option. - Changed /007 to /a, not a real change but more sane. - Added mask option. - Added get_ppm for reading ppm files - Optimized greyscale blowup code. - Added 'FORCE_ENCODE_LAST_FRAME' to mpeg params file. - Experimental tracking routines for mini ssc library - -1.2 froze 1.2 - Fixed some exit(-1) to exit(1) - Updated manpage with the new options. - Added adjustable noise level. - Snapshots can be made in ppm format to. - Fixed signal blocking code (this time right?) - -1.1 froze 1.1 - Motion now has it own logos!!!! - Added timestamp to picture. - Added ppm output format. - Rewrote locate function, small things (like fish :) don't - disturb the locate option anymore. - Added break for -B option - -1.0 froze 1.0 - Went back to alarm for automated snapshots - (signals should work with bttv now) - Moved usage to conf.c - Finished manpage - Added check for existing target dir. - Moved diff calculation and image_out generation out of main - loop, adding other methods is easier this way. - Removed sanity check for output formats since someone might - want no pictures at all but only warning messages. - Make snapshots separately from other pictures. - New snapshot names: YYYYMMDDHHMMSS-snapshot - Motion images are encoded to mpeg movies to. - Made movie file names and counter sane. - -0.99-2 froze 0.99-2 - Added signal blocking during ioctls, bttv should now continue - to work when receiving signals. - Snapshots with no movement don't go to the movies ;) - Also flush buffers when making snapshots. - Fixed for segfault when there is no config file. - (Second time, remember to fix the current version next time) - -0.99 Last beta before 1.0 - mpeg movies get timestamp in filename - mpeg_encode is now called from within motion - added chdir, filename generation is now much easier - Added check for complete frames with read - -0.8 froze 0.8 - Added script for mpeg_encode - Moved getopt stuff to conf.c - Added conf.h and conf.c for config file parsing - Added -f option for frame rate limit - Fixed frame nr count (starts at 0 again instead of 1 in v0.7) - -0.7 froze 0.7 - Added event nr to the filename, settable with -g (gap). - Added genhtml.sh (for creating a static version of show.cgi) - New show.cgi - Option for saving both motion and normal images. - Moved image_ref update into diff for loop. - *a option does not use alarm anymore, bttv card users can use - it to (they just miss the SIGALRM option...) - Added picture size settings for read. - Moved read back in, after mmap failure motion we fall back - to normal reads. - Greyscale camera fix - Added check for capture failure - -0.6 froze 0.6 - Fixed stupid typo for execute option (forgot the shift) - Added -l option for locating and marking movement - Added buffer flush to keep log files up to date - -0.5 froze 0.5 - Added contrib dir with infra red script - Option to always output changes between images - Output of motion images - configure script - -0.4 froze 0.4 - Gave the help text a new look. - Overall cleanup (moving defines to motion.h) - Added -E option for executing external commands - -0.3 froze 0.3 - New homepage: http://motion.technolust.cx - Fixed -t option (target path) - Changed from read to mmap for bttv cards - Added input and norm selection - Added alarm signal handler and snapshot (-a) option - (does not work with bttv....) - -0.2 froze 0.2 - Updated README and TODO - Added SMS and mail alert messages - Changed file name format to YYYYMMDDHHMMSS-fn.jpg - (fn=framenumber) - Added deamonize option - Cleaned up includes - Decaying reference picture added - Renamed image1 and image2 to image_ref and image_new - -0.1 Initial release diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9dc365d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,158 @@ +# +# For compilation, the following environment vars should be defined before running cmake: +# USERLANDPATH - path to the root of the Pi userland files (from https://github.com/raspberrypi/userland.git) +# +# For cross-compilation, the following environment vars should be defined before running cmake: +# ROOTFSPATH - path to the root of the Pi file system (for include and library file paths) +# TOOLPATH - path to the root of the cross-compiler (e.g. a path ending in "tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian" for the Linaro toolchain) +# TOOLPREFIX - platform specific prefix for compiler tool names (e.g. arm-linux-gnueabihf-) +# +# Optional environment vars: +# DEBUG - if set to any value, will build debug version (no optimisation, full symbol information). +# + +project(motion) +cmake_minimum_required(VERSION 2.8) + +#set(TOOLPATH ~/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian) +#set(ROOTFSPATH ~/RPi/rootfs-2013-05) +#set(USERLANDPATH ~/RPi/userland) +#set(TOOLPREFIX arm-linux-gnueabihf-) + +set(ROOTFSPATH $ENV{ROOTFSPATH}) +set(USERLANDPATH $ENV{USERLANDPATH}) + +execute_process(COMMAND uname -m OUTPUT_VARIABLE MACHINE) + +if(NOT MACHINE MATCHES "arm*") + set(TOOLPATH $ENV{TOOLPATH}) + set(TOOLPREFIX $ENV{TOOLPREFIX}) + set(CMAKE_C_COMPILER ${TOOLPATH}/bin/${TOOLPREFIX}gcc) + set(CMAKE_ASM_COMPILER ${TOOLPATH}/bin/${TOOLPREFIX}gcc) + set(CMAKE_SYSTEM_NAME Linux) + + include_directories( + ${TOOLPATH}/arm-linux-gnueabihf/include + ${TOOLPATH}/arm-linux-gnueabihf/libc/usr/include/arm-linux-gnueabihf + ${TOOLPATH}/arm-linux-gnueabihf/libc/usr/include + ${TOOLPATH}/lib/gcc/arm-linux-gnueabihf/4.7.2/include-fixed + ${TOOLPATH}/lib/gcc/arm-linux-gnueabihf/4.7.2/include + ${TOOLPATH}/lib/gcc/arm-linux-gnueabihf/4.7.2/finclude + ${ROOTFSPATH}/usr/include/arm-linux-gnueabihf + ${ROOTFSPATH}/usr/include + ${ROOTFSPATH}/usr/local/include + ) + + add_definitions( + -march=armv6zk + -mfpu=vfp + -mfloat-abi=hard + ) + + link_directories( + ${TOOLPATH}/arm-linux-gnueabihf/lib + ${TOOLPATH}/arm-linux-gnueabihf/libc/lib + ${TOOLPATH}/arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf + ${TOOLPATH}/lib/gcc/arm-linux-gnueabihf/4.7.2 + ${TOOLPATH}/libexec/gcc/arm-linux-gnueabihf/4.7.2 + ${ROOTFSPATH}/lib/arm-linux-gnueabihf + ${ROOTFSPATH}/lib + ${ROOTFSPATH}/usr/lib/arm-linux-gnueabihf + ${ROOTFSPATH}/usr/lib + ${ROOTFSPATH}/usr/local/lib + ) +endif() + +enable_language(ASM) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +include_directories( + ${ROOTFSPATH}/usr/include/mysql + ${ROOTFSPATH}/usr/include/postgresql + ${USERLANDPATH} + ${USERLANDPATH}/interface/vcos + ${USERLANDPATH}/interface/vcos/pthreads + ${USERLANDPATH}/interface/vmcs_host/linux + ${USERLANDPATH}/interface/vmcs_host + ${USERLANDPATH}/host_applications/linux/libs/bcm_host/include + ) + +add_definitions( -DVERSION="mmaltest" + -Dsysconfdir="/etc" + -D_REENTRANT + -DHAVE_FFMPEG + -DFFMPEG_NEW_INCLUDES + -DHAVE_FFMPEG_NEW + -DMOTION_V4L2 + -DMOTION_V4L2_OLD + -DTYPE_32BIT=int + -DHAVE_BSWAP + -Wall + -fmessage-length=0 + -std=gnu99 + ) + +if ($ENV{DEBUG}) + add_definitions(-O0 -g3 -D_DEBUG) +else() + add_definitions(-O3) +endif() + +link_directories( + ${ROOTFSPATH}/opt/vc/lib + ) + +add_executable(motion + alg.c + alg_arm.s + conf.c + draw.c + event.c + ffmpeg.c + filecam.c + jpegutils.c + logger.c + md5.c + mmalcam.c + mmaloutput.c + motion.c + netcam.c + netcam_ftp.c + netcam_jpeg.c + netcam_wget.c + metrics.c + picture.c + rotate.c + stream.c + track.c + utils.c + video2.c + video.c + video_common.c + videosourceplugin.c + vloopback_motion.c + webhttpd.c + raspicam/RaspiCamControl.c + raspicam/RaspiCLI.c + ) + +target_link_libraries(motion + pthread + m + jpeg + avformat + avcodec + avutil + z + mysqlclient + pq + rt + bcm_host + vcos + vchiq_arm + mmal_core + mmal_util + mmal_vc_client + -Xlinker -rpath-link=${ROOTFSPATH}/usr/lib/arm-linux-gnueabihf -Xlinker -rpath-link=${ROOTFSPATH}/lib/arm-linux-gnueabihf + ) + diff --git a/CODE_STANDARD b/CODE_STANDARD deleted file mode 100644 index 921094b..0000000 --- a/CODE_STANDARD +++ /dev/null @@ -1,248 +0,0 @@ -Formatting rules for Motion code. -Version 2.0 - 15 Jul 2008 - -Note: To understand them you must view this document with spaces and tabs -visible. - --------------------- -RULE 1 -Code is generally indented using 4 spaces - -Example -/* allocate some memory and check if that succeeded or not. If it failed - * do some error logging and bail out - */ -void * mymalloc(size_t nbytes) -{ - void *dummy = malloc(nbytes); - if (!dummy) { - printf("Could not allocate %llu bytes of memory!\n", (unsigned long long) nbytes); - syslog(EMERG, TYPE_ALL, "%s: Could not allocate %llu bytes of memory!", - __FUNCTION__, (unsigned long long) nbytes); - exit(1); - } - - return dummy; -} - --------------------- -RULE 2 -If a line or statement is broken into two lines you will normally want the text -in the 2nd line to align with text in the first line. The alignment is done -using spaces making the code on the following lines appear in a natural way below -the corresponding code above. Use common sense to enhance readability. - -Example -/* allocate some memory and check if that succeeded or not. If it failed - * do some error logging and bail out - */ -void * mymalloc(size_t nbytes) -{ - void *dummy = malloc(nbytes); - if (!dummy) { - printf("Could not allocate %llu bytes of memory!\n", - (unsigned long long) nbytes); - syslog(EMERG, TYPE_ALL,"Could not allocate %llu bytes of memory!", - __FUNCTION__, (unsigned long long) nbytes); - exit(1); - } - - return dummy; -} - -Example - 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_mpeg * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + - cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE; - - - -Example - char msg[] = "This is a very long message which we would like to break" - "into two lines or more because otherwise the line gets" - "too long to read. We align them below each other for readability" - --------------------- -RULE 3 -Never use TABS to align anything. A tab may be 4 positions in one editor -and 8 in another. A space is always a space. - --------------------- -RULE 4 -Functions should be written with this syntax. - -GOOD EXAMPLE -/* Comment block - * A comment block should be at least one line saying what the function does. - * It is better to make several lines explaining what it does, what it takes - * for arguments and what it returns. It is a bad idea to try to use tabs to - * align text in the comment block - */ -type function_name(parameters) -{ - declarations - declarations - - statements - statements -} - -Do not split the function declaration into two lines. -Do not put the '{' after the function declaration. Put it on an empty line -right after. Note that this rule is only for functions. - -BAD EXAMPLE - -type -function_name(parameters) { - declarations - declarations - - statements - statements -} - --------------------- -RULE 5 -Blocks follow K&R. - -GOOD EXAMPLE - -if ((picture=fopen(cnt->conf.mask_file, "r"))) { - cnt->imgs.mask=get_pgm(cnt, picture, cnt->imgs.width, cnt->imgs.height); - fclose(picture); -} else { - put_fixed_mask(cnt, cnt->conf.mask_file); - printf("Hello world\n"); -} - - -BAD EXAMPLE (even though Kenneth loves this one personally) - -if ((picture=fopen(cnt->conf.mask_file, "r"))) -{ - cnt->imgs.mask=get_pgm(cnt, picture, cnt->imgs.width, cnt->imgs.height); - fclose(picture); -} -else -{ - put_fixed_mask(cnt, cnt->conf.mask_file); - printf("Hello world\n"); -} - - - -GOOD EXAMPLE - -switch (expr) { -case ABC: -case DEF: - statement; - break; -case UVW: - statement; - break; -default: - /* default case */ - statement; -} - -BAD EXAMPLE - -switch (expr) { - case ABC: - case DEF: - statement; - break; - case UVW: - statement; - break; - default: - /* default case */ - statement; -} - - - --------------------- -RULE 6 -Whitespace. -To ensure that Motion code looks homogeneous and to enhance readability: - 1. Do not use a space before a comma - 2. Always leave at least one space after a comma - 3. Use one space between a block start statement and a '{' - 4. Do not use a space between a function name and the '(' - 5. Use spaces to enhance readability (a non objective rule but at least - think about it) - 6. The '*' for pointers should be just before the variable name with no - space. - -GOOD EXAMPLES -int function_name(int *par1, int par2, int par3) { -if (var1==2 || var2==3) { - -BAD EXAMPLES -int function_name (int * par1 , int par2,int par3){ -if (var1==2||var2==3){ - --------------------- -RULE 7 -Comment your code -That's worth repeating - PLEASE, PLEASE comment your code. -We receive far too much code which is completely uncommented and where -variable names are short and say nothing about their function. -Use /* This style of comment for permament comments */ or -/* - * This style of comment for comments which - * require more that one line - */ -Use // this style comments for something you add temporarily while testing and -FIXME type comments. It is much easier to spot the temporary comments this way. - --------------------- -RULE 8 -Use variable names that say what the variable is used for. -Avoid x,t,vt type variable names. -Use names like image, image_buffer, image_height, output_buffer -Short names like i and j for loop index variable are a known good practice. -Variable and function names are in lower case. Use '_' to separate words. -MACROS are in uppercase. -camelCase (mix of upper and lower case) is not allowed because it creates too -many typos for many two finger typers. - - --------------------- - -BEST PRACTICES -Not rules, but these suggestions make code easier to read. - -Use lots of white space and empty lines to group code. -For example, large if statements are easier to read when there is an empty -line before and after them. - -Use an empty line before a comment which describes the code lines below. - -Always use spaces in statements like -thisvar->thismember>thisvar->thisothermember (bad) -thisvar->thismember > thisvar->thisothermember (good) - -if (cnt->event_nr==cnt->prev_event||cnt->makemovie) (bad) -if (cnt->event_nr == cnt->prev_event || cnt->makemovie) (good) - -frame_delay=(1000000L/cnt->conf.low_cpu)-frame_delay-elapsedtime; (bad) -frame_delay = (1000000L / cnt->conf.low_cpu) - frame_delay - elapsedtime; (good) - - --------------------- - -This document can probably be enhanced more as time goes by. -Hope it helps developers to understand the ideas. - -What happens if I do not follow the rules? -Your code will probably be accepted, but developers will have to spend a lot of -time rewriting the code to follow the standard. If this happens, he may make -a less-than-complimentary remark. Please help the developers by at least trying -to follow the spirit of this document. We all have our coding preferences, but -if Motion is coded in 40 different styles, readability (and at the end -quality) will become bad. diff --git a/FAQ b/FAQ deleted file mode 100644 index f4cc8ff..0000000 --- a/FAQ +++ /dev/null @@ -1,24 +0,0 @@ -This FAQ is no longer kept up to date -Look at this URL for a more up to date wiki based FAQ -http://www.lavrsen.dk/twiki/bin/view/Motion/FrequentlyAskedQuestions - -Q: motion crashes while parsing the config file. - -A: Appearantly the behaviour of strtok in glibc has changed somewhat. - This problem should be fixed as of 2.3 - - -Q: Were does motion look for the config file? - -A: First it will look for 'motion.conf' in the current directory, next it will - try to find '.motion/motion.conf' in your home directory (pointed to by - the HOME environment variable). If these don't exist it will try to open - '/usr/local/etc/motion.conf' if you specified /usr/local as the prefix to - configure (this is the default). - -Q: What codingstyle is used for motion? - -A: Motion follows the same style as the linux kernel. - Read Documentation/Codingstyle in the kernel tree for some good reasons. - Also be aware that motion is multithreaded and as such all functions should - be reentrant, using static variables is usually a bad idea. diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 5063740..0000000 --- a/INSTALL +++ /dev/null @@ -1,16 +0,0 @@ -Very simple: - -type: - - ./configure - -followed by: - - make - -And - - make install - - -Next read the README diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 45af71a..0000000 --- a/Makefile.in +++ /dev/null @@ -1,279 +0,0 @@ -################################################################################ -# Makefile for Motion # -################################################################################ -# Copyright 2000 by Jeroen Vreeken # -# # -# This program is published under the GNU public license version 2.0 or later. # -# Please read the file COPYING for more info. # -################################################################################ -# Please visit the Motion home page: # -# http://www.lavrsen.dk/twiki/bin/view/Motion # -################################################################################ - -CC = @CC@ -INSTALL = install - -################################################################################ -# Install locations, controlled by setting configure flags. # -################################################################################ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -mandir = @mandir@ -sysconfdir = @sysconfdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = $(datadir)/doc/@PACKAGE_NAME@-@PACKAGE_VERSION@ -examplesdir = $(datadir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/examples - -################################################################################ -# These variables contain compiler flags, object files to build and files to # -# install. # -################################################################################ -CFLAGS = @CFLAGS@ -Wall -DVERSION=\"@PACKAGE_VERSION@\" -Dsysconfdir=\"$(sysconfdir)\" -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -VIDEO_OBJ = @VIDEO@ -OBJ = motion.o logger.o conf.o draw.o jpegutils.o vloopback_motion.o $(VIDEO_OBJ) \ - netcam.o netcam_ftp.o netcam_jpeg.o netcam_wget.o track.o \ - alg.o event.o picture.o rotate.o webhttpd.o \ - stream.o md5.o @FFMPEG_OBJ@ @SDL_OBJ@ -SRC = $(OBJ:.o=.c) -DOC = CHANGELOG COPYING CREDITS INSTALL README motion_guide.html -EXAMPLES = *.conf motion.init-Debian motion.init-Fedora motion.init-FreeBSD.sh -PROGS = motion -DEPEND_FILE = .depend - -################################################################################ -# ALL and PROGS build Motion and, possibly, Motion-control. # -################################################################################ -all: progs -ifneq (,$(findstring freebsd,$(VIDEO_OBJ))) - @echo "Build complete, run \"gmake install\" to install Motion!" -else - @echo "Build complete, run \"make install\" to install Motion!" -endif - @echo - -progs: pre-build-info $(PROGS) - -################################################################################ -# PRE-BUILD-INFO outputs some general info before the build process starts. # -################################################################################ -pre-build-info: - @echo "Welcome to the setup procedure for Motion, the motion detection daemon! If you get" - @echo "error messages during this procedure, please report them to the mailing list. The" - @echo "Motion Guide contains all information you should need to get Motion up and running." - @echo "Run \"make updateguide\" to download the latest version of the Motion Guide." - @echo - @echo "Version: @PACKAGE_VERSION@" -ifneq (,$(findstring freebsd,$(VIDEO_OBJ))) - @echo "Platform: FreeBSD" -else - @echo "Platform: Linux (if this is incorrect, please read README.FreeBSD)" -endif - @echo - -################################################################################ -# MOTION builds motion. MOTION-OBJECTS and PRE-MOBJECT-INFO are helpers. # -################################################################################ -motion: motion-objects - @echo "Linking Motion..." - @echo "--------------------------------------------------------------------------------" - $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) - @echo "--------------------------------------------------------------------------------" - @echo "Motion has been linked." - @echo - -motion-objects: dep pre-mobject-info $(OBJ) - @echo "--------------------------------------------------------------------------------" - @echo "Motion object files compiled." - @echo - -pre-mobject-info: - @echo "Compiling Motion object files..." - @echo "--------------------------------------------------------------------------------" - -################################################################################ -# Define the compile command for C files. # -################################################################################ -#%.o: %.c -# @echo -e "\tCompiling $< into $@..." -# @$(CC) -c $(CFLAGS) $< -o $@ - -################################################################################ -# Include the dependency file if it exists. # -################################################################################ -ifeq ($(DEPEND_FILE), $(wildcard $(DEPEND_FILE))) -ifeq (,$(findstring clean,$(MAKECMDGOALS))) --include $(DEPEND_FILE) -endif -endif - -################################################################################ -# Make the dependency file depend on all header files and all relevant source # -# files. This forces the file to be re-generated if the source/header files # -# change. Note, however, that the existing version will be included before # -# re-generation. # -################################################################################ -$(DEPEND_FILE): *.h $(SRC) - @echo "Generating dependencies, please wait..." - @$(CC) $(CFLAGS) -M $(SRC) > .tmp - @mv -f .tmp $(DEPEND_FILE) - @echo - -################################################################################ -# DEP, DEPEND and FASTDEP generate the dependency file. # -################################################################################ -dep depend fastdep: $(DEPEND_FILE) - - -################################################################################ -# DEV, BUILD with developer flags # -################################################################################ -dev: distclean autotools all - -################################################################################ -# DEV-GIT, BUILD with developer flags # -################################################################################ -dev-git: distclean autotools-git all - - -################################################################################ -# GIT, BUILD with developer flags # -################################################################################ -build-commit-git: distclean set-version-git all - -################################################################################ -# CURRENT, BUILD current svn trunk. # -################################################################################ -current: distclean svn autotools all - -svn: - svn update - -autotools: - @sed -i 's/.\/commit-version.sh/.\/version.sh/g' configure.in - autoconf - ./configure --with-developer-flags - -autotools-git: - @sed -i 's/.\/git-commit-version.sh/.\/version.sh/g' configure.in - autoconf - ./configure --with-developer-flags - - -build-commit: distclean svn set-version all - -set-version: - @sed -i 's/.\/version.sh/.\/commit-version.sh/g' configure.in - autoconf - @sed -i 's/.\/commit-version.sh/.\/version.sh/g' configure.in - ./configure --with-developer-flags - -set-version-git: - @sed -i 's/.\/version.sh/.\/git-commit-version.sh/g' configure.in - autoconf - @sed -i 's/.\/git-commit-version.sh/.\/version.sh/g' configure.in - ./configure --with-developer-flags - - -help: - @echo "--------------------------------------------------------------------------------" - @echo "make Build motion from local copy in your computer" - @echo "make current Build last version of motion from svn" - @echo "make dev Build motion with dev flags" - @echo "make dev-git Build motion with dev flags for git" - @echo "make build-commit Build last version of motion and prepare to commit to svn" - @echo "make build-commit-git Build last version of motion and prepare to commit to git" - @echo "make clean Clean objects" - @echo "make distclean Clean everything" - @echo "make install Install binary , examples , docs and config files" - @echo "make uninstall Uninstall all installed files" - @echo "--------------------------------------------------------------------------------" - @echo - -################################################################################ -# INSTALL installs all relevant files. # -################################################################################ -install: - @echo "Installing files..." - @echo "--------------------------------------------------------------------------------" - mkdir -p $(DESTDIR)$(bindir) - mkdir -p $(DESTDIR)$(mandir)/man1 - mkdir -p $(DESTDIR)$(sysconfdir) - mkdir -p $(DESTDIR)$(docdir) - mkdir -p $(DESTDIR)$(examplesdir) - $(INSTALL) motion.1 $(DESTDIR)$(mandir)/man1 - $(INSTALL) $(DOC) $(DESTDIR)$(docdir) - $(INSTALL) $(EXAMPLES) $(DESTDIR)$(examplesdir) - $(INSTALL) motion-dist.conf $(DESTDIR)$(sysconfdir) - for prog in $(PROGS); \ - do \ - ($(INSTALL) $$prog $(DESTDIR)$(bindir) ); \ - done - @echo "--------------------------------------------------------------------------------" - @echo "Install complete! The default configuration file, motion-dist.conf, has been" - @echo "installed to $(sysconfdir). You need to rename/copy it to $(sysconfdir)/motion.conf" - @echo "for Motion to find it. More configuration examples as well as init scripts" - @echo "can be found in $(examplesdir)." - @echo - -################################################################################ -# UNINSTALL and REMOVE uninstall already installed files. # -################################################################################ -uninstall remove: pre-build-info - @echo "Uninstalling files..." - @echo "--------------------------------------------------------------------------------" - for prog in $(PROGS); \ - do \ - ($ rm -f $(bindir)/$$prog ); \ - done - rm -f $(mandir)/man1/motion.1 - rm -f $(sysconfdir)/motion-dist.conf - rm -rf $(docdir) - rm -rf $(examplesdir) - @echo "--------------------------------------------------------------------------------" - @echo "Uninstall complete!" - @echo - -################################################################################ -# CLEAN is basic cleaning; removes object files and executables, but does not # -# remove files generated from the configure step. # -################################################################################ -clean: pre-build-info - @echo "Removing compiled files and binaries..." - @rm -f *~ *.jpg *.o $(PROGS) combine $(DEPEND_FILE) - -################################################################################ -# DIST restores the directory to distribution state. # -################################################################################ -dist: distclean updateguide - @chmod -R 644 * - @chmod 755 configure - @chmod 755 version.sh - -################################################################################ -# DISTCLEAN removes all files generated during the configure step in addition # -# to basic cleaning. # -################################################################################ -distclean: clean - @echo "Removing files generated by configure..." - @rm -f config.status config.log config.cache Makefile motion.init-Fedora motion.init-Debian motion.init-FreeBSD.sh - @rm -f thread1.conf thread2.conf thread3.conf thread4.conf motion-dist.conf motion-help.conf motion.spec - @rm -rf autom4te.cache config.h - @echo "You will need to re-run configure if you want to build Motion." - @echo - -################################################################################ -# UPDATEGUIDE downloads the Motion Guide from TWiki. # -################################################################################ -updateguide: pre-build-info - @echo "Downloading Motion Guide. If it fails, please check your Internet connection." - @echo - wget www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument?skin=text -O motion_guide.tmp - @echo "Cleaning up and fixing links..." - @cat motion_guide.tmp | sed -e 's/\?skin=text//g;s,"/twiki/,"http://www.lavrsen.dk/twiki/,g' > motion_guide.html - @rm -f motion_guide.tmp - @echo "All done, you should now have an up-to-date local copy of the Motion guide." - @echo diff --git a/README b/README index 624e03c..13f7499 100644 --- a/README +++ b/README @@ -1,3 +1,28 @@ +MMAL README +----------- +This is an experimental version of motion that adds support for the +Raspberry Pi's CSI camera module, via the MMAL API. + +As such, this branch has been stripped down to just the code and +some supporting files, and does not at this time contain a means +to build the code. Generated code files have been pre-created +using the original's configure script (see config.h). + +Downloading: a temporary prebuilt binary for Raspberry Pi is available at this link: +https://www.dropbox.com/s/jw5r1wss32tdibb/motion-mmal-opt.tar.gz + +Known working resolutions: + + 352 x 288 + 512 x 288 + 640 x 480 + 768 x 432 + 768 x 576 + 1024 x 576 + + +Original README text +-------------------- Motion up to version 3.1.8 was created and maintained by Jeroen Vreeken. Versions 3.1.9-3.1.12 was maintained by Kenneth Lavrsen (http://www.lavrsen.dk/) and Folkert van Heusden (http://www.vanheusden.com/). diff --git a/README.FreeBSD b/README.FreeBSD deleted file mode 100644 index 2980532..0000000 --- a/README.FreeBSD +++ /dev/null @@ -1,88 +0,0 @@ -The motion port to *BSD is still in very beta state, but -has been tested with network cameras support successfully. -This version has been tested with TV Card ( Miro PCTV pro ), -but should work by any framegrabber supported by bktr driver. - -* How configure your capture card * - -1-. Load the bktr modules -type as root : - -kldload bktr_mem.ko -kldload bktr.ko - -You can setup this in your /boot/loader.conf adding : - -bktr_mem_load="YES" -bktr_load="YES" - -2-. Configure your card settings ( tuner type , format and card ). - -Type as root : - -sysctl hw.bt848.card=1 ( Miro pctv ) -sysctl hw.bt848.tuner=10 ( PHILIPS_FR1216_PAL ) -sysctl hw.bt848.format=0 ( PAL ) - -or add to /etc/sysctl.conf adding : - -hw.bt848.card=1 -hw.bt848.tuner=10 -hw.bt848.format=0 - -* To compile motion in FreeBSD ( should work in OpenBSD and NetBSD ) : - - autoconf - ./configure - of - CC=gcc34 ./configure ( to override the default gcc version) - gmake - gmake install - -( ./configure --without-bktr , to work only with network cameras ). - -Tested in FreeBSD 4.9/4.1x/5.x/6.x . - -Packages needed (dependencies for 6.x): - - - autoconf-2.59_2 - - gcc-3.4.6_20051206 - - m4-1.4.4 - - linuxthreads-2.2.3_19 only if you don't want native freebsd pthread - - jpeg-6b_4 or above - - gmake-3.80_2 ( GNU Make ) - - ffmpeg-0.4.9.p1_6 ( mpeg1/4 video encoders ). - - mysql-server , mysql-client ( database backend support ). - - postgresql-devel , postgresql ( database backend support ). - - - kernel with bktr support ( GENERIC kernel has by default support ). - - - * webcams pwc based - - - pwcbsd-1.4.1_1 ( with mmap support ) - - v4l_compat-1.0.20060801 - - run : ./configure --with-pwcbsd ; gmake ; gmake install - - -* TODO * --------- - -- Improve the capture method ( double buffer , async capture ). -- Detect pixelformat , palettes format , etc ... -- Implement tuner capture ( now only video / svideo capture implemented ). -- Code clean up. -- And many others ... - - Any question / fix / suggestion please send it to motion mailing list. - - - http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD - - * WEBCAMS - ---------- - http://www.lavrsen.dk/twiki/bin/view/Motion/HowtoMotionPwcFreeBSD - - Angel Carpintero - ack@telefonica.net diff --git a/README.MacOSX b/README.MacOSX deleted file mode 100644 index 45f8841..0000000 --- a/README.MacOSX +++ /dev/null @@ -1,33 +0,0 @@ - The motion port to MacOSX is only working with network cameras. - - Tested in latest MacOSX - - Packages needed : - - * autoconf-2.57 or above. - * make-3.79 or above. - * This port has been made using some packages from Fink and DarwinPorts : - o ffmpeg-0.4.8 from DarwinPorts ( but it needs to be patched with ffmpeg-0.4.8-macosx.patch ). - o libjpeg-6b-16, libjpeg-shlibs-6b-16 from Fink - - How to Install - - * Get/Patch/Install ffmpeg - o Download the ffmpeg from sourceforge ( the same version used in Darwinports ). - o Get the patch-ffmpeg - - tar xfvz ffmpeg-0.4.8.tar.gz - cd ffmpeg-0.4.8/ - patch -p1 < ../ffmpeg-0.4.8-macosx.patch - ./configure --prefix=/path_to_install_ffmpeg ; make ; make install ; make installlib - ldconfig - - To install motion follow the standard procedure : - - ./configure --with-ffmpeg=/path_where_you_installed_ffmpeg ; make ; make install - - Any question / fix / suggestion please send it to motion mailing list. - - - Angel Carpintero - ack@telefonica.net diff --git a/README.axis_2100 b/README.axis_2100 deleted file mode 100644 index 67a870e..0000000 --- a/README.axis_2100 +++ /dev/null @@ -1,21 +0,0 @@ -Using motion with the Axis 2100 network camera - -First compile the motion binary as described in README and INSTALL -Then edit motion.conf: Add your axis cameras ip address to the netcam_url -paramter in the "Captute Device Options" section. - - To increase the performance use this urls : - - # for multipart jpeg - http://192.168.1.10/axis-cgi/mjpg/video.cgi?showlength=1 - - or - - # for single jpeg - http://192.168.1.10/axis-cgi/jpg/image.cgi?showlength=1 - -There are only two valid picture sizes for the axis camera: 320x240 and 640x480 - -TODO: - - - Make the IP changeable at run-time. diff --git a/alg.c b/alg.c index 93c260f..ccd9451 100644 --- a/alg.c +++ b/alg.c @@ -8,6 +8,7 @@ */ #include "motion.h" #include "alg.h" +#include "metrics.h" #ifdef __MMX__ #define HAVE_MMX @@ -17,6 +18,12 @@ #define MAX2(x, y) ((x) > (y) ? (x) : (y)) #define MAX3(x, y, z) ((x) > (y) ? ((x) > (z) ? (x) : (z)) : ((y) > (z) ? (y) : (z))) +#if defined(ARM_OPTIMISATIONS) +extern int alg_diff_asm(unsigned char *ref, unsigned char *new, unsigned char *out, int pixel_count, int noise); +extern void alg_update_reference_frame_asm(unsigned char *image_virgin, unsigned char *ref, unsigned char *out, int *ref_dyn, + unsigned char *smart_mask, int pixel_count, int threshold, int accept_timer); +#endif + /** * alg_locate_center_size * Locates the center and size of the movement. @@ -165,20 +172,66 @@ void alg_locate_center_size(struct images *imgs, int width, int height, struct c } +static void alg_draw_box(struct coord *cent, unsigned char* new, int width) +{ + int width_miny = width * cent->miny; + int width_maxy = width * cent->maxy; + + for (int x = cent->minx; x <= cent->maxx; x++) { + int width_miny_x = x + width_miny; + int width_maxy_x = x + width_maxy; + + new[width_miny_x] =~new[width_miny_x]; + new[width_maxy_x] =~new[width_maxy_x]; + } + + for (int y = cent->miny; y <= cent->maxy; y++) { + int width_minx_y = cent->minx + y * width; + int width_maxx_y = cent->maxx + y * width; + + new[width_minx_y] =~new[width_minx_y]; + new[width_maxx_y] =~new[width_maxx_y]; + } +} + +static void alg_draw_cross(struct coord *cent, unsigned char* new, int width) +{ + int centy = cent->y * width; + + for (int x = cent->x - 10; x <= cent->x + 10; x++) { + new[centy + x] =~new[centy + x]; + } + + for (int y = cent->y - 10; y <= cent->y + 10; y++) { + new[cent->x + y * width] =~new[cent->x + y * width]; + } +} + +static void scale_coord(const struct coord* in, struct coord* out, float xfactor, float yfactor) +{ + out->x = in->x * xfactor; + out->y = in->y * yfactor; + out->width = in->width * xfactor; + out->height = in->height * yfactor; + out->minx = in->minx * xfactor; + out->miny = in->miny * yfactor; + out->maxx = in->maxx * xfactor; + out->maxy = in->maxy * yfactor; +} + /** * alg_draw_location * Draws a box around the movement. */ -void alg_draw_location(struct coord *cent, struct images *imgs, int width, unsigned char *new, +void alg_draw_location(struct coord *cent, struct images *imgs, struct image_data *imgdata, int style, int mode, int process_thisframe) { - unsigned char *out = imgs->out; - int x, y; - - out = imgs->out; - /* Debug image always gets a 'normal' box. */ if ((mode == LOCATE_BOTH) && process_thisframe) { + unsigned char *out = imgs->out; + int x, y; + int width = imgs->width; + int width_miny = width * cent->miny; int width_maxy = width * cent->maxy; @@ -199,65 +252,122 @@ void alg_draw_location(struct coord *cent, struct images *imgs, int width, unsig } } if (style == LOCATE_BOX) { /* Draw a box on normal images. */ - int width_miny = width * cent->miny; - int width_maxy = width * cent->maxy; + alg_draw_box(cent, imgdata->image, imgs->width); + if (imgdata->secondary_image && imgs->secondary_type == SECONDARY_TYPE_RAW) { + struct coord cent2; + scale_coord(cent, ¢2, imgs->secondary_width_scale, imgs->secondary_height_scale); + alg_draw_box(¢2, imgdata->secondary_image, imgs->secondary_width); + } + } else if (style == LOCATE_CROSS) { /* Draw a cross on normal images. */ + alg_draw_cross(cent, imgdata->image, imgs->width); + if (imgdata->secondary_image && imgs->secondary_type == SECONDARY_TYPE_RAW) { + struct coord cent2; + scale_coord(cent, ¢2, imgs->secondary_width_scale, imgs->secondary_height_scale); + alg_draw_cross(¢2, imgdata->secondary_image, imgs->secondary_width); + } + } +} - for (x = cent->minx; x <= cent->maxx; x++) { - int width_miny_x = x + width_miny; - int width_maxy_x = x + width_maxy; +static void alg_draw_red_box(struct coord *cent, unsigned char* new, int width, int height) +{ + int cwidth = width / 2; + int width_miny = width * cent->miny; + int width_maxy = width * cent->maxy; + int cwidth_miny = cwidth * (cent->miny / 2); + int cwidth_maxy = cwidth * (cent->maxy / 2); + int ysize = width * height; + int uvsize = ysize / 4; + unsigned char *new_u = new + ysize; + unsigned char *new_v = new_u + uvsize; + + for (int x = cent->minx + 2; x <= cent->maxx - 2; x += 2) { + int width_miny_x = x + width_miny; + int width_maxy_x = x + width_maxy; + int cwidth_miny_x = x / 2 + cwidth_miny; + int cwidth_maxy_x = x / 2 + cwidth_maxy; + + new_u[cwidth_miny_x] = 128; + new_u[cwidth_maxy_x] = 128; + new_v[cwidth_miny_x] = 255; + new_v[cwidth_maxy_x] = 255; + + new[width_miny_x] = 128; + new[width_maxy_x] = 128; + + new[width_miny_x + 1] = 128; + new[width_maxy_x + 1] = 128; + + new[width_miny_x + width] = 128; + new[width_maxy_x + width] = 128; + + new[width_miny_x + 1 + width] = 128; + new[width_maxy_x + 1 + width] = 128; + } - new[width_miny_x] =~new[width_miny_x]; - new[width_maxy_x] =~new[width_maxy_x]; - } + for (int y = cent->miny; y <= cent->maxy; y += 2) { + int width_minx_y = cent->minx + y * width; + int width_maxx_y = cent->maxx + y * width; + int cwidth_minx_y = (cent->minx / 2) + (y / 2) * cwidth; + int cwidth_maxx_y = (cent->maxx / 2) + (y / 2) * cwidth; - for (y = cent->miny; y <= cent->maxy; y++) { - int width_minx_y = cent->minx + y * width; - int width_maxx_y = cent->maxx + y * width; + new_u[cwidth_minx_y] = 128; + new_u[cwidth_maxx_y] = 128; + new_v[cwidth_minx_y] = 255; + new_v[cwidth_maxx_y] = 255; - new[width_minx_y] =~new[width_minx_y]; - new[width_maxx_y] =~new[width_maxx_y]; - } - } else if (style == LOCATE_CROSS) { /* Draw a cross on normal images. */ - int centy = cent->y * width; + new[width_minx_y] = 128; + new[width_maxx_y] = 128; - for (x = cent->x - 10; x <= cent->x + 10; x++) { - new[centy + x] =~new[centy + x]; - out[centy + x] =~out[centy + x]; - } + new[width_minx_y + width] = 128; + new[width_maxx_y + width] = 128; + + new[width_minx_y + 1] = 128; + new[width_maxx_y + 1] = 128; - for (y = cent->y - 10; y <= cent->y + 10; y++) { - new[cent->x + y * width] =~new[cent->x + y * width]; - out[cent->x + y * width] =~out[cent->x + y * width]; - } + new[width_minx_y + width + 1] = 128; + new[width_maxx_y + width + 1] = 128; } } +static void alg_draw_red_cross(struct coord *cent, unsigned char* new, int width, int height) +{ + int cwidth = width / 2; + int cwidth_maxy = cwidth * (cent->y / 2); + int ysize = width * height; + int uvsize = ysize / 4; + unsigned char *new_u = new + ysize; + unsigned char *new_v = new_u + uvsize; + + for (int x = cent->x - 10; x <= cent->x + 10; x += 2) { + int cwidth_maxy_x = x / 2 + cwidth_maxy; + + new_u[cwidth_maxy_x] = 128; + new_v[cwidth_maxy_x] = 255; + } + + for (int y = cent->y - 10; y <= cent->y + 10; y += 2) { + int cwidth_minx_y = (cent->x / 2) + (y / 2) * cwidth; + + new_u[cwidth_minx_y] = 128; + new_v[cwidth_minx_y] = 255; + } +} /** * alg_draw_red_location * Draws a RED box around the movement. */ -void alg_draw_red_location(struct coord *cent, struct images *imgs, int width, unsigned char *new, +void alg_draw_red_location(struct coord *cent, struct images *imgs, struct image_data *imgdata, int style, int mode, int process_thisframe) { - unsigned char *out = imgs->out; - unsigned char *new_u, *new_v; - int x, y, v, cwidth, cblock; - - cwidth = width / 2; - cblock = imgs->motionsize / 4; - x = imgs->motionsize; - v = x + cblock; - out = imgs->out; - new_u = new + x; - new_v = new + v; - /* Debug image always gets a 'normal' box. */ if ((mode == LOCATE_BOTH) && process_thisframe) { + unsigned char *out = imgs->out; + int width = imgs->width; int width_miny = width * cent->miny; int width_maxy = width * cent->maxy; - for (x = cent->minx; x <= cent->maxx; x++) { + for (int x = cent->minx; x <= cent->maxx; x++) { int width_miny_x = x + width_miny; int width_maxy_x = x + width_maxy; @@ -265,7 +375,7 @@ void alg_draw_red_location(struct coord *cent, struct images *imgs, int width, u out[width_maxy_x] =~out[width_maxy_x]; } - for (y = cent->miny; y <= cent->maxy; y++) { + for (int y = cent->miny; y <= cent->maxy; y++) { int width_minx_y = cent->minx + y * width; int width_maxx_y = cent->maxx + y * width; @@ -275,73 +385,18 @@ void alg_draw_red_location(struct coord *cent, struct images *imgs, int width, u } if (style == LOCATE_REDBOX) { /* Draw a red box on normal images. */ - int width_miny = width * cent->miny; - int width_maxy = width * cent->maxy; - int cwidth_miny = cwidth * (cent->miny / 2); - int cwidth_maxy = cwidth * (cent->maxy / 2); - - for (x = cent->minx + 2; x <= cent->maxx - 2; x += 2) { - int width_miny_x = x + width_miny; - int width_maxy_x = x + width_maxy; - int cwidth_miny_x = x / 2 + cwidth_miny; - int cwidth_maxy_x = x / 2 + cwidth_maxy; - - new_u[cwidth_miny_x] = 128; - new_u[cwidth_maxy_x] = 128; - new_v[cwidth_miny_x] = 255; - new_v[cwidth_maxy_x] = 255; - - new[width_miny_x] = 128; - new[width_maxy_x] = 128; - - new[width_miny_x + 1] = 128; - new[width_maxy_x + 1] = 128; - - new[width_miny_x + width] = 128; - new[width_maxy_x + width] = 128; - - new[width_miny_x + 1 + width] = 128; - new[width_maxy_x + 1 + width] = 128; - } - - for (y = cent->miny; y <= cent->maxy; y += 2) { - int width_minx_y = cent->minx + y * width; - int width_maxx_y = cent->maxx + y * width; - int cwidth_minx_y = (cent->minx / 2) + (y / 2) * cwidth; - int cwidth_maxx_y = (cent->maxx / 2) + (y / 2) * cwidth; - - new_u[cwidth_minx_y] = 128; - new_u[cwidth_maxx_y] = 128; - new_v[cwidth_minx_y] = 255; - new_v[cwidth_maxx_y] = 255; - - new[width_minx_y] = 128; - new[width_maxx_y] = 128; - - new[width_minx_y + width] = 128; - new[width_maxx_y + width] = 128; - - new[width_minx_y + 1] = 128; - new[width_maxx_y + 1] = 128; - - new[width_minx_y + width + 1] = 128; - new[width_maxx_y + width + 1] = 128; + alg_draw_red_box(cent, imgdata->image, imgs->width, imgs->height); + if (imgdata->secondary_image && imgs->secondary_type == SECONDARY_TYPE_RAW) { + struct coord cent2; + scale_coord(cent, ¢2, imgs->secondary_width_scale, imgs->secondary_height_scale); + alg_draw_red_box(¢2, imgdata->secondary_image, imgs->secondary_width, imgs->secondary_height); } } else if (style == LOCATE_REDCROSS) { /* Draw a red cross on normal images. */ - int cwidth_maxy = cwidth * (cent->y / 2); - - for (x = cent->x - 10; x <= cent->x + 10; x += 2) { - int cwidth_maxy_x = x / 2 + cwidth_maxy; - - new_u[cwidth_maxy_x] = 128; - new_v[cwidth_maxy_x] = 255; - } - - for (y = cent->y - 10; y <= cent->y + 10; y += 2) { - int cwidth_minx_y = (cent->x / 2) + (y / 2) * cwidth; - - new_u[cwidth_minx_y] = 128; - new_v[cwidth_minx_y] = 255; + alg_draw_red_cross(cent, imgdata->image, imgs->width, imgs->height); + if (imgdata->secondary_image && imgs->secondary_type == SECONDARY_TYPE_RAW) { + struct coord cent2; + scale_coord(cent, ¢2, imgs->secondary_width_scale, imgs->secondary_height_scale); + alg_draw_red_cross(¢2, imgdata->secondary_image, imgs->secondary_width, imgs->secondary_height); } } } @@ -922,6 +977,7 @@ void alg_tune_smartmask(struct context *cnt) /* Increment for *smartmask_buffer in alg_diff_standard. */ #define SMARTMASK_SENSITIVITY_INCR 5 + /** * alg_diff_standard * @@ -1159,39 +1215,46 @@ int alg_diff_standard(struct context *cnt, unsigned char *new) * case the non-MMX code needs to take care of the remaining pixels. */ - for (; i > 0; i--) { - register unsigned char curdiff = (int)(abs(*ref - *new)); /* Using a temp variable is 12% faster. */ - /* Apply fixed mask */ - if (mask) - curdiff = ((int)(curdiff * *mask++) / 255); - - if (smartmask_speed) { +#if defined(ARM_OPTIMISATIONS) + if (!mask && !smartmask_speed) { + diffs = alg_diff_asm(ref, new, out, i, cnt->noise); + } + else +#endif + for (; i > 0; i--) { + register unsigned char curdiff = (int)(abs(*ref - *new)); /* Using a temp variable is 12% faster. */ + /* Apply fixed mask */ + if (mask) + curdiff = ((int)(curdiff * *mask++) / 255); + + if (smartmask_speed) { + if (curdiff > noise) { + /* + * Increase smart_mask sensitivity every frame when motion + * is detected. (with speed=5, mask is increased by 1 every + * second. To be able to increase by 5 every second (with + * speed=10) we add 5 here. NOT related to the 5 at ratio- + * calculation. + */ + if (cnt->event_nr != cnt->prev_event) + (*smartmask_buffer) += SMARTMASK_SENSITIVITY_INCR; + /* Apply smart_mask */ + if (!*smartmask_final) + curdiff = 0; + } + smartmask_final++; + smartmask_buffer++; + } + /* Pixel still in motion after all the masks? */ if (curdiff > noise) { - /* - * Increase smart_mask sensitivity every frame when motion - * is detected. (with speed=5, mask is increased by 1 every - * second. To be able to increase by 5 every second (with - * speed=10) we add 5 here. NOT related to the 5 at ratio- - * calculation. - */ - if (cnt->event_nr != cnt->prev_event) - (*smartmask_buffer) += SMARTMASK_SENSITIVITY_INCR; - /* Apply smart_mask */ - if (!*smartmask_final) - curdiff = 0; + *out = *new; + diffs++; } - smartmask_final++; - smartmask_buffer++; - } - /* Pixel still in motion after all the masks? */ - if (curdiff > noise) { - *out = *new; - diffs++; + out++; + ref++; + new++; } - out++; - ref++; - new++; - } + return diffs; } @@ -1318,8 +1381,8 @@ int alg_switchfilter(struct context *cnt, int diffs, unsigned char *newimg) #define EXCLUDE_LEVEL_PERCENT 20 void alg_update_reference_frame(struct context *cnt, int action) { - int accept_timer = cnt->lastrate * ACCEPT_STATIC_OBJECT_TIME; - int i, threshold_ref; + unsigned char accept_timer = cnt->lastrate * ACCEPT_STATIC_OBJECT_TIME; + int threshold_ref; int *ref_dyn = cnt->imgs.ref_dyn; unsigned char *image_virgin = cnt->imgs.image_virgin; unsigned char *ref = cnt->imgs.ref; @@ -1332,7 +1395,10 @@ void alg_update_reference_frame(struct context *cnt, int action) if (action == UPDATE_REF_FRAME) { /* Black&white only for better performance. */ threshold_ref = cnt->noise * EXCLUDE_LEVEL_PERCENT / 100; - for (i = cnt->imgs.motionsize; i > 0; i--) { +#if defined(ARM_OPTIMISATIONS) + alg_update_reference_frame_asm(image_virgin, ref, out, ref_dyn, smartmask, cnt->imgs.motionsize, threshold_ref, accept_timer); +#else + for (int i = cnt->imgs.motionsize; i > 0; i--) { /* Exclude pixels from ref frame well below noise level. */ if (((int)(abs(*ref - *image_virgin)) > threshold_ref) && (*smartmask)) { if (*ref_dyn == 0) { /* Always give new pixels a chance. */ @@ -1358,11 +1424,12 @@ void alg_update_reference_frame(struct context *cnt, int action) ref_dyn++; out++; } /* end for i */ +#endif // ARM_OPTIMISATIONS } else { /* action == RESET_REF_FRAME - also used to initialize the frame at startup. */ /* Copy fresh image */ memcpy(cnt->imgs.ref, cnt->imgs.image_virgin, cnt->imgs.size); /* Reset static objects */ - memset(cnt->imgs.ref_dyn, 0, cnt->imgs.motionsize * sizeof(cnt->imgs.ref_dyn)); + memset(cnt->imgs.ref_dyn, 0, cnt->imgs.motionsize * sizeof(cnt->imgs.ref_dyn[0])); } } diff --git a/alg.h b/alg.h index 03ddf02..6946632 100644 --- a/alg.h +++ b/alg.h @@ -11,17 +11,7 @@ #define _INCLUDE_ALG_H #include "motion.h" - -struct coord { - int x; - int y; - int width; - int height; - int minx; - int maxx; - int miny; - int maxy; -}; +#include "coord.h" struct segment { struct coord coord; @@ -32,8 +22,8 @@ struct segment { }; void alg_locate_center_size(struct images *, int width, int height, struct coord *); -void alg_draw_location(struct coord *, struct images *, int width, unsigned char *, int, int, int); -void alg_draw_red_location(struct coord *, struct images *, int width, unsigned char *, int, int, int); +void alg_draw_location(struct coord *, struct images *, struct image_data *, int, int, int); +void alg_draw_red_location(struct coord *, struct images *, struct image_data *, int, int, int); int alg_diff(struct context *, unsigned char *); int alg_diff_standard(struct context *, unsigned char *); int alg_lightswitch(struct context *, int diffs); diff --git a/alg_arm.s b/alg_arm.s new file mode 100644 index 0000000..66bafcf --- /dev/null +++ b/alg_arm.s @@ -0,0 +1,148 @@ +.globl alg_diff_asm +.globl alg_update_reference_frame_asm + +@ r0 - ref image ptr +@ r1 - new image ptr +@ r2 - out image ptr +@ r3 - pixel count +@ noise threshold + +alg_diff_asm: + stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r12, lr} @ save regs here + + mov r6, r0 + sub r0, r0 + @calculate noise threshold in parallel into r12 + ldr r12,[sp, #40] + add r12, r12, #1 + orr r12, r12, lsl #8 + orr r12, r12, lsl #16 + mov r9, r0 @ always zeros + mov r8, #1 @ four 1 bytes + orr r8, r8, lsl #8 + orr r8, r8, lsl #16 + +L0: + ldr r10, [r6] @ load original & new pixels 4 at a time @C1L3 + ldr r11, [r1] @C1L3 + add r6, r6, #4 @C1L1 + add r1, r1, #4 @C1L1 + + uqsub8 r4, r10, r11 @ absolute difference into r3 @C1L2 + uqsub8 r5, r11, r10 @C1L2 + ldr r7, [r2] @C1L3 + orr r4, r4, r5 @C1L1 + + usub8 r4, r4, r12 @ compare against threshold, and mix out/new @C1L1 + sel r5, r11, r7 @ based on that into r4 @C1L1 + str r5, [r2] @C1L1 + + sel r4, r8, r9 @ calculate number of different pixels @C1L1 + usada8 r0, r4, r9, r0 @C1L3 + + subs r3, r3, #4 @C1L1 + add r2, r2, #4 @C1L1 + bge L0 @C5-7 + + ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r12, pc} + +@ Macro to process a single pixel post absolute differencing & thresholding +@ +@ r0 - in: virgin image ptr + 4 (byte*) +@ r1 - in: ref image ptr + 4 (byte*) +@ r2 - in: out image ptr (byte*) (will increment) +@ r3 - in: ref_dyn image ptr (int*) (will increment) +@ r4 - in: smart mask ptr (byte*) (will increment) +@ r5 - in: ? (used as ref_dyn value, virgin pixel, new ref pixel) +@ r6 - in: accept timer +@ r7 - in: ? (used as smart mask pixel, out pixel, ref pixel) +@ r8 - in: 4 x thresholded diff pixels +@ r9 - in: ? (used as updated ref_dyn value) +@ r10- in: ? (unused) +@ r11- in: ? (unused) +@ r12- in: ? (but outer loop is reserving this as a constant) +@ +.macro update_ref_pix pix_lsb, pix_offset + ldrb r7, [r4] @ smart mask pixel + add r4, r4, #1 + cmp r7, #0 + beq 2f + uxtb r9, r8, ror #\pix_lsb @ diff pixel + cmp r9, #0 @ ... if 0, no motion + beq 2f + + ldr r5, [r3] @ if *ref_dyn == 0... + mov r9, #1 + cmp r5, #0 + beq 3f @ ...*ref_dyn = 1 + cmp r5, r6 @ if *ref_dyn > accept timer... + bgt 2f @ ...*ref_dyn = 0, *ref = *virgin + + ldrb r7, [r2] @ if *out + add r9, r5, #1 + cmp r7, #0 + bgt 3f @ ...(*ref_dyn)++ +1:@release_pixel: + ldrb r7, [r0, #\pix_offset] @ *ref = (*ref + *virgin) / 2 + ldrb r5, [r1, #\pix_offset] + sub r9, r9, r9 @ *ref_dyn = 0 + add r5, r5, r7 + lsr r5, r5, #1 + strb r5, [r1, #\pix_offset] + b 3f +2:@copy_virgin: + ldrb r7, [r0, #\pix_offset] @ ref[0] = virgin[0] + sub r9, r9, r9 @ *ref_dyn = 0 + strb r7, [r1, #\pix_offset] +3:@next_ref: + str r9, [r3] + add r3, r3, #4 + add r2, r2, #1 +.endm + +@ r0 - virgin image ptr (byte*) +@ r1 - ref image ptr (byte*) +@ r2 - out image ptr (byte*) +@ r3 - ref_dyn image ptr (int*) +@ smart mask [sp, #40] +@ pixel count [sp, #44] +@ threshold [sp, #48] +@ accept timer [sp, #52] + +alg_update_reference_frame_asm: + stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r12, lr} + + ldr r12,[sp, #48] @calculate noise threshold in parallel into r12 + add r12, r12, #1 + orr r12, r12, lsl #8 + orr r12, r12, lsl #16 + + ldr r4, [sp, #40] @ smart mask ptr + b L2 +L1: + str r6, [sp, #44] @ update pixel count +L2: + ldr r10, [r0] @ load 4 virgin, ref, smartmask pixels 4 @C1L3 + ldr r11, [r1] @C1L3 + add r0, r0, #4 @C1L1 + add r1, r1, #4 @C1L1 + + uqsub8 r8, r10, r11 @ absolute differences into r8 @C1L2 + uqsub8 r9, r11, r10 @C1L2 + ldr r6, [sp, #52] @ accept timer + orr r8, r8, r9 @C1L1 + + usub8 r8, r8, r12 @ compare against threshold, and zero out @C1L1 + sub r9, r9, r9 @ those pixels lower than the threshold @C1L1 + sel r8, r8, r9 @ into r8 @C1L1 + + update_ref_pix 0, -4 + update_ref_pix 8, -3 + update_ref_pix 16, -2 + update_ref_pix 24, -1 + + ldr r6, [sp, #44] @ update pixel count + subs r6, r6, #4 + bgt L1 + + ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r12, pc} diff --git a/commit-version.sh b/commit-version.sh deleted file mode 100755 index 04b4bbd..0000000 --- a/commit-version.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -SNV_VERSION=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2` -SNV_VERSION=`expr $SNV_VERSION + 1` -echo -n "trunkREV$SNV_VERSION" diff --git a/conf.c b/conf.c index 2da0da6..7fa8927 100644 --- a/conf.c +++ b/conf.c @@ -51,6 +51,7 @@ struct config conf_template = { threshold_tune: 0, output_pictures: "on", motion_img: 0, + output_secondary_pictures: 0, emulate_motion: 0, event_gap: DEF_EVENT_GAP, max_movie_time: DEF_MAXMOVIETIME, @@ -79,7 +80,9 @@ struct config conf_template = { ffmpeg_output: 0, extpipe: NULL, useextpipe: 0, + extpipe_secondary: 0, ffmpeg_output_debug: 0, + ffmpeg_output_secondary: 0, ffmpeg_bps: DEF_FFMPEG_BPS, ffmpeg_vbr: DEF_FFMPEG_VBR, ffmpeg_video_codec: DEF_FFMPEG_CODEC, @@ -90,6 +93,7 @@ struct config conf_template = { stream_port: 0, stream_quality: 50, stream_motion: 0, + stream_secondary: 0, stream_maxrate: 1, stream_localhost: 1, stream_limit: 0, @@ -146,6 +150,14 @@ struct config conf_template = { netcam_keepalive: "off", netcam_proxy: NULL, netcam_tolerant_check: 0, +#ifdef HAVE_MMAL + mmalcam_name: NULL, + mmalcam_control_params: NULL, + mmalcam_use_still: 0, + mmalcam_raw_capture_file: NULL, + mmalcam_buffer2_upscale: 0, + mmalcam_buffer2_jpeg: 0, +#endif text_changes: 0, text_left: NULL, text_right: DEF_TIMESTAMP, @@ -410,6 +422,71 @@ config_param config_params[] = { copy_bool, print_bool }, + { + "filecam_path", + "# Path to file containing raw captured YUV frames from which to read input\n" + " Default: Not defined", + 0, + CONF_OFFSET(filecam_path), + copy_string, + print_string + }, +#ifdef HAVE_MMAL + { + "mmalcam_name", + "# Name of camera to use if you are using a camera accessed through OpenMax/MMAL\n" + " Default: Not defined", + 0, + CONF_OFFSET(mmalcam_name), + copy_string, + print_string + }, + { + "mmalcam_control_params", + "# Camera control parameters (see raspivid/raspistill tool documentation)\n" + " Default: Not defined", + 0, + CONF_OFFSET(mmalcam_control_params), + copy_string, + print_string + }, + { + "mmalcam_use_still", + "# Use the still camera output - limits frame rate, but can show more of frame\n" + " Default: off", + 0, + CONF_OFFSET(mmalcam_use_still), + copy_bool, + print_bool + }, + { + "mmalcam_secondary_buffer_upscale", + "# Activate a secondary buffer with larger resolution\n" + " Default: 0 (off)", + 0, + CONF_OFFSET(mmalcam_buffer2_upscale), + copy_int, + print_int + }, + { + "mmalcam_secondary_buffer_jpeg", + "# Pre-encode the secondary buffer to this jpeg quality\n" + " Default: 0 (off), range 1-100", + 0, + CONF_OFFSET(mmalcam_buffer2_jpeg), + copy_int, + print_int + }, + { + "mmalcam_raw_capture_file", + "# Path to file where raw dump of camera YUV capture will be written (for testing, profiling & debugging)\n" + " Default: Not defined", + 0, + CONF_OFFSET(mmalcam_raw_capture_file), + copy_string, + print_string + }, +#endif { "auto_brightness", "# Let motion regulate the brightness of a video device (default: off).\n" @@ -659,6 +736,14 @@ config_param config_params[] = { print_bool }, { + "output_secondary_pictures", + "# Output pictures from any enabled secondary image (default: off)", + 0, + CONF_OFFSET(output_secondary_pictures), + copy_bool, + print_bool + }, + { "quality", "# The quality (in percent) to be used by the jpeg compression (default: 75)", 0, @@ -699,6 +784,15 @@ config_param config_params[] = { copy_bool, print_bool }, + { + "ffmpeg_output_secondary_movies", + "# Use ffmpeg to make movies using any enabled secondary buffer (default: off)", + 0, + CONF_OFFSET(ffmpeg_output_secondary), + copy_bool, + print_bool + }, + { "ffmpeg_timelapse", "# Use ffmpeg to encode a timelapse movie\n" @@ -804,6 +898,14 @@ config_param config_params[] = { print_string }, { + "extpipe_secondary", + "# Send secondary buffer contents to extpipe", + 0, + CONF_OFFSET(extpipe_secondary), + copy_bool, + print_bool + }, + { "snapshot_interval", "\n############################################################\n" "# Snapshots (Traditional Periodic Webcam File Output)\n" @@ -1027,6 +1129,14 @@ config_param config_params[] = { print_bool }, { + "stream_secondary", + "# Use secondary buffer as stream image source (default: off)", + 0, + CONF_OFFSET(stream_secondary), + copy_bool, + print_bool + }, + { "stream_maxrate", "# Maximum framerate for streams (default: 1)", 0, diff --git a/conf.h b/conf.h index b03397e..365ff27 100644 --- a/conf.h +++ b/conf.h @@ -31,6 +31,7 @@ struct config { int threshold_tune; const char *output_pictures; int motion_img; + int output_secondary_pictures; int emulate_motion; int event_gap; int max_movie_time; @@ -43,6 +44,7 @@ struct config { int quiet; int useextpipe; /* ext_pipe on or off */ const char *extpipe; /* full Command-line for pipe -- must accept YUV420P images */ + int extpipe_secondary; const char *picture_type; int noise; int noise_tune; @@ -60,6 +62,7 @@ struct config { int switchfilter; int ffmpeg_output; int ffmpeg_output_debug; + int ffmpeg_output_secondary; int ffmpeg_bps; int ffmpeg_vbr; int ffmpeg_deinterlace; @@ -71,6 +74,7 @@ struct config { int stream_port; int stream_quality; int stream_motion; + int stream_secondary; int stream_maxrate; int stream_localhost; int stream_limit; @@ -123,6 +127,15 @@ struct config { const char *netcam_keepalive; const char *netcam_proxy; unsigned int netcam_tolerant_check; + const char *filecam_path; +#ifdef HAVE_MMAL + const char *mmalcam_name; + const char *mmalcam_control_params; + int mmalcam_use_still; + int mmalcam_buffer2_upscale; + const char *mmalcam_raw_capture_file; + int mmalcam_buffer2_jpeg; +#endif int text_changes; const char *text_left; const char *text_right; diff --git a/config.h.in b/config.h similarity index 64% rename from config.h.in rename to config.h index 26b86ec..9af32db 100644 --- a/config.h.in +++ b/config.h @@ -1,124 +1,133 @@ +/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H +#define HAVE_FCNTL_H 1 /* Define to 1 if you have the `get_current_dir_name' function. */ -#undef HAVE_GET_CURRENT_DIR_NAME +#define HAVE_GET_CURRENT_DIR_NAME 1 /* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H +#define HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_VIDEODEV2_H +#define HAVE_LINUX_VIDEODEV2_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_VIDEODEV_H +/* #undef HAVE_LINUX_VIDEODEV_H */ /* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H +#define HAVE_MEMORY_H 1 /* Define to 1 if you have MySQL support */ -#undef HAVE_MYSQL +#define HAVE_MYSQL 1 /* Define to 1 if you have PostgreSQL support */ -#undef HAVE_PGSQL +#define HAVE_PGSQL 1 /* Define to 1 if you have SDL support */ -#undef HAVE_SDL +/* #undef HAVE_SDL */ + +/* Define to 1 if you have MMAL support */ +#define HAVE_MMAL 1 /* Define to 1 if you have the header file. */ -#undef HAVE_SIGNAL_H +#define HAVE_SIGNAL_H 1 /* Define to 1 if you have SQLITE3 support */ -#undef HAVE_SQLITE3 +/* #undef HAVE_SQLITE3 */ /* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H +#define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H +#define HAVE_STDIO_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H +#define HAVE_STDLIB_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H +#define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H +#define HAVE_STRING_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H +#define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H +#define HAVE_SYS_MMAN_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H +#define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H +#define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H +#define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H +#define HAVE_TIME_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H +#define HAVE_UNISTD_H 1 /* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT +#define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ -#undef PACKAGE_NAME +#define PACKAGE_NAME "motion" /* Define to the full name and version of this package. */ -#undef PACKAGE_STRING +#define PACKAGE_STRING "motion mmaltest" /* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME +#define PACKAGE_TARNAME "motion" /* Define to the home page for this package. */ -#undef PACKAGE_URL +#define PACKAGE_URL "" /* Define to the version of this package. */ -#undef PACKAGE_VERSION +#define PACKAGE_VERSION "mmaltest" /* The size of `int', as computed by sizeof. */ -#undef SIZEOF_INT +#define SIZEOF_INT 4 /* The size of `int *', as computed by sizeof. */ -#undef SIZEOF_INT_P +#define SIZEOF_INT_P 4 /* The size of `long int', as computed by sizeof. */ -#undef SIZEOF_LONG_INT +#define SIZEOF_LONG_INT 4 /* The size of `long long', as computed by sizeof. */ -#undef SIZEOF_LONG_LONG +#define SIZEOF_LONG_LONG 8 /* The size of `short', as computed by sizeof. */ -#undef SIZEOF_SHORT +#define SIZEOF_SHORT 2 /* The size of `void *', as computed by sizeof. */ -#undef SIZEOF_VOID_P +#define SIZEOF_VOID_P 4 /* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS +#define STDC_HEADERS 1 /* Define to empty if `const' does not conform to ANSI C. */ -#undef const +/* #undef const */ /* Define to 1 if you have av_avformat_alloc_context support */ -#undef have_av_avformat_alloc_context +/* #undef have_av_avformat_alloc_context */ /* Define to 1 if you have av_register_protocol support */ -#undef have_av_register_protocol +/* #undef have_av_register_protocol */ /* Define to 1 if you have av_register_protocol2 support */ -#undef have_av_register_protocol2 +#define have_av_register_protocol2 1 /* Define to 1 if you have avformat_alloc_context support */ -#undef have_avformat_alloc_context +#define have_avformat_alloc_context 1 + +#if defined(__ARM_ARCH_6ZK__) +#define ARM_PMCR_METRICS 1 +#define ARM_OPTIMISATIONS 1 +#endif diff --git a/motion-dist.conf.in b/configs/motion-dist.conf similarity index 99% rename from motion-dist.conf.in rename to configs/motion-dist.conf index 30886bc..0278859 100644 --- a/motion-dist.conf.in +++ b/configs/motion-dist.conf @@ -1,6 +1,6 @@ # Rename this distribution example file to motion.conf # -# This config file was generated by @PACKAGE_NAME@ @PACKAGE_VERSION@ +# This config file was generated by motion trunkREV557 ############################################################ diff --git a/configs/motion-mmalcam-testcap.conf b/configs/motion-mmalcam-testcap.conf new file mode 100644 index 0000000..962b111 --- /dev/null +++ b/configs/motion-mmalcam-testcap.conf @@ -0,0 +1,741 @@ +############################################################ +# Daemon +############################################################ + +# Start in daemon (background) mode and release terminal (default: off) +daemon off + +# File to store the process ID, also called pid file. (default: not defined) +process_id_file /var/run/motion/motion.pid + +############################################################ +# Basic Setup Mode +############################################################ + +# Start in Setup-Mode, daemon disabled. (default: off) +setup_mode off + + +# Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined) +logfile /home/pi/motion.log + +# Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC) +log_level 5 + +# Filter to log messages by type (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL) +log_type all + +########################################################### +# Capture device options +############################################################ + +# Videodevice to be used for capturing (default /dev/video0) +# for FreeBSD default is /dev/bktr0 +#videodevice /dev/video0 + +# v4l2_palette allows to choose preferable palette to be use by motion +# to capture from those supported by your videodevice. (default: 17) +# E.g. if your videodevice supports both V4L2_PIX_FMT_SBGGR8 and +# V4L2_PIX_FMT_MJPEG then motion will by default use V4L2_PIX_FMT_MJPEG. +# Setting v4l2_palette to 2 forces motion to use V4L2_PIX_FMT_SBGGR8 +# instead. +# +# Values : +# V4L2_PIX_FMT_SN9C10X : 0 'S910' +# V4L2_PIX_FMT_SBGGR16 : 1 'BYR2' +# V4L2_PIX_FMT_SBGGR8 : 2 'BA81' +# V4L2_PIX_FMT_SPCA561 : 3 'S561' +# V4L2_PIX_FMT_SGBRG8 : 4 'GBRG' +# V4L2_PIX_FMT_SGRBG8 : 5 'GRBG' +# V4L2_PIX_FMT_PAC207 : 6 'P207' +# V4L2_PIX_FMT_PJPG : 7 'PJPG' +# V4L2_PIX_FMT_MJPEG : 8 'MJPEG' +# V4L2_PIX_FMT_JPEG : 9 'JPEG' +# V4L2_PIX_FMT_RGB24 : 10 'RGB3' +# V4L2_PIX_FMT_SPCA501 : 11 'S501' +# V4L2_PIX_FMT_SPCA505 : 12 'S505' +# V4L2_PIX_FMT_SPCA508 : 13 'S508' +# V4L2_PIX_FMT_UYVY : 14 'UYVY' +# V4L2_PIX_FMT_YUYV : 15 'YUYV' +# V4L2_PIX_FMT_YUV422P : 16 '422P' +# V4L2_PIX_FMT_YUV420 : 17 'YU12' +# +v4l2_palette 17 + +# Tuner device to be used for capturing using tuner as source (default /dev/tuner0) +# This is ONLY used for FreeBSD. Leave it commented out for Linux +; tunerdevice /dev/tuner0 + +# The video input to be used (default: -1) +# Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras +input -1 + +# The video norm to use (only for video capture and TV tuner cards) +# Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) +norm 0 + +# The frequency to set the tuner to (kHz) (only for TV tuner cards) (default: 0) +frequency 0 + +# Rotate image this number of degrees. The rotation affects all saved images as +# well as movies. Valid values: 0 (default = no rotation), 90, 180 and 270. +rotate 0 + +# Image width (pixels). Valid range: Camera dependent, default: 352 +width 1024 + +# Image height (pixels). Valid range: Camera dependent, default: 288 +height 576 + +# Maximum number of frames to be captured per second. +# Valid range: 2-100. Default: 100 (almost no limit). +framerate 5 + +# Minimum time in seconds between capturing picture frames from the camera. +# Default: 0 = disabled - the capture rate is given by the camera framerate. +# This option is used when you want to capture images at a rate lower than 2 per second. +minimum_frame_time 0 + +# URL to use if you are using a network camera, size will be autodetected (incl http:// ftp:// mjpg:// or file:///) +# Must be a URL that returns single jpeg pictures or a raw mjpeg stream. Default: Not defined +;netcam_url http://127.0.0.1/cgi-bin/raspicam.sh + +# Username and password for network camera (only if required). Default: not defined +# Syntax is user:password +; netcam_userpass value + +# The setting for keep-alive of network socket, should improve performance on compatible net cameras. +# off: The historical implementation using HTTP/1.0, closing the socket after each http request. +# force: Use HTTP/1.0 requests with keep alive header to reuse the same connection. +# on: Use HTTP/1.1 requests that support keep alive as default. +# Default: off +netcam_keepalive off + +# URL to use for a netcam proxy server, if required, e.g. "http://myproxy". +# If a port number other than 80 is needed, use "http://myproxy:1234". +# Default: not defined +; netcam_proxy value + +# Set less strict jpeg checks for network cameras with a poor/buggy firmware. +# Default: off +netcam_tolerant_check off + +# Let motion regulate the brightness of a video device (default: off). +# The auto_brightness feature uses the brightness option as its target value. +# If brightness is zero auto_brightness will adjust to average brightness value 128. +# Only recommended for cameras without auto brightness +auto_brightness off + +# Set the initial brightness of a video device. +# If auto_brightness is enabled, this value defines the average brightness level +# which Motion will try and adjust to. +# Valid range 0-255, default 0 = disabled +brightness 0 + +# Set the contrast of a video device. +# Valid range 0-255, default 0 = disabled +contrast 0 + +# Set the saturation of a video device. +# Valid range 0-255, default 0 = disabled +saturation 0 + +# Set the hue of a video device (NTSC feature). +# Valid range 0-255, default 0 = disabled +hue 0 + +############################################################ +# File "camera" support - read raw YUV data from a file +############################################################ +#filecam_path /home/pi/test-cap/motion-mmal.capture + +############################################################ +# OpenMax/MMAL camera support for Raspberry Pi +############################################################ +mmalcam_name vc.ril.camera +mmalcam_control_params -hf +mmalcam_use_still off +mmalcam_raw_capture_file /home/pi/motion-mmal.capture + +############################################################ +# Round Robin (multiple inputs on same video device name) +############################################################ + +# Number of frames to capture in each roundrobin step (default: 1) +roundrobin_frames 1 + +# Number of frames to skip before each roundrobin step (default: 1) +roundrobin_skip 1 + +# Try to filter out noise generated by roundrobin (default: off) +switchfilter off + + +############################################################ +# Motion Detection Settings: +############################################################ + +# Threshold for number of changed pixels in an image that +# triggers motion detection (default: 1500) +threshold 1500 + +# Automatically tune the threshold down if possible (default: off) +threshold_tune off + +# Noise threshold for the motion detection (default: 32) +noise_level 32 + +# Automatically tune the noise threshold (default: on) +noise_tune on + +# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined) +# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid. +# (l)abeling must only be used once and the 'l' must be the last letter. +# Comment out to disable +despeckle_filter EedDl + +# Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3 +# A script (on_area_detected) is started immediately when motion is 4 5 6 +# detected in one of the given areas, but only once during an event. 7 8 9 +# One or more areas can be specified with this option. Take care: This option +# does NOT restrict detection to these areas! (Default: not defined) +; area_detect value + +# PGM file to use as a sensitivity mask. +# Full path name to. (Default: not defined) +; mask_file value + +# Dynamically create a mask file during operation (default: 0) +# Adjust speed of mask changes from 0 (off) to 10 (fast) +smart_mask_speed 0 + +# Ignore sudden massive light intensity changes given as a percentage of the picture +# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled +lightswitch 0 + +# Picture frames must contain motion at least the specified number of frames +# in a row before they are detected as true motion. At the default of 1, all +# motion is detected. Valid range: 1 to thousands, recommended 1-5 +minimum_motion_frames 1 + +# Specifies the number of pre-captured (buffered) pictures from before motion +# was detected that will be output at motion detection. +# Recommended range: 0 to 5 (default: 0) +# Do not use large values! Large values will cause Motion to skip video frames and +# cause unsmooth movies. To smooth movies use larger values of post_capture instead. +pre_capture 0 + +# Number of frames to capture after motion is no longer detected (default: 0) +post_capture 0 + +# Event Gap is the seconds of no motion detection that triggers the end of an event. +# An event is defined as a series of motion images taken within a short timeframe. +# Recommended value is 60 seconds (Default). The value -1 is allowed and disables +# events causing all Motion to be written to one single movie file and no pre_capture. +# If set to 0, motion is running in gapless mode. Movies don't have gaps anymore. An +# event ends right after no more motion is detected and post_capture is over. +event_gap 60 + +# Maximum length in seconds of a movie +# When value is exceeded a new movie file is created. (Default: 0 = infinite) +max_movie_time 0 + +# Always save images even if there was no motion (default: off) +emulate_motion off + + +############################################################ +# Image File Output +############################################################ + +# Output 'normal' pictures when motion is detected (default: on) +# Valid values: on, off, first, best, center +# When set to 'first', only the first picture of an event is saved. +# Picture with most motion of an event is saved when set to 'best'. +# Picture with motion nearest center of picture is saved when set to 'center'. +# Can be used as preview shot for the corresponding movie. +output_pictures on + +# Output pictures with only the pixels moving object (ghost images) (default: off) +output_debug_pictures off + +# The quality (in percent) to be used by the jpeg compression (default: 75) +quality 75 + +# Type of output images +# Valid values: jpeg, ppm (default: jpeg) +picture_type jpeg + +############################################################ +# FFMPEG related options +# Film (movies) file output, and deinterlacing of the video input +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################ + +# Use ffmpeg to encode movies in realtime (default: off) +ffmpeg_output_movies off + +# Use ffmpeg to make movies with only the pixels moving +# object (ghost images) (default: off) +ffmpeg_output_debug_movies off + +# Use ffmpeg to encode a timelapse movie +# Default value 0 = off - else save frame every Nth second +ffmpeg_timelapse 0 + +# The file rollover mode of the timelapse video +# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual +ffmpeg_timelapse_mode daily + +# Bitrate to be used by the ffmpeg encoder (default: 400000) +# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled) +ffmpeg_bps 500000 + +# Enables and defines variable bitrate for the ffmpeg encoder. +# ffmpeg_bps is ignored if variable bitrate is enabled. +# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, +# or the range 2 - 31 where 2 means best quality and 31 is worst. +ffmpeg_variable_bitrate 0 + +# Codec to used by ffmpeg for the video compression. +# Timelapse mpegs are always made in mpeg1 format independent from this option. +# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4. +# mpeg1 - gives you files with extension .mpg +# mpeg4 or msmpeg4 - gives you files with extension .avi +# msmpeg4 is recommended for use with Windows Media Player because +# it requires no installation of codec on the Windows client. +# swf - gives you a flash film with extension .swf +# flv - gives you a flash video with extension .flv +# ffv1 - FF video codec 1 for Lossless Encoding ( experimental ) +# mov - QuickTime ( testing ) +# ogg - Ogg/Theora ( testing ) +ffmpeg_video_codec mpeg4 + +# Use ffmpeg to deinterlace video. Necessary if you use an analog camera +# and see horizontal combing on moving objects in video or pictures. +# (default: off) +ffmpeg_deinterlace off + +############################################################ +# SDL Window +############################################################ + +# Number of motion thread to show in SDL Window (default: 0 = disabled) +#sdl_threadnr 0 + +############################################################ +# External pipe to video encoder +# Replacement for FFMPEG builtin encoder for ffmpeg_output_movies only. +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################# + +# Bool to enable or disable extpipe (default: off) +use_extpipe off + +# External program (full path and opts) to pipe raw video to +# Generally, use '-' for STDIN... +;extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps + + + +############################################################ +# Snapshots (Traditional Periodic Webcam File Output) +############################################################ + +# Make automated snapshot every N seconds (default: 0 = disabled) +snapshot_interval 0 + + +############################################################ +# Text Display +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, %T = HH:MM:SS, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, \n = new line, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event - do not use with text_event! +# You can put quotation marks around the text to allow +# leading spaces +############################################################ + +# Locate and draw a box around the moving object. +# Valid values: on, off, preview (default: off) +# Set to 'preview' will only draw a box in preview_shot pictures. +locate_motion_mode off + +# Set the look and style of the locate box if enabled. +# Valid values: box, redbox, cross, redcross (default: box) +# Set to 'box' will draw the traditional box. +# Set to 'redbox' will draw a red box. +# Set to 'cross' will draw a little cross to mark center. +# Set to 'redcross' will draw a little red cross to mark center. +locate_motion_style box + +# Draws the timestamp using same options as C function strftime(3) +# Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock +# Text is placed in lower right corner +;text_right %Y-%m-%d\n%T-%q +text_right + +# Draw a user defined text on the images using same options as C function strftime(3) +# Default: Not defined = no text +# Text is placed in lower left corner +; text_left CAMERA %t + +# Draw the number of changed pixed on the images (default: off) +# Will normally be set to off except when you setup and adjust the motion settings +# Text is placed in upper right corner +text_changes off + +# This option defines the value of the special event conversion specifier %C +# You can use any conversion specifier in this option except %C. Date and time +# values are from the timestamp of the first image in the current event. +# Default: %Y%m%d%H%M%S +# The idea is that %C can be used filenames and text_left/right for creating +# a unique identifier for each event. +;text_event %Y%m%d%H%M%S + +# Draw characters at twice normal size on images. (default: off) +text_double on + + +# Text to include in a JPEG EXIF comment +# May be any text, including conversion specifiers. +# The EXIF timestamp is included independent of this text. +;exif_text %i%J/%K%L + +############################################################ +# Target Directories and filenames For Images And Films +# For the options snapshot_, picture_, movie_ and timelapse_filename +# you can use conversion specifiers +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# Quotation marks round string are allowed. +############################################################ + +# Target base directory for pictures and films +# Recommended to use absolute path. (Default: current working directory) +target_dir /home/pi + +# File path for snapshots (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-snapshot +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot +# File extension .jpg or .ppm is automatically added so do not include this. +# Note: A symbolic link called lastsnap.jpg created in the target_dir will always +# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap' +snapshot_filename %v-%Y%m%d%H%M%S-snapshot + +# File path for motion triggered images (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-%q +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q +# File extension .jpg or .ppm is automatically added so do not include this +# Set to 'preview' together with best-preview feature enables special naming +# convention for preview shots. See motion guide for details +#picture_filename %v-%Y%m%d%H%M%S-%q +picture_filename testcap-frame-%g + +# File path for motion triggered ffmpeg films (movies) relative to target_dir +# Default: %v-%Y%m%d%H%M%S +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S +# File extension .mpg or .avi is automatically added so do not include this +# This option was previously called ffmpeg_filename +movie_filename %v-%Y%m%d%H%M%S + +# File path for timelapse movies relative to target_dir +# Default: %Y%m%d-timelapse +# Default value is near equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d-timelapse +# File extension .mpg is automatically added so do not include this +timelapse_filename %Y%m%d-timelapse + +############################################################ +# Global Network Options +############################################################ +# Enable or disable IPV6 for http control and stream (default: off ) +ipv6_enabled off + +############################################################ +# Live Stream Server +############################################################ + +# The mini-http server listens to this port for requests (default: 0 = disabled) +stream_port 8081 + +# Quality of the jpeg (in percent) images produced (default: 50) +stream_quality 50 + +# Output frames at 1 fps when no motion is detected and increase to the +# rate given by stream_maxrate when motion is detected (default: off) +stream_motion off + +# Maximum framerate for stream streams (default: 1) +stream_maxrate 1 + +# Restrict stream connections to localhost only (default: on) +stream_localhost off + +# Limits the number of images per connection (default: 0 = unlimited) +# Number can be defined by multiplying actual stream rate by desired number of seconds +# Actual stream rate is the smallest of the numbers framerate and stream_maxrate +stream_limit 0 + +# Set the authentication method (default: 0) +# 0 = disabled +# 1 = Basic authentication +# 2 = MD5 digest (the safer authentication) +stream_auth_method 0 + +# Authentication for the stream. Syntax username:password +# Default: not defined (Disabled) +; stream_authentication username:password + + +############################################################ +# HTTP Based Control +############################################################ + +# TCP/IP port for the http server to listen on (default: 0 = disabled) +webcontrol_port 8080 + +# Restrict control connections to localhost only (default: on) +webcontrol_localhost on + +# Output for http server, select off to choose raw text plain (default: on) +webcontrol_html_output on + +# Authentication for the http based control. Syntax username:password +# Default: not defined (Disabled) +; webcontrol_authentication username:password + + +############################################################ +# Tracking (Pan/Tilt) +############################################################# + +# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo) +# The generic type enables the definition of motion center and motion size to +# be used with the conversion specifiers for options like on_motion_detected +track_type 0 + +# Enable auto tracking (default: off) +track_auto off + +# Serial port of motor (default: none) +;track_port /dev/ttyS0 + +# Motor number for x-axis (default: 0) +;track_motorx 0 + +# Set motorx reverse (default: 0) +;track_motorx_reverse 0 + +# Motor number for y-axis (default: 0) +;track_motory 1 + +# Set motory reverse (default: 0) +;track_motory_reverse 0 + +# Maximum value on x-axis (default: 0) +;track_maxx 200 + +# Minimum value on x-axis (default: 0) +;track_minx 50 + +# Maximum value on y-axis (default: 0) +;track_maxy 200 + +# Minimum value on y-axis (default: 0) +;track_miny 50 + +# Center value on x-axis (default: 0) +;track_homex 128 + +# Center value on y-axis (default: 0) +;track_homey 128 + +# ID of an iomojo camera if used (default: 0) +track_iomojo_id 0 + +# Angle in degrees the camera moves per step on the X-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_x 10 + +# Angle in degrees the camera moves per step on the Y-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_y 10 + +# Delay to wait for after tracking movement as number +# of picture frames (default: 10) +track_move_wait 10 + +# Speed to set the motor to (stepper motor option) (default: 255) +track_speed 255 + +# Number of steps to make (stepper motor option) (default: 40) +track_stepsize 40 + + +############################################################ +# External Commands, Warnings and Logging: +# You can use conversion specifiers for the on_xxxx commands +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# %f = filename with full path +# %n = number indicating filetype +# Both %f and %n are only defined for on_picture_save, +# on_movie_start and on_movie_end +# Quotation marks round string are allowed. +############################################################ + +# Do not sound beeps when detecting motion (default: on) +# Note: Motion never beeps when running in daemon mode. +quiet on + +# Command to be executed when an event starts. (default: none) +# An event starts at first motion detected after a period of no motion defined by event_gap +; on_event_start value + +# Command to be executed when an event ends after a period of no motion +# (default: none). The period of no motion is defined by option event_gap. +; on_event_end value + +# Command to be executed when a picture (.ppm|.jpg) is saved (default: none) +# To give the filename as an argument to a command append it with %f +; on_picture_save value + +# Command to be executed when a motion frame is detected (default: none) +; on_motion_detected value + +# Command to be executed when motion in a predefined area is detected +# Check option 'area_detect'. (default: none) +; on_area_detected value + +# Command to be executed when a movie file (.mpg|.avi) is created. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_start value + +# Command to be executed when a movie file (.mpg|.avi) is closed. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_end value + +# Command to be executed when a camera can't be opened or if it is lost +# NOTE: There is situations when motion don't detect a lost camera! +# It depends on the driver, some drivers dosn't detect a lost camera at all +# Some hangs the motion thread. Some even hangs the PC! (default: none) +; on_camera_lost value + +##################################################################### +# Common Options for database features. +# Options require database options to be active also. +##################################################################### + +# Log to the database when creating motion triggered picture file (default: on) +; sql_log_picture on + +# Log to the database when creating a snapshot image file (default: on) +; sql_log_snapshot on + +# Log to the database when creating motion triggered movie file (default: off) +; sql_log_movie off + +# Log to the database when creating timelapse movies file (default: off) +; sql_log_timelapse off + +# SQL query string that is sent to the database +# Use same conversion specifiers has for text features +# Additional special conversion specifiers are +# %n = the number representing the file_type +# %f = filename with full path +# Default value: +# Create tables : +## +# Mysql +# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), event_time_stamp timestamp(14)); +# +# Postgresql +# 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); +# +# insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') +; sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') + + +############################################################ +# Database Options +############################################################ + +# database type : mysql, postgresql, sqlite3 (default : not defined) +; database_type value + +# database to log to (default: not defined) +; database_dbname value + +# The host on which the database is located (default: localhost) +; database_host value + +# User account name for database (default: not defined) +; database_user value + +# User password for database (default: not defined) +; database_password value + +# Port on which the database is located +# mysql 3306 , postgresql 5432 (default: not defined) +; database_port value + +############################################################ +# Database Options For SQLite3 +############################################################ + +# SQLite3 database (file path) (default: not defined) +; sqlite3_db value + + + +############################################################ +# Video Loopback Device (vloopback project) +############################################################ + +# Output images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; video_pipe value + +# Output motion images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; motion_video_pipe value + + +############################################################## +# Thread config files - One for each camera. +# Except if only one camera - You only need this config file. +# If you have more than one camera you MUST define one thread +# config file for each camera in addition to this config file. +############################################################## + +# Remember: If you have more than one camera you must have one +# thread file for each camera. E.g. 2 cameras requires 3 files: +# This motion.conf file AND thread1.conf and thread2.conf. +# Only put the options that are unique to each camera in the +# thread config files. +; thread /usr/local/etc/thread1.conf +; thread /usr/local/etc/thread2.conf +; thread /usr/local/etc/thread3.conf +; thread /usr/local/etc/thread4.conf + diff --git a/configs/motion-mmalcam-testplayback.conf b/configs/motion-mmalcam-testplayback.conf new file mode 100644 index 0000000..f2651fc --- /dev/null +++ b/configs/motion-mmalcam-testplayback.conf @@ -0,0 +1,741 @@ +############################################################ +# Daemon +############################################################ + +# Start in daemon (background) mode and release terminal (default: off) +daemon off + +# File to store the process ID, also called pid file. (default: not defined) +process_id_file /var/run/motion/motion.pid + +############################################################ +# Basic Setup Mode +############################################################ + +# Start in Setup-Mode, daemon disabled. (default: off) +setup_mode off + + +# Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined) +logfile /home/pi/motion.log + +# Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC) +log_level 6 + +# Filter to log messages by type (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL) +log_type all + +########################################################### +# Capture device options +############################################################ + +# Videodevice to be used for capturing (default /dev/video0) +# for FreeBSD default is /dev/bktr0 +#videodevice /dev/video0 + +# v4l2_palette allows to choose preferable palette to be use by motion +# to capture from those supported by your videodevice. (default: 17) +# E.g. if your videodevice supports both V4L2_PIX_FMT_SBGGR8 and +# V4L2_PIX_FMT_MJPEG then motion will by default use V4L2_PIX_FMT_MJPEG. +# Setting v4l2_palette to 2 forces motion to use V4L2_PIX_FMT_SBGGR8 +# instead. +# +# Values : +# V4L2_PIX_FMT_SN9C10X : 0 'S910' +# V4L2_PIX_FMT_SBGGR16 : 1 'BYR2' +# V4L2_PIX_FMT_SBGGR8 : 2 'BA81' +# V4L2_PIX_FMT_SPCA561 : 3 'S561' +# V4L2_PIX_FMT_SGBRG8 : 4 'GBRG' +# V4L2_PIX_FMT_SGRBG8 : 5 'GRBG' +# V4L2_PIX_FMT_PAC207 : 6 'P207' +# V4L2_PIX_FMT_PJPG : 7 'PJPG' +# V4L2_PIX_FMT_MJPEG : 8 'MJPEG' +# V4L2_PIX_FMT_JPEG : 9 'JPEG' +# V4L2_PIX_FMT_RGB24 : 10 'RGB3' +# V4L2_PIX_FMT_SPCA501 : 11 'S501' +# V4L2_PIX_FMT_SPCA505 : 12 'S505' +# V4L2_PIX_FMT_SPCA508 : 13 'S508' +# V4L2_PIX_FMT_UYVY : 14 'UYVY' +# V4L2_PIX_FMT_YUYV : 15 'YUYV' +# V4L2_PIX_FMT_YUV422P : 16 '422P' +# V4L2_PIX_FMT_YUV420 : 17 'YU12' +# +v4l2_palette 17 + +# Tuner device to be used for capturing using tuner as source (default /dev/tuner0) +# This is ONLY used for FreeBSD. Leave it commented out for Linux +; tunerdevice /dev/tuner0 + +# The video input to be used (default: -1) +# Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras +input -1 + +# The video norm to use (only for video capture and TV tuner cards) +# Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) +norm 0 + +# The frequency to set the tuner to (kHz) (only for TV tuner cards) (default: 0) +frequency 0 + +# Rotate image this number of degrees. The rotation affects all saved images as +# well as movies. Valid values: 0 (default = no rotation), 90, 180 and 270. +rotate 0 + +# Image width (pixels). Valid range: Camera dependent, default: 352 +width 1024 + +# Image height (pixels). Valid range: Camera dependent, default: 288 +height 576 + +# Maximum number of frames to be captured per second. +# Valid range: 2-100. Default: 100 (almost no limit). +framerate 5 + +# Minimum time in seconds between capturing picture frames from the camera. +# Default: 0 = disabled - the capture rate is given by the camera framerate. +# This option is used when you want to capture images at a rate lower than 2 per second. +minimum_frame_time 0 + +# URL to use if you are using a network camera, size will be autodetected (incl http:// ftp:// mjpg:// or file:///) +# Must be a URL that returns single jpeg pictures or a raw mjpeg stream. Default: Not defined +;netcam_url http://127.0.0.1/cgi-bin/raspicam.sh + +# Username and password for network camera (only if required). Default: not defined +# Syntax is user:password +; netcam_userpass value + +# The setting for keep-alive of network socket, should improve performance on compatible net cameras. +# off: The historical implementation using HTTP/1.0, closing the socket after each http request. +# force: Use HTTP/1.0 requests with keep alive header to reuse the same connection. +# on: Use HTTP/1.1 requests that support keep alive as default. +# Default: off +netcam_keepalive off + +# URL to use for a netcam proxy server, if required, e.g. "http://myproxy". +# If a port number other than 80 is needed, use "http://myproxy:1234". +# Default: not defined +; netcam_proxy value + +# Set less strict jpeg checks for network cameras with a poor/buggy firmware. +# Default: off +netcam_tolerant_check off + +# Let motion regulate the brightness of a video device (default: off). +# The auto_brightness feature uses the brightness option as its target value. +# If brightness is zero auto_brightness will adjust to average brightness value 128. +# Only recommended for cameras without auto brightness +auto_brightness off + +# Set the initial brightness of a video device. +# If auto_brightness is enabled, this value defines the average brightness level +# which Motion will try and adjust to. +# Valid range 0-255, default 0 = disabled +brightness 0 + +# Set the contrast of a video device. +# Valid range 0-255, default 0 = disabled +contrast 0 + +# Set the saturation of a video device. +# Valid range 0-255, default 0 = disabled +saturation 0 + +# Set the hue of a video device (NTSC feature). +# Valid range 0-255, default 0 = disabled +hue 0 + +############################################################ +# File "camera" support - read raw YUV data from a file +############################################################ +filecam_path /home/pi/test-cap/motion-mmal.capture + +############################################################ +# OpenMax/MMAL camera support for Raspberry Pi +############################################################ +#mmalcam_name vc.ril.camera +mmalcam_control_params -hf +mmalcam_use_still off +#mmalcam_raw_capture_file /home/pi/motion-mmal.capture + +############################################################ +# Round Robin (multiple inputs on same video device name) +############################################################ + +# Number of frames to capture in each roundrobin step (default: 1) +roundrobin_frames 1 + +# Number of frames to skip before each roundrobin step (default: 1) +roundrobin_skip 1 + +# Try to filter out noise generated by roundrobin (default: off) +switchfilter off + + +############################################################ +# Motion Detection Settings: +############################################################ + +# Threshold for number of changed pixels in an image that +# triggers motion detection (default: 1500) +threshold 1500 + +# Automatically tune the threshold down if possible (default: off) +threshold_tune off + +# Noise threshold for the motion detection (default: 32) +noise_level 32 + +# Automatically tune the noise threshold (default: on) +noise_tune on + +# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined) +# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid. +# (l)abeling must only be used once and the 'l' must be the last letter. +# Comment out to disable +despeckle_filter EedDl + +# Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3 +# A script (on_area_detected) is started immediately when motion is 4 5 6 +# detected in one of the given areas, but only once during an event. 7 8 9 +# One or more areas can be specified with this option. Take care: This option +# does NOT restrict detection to these areas! (Default: not defined) +; area_detect value + +# PGM file to use as a sensitivity mask. +# Full path name to. (Default: not defined) +; mask_file value + +# Dynamically create a mask file during operation (default: 0) +# Adjust speed of mask changes from 0 (off) to 10 (fast) +smart_mask_speed 0 + +# Ignore sudden massive light intensity changes given as a percentage of the picture +# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled +lightswitch 0 + +# Picture frames must contain motion at least the specified number of frames +# in a row before they are detected as true motion. At the default of 1, all +# motion is detected. Valid range: 1 to thousands, recommended 1-5 +minimum_motion_frames 1 + +# Specifies the number of pre-captured (buffered) pictures from before motion +# was detected that will be output at motion detection. +# Recommended range: 0 to 5 (default: 0) +# Do not use large values! Large values will cause Motion to skip video frames and +# cause unsmooth movies. To smooth movies use larger values of post_capture instead. +pre_capture 0 + +# Number of frames to capture after motion is no longer detected (default: 0) +post_capture 0 + +# Event Gap is the seconds of no motion detection that triggers the end of an event. +# An event is defined as a series of motion images taken within a short timeframe. +# Recommended value is 60 seconds (Default). The value -1 is allowed and disables +# events causing all Motion to be written to one single movie file and no pre_capture. +# If set to 0, motion is running in gapless mode. Movies don't have gaps anymore. An +# event ends right after no more motion is detected and post_capture is over. +event_gap 60 + +# Maximum length in seconds of a movie +# When value is exceeded a new movie file is created. (Default: 0 = infinite) +max_movie_time 0 + +# Always save images even if there was no motion (default: off) +emulate_motion off + + +############################################################ +# Image File Output +############################################################ + +# Output 'normal' pictures when motion is detected (default: on) +# Valid values: on, off, first, best, center +# When set to 'first', only the first picture of an event is saved. +# Picture with most motion of an event is saved when set to 'best'. +# Picture with motion nearest center of picture is saved when set to 'center'. +# Can be used as preview shot for the corresponding movie. +output_pictures on + +# Output pictures with only the pixels moving object (ghost images) (default: off) +output_debug_pictures off + +# The quality (in percent) to be used by the jpeg compression (default: 75) +quality 75 + +# Type of output images +# Valid values: jpeg, ppm (default: jpeg) +picture_type jpeg + +############################################################ +# FFMPEG related options +# Film (movies) file output, and deinterlacing of the video input +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################ + +# Use ffmpeg to encode movies in realtime (default: off) +ffmpeg_output_movies off + +# Use ffmpeg to make movies with only the pixels moving +# object (ghost images) (default: off) +ffmpeg_output_debug_movies off + +# Use ffmpeg to encode a timelapse movie +# Default value 0 = off - else save frame every Nth second +ffmpeg_timelapse 0 + +# The file rollover mode of the timelapse video +# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual +ffmpeg_timelapse_mode daily + +# Bitrate to be used by the ffmpeg encoder (default: 400000) +# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled) +ffmpeg_bps 500000 + +# Enables and defines variable bitrate for the ffmpeg encoder. +# ffmpeg_bps is ignored if variable bitrate is enabled. +# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, +# or the range 2 - 31 where 2 means best quality and 31 is worst. +ffmpeg_variable_bitrate 0 + +# Codec to used by ffmpeg for the video compression. +# Timelapse mpegs are always made in mpeg1 format independent from this option. +# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4. +# mpeg1 - gives you files with extension .mpg +# mpeg4 or msmpeg4 - gives you files with extension .avi +# msmpeg4 is recommended for use with Windows Media Player because +# it requires no installation of codec on the Windows client. +# swf - gives you a flash film with extension .swf +# flv - gives you a flash video with extension .flv +# ffv1 - FF video codec 1 for Lossless Encoding ( experimental ) +# mov - QuickTime ( testing ) +# ogg - Ogg/Theora ( testing ) +ffmpeg_video_codec mpeg4 + +# Use ffmpeg to deinterlace video. Necessary if you use an analog camera +# and see horizontal combing on moving objects in video or pictures. +# (default: off) +ffmpeg_deinterlace off + +############################################################ +# SDL Window +############################################################ + +# Number of motion thread to show in SDL Window (default: 0 = disabled) +#sdl_threadnr 0 + +############################################################ +# External pipe to video encoder +# Replacement for FFMPEG builtin encoder for ffmpeg_output_movies only. +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################# + +# Bool to enable or disable extpipe (default: off) +use_extpipe off + +# External program (full path and opts) to pipe raw video to +# Generally, use '-' for STDIN... +;extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps + + + +############################################################ +# Snapshots (Traditional Periodic Webcam File Output) +############################################################ + +# Make automated snapshot every N seconds (default: 0 = disabled) +snapshot_interval 0 + + +############################################################ +# Text Display +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, %T = HH:MM:SS, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, \n = new line, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event - do not use with text_event! +# You can put quotation marks around the text to allow +# leading spaces +############################################################ + +# Locate and draw a box around the moving object. +# Valid values: on, off, preview (default: off) +# Set to 'preview' will only draw a box in preview_shot pictures. +locate_motion_mode off + +# Set the look and style of the locate box if enabled. +# Valid values: box, redbox, cross, redcross (default: box) +# Set to 'box' will draw the traditional box. +# Set to 'redbox' will draw a red box. +# Set to 'cross' will draw a little cross to mark center. +# Set to 'redcross' will draw a little red cross to mark center. +locate_motion_style box + +# Draws the timestamp using same options as C function strftime(3) +# Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock +# Text is placed in lower right corner +;text_right %Y-%m-%d\n%T-%q +text_right + +# Draw a user defined text on the images using same options as C function strftime(3) +# Default: Not defined = no text +# Text is placed in lower left corner +; text_left CAMERA %t + +# Draw the number of changed pixed on the images (default: off) +# Will normally be set to off except when you setup and adjust the motion settings +# Text is placed in upper right corner +text_changes off + +# This option defines the value of the special event conversion specifier %C +# You can use any conversion specifier in this option except %C. Date and time +# values are from the timestamp of the first image in the current event. +# Default: %Y%m%d%H%M%S +# The idea is that %C can be used filenames and text_left/right for creating +# a unique identifier for each event. +;text_event %Y%m%d%H%M%S + +# Draw characters at twice normal size on images. (default: off) +text_double on + + +# Text to include in a JPEG EXIF comment +# May be any text, including conversion specifiers. +# The EXIF timestamp is included independent of this text. +;exif_text %i%J/%K%L + +############################################################ +# Target Directories and filenames For Images And Films +# For the options snapshot_, picture_, movie_ and timelapse_filename +# you can use conversion specifiers +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# Quotation marks round string are allowed. +############################################################ + +# Target base directory for pictures and films +# Recommended to use absolute path. (Default: current working directory) +target_dir /home/pi + +# File path for snapshots (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-snapshot +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot +# File extension .jpg or .ppm is automatically added so do not include this. +# Note: A symbolic link called lastsnap.jpg created in the target_dir will always +# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap' +snapshot_filename %v-%Y%m%d%H%M%S-snapshot + +# File path for motion triggered images (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-%q +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q +# File extension .jpg or .ppm is automatically added so do not include this +# Set to 'preview' together with best-preview feature enables special naming +# convention for preview shots. See motion guide for details +#picture_filename %v-%Y%m%d%H%M%S-%q +picture_filename testcap-frame-%g + +# File path for motion triggered ffmpeg films (movies) relative to target_dir +# Default: %v-%Y%m%d%H%M%S +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S +# File extension .mpg or .avi is automatically added so do not include this +# This option was previously called ffmpeg_filename +movie_filename %v-%Y%m%d%H%M%S + +# File path for timelapse movies relative to target_dir +# Default: %Y%m%d-timelapse +# Default value is near equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d-timelapse +# File extension .mpg is automatically added so do not include this +timelapse_filename %Y%m%d-timelapse + +############################################################ +# Global Network Options +############################################################ +# Enable or disable IPV6 for http control and stream (default: off ) +ipv6_enabled off + +############################################################ +# Live Stream Server +############################################################ + +# The mini-http server listens to this port for requests (default: 0 = disabled) +stream_port 8081 + +# Quality of the jpeg (in percent) images produced (default: 50) +stream_quality 50 + +# Output frames at 1 fps when no motion is detected and increase to the +# rate given by stream_maxrate when motion is detected (default: off) +stream_motion off + +# Maximum framerate for stream streams (default: 1) +stream_maxrate 1 + +# Restrict stream connections to localhost only (default: on) +stream_localhost off + +# Limits the number of images per connection (default: 0 = unlimited) +# Number can be defined by multiplying actual stream rate by desired number of seconds +# Actual stream rate is the smallest of the numbers framerate and stream_maxrate +stream_limit 0 + +# Set the authentication method (default: 0) +# 0 = disabled +# 1 = Basic authentication +# 2 = MD5 digest (the safer authentication) +stream_auth_method 0 + +# Authentication for the stream. Syntax username:password +# Default: not defined (Disabled) +; stream_authentication username:password + + +############################################################ +# HTTP Based Control +############################################################ + +# TCP/IP port for the http server to listen on (default: 0 = disabled) +webcontrol_port 8080 + +# Restrict control connections to localhost only (default: on) +webcontrol_localhost on + +# Output for http server, select off to choose raw text plain (default: on) +webcontrol_html_output on + +# Authentication for the http based control. Syntax username:password +# Default: not defined (Disabled) +; webcontrol_authentication username:password + + +############################################################ +# Tracking (Pan/Tilt) +############################################################# + +# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo) +# The generic type enables the definition of motion center and motion size to +# be used with the conversion specifiers for options like on_motion_detected +track_type 0 + +# Enable auto tracking (default: off) +track_auto off + +# Serial port of motor (default: none) +;track_port /dev/ttyS0 + +# Motor number for x-axis (default: 0) +;track_motorx 0 + +# Set motorx reverse (default: 0) +;track_motorx_reverse 0 + +# Motor number for y-axis (default: 0) +;track_motory 1 + +# Set motory reverse (default: 0) +;track_motory_reverse 0 + +# Maximum value on x-axis (default: 0) +;track_maxx 200 + +# Minimum value on x-axis (default: 0) +;track_minx 50 + +# Maximum value on y-axis (default: 0) +;track_maxy 200 + +# Minimum value on y-axis (default: 0) +;track_miny 50 + +# Center value on x-axis (default: 0) +;track_homex 128 + +# Center value on y-axis (default: 0) +;track_homey 128 + +# ID of an iomojo camera if used (default: 0) +track_iomojo_id 0 + +# Angle in degrees the camera moves per step on the X-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_x 10 + +# Angle in degrees the camera moves per step on the Y-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_y 10 + +# Delay to wait for after tracking movement as number +# of picture frames (default: 10) +track_move_wait 10 + +# Speed to set the motor to (stepper motor option) (default: 255) +track_speed 255 + +# Number of steps to make (stepper motor option) (default: 40) +track_stepsize 40 + + +############################################################ +# External Commands, Warnings and Logging: +# You can use conversion specifiers for the on_xxxx commands +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# %f = filename with full path +# %n = number indicating filetype +# Both %f and %n are only defined for on_picture_save, +# on_movie_start and on_movie_end +# Quotation marks round string are allowed. +############################################################ + +# Do not sound beeps when detecting motion (default: on) +# Note: Motion never beeps when running in daemon mode. +quiet on + +# Command to be executed when an event starts. (default: none) +# An event starts at first motion detected after a period of no motion defined by event_gap +; on_event_start value + +# Command to be executed when an event ends after a period of no motion +# (default: none). The period of no motion is defined by option event_gap. +; on_event_end value + +# Command to be executed when a picture (.ppm|.jpg) is saved (default: none) +# To give the filename as an argument to a command append it with %f +; on_picture_save value + +# Command to be executed when a motion frame is detected (default: none) +; on_motion_detected value + +# Command to be executed when motion in a predefined area is detected +# Check option 'area_detect'. (default: none) +; on_area_detected value + +# Command to be executed when a movie file (.mpg|.avi) is created. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_start value + +# Command to be executed when a movie file (.mpg|.avi) is closed. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_end value + +# Command to be executed when a camera can't be opened or if it is lost +# NOTE: There is situations when motion don't detect a lost camera! +# It depends on the driver, some drivers dosn't detect a lost camera at all +# Some hangs the motion thread. Some even hangs the PC! (default: none) +; on_camera_lost value + +##################################################################### +# Common Options for database features. +# Options require database options to be active also. +##################################################################### + +# Log to the database when creating motion triggered picture file (default: on) +; sql_log_picture on + +# Log to the database when creating a snapshot image file (default: on) +; sql_log_snapshot on + +# Log to the database when creating motion triggered movie file (default: off) +; sql_log_movie off + +# Log to the database when creating timelapse movies file (default: off) +; sql_log_timelapse off + +# SQL query string that is sent to the database +# Use same conversion specifiers has for text features +# Additional special conversion specifiers are +# %n = the number representing the file_type +# %f = filename with full path +# Default value: +# Create tables : +## +# Mysql +# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), event_time_stamp timestamp(14)); +# +# Postgresql +# 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); +# +# insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') +; sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') + + +############################################################ +# Database Options +############################################################ + +# database type : mysql, postgresql, sqlite3 (default : not defined) +; database_type value + +# database to log to (default: not defined) +; database_dbname value + +# The host on which the database is located (default: localhost) +; database_host value + +# User account name for database (default: not defined) +; database_user value + +# User password for database (default: not defined) +; database_password value + +# Port on which the database is located +# mysql 3306 , postgresql 5432 (default: not defined) +; database_port value + +############################################################ +# Database Options For SQLite3 +############################################################ + +# SQLite3 database (file path) (default: not defined) +; sqlite3_db value + + + +############################################################ +# Video Loopback Device (vloopback project) +############################################################ + +# Output images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; video_pipe value + +# Output motion images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; motion_video_pipe value + + +############################################################## +# Thread config files - One for each camera. +# Except if only one camera - You only need this config file. +# If you have more than one camera you MUST define one thread +# config file for each camera in addition to this config file. +############################################################## + +# Remember: If you have more than one camera you must have one +# thread file for each camera. E.g. 2 cameras requires 3 files: +# This motion.conf file AND thread1.conf and thread2.conf. +# Only put the options that are unique to each camera in the +# thread config files. +; thread /usr/local/etc/thread1.conf +; thread /usr/local/etc/thread2.conf +; thread /usr/local/etc/thread3.conf +; thread /usr/local/etc/thread4.conf + diff --git a/configs/motion-mmalcam.conf b/configs/motion-mmalcam.conf new file mode 100644 index 0000000..e6a49b7 --- /dev/null +++ b/configs/motion-mmalcam.conf @@ -0,0 +1,777 @@ +############################################################ +# Daemon +############################################################ + +# Start in daemon (background) mode and release terminal (default: off) +daemon off + +# File to store the process ID, also called pid file. (default: not defined) +process_id_file /var/run/motion/motion.pid + +############################################################ +# Basic Setup Mode +############################################################ + +# Start in Setup-Mode, daemon disabled. (default: off) +setup_mode off + + +# Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined) +logfile /home/pi/motion.log + +# Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC) +log_level 6 + +# Filter to log messages by type (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL) +log_type all + +########################################################### +# Capture device options +############################################################ + +# Videodevice to be used for capturing (default /dev/video0) +# for FreeBSD default is /dev/bktr0 +#videodevice /dev/video0 + +# v4l2_palette allows to choose preferable palette to be use by motion +# to capture from those supported by your videodevice. (default: 17) +# E.g. if your videodevice supports both V4L2_PIX_FMT_SBGGR8 and +# V4L2_PIX_FMT_MJPEG then motion will by default use V4L2_PIX_FMT_MJPEG. +# Setting v4l2_palette to 2 forces motion to use V4L2_PIX_FMT_SBGGR8 +# instead. +# +# Values : +# V4L2_PIX_FMT_SN9C10X : 0 'S910' +# V4L2_PIX_FMT_SBGGR16 : 1 'BYR2' +# V4L2_PIX_FMT_SBGGR8 : 2 'BA81' +# V4L2_PIX_FMT_SPCA561 : 3 'S561' +# V4L2_PIX_FMT_SGBRG8 : 4 'GBRG' +# V4L2_PIX_FMT_SGRBG8 : 5 'GRBG' +# V4L2_PIX_FMT_PAC207 : 6 'P207' +# V4L2_PIX_FMT_PJPG : 7 'PJPG' +# V4L2_PIX_FMT_MJPEG : 8 'MJPEG' +# V4L2_PIX_FMT_JPEG : 9 'JPEG' +# V4L2_PIX_FMT_RGB24 : 10 'RGB3' +# V4L2_PIX_FMT_SPCA501 : 11 'S501' +# V4L2_PIX_FMT_SPCA505 : 12 'S505' +# V4L2_PIX_FMT_SPCA508 : 13 'S508' +# V4L2_PIX_FMT_UYVY : 14 'UYVY' +# V4L2_PIX_FMT_YUYV : 15 'YUYV' +# V4L2_PIX_FMT_YUV422P : 16 '422P' +# V4L2_PIX_FMT_YUV420 : 17 'YU12' +# +v4l2_palette 17 + +# Tuner device to be used for capturing using tuner as source (default /dev/tuner0) +# This is ONLY used for FreeBSD. Leave it commented out for Linux +; tunerdevice /dev/tuner0 + +# The video input to be used (default: -1) +# Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras +input -1 + +# The video norm to use (only for video capture and TV tuner cards) +# Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) +norm 0 + +# The frequency to set the tuner to (kHz) (only for TV tuner cards) (default: 0) +frequency 0 + +# Rotate image this number of degrees. The rotation affects all saved images as +# well as movies. Valid values: 0 (default = no rotation), 90, 180 and 270. +rotate 0 + +# Image width (pixels). Valid range: Camera dependent, default: 352 +width 256 + +# Image height (pixels). Valid range: Camera dependent, default: 288 +height 144 + +# Maximum number of frames to be captured per second. +# Valid range: 2-100. Default: 100 (almost no limit). +framerate 15 + +# Minimum time in seconds between capturing picture frames from the camera. +# Default: 0 = disabled - the capture rate is given by the camera framerate. +# This option is used when you want to capture images at a rate lower than 2 per second. +minimum_frame_time 0 + +# URL to use if you are using a network camera, size will be autodetected (incl http:// ftp:// mjpg:// or file:///) +# Must be a URL that returns single jpeg pictures or a raw mjpeg stream. Default: Not defined +;netcam_url http://127.0.0.1/cgi-bin/raspicam.sh + +# Username and password for network camera (only if required). Default: not defined +# Syntax is user:password +; netcam_userpass value + +# The setting for keep-alive of network socket, should improve performance on compatible net cameras. +# off: The historical implementation using HTTP/1.0, closing the socket after each http request. +# force: Use HTTP/1.0 requests with keep alive header to reuse the same connection. +# on: Use HTTP/1.1 requests that support keep alive as default. +# Default: off +netcam_keepalive off + +# URL to use for a netcam proxy server, if required, e.g. "http://myproxy". +# If a port number other than 80 is needed, use "http://myproxy:1234". +# Default: not defined +; netcam_proxy value + +# Set less strict jpeg checks for network cameras with a poor/buggy firmware. +# Default: off +netcam_tolerant_check off + +# Let motion regulate the brightness of a video device (default: off). +# The auto_brightness feature uses the brightness option as its target value. +# If brightness is zero auto_brightness will adjust to average brightness value 128. +# Only recommended for cameras without auto brightness +auto_brightness off + +# Set the initial brightness of a video device. +# If auto_brightness is enabled, this value defines the average brightness level +# which Motion will try and adjust to. +# Valid range 0-255, default 0 = disabled +brightness 0 + +# Set the contrast of a video device. +# Valid range 0-255, default 0 = disabled +contrast 0 + +# Set the saturation of a video device. +# Valid range 0-255, default 0 = disabled +saturation 0 + +# Set the hue of a video device (NTSC feature). +# Valid range 0-255, default 0 = disabled +hue 0 + +############################################################ +# File "camera" support - read raw YUV data from a file +############################################################ +#filecam_path /home/pi/test-cap/motion-mmal.capture + +############################################################ +# OpenMax/MMAL camera support for Raspberry Pi +############################################################ +mmalcam_name vc.ril.camera +#mmalcam_control_params +#mmalcam_raw_capture_file /home/pi/motion-mmal.capture + +# Switch this setting to "on" to use the still image mode of the Pi's camera +# instead of video. This gives a wider field of view, but requires +# a much slower frame-rate to achieve exposure stability +# (e.g. 0.25 fps or slower). You can use the minimum_frame_time +# parameter above to achieve this + +mmalcam_use_still off + +# Set this to non-zero value to enable a secondary buffer used for outputting results +# This value is used to multiply the original width & height settings to decide the +# secondary buffer size, so you can use it to capture a high-res image as well as a +# normal (low) resolution one for the primary. +# +# Use the options output_secondary_pictures, ffmpeg_output_secondary_movies, stream_secondary +# to use this high-res secondary image as the source for picture, movie and web stream output, +# while the actual motion detection is performed on the lower-resolution primary image (and +# thus use less CPU power). + +mmalcam_secondary_buffer_upscale 4 + +# Pre-encode the secondary buffer to this jpeg quality +# Note that overlaid text or motion location markers will NOT be drawn into a pre-encoded buffer +# as encoding is done on the MMAL side before the image is passed to motion. +# Default: 0 (off), range 1-100 +mmalcam_secondary_buffer_jpeg 50 + +############################################################ +# Round Robin (multiple inputs on same video device name) +############################################################ + +# Number of frames to capture in each roundrobin step (default: 1) +roundrobin_frames 1 + +# Number of frames to skip before each roundrobin step (default: 1) +roundrobin_skip 1 + +# Try to filter out noise generated by roundrobin (default: off) +switchfilter off + + +############################################################ +# Motion Detection Settings: +############################################################ + +# Threshold for number of changed pixels in an image that +# triggers motion detection (default: 1500) +;threshold 1500 +threshold 350 + +# Automatically tune the threshold down if possible (default: off) +threshold_tune off + +# Noise threshold for the motion detection (default: 32) +noise_level 32 + +# Automatically tune the noise threshold (default: on) +noise_tune on + +# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined) +# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid. +# (l)abeling must only be used once and the 'l' must be the last letter. +# Comment out to disable +despeckle_filter EedDl + +# Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3 +# A script (on_area_detected) is started immediately when motion is 4 5 6 +# detected in one of the given areas, but only once during an event. 7 8 9 +# One or more areas can be specified with this option. Take care: This option +# does NOT restrict detection to these areas! (Default: not defined) +; area_detect value + +# PGM file to use as a sensitivity mask. +# Full path name to. (Default: not defined) +; mask_file value + +# Dynamically create a mask file during operation (default: 0) +# Adjust speed of mask changes from 0 (off) to 10 (fast) +smart_mask_speed 0 + +# Ignore sudden massive light intensity changes given as a percentage of the picture +# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled +lightswitch 0 + +# Picture frames must contain motion at least the specified number of frames +# in a row before they are detected as true motion. At the default of 1, all +# motion is detected. Valid range: 1 to thousands, recommended 1-5 +minimum_motion_frames 1 + +# Specifies the number of pre-captured (buffered) pictures from before motion +# was detected that will be output at motion detection. +# Recommended range: 0 to 5 (default: 0) +# Do not use large values! Large values will cause Motion to skip video frames and +# cause unsmooth movies. To smooth movies use larger values of post_capture instead. +pre_capture 0 + +# Number of frames to capture after motion is no longer detected (default: 0) +post_capture 0 + +# Event Gap is the seconds of no motion detection that triggers the end of an event. +# An event is defined as a series of motion images taken within a short timeframe. +# Recommended value is 60 seconds (Default). The value -1 is allowed and disables +# events causing all Motion to be written to one single movie file and no pre_capture. +# If set to 0, motion is running in gapless mode. Movies don't have gaps anymore. An +# event ends right after no more motion is detected and post_capture is over. +event_gap 60 + +# Maximum length in seconds of a movie +# When value is exceeded a new movie file is created. (Default: 0 = infinite) +max_movie_time 0 + +# Always save images even if there was no motion (default: off) +emulate_motion off + + +############################################################ +# Image File Output +############################################################ + +# Output 'normal' pictures when motion is detected (default: on) +# Valid values: on, off, first, best, center +# When set to 'first', only the first picture of an event is saved. +# Picture with most motion of an event is saved when set to 'best'. +# Picture with motion nearest center of picture is saved when set to 'center'. +# Can be used as preview shot for the corresponding movie. +output_pictures on + +# Output pictures with only the pixels moving object (ghost images) (default: off) +output_debug_pictures off + +# Output pictures from secondary capture (see mmalcam_secondary_buffer_upscale above) +# Use this to perform motion detection on a low-res image and record a high-res output +output_secondary_pictures on + +# The quality (in percent) to be used by the jpeg compression (default: 75) +quality 50 + +# Type of output images +# Valid values: jpeg, ppm (default: jpeg) +picture_type jpeg + +############################################################ +# FFMPEG related options +# Film (movies) file output, and deinterlacing of the video input +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################ + +# Use ffmpeg to encode movies in realtime (default: off) +ffmpeg_output_movies off + +# Use ffmpeg to make movies with only the pixels moving +# object (ghost images) (default: off) +ffmpeg_output_debug_movies off + +# Use ffmpeg to make movies using any enabled secondary buffer (default: off) +ffmpeg_output_secondary_movies on + +# Use ffmpeg to encode a timelapse movie +# Default value 0 = off - else save frame every Nth second +ffmpeg_timelapse 0 + +# The file rollover mode of the timelapse video +# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual +ffmpeg_timelapse_mode daily + +# Bitrate to be used by the ffmpeg encoder (default: 400000) +# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled) +ffmpeg_bps 500000 + +# Enables and defines variable bitrate for the ffmpeg encoder. +# ffmpeg_bps is ignored if variable bitrate is enabled. +# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, +# or the range 2 - 31 where 2 means best quality and 31 is worst. +ffmpeg_variable_bitrate 0 + +# Codec to used by ffmpeg for the video compression. +# Timelapse mpegs are always made in mpeg1 format independent from this option. +# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4. +# mpeg1 - gives you files with extension .mpg +# mpeg4 or msmpeg4 - gives you files with extension .avi +# msmpeg4 is recommended for use with Windows Media Player because +# it requires no installation of codec on the Windows client. +# swf - gives you a flash film with extension .swf +# flv - gives you a flash video with extension .flv +# ffv1 - FF video codec 1 for Lossless Encoding ( experimental ) +# mov - QuickTime ( testing ) +# ogg - Ogg/Theora ( testing ) +ffmpeg_video_codec mpeg4 + +# Use ffmpeg to deinterlace video. Necessary if you use an analog camera +# and see horizontal combing on moving objects in video or pictures. +# (default: off) +ffmpeg_deinterlace off + +############################################################ +# SDL Window +############################################################ + +# Number of motion thread to show in SDL Window (default: 0 = disabled) +#sdl_threadnr 0 + +############################################################ +# External pipe to video encoder +# Replacement for FFMPEG builtin encoder for ffmpeg_output_movies only. +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################# + +# Bool to enable or disable extpipe (default: off) +use_extpipe off +extpipe_secondary on + +# External program (full path and opts) to pipe raw video to +# Generally, use '-' for STDIN... +;extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps +extpipe mencoder -demuxer rawvideo -rawvideo w=1024:h=576 -ovc raw -of avi -o %f.avi - -fps 15 -noskip + + + +############################################################ +# Snapshots (Traditional Periodic Webcam File Output) +############################################################ + +# Make automated snapshot every N seconds (default: 0 = disabled) +snapshot_interval 0 + + +############################################################ +# Text Display +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, %T = HH:MM:SS, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, \n = new line, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event - do not use with text_event! +# You can put quotation marks around the text to allow +# leading spaces +############################################################ + +# Locate and draw a box around the moving object. +# Valid values: on, off, preview (default: off) +# Set to 'preview' will only draw a box in preview_shot pictures. +locate_motion_mode off + +# Set the look and style of the locate box if enabled. +# Valid values: box, redbox, cross, redcross (default: box) +# Set to 'box' will draw the traditional box. +# Set to 'redbox' will draw a red box. +# Set to 'cross' will draw a little cross to mark center. +# Set to 'redcross' will draw a little red cross to mark center. +locate_motion_style redbox + +# Draws the timestamp using same options as C function strftime(3) +# Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock +# Text is placed in lower right corner +text_right %Y-%m-%d\n%T-%q + +# Draw a user defined text on the images using same options as C function strftime(3) +# Default: Not defined = no text +# Text is placed in lower left corner +;text_left CAMERA %t + +# Draw the number of changed pixed on the images (default: off) +# Will normally be set to off except when you setup and adjust the motion settings +# Text is placed in upper right corner +text_changes off + +# This option defines the value of the special event conversion specifier %C +# You can use any conversion specifier in this option except %C. Date and time +# values are from the timestamp of the first image in the current event. +# Default: %Y%m%d%H%M%S +# The idea is that %C can be used filenames and text_left/right for creating +# a unique identifier for each event. +text_event %Y%m%d%H%M%S + +# Draw characters at twice normal size on images. (default: off) +text_double on + + +# Text to include in a JPEG EXIF comment +# May be any text, including conversion specifiers. +# The EXIF timestamp is included independent of this text. +;exif_text %i%J/%K%L + +############################################################ +# Target Directories and filenames For Images And Films +# For the options snapshot_, picture_, movie_ and timelapse_filename +# you can use conversion specifiers +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# Quotation marks round string are allowed. +############################################################ + +# Target base directory for pictures and films +# Recommended to use absolute path. (Default: current working directory) +target_dir /home/pi + +# File path for snapshots (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-snapshot +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot +# File extension .jpg or .ppm is automatically added so do not include this. +# Note: A symbolic link called lastsnap.jpg created in the target_dir will always +# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap' +snapshot_filename %v-%Y%m%d%H%M%S-snapshot + +# File path for motion triggered images (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-%q +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q +# File extension .jpg or .ppm is automatically added so do not include this +# Set to 'preview' together with best-preview feature enables special naming +# convention for preview shots. See motion guide for details +picture_filename %v-%Y%m%d%H%M%S-%q + +# File path for motion triggered ffmpeg films (movies) relative to target_dir +# Default: %v-%Y%m%d%H%M%S +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S +# File extension .mpg or .avi is automatically added so do not include this +# This option was previously called ffmpeg_filename +movie_filename %v-%Y%m%d%H%M%S + +# File path for timelapse movies relative to target_dir +# Default: %Y%m%d-timelapse +# Default value is near equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d-timelapse +# File extension .mpg is automatically added so do not include this +timelapse_filename %Y%m%d-timelapse + +############################################################ +# Global Network Options +############################################################ +# Enable or disable IPV6 for http control and stream (default: off ) +ipv6_enabled off + +############################################################ +# Live Stream Server +############################################################ + +# The mini-http server listens to this port for requests (default: 0 = disabled) +stream_port 8085 + +# Quality of the jpeg (in percent) images produced (default: 50) +stream_quality 50 + +# Output frames at 1 fps when no motion is detected and increase to the +# rate given by stream_maxrate when motion is detected (default: off) +stream_motion off + +# Use secondary buffer as stream image source (default: off) +stream_secondary off + +# Maximum framerate for stream streams (default: 1) +stream_maxrate 4 + +# Restrict stream connections to localhost only (default: on) +stream_localhost off + +# Limits the number of images per connection (default: 0 = unlimited) +# Number can be defined by multiplying actual stream rate by desired number of seconds +# Actual stream rate is the smallest of the numbers framerate and stream_maxrate +stream_limit 0 + +# Set the authentication method (default: 0) +# 0 = disabled +# 1 = Basic authentication +# 2 = MD5 digest (the safer authentication) +stream_auth_method 0 + +# Authentication for the stream. Syntax username:password +# Default: not defined (Disabled) +; stream_authentication username:password + + +############################################################ +# HTTP Based Control +############################################################ + +# TCP/IP port for the http server to listen on (default: 0 = disabled) +webcontrol_port 8080 + +# Restrict control connections to localhost only (default: on) +webcontrol_localhost off + +# Output for http server, select off to choose raw text plain (default: on) +webcontrol_html_output on + +# Authentication for the http based control. Syntax username:password +# Default: not defined (Disabled) +; webcontrol_authentication username:password + + +############################################################ +# Tracking (Pan/Tilt) +############################################################# + +# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo) +# The generic type enables the definition of motion center and motion size to +# be used with the conversion specifiers for options like on_motion_detected +track_type 0 + +# Enable auto tracking (default: off) +track_auto off + +# Serial port of motor (default: none) +;track_port /dev/ttyS0 + +# Motor number for x-axis (default: 0) +;track_motorx 0 + +# Set motorx reverse (default: 0) +;track_motorx_reverse 0 + +# Motor number for y-axis (default: 0) +;track_motory 1 + +# Set motory reverse (default: 0) +;track_motory_reverse 0 + +# Maximum value on x-axis (default: 0) +;track_maxx 200 + +# Minimum value on x-axis (default: 0) +;track_minx 50 + +# Maximum value on y-axis (default: 0) +;track_maxy 200 + +# Minimum value on y-axis (default: 0) +;track_miny 50 + +# Center value on x-axis (default: 0) +;track_homex 128 + +# Center value on y-axis (default: 0) +;track_homey 128 + +# ID of an iomojo camera if used (default: 0) +track_iomojo_id 0 + +# Angle in degrees the camera moves per step on the X-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_x 10 + +# Angle in degrees the camera moves per step on the Y-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_y 10 + +# Delay to wait for after tracking movement as number +# of picture frames (default: 10) +track_move_wait 10 + +# Speed to set the motor to (stepper motor option) (default: 255) +track_speed 255 + +# Number of steps to make (stepper motor option) (default: 40) +track_stepsize 40 + + +############################################################ +# External Commands, Warnings and Logging: +# You can use conversion specifiers for the on_xxxx commands +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# %f = filename with full path +# %n = number indicating filetype +# Both %f and %n are only defined for on_picture_save, +# on_movie_start and on_movie_end +# Quotation marks round string are allowed. +############################################################ + +# Do not sound beeps when detecting motion (default: on) +# Note: Motion never beeps when running in daemon mode. +quiet on + +# Command to be executed when an event starts. (default: none) +# An event starts at first motion detected after a period of no motion defined by event_gap +; on_event_start value + +# Command to be executed when an event ends after a period of no motion +# (default: none). The period of no motion is defined by option event_gap. +; on_event_end value + +# Command to be executed when a picture (.ppm|.jpg) is saved (default: none) +# To give the filename as an argument to a command append it with %f +; on_picture_save value + +# Command to be executed when a motion frame is detected (default: none) +; on_motion_detected value + +# Command to be executed when motion in a predefined area is detected +# Check option 'area_detect'. (default: none) +; on_area_detected value + +# Command to be executed when a movie file (.mpg|.avi) is created. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_start value + +# Command to be executed when a movie file (.mpg|.avi) is closed. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_end value + +# Command to be executed when a camera can't be opened or if it is lost +# NOTE: There is situations when motion don't detect a lost camera! +# It depends on the driver, some drivers dosn't detect a lost camera at all +# Some hangs the motion thread. Some even hangs the PC! (default: none) +; on_camera_lost value + +##################################################################### +# Common Options for database features. +# Options require database options to be active also. +##################################################################### + +# Log to the database when creating motion triggered picture file (default: on) +; sql_log_picture on + +# Log to the database when creating a snapshot image file (default: on) +; sql_log_snapshot on + +# Log to the database when creating motion triggered movie file (default: off) +; sql_log_movie off + +# Log to the database when creating timelapse movies file (default: off) +; sql_log_timelapse off + +# SQL query string that is sent to the database +# Use same conversion specifiers has for text features +# Additional special conversion specifiers are +# %n = the number representing the file_type +# %f = filename with full path +# Default value: +# Create tables : +## +# Mysql +# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), event_time_stamp timestamp(14)); +# +# Postgresql +# 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); +# +# insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') +; sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') + + +############################################################ +# Database Options +############################################################ + +# database type : mysql, postgresql, sqlite3 (default : not defined) +; database_type value + +# database to log to (default: not defined) +; database_dbname value + +# The host on which the database is located (default: localhost) +; database_host value + +# User account name for database (default: not defined) +; database_user value + +# User password for database (default: not defined) +; database_password value + +# Port on which the database is located +# mysql 3306 , postgresql 5432 (default: not defined) +; database_port value + +############################################################ +# Database Options For SQLite3 +############################################################ + +# SQLite3 database (file path) (default: not defined) +; sqlite3_db value + + + +############################################################ +# Video Loopback Device (vloopback project) +############################################################ + +# Output images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; video_pipe value + +# Output motion images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; motion_video_pipe value + + +############################################################## +# Thread config files - One for each camera. +# Except if only one camera - You only need this config file. +# If you have more than one camera you MUST define one thread +# config file for each camera in addition to this config file. +############################################################## + +# Remember: If you have more than one camera you must have one +# thread file for each camera. E.g. 2 cameras requires 3 files: +# This motion.conf file AND thread1.conf and thread2.conf. +# Only put the options that are unique to each camera in the +# thread config files. +; thread /usr/local/etc/thread1.conf +; thread /usr/local/etc/thread2.conf +; thread /usr/local/etc/thread3.conf +; thread /usr/local/etc/thread4.conf + diff --git a/configs/motion-piwebcam.conf b/configs/motion-piwebcam.conf new file mode 100644 index 0000000..107c812 --- /dev/null +++ b/configs/motion-piwebcam.conf @@ -0,0 +1,727 @@ +############################################################ +# Daemon +############################################################ + +# Start in daemon (background) mode and release terminal (default: off) +daemon off + +# File to store the process ID, also called pid file. (default: not defined) +process_id_file /var/run/motion/motion.pid + +############################################################ +# Basic Setup Mode +############################################################ + +# Start in Setup-Mode, daemon disabled. (default: off) +setup_mode off + + +# Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined) +;logfile /tmp/motion.log + +# Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC) +log_level 5 + +# Filter to log messages by type (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL) +log_type all + +########################################################### +# Capture device options +############################################################ + +# Videodevice to be used for capturing (default /dev/video0) +# for FreeBSD default is /dev/bktr0 +#videodevice /dev/video0 + +# v4l2_palette allows to choose preferable palette to be use by motion +# to capture from those supported by your videodevice. (default: 17) +# E.g. if your videodevice supports both V4L2_PIX_FMT_SBGGR8 and +# V4L2_PIX_FMT_MJPEG then motion will by default use V4L2_PIX_FMT_MJPEG. +# Setting v4l2_palette to 2 forces motion to use V4L2_PIX_FMT_SBGGR8 +# instead. +# +# Values : +# V4L2_PIX_FMT_SN9C10X : 0 'S910' +# V4L2_PIX_FMT_SBGGR16 : 1 'BYR2' +# V4L2_PIX_FMT_SBGGR8 : 2 'BA81' +# V4L2_PIX_FMT_SPCA561 : 3 'S561' +# V4L2_PIX_FMT_SGBRG8 : 4 'GBRG' +# V4L2_PIX_FMT_SGRBG8 : 5 'GRBG' +# V4L2_PIX_FMT_PAC207 : 6 'P207' +# V4L2_PIX_FMT_PJPG : 7 'PJPG' +# V4L2_PIX_FMT_MJPEG : 8 'MJPEG' +# V4L2_PIX_FMT_JPEG : 9 'JPEG' +# V4L2_PIX_FMT_RGB24 : 10 'RGB3' +# V4L2_PIX_FMT_SPCA501 : 11 'S501' +# V4L2_PIX_FMT_SPCA505 : 12 'S505' +# V4L2_PIX_FMT_SPCA508 : 13 'S508' +# V4L2_PIX_FMT_UYVY : 14 'UYVY' +# V4L2_PIX_FMT_YUYV : 15 'YUYV' +# V4L2_PIX_FMT_YUV422P : 16 '422P' +# V4L2_PIX_FMT_YUV420 : 17 'YU12' +# +v4l2_palette 17 + +# Tuner device to be used for capturing using tuner as source (default /dev/tuner0) +# This is ONLY used for FreeBSD. Leave it commented out for Linux +; tunerdevice /dev/tuner0 + +# The video input to be used (default: -1) +# Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras +input -1 + +# The video norm to use (only for video capture and TV tuner cards) +# Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) +norm 0 + +# The frequency to set the tuner to (kHz) (only for TV tuner cards) (default: 0) +frequency 0 + +# Rotate image this number of degrees. The rotation affects all saved images as +# well as movies. Valid values: 0 (default = no rotation), 90, 180 and 270. +rotate 0 + +# Image width (pixels). Valid range: Camera dependent, default: 352 +width 320 + +# Image height (pixels). Valid range: Camera dependent, default: 288 +height 240 + +# Maximum number of frames to be captured per second. +# Valid range: 2-100. Default: 100 (almost no limit). +framerate 2 + +# Minimum time in seconds between capturing picture frames from the camera. +# Default: 0 = disabled - the capture rate is given by the camera framerate. +# This option is used when you want to capture images at a rate lower than 2 per second. +minimum_frame_time 0 + +# URL to use if you are using a network camera, size will be autodetected (incl http:// ftp:// mjpg:// or file:///) +# Must be a URL that returns single jpeg pictures or a raw mjpeg stream. Default: Not defined +netcam_url http://127.0.0.1/cgi-bin/raspicam.sh + +# Username and password for network camera (only if required). Default: not defined +# Syntax is user:password +; netcam_userpass value + +# The setting for keep-alive of network socket, should improve performance on compatible net cameras. +# off: The historical implementation using HTTP/1.0, closing the socket after each http request. +# force: Use HTTP/1.0 requests with keep alive header to reuse the same connection. +# on: Use HTTP/1.1 requests that support keep alive as default. +# Default: off +netcam_keepalive off + +# URL to use for a netcam proxy server, if required, e.g. "http://myproxy". +# If a port number other than 80 is needed, use "http://myproxy:1234". +# Default: not defined +; netcam_proxy value + +# Set less strict jpeg checks for network cameras with a poor/buggy firmware. +# Default: off +netcam_tolerant_check off + +# Let motion regulate the brightness of a video device (default: off). +# The auto_brightness feature uses the brightness option as its target value. +# If brightness is zero auto_brightness will adjust to average brightness value 128. +# Only recommended for cameras without auto brightness +auto_brightness off + +# Set the initial brightness of a video device. +# If auto_brightness is enabled, this value defines the average brightness level +# which Motion will try and adjust to. +# Valid range 0-255, default 0 = disabled +brightness 0 + +# Set the contrast of a video device. +# Valid range 0-255, default 0 = disabled +contrast 0 + +# Set the saturation of a video device. +# Valid range 0-255, default 0 = disabled +saturation 0 + +# Set the hue of a video device (NTSC feature). +# Valid range 0-255, default 0 = disabled +hue 0 + + +############################################################ +# Round Robin (multiple inputs on same video device name) +############################################################ + +# Number of frames to capture in each roundrobin step (default: 1) +roundrobin_frames 1 + +# Number of frames to skip before each roundrobin step (default: 1) +roundrobin_skip 1 + +# Try to filter out noise generated by roundrobin (default: off) +switchfilter off + + +############################################################ +# Motion Detection Settings: +############################################################ + +# Threshold for number of changed pixels in an image that +# triggers motion detection (default: 1500) +threshold 1500 + +# Automatically tune the threshold down if possible (default: off) +threshold_tune off + +# Noise threshold for the motion detection (default: 32) +noise_level 32 + +# Automatically tune the noise threshold (default: on) +noise_tune on + +# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined) +# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid. +# (l)abeling must only be used once and the 'l' must be the last letter. +# Comment out to disable +despeckle_filter EedDl + +# Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3 +# A script (on_area_detected) is started immediately when motion is 4 5 6 +# detected in one of the given areas, but only once during an event. 7 8 9 +# One or more areas can be specified with this option. Take care: This option +# does NOT restrict detection to these areas! (Default: not defined) +; area_detect value + +# PGM file to use as a sensitivity mask. +# Full path name to. (Default: not defined) +; mask_file value + +# Dynamically create a mask file during operation (default: 0) +# Adjust speed of mask changes from 0 (off) to 10 (fast) +smart_mask_speed 0 + +# Ignore sudden massive light intensity changes given as a percentage of the picture +# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled +lightswitch 0 + +# Picture frames must contain motion at least the specified number of frames +# in a row before they are detected as true motion. At the default of 1, all +# motion is detected. Valid range: 1 to thousands, recommended 1-5 +minimum_motion_frames 1 + +# Specifies the number of pre-captured (buffered) pictures from before motion +# was detected that will be output at motion detection. +# Recommended range: 0 to 5 (default: 0) +# Do not use large values! Large values will cause Motion to skip video frames and +# cause unsmooth movies. To smooth movies use larger values of post_capture instead. +pre_capture 0 + +# Number of frames to capture after motion is no longer detected (default: 0) +post_capture 0 + +# Event Gap is the seconds of no motion detection that triggers the end of an event. +# An event is defined as a series of motion images taken within a short timeframe. +# Recommended value is 60 seconds (Default). The value -1 is allowed and disables +# events causing all Motion to be written to one single movie file and no pre_capture. +# If set to 0, motion is running in gapless mode. Movies don't have gaps anymore. An +# event ends right after no more motion is detected and post_capture is over. +event_gap 60 + +# Maximum length in seconds of a movie +# When value is exceeded a new movie file is created. (Default: 0 = infinite) +max_movie_time 0 + +# Always save images even if there was no motion (default: off) +emulate_motion off + + +############################################################ +# Image File Output +############################################################ + +# Output 'normal' pictures when motion is detected (default: on) +# Valid values: on, off, first, best, center +# When set to 'first', only the first picture of an event is saved. +# Picture with most motion of an event is saved when set to 'best'. +# Picture with motion nearest center of picture is saved when set to 'center'. +# Can be used as preview shot for the corresponding movie. +output_pictures on + +# Output pictures with only the pixels moving object (ghost images) (default: off) +output_debug_pictures off + +# The quality (in percent) to be used by the jpeg compression (default: 75) +quality 75 + +# Type of output images +# Valid values: jpeg, ppm (default: jpeg) +picture_type jpeg + +############################################################ +# FFMPEG related options +# Film (movies) file output, and deinterlacing of the video input +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################ + +# Use ffmpeg to encode movies in realtime (default: off) +ffmpeg_output_movies on + +# Use ffmpeg to make movies with only the pixels moving +# object (ghost images) (default: off) +ffmpeg_output_debug_movies off + +# Use ffmpeg to encode a timelapse movie +# Default value 0 = off - else save frame every Nth second +ffmpeg_timelapse 0 + +# The file rollover mode of the timelapse video +# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual +ffmpeg_timelapse_mode daily + +# Bitrate to be used by the ffmpeg encoder (default: 400000) +# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled) +ffmpeg_bps 500000 + +# Enables and defines variable bitrate for the ffmpeg encoder. +# ffmpeg_bps is ignored if variable bitrate is enabled. +# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, +# or the range 2 - 31 where 2 means best quality and 31 is worst. +ffmpeg_variable_bitrate 0 + +# Codec to used by ffmpeg for the video compression. +# Timelapse mpegs are always made in mpeg1 format independent from this option. +# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4. +# mpeg1 - gives you files with extension .mpg +# mpeg4 or msmpeg4 - gives you files with extension .avi +# msmpeg4 is recommended for use with Windows Media Player because +# it requires no installation of codec on the Windows client. +# swf - gives you a flash film with extension .swf +# flv - gives you a flash video with extension .flv +# ffv1 - FF video codec 1 for Lossless Encoding ( experimental ) +# mov - QuickTime ( testing ) +# ogg - Ogg/Theora ( testing ) +ffmpeg_video_codec mpeg4 + +# Use ffmpeg to deinterlace video. Necessary if you use an analog camera +# and see horizontal combing on moving objects in video or pictures. +# (default: off) +ffmpeg_deinterlace off + +############################################################ +# SDL Window +############################################################ + +# Number of motion thread to show in SDL Window (default: 0 = disabled) +sdl_threadnr 0 + +############################################################ +# External pipe to video encoder +# Replacement for FFMPEG builtin encoder for ffmpeg_output_movies only. +# The options movie_filename and timelapse_filename are also used +# by the ffmpeg feature +############################################################# + +# Bool to enable or disable extpipe (default: off) +use_extpipe off + +# External program (full path and opts) to pipe raw video to +# Generally, use '-' for STDIN... +;extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps + + + +############################################################ +# Snapshots (Traditional Periodic Webcam File Output) +############################################################ + +# Make automated snapshot every N seconds (default: 0 = disabled) +snapshot_interval 0 + + +############################################################ +# Text Display +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, %T = HH:MM:SS, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, \n = new line, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event - do not use with text_event! +# You can put quotation marks around the text to allow +# leading spaces +############################################################ + +# Locate and draw a box around the moving object. +# Valid values: on, off, preview (default: off) +# Set to 'preview' will only draw a box in preview_shot pictures. +locate_motion_mode off + +# Set the look and style of the locate box if enabled. +# Valid values: box, redbox, cross, redcross (default: box) +# Set to 'box' will draw the traditional box. +# Set to 'redbox' will draw a red box. +# Set to 'cross' will draw a little cross to mark center. +# Set to 'redcross' will draw a little red cross to mark center. +locate_motion_style box + +# Draws the timestamp using same options as C function strftime(3) +# Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock +# Text is placed in lower right corner +text_right %Y-%m-%d\n%T-%q + +# Draw a user defined text on the images using same options as C function strftime(3) +# Default: Not defined = no text +# Text is placed in lower left corner +; text_left CAMERA %t + +# Draw the number of changed pixed on the images (default: off) +# Will normally be set to off except when you setup and adjust the motion settings +# Text is placed in upper right corner +text_changes off + +# This option defines the value of the special event conversion specifier %C +# You can use any conversion specifier in this option except %C. Date and time +# values are from the timestamp of the first image in the current event. +# Default: %Y%m%d%H%M%S +# The idea is that %C can be used filenames and text_left/right for creating +# a unique identifier for each event. +text_event %Y%m%d%H%M%S + +# Draw characters at twice normal size on images. (default: off) +text_double on + + +# Text to include in a JPEG EXIF comment +# May be any text, including conversion specifiers. +# The EXIF timestamp is included independent of this text. +;exif_text %i%J/%K%L + +############################################################ +# Target Directories and filenames For Images And Films +# For the options snapshot_, picture_, movie_ and timelapse_filename +# you can use conversion specifiers +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# Quotation marks round string are allowed. +############################################################ + +# Target base directory for pictures and films +# Recommended to use absolute path. (Default: current working directory) +target_dir /home/pi + +# File path for snapshots (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-snapshot +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot +# File extension .jpg or .ppm is automatically added so do not include this. +# Note: A symbolic link called lastsnap.jpg created in the target_dir will always +# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap' +snapshot_filename %v-%Y%m%d%H%M%S-snapshot + +# File path for motion triggered images (jpeg or ppm) relative to target_dir +# Default: %v-%Y%m%d%H%M%S-%q +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q +# File extension .jpg or .ppm is automatically added so do not include this +# Set to 'preview' together with best-preview feature enables special naming +# convention for preview shots. See motion guide for details +picture_filename %v-%Y%m%d%H%M%S-%q + +# File path for motion triggered ffmpeg films (movies) relative to target_dir +# Default: %v-%Y%m%d%H%M%S +# Default value is equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S +# File extension .mpg or .avi is automatically added so do not include this +# This option was previously called ffmpeg_filename +movie_filename %v-%Y%m%d%H%M%S + +# File path for timelapse movies relative to target_dir +# Default: %Y%m%d-timelapse +# Default value is near equivalent to legacy oldlayout option +# For Motion 3.0 compatible mode choose: %Y/%m/%d-timelapse +# File extension .mpg is automatically added so do not include this +timelapse_filename %Y%m%d-timelapse + +############################################################ +# Global Network Options +############################################################ +# Enable or disable IPV6 for http control and stream (default: off ) +ipv6_enabled off + +############################################################ +# Live Stream Server +############################################################ + +# The mini-http server listens to this port for requests (default: 0 = disabled) +stream_port 8081 + +# Quality of the jpeg (in percent) images produced (default: 50) +stream_quality 50 + +# Output frames at 1 fps when no motion is detected and increase to the +# rate given by stream_maxrate when motion is detected (default: off) +stream_motion off + +# Maximum framerate for stream streams (default: 1) +stream_maxrate 1 + +# Restrict stream connections to localhost only (default: on) +stream_localhost off + +# Limits the number of images per connection (default: 0 = unlimited) +# Number can be defined by multiplying actual stream rate by desired number of seconds +# Actual stream rate is the smallest of the numbers framerate and stream_maxrate +stream_limit 0 + +# Set the authentication method (default: 0) +# 0 = disabled +# 1 = Basic authentication +# 2 = MD5 digest (the safer authentication) +stream_auth_method 0 + +# Authentication for the stream. Syntax username:password +# Default: not defined (Disabled) +; stream_authentication username:password + + +############################################################ +# HTTP Based Control +############################################################ + +# TCP/IP port for the http server to listen on (default: 0 = disabled) +webcontrol_port 8080 + +# Restrict control connections to localhost only (default: on) +webcontrol_localhost on + +# Output for http server, select off to choose raw text plain (default: on) +webcontrol_html_output on + +# Authentication for the http based control. Syntax username:password +# Default: not defined (Disabled) +; webcontrol_authentication username:password + + +############################################################ +# Tracking (Pan/Tilt) +############################################################# + +# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo) +# The generic type enables the definition of motion center and motion size to +# be used with the conversion specifiers for options like on_motion_detected +track_type 0 + +# Enable auto tracking (default: off) +track_auto off + +# Serial port of motor (default: none) +;track_port /dev/ttyS0 + +# Motor number for x-axis (default: 0) +;track_motorx 0 + +# Set motorx reverse (default: 0) +;track_motorx_reverse 0 + +# Motor number for y-axis (default: 0) +;track_motory 1 + +# Set motory reverse (default: 0) +;track_motory_reverse 0 + +# Maximum value on x-axis (default: 0) +;track_maxx 200 + +# Minimum value on x-axis (default: 0) +;track_minx 50 + +# Maximum value on y-axis (default: 0) +;track_maxy 200 + +# Minimum value on y-axis (default: 0) +;track_miny 50 + +# Center value on x-axis (default: 0) +;track_homex 128 + +# Center value on y-axis (default: 0) +;track_homey 128 + +# ID of an iomojo camera if used (default: 0) +track_iomojo_id 0 + +# Angle in degrees the camera moves per step on the X-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_x 10 + +# Angle in degrees the camera moves per step on the Y-axis +# with auto-track (default: 10) +# Currently only used with pwc type cameras +track_step_angle_y 10 + +# Delay to wait for after tracking movement as number +# of picture frames (default: 10) +track_move_wait 10 + +# Speed to set the motor to (stepper motor option) (default: 255) +track_speed 255 + +# Number of steps to make (stepper motor option) (default: 40) +track_stepsize 40 + + +############################################################ +# External Commands, Warnings and Logging: +# You can use conversion specifiers for the on_xxxx commands +# %Y = year, %m = month, %d = date, +# %H = hour, %M = minute, %S = second, +# %v = event, %q = frame number, %t = thread (camera) number, +# %D = changed pixels, %N = noise level, +# %i and %J = width and height of motion area, +# %K and %L = X and Y coordinates of motion center +# %C = value defined by text_event +# %f = filename with full path +# %n = number indicating filetype +# Both %f and %n are only defined for on_picture_save, +# on_movie_start and on_movie_end +# Quotation marks round string are allowed. +############################################################ + +# Do not sound beeps when detecting motion (default: on) +# Note: Motion never beeps when running in daemon mode. +quiet on + +# Command to be executed when an event starts. (default: none) +# An event starts at first motion detected after a period of no motion defined by event_gap +; on_event_start value + +# Command to be executed when an event ends after a period of no motion +# (default: none). The period of no motion is defined by option event_gap. +; on_event_end value + +# Command to be executed when a picture (.ppm|.jpg) is saved (default: none) +# To give the filename as an argument to a command append it with %f +; on_picture_save value + +# Command to be executed when a motion frame is detected (default: none) +; on_motion_detected value + +# Command to be executed when motion in a predefined area is detected +# Check option 'area_detect'. (default: none) +; on_area_detected value + +# Command to be executed when a movie file (.mpg|.avi) is created. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_start value + +# Command to be executed when a movie file (.mpg|.avi) is closed. (default: none) +# To give the filename as an argument to a command append it with %f +; on_movie_end value + +# Command to be executed when a camera can't be opened or if it is lost +# NOTE: There is situations when motion don't detect a lost camera! +# It depends on the driver, some drivers dosn't detect a lost camera at all +# Some hangs the motion thread. Some even hangs the PC! (default: none) +; on_camera_lost value + +##################################################################### +# Common Options for database features. +# Options require database options to be active also. +##################################################################### + +# Log to the database when creating motion triggered picture file (default: on) +; sql_log_picture on + +# Log to the database when creating a snapshot image file (default: on) +; sql_log_snapshot on + +# Log to the database when creating motion triggered movie file (default: off) +; sql_log_movie off + +# Log to the database when creating timelapse movies file (default: off) +; sql_log_timelapse off + +# SQL query string that is sent to the database +# Use same conversion specifiers has for text features +# Additional special conversion specifiers are +# %n = the number representing the file_type +# %f = filename with full path +# Default value: +# Create tables : +## +# Mysql +# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), event_time_stamp timestamp(14)); +# +# Postgresql +# 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); +# +# insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') +; sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') + + +############################################################ +# Database Options +############################################################ + +# database type : mysql, postgresql, sqlite3 (default : not defined) +; database_type value + +# database to log to (default: not defined) +; database_dbname value + +# The host on which the database is located (default: localhost) +; database_host value + +# User account name for database (default: not defined) +; database_user value + +# User password for database (default: not defined) +; database_password value + +# Port on which the database is located +# mysql 3306 , postgresql 5432 (default: not defined) +; database_port value + +############################################################ +# Database Options For SQLite3 +############################################################ + +# SQLite3 database (file path) (default: not defined) +; sqlite3_db value + + + +############################################################ +# Video Loopback Device (vloopback project) +############################################################ + +# Output images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; video_pipe value + +# Output motion images to a video4linux loopback device +# The value '-' means next available (default: not defined) +; motion_video_pipe value + + +############################################################## +# Thread config files - One for each camera. +# Except if only one camera - You only need this config file. +# If you have more than one camera you MUST define one thread +# config file for each camera in addition to this config file. +############################################################## + +# Remember: If you have more than one camera you must have one +# thread file for each camera. E.g. 2 cameras requires 3 files: +# This motion.conf file AND thread1.conf and thread2.conf. +# Only put the options that are unique to each camera in the +# thread config files. +; thread /usr/local/etc/thread1.conf +; thread /usr/local/etc/thread2.conf +; thread /usr/local/etc/thread3.conf +; thread /usr/local/etc/thread4.conf + diff --git a/thread1.conf.in b/configs/thread1.conf similarity index 96% rename from thread1.conf.in rename to configs/thread1.conf index f6d5fe8..b3a95a1 100644 --- a/thread1.conf.in +++ b/configs/thread1.conf @@ -1,6 +1,6 @@ # /usr/local/etc/thread1.conf # -# This config file was generated by @PACKAGE_NAME@ @PACKAGE_VERSION@ +# This config file was generated by motion trunkREV557 diff --git a/thread2.conf.in b/configs/thread2.conf similarity index 96% rename from thread2.conf.in rename to configs/thread2.conf index d0b8b2a..7d75020 100644 --- a/thread2.conf.in +++ b/configs/thread2.conf @@ -1,6 +1,6 @@ # /usr/local/etc/thread2.conf # -# This config file was generated by @PACKAGE_NAME@ @PACKAGE_VERSION@ +# This config file was generated by motion trunkREV557 diff --git a/thread3.conf.in b/configs/thread3.conf similarity index 96% rename from thread3.conf.in rename to configs/thread3.conf index 2192805..981afb8 100644 --- a/thread3.conf.in +++ b/configs/thread3.conf @@ -1,6 +1,6 @@ # /usr/local/etc/thread3.conf # -# This config file was generated by @PACKAGE_NAME@ @PACKAGE_VERSION@ +# This config file was generated by motion trunkREV557 diff --git a/thread4.conf.in b/configs/thread4.conf similarity index 97% rename from thread4.conf.in rename to configs/thread4.conf index 64a6363..33bdfb2 100644 --- a/thread4.conf.in +++ b/configs/thread4.conf @@ -1,6 +1,6 @@ # /usr/local/etc/thread4.conf # -# This config file was generated by @PACKAGE_NAME@ @PACKAGE_VERSION@ +# This config file was generated by motion trunkREV557 ########################################################### # Capture device options diff --git a/configure b/configure deleted file mode 100755 index 4c63a45..0000000 --- a/configure +++ /dev/null @@ -1,7435 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for motion Git-8619d7c17ce112e7196975905c6e840f345141ba. -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # 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. - 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+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='motion' -PACKAGE_TARNAME='motion' -PACKAGE_VERSION='Git-8619d7c17ce112e7196975905c6e840f345141ba' -PACKAGE_STRING='motion Git-8619d7c17ce112e7196975905c6e840f345141ba' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -ac_unique_file="motion.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='LTLIBOBJS -LIBOBJS -BIN_PATH -EGREP -GREP -CPP -FFMPEG_OBJ -SDL_OBJ -VIDEO -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_linuxthreads -with_pwcbsd -with_bktr -with_v4l -with_sdl -with_jpeg_turbo -with_jpeg_mmx -with_ffmpeg -with_ffmpeg_headers -with_sqlite3 -with_mysql -with_mysql_lib -with_mysql_include -with_pgsql -with_pgsql_lib -with_pgsql_include -with_optimizecpu -with_developer_flags -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $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} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -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-8619d7c17ce112e7196975905c6e840f345141ba to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/motion] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of motion Git-8619d7c17ce112e7196975905c6e840f345141ba:";; - esac - cat <<\_ACEOF - -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 pthreads - - - --with-pwcbsd Use pwcbsd based webcams ( only BSD ) - - - --without-bktr Exclude to use bktr subsystem , that usually useful - for devices as network cameras ( ONLY used in *BSD). - - - --without-v4l Exclude using v4l (video4linux) subsystem. - Makes Motion so it only supports network cameras. - - --without-sdl Compile without sdl support to get stream in SDL window. - - --with-jpeg-turbo=DIR Specify the prefix for the install path for - jpeg-turbo for optimized jpeg handling (optional). - - --with-jpeg-mmx=DIR Specify the prefix for the install path for - jpeg-mmx for optimized jpeg handling (optional). - If this is not specified motion will try to find - the library /usr/lib/libjpeg-mmx.a /usr/local/lib/libjpeg-mmx.a. - - --with-ffmpeg=DIR Specify the prefix for the install path for - libavcodec/libavformat (part of ffmpeg) be able to - encode mpeg movies realtime. - If this is not specified motion will try to find - the libraries in /usr and /usr/local. - - --with-ffmpeg-headers=DIR Specify the prefix for ffmpeg headers. - - --without-sqlite3 Disable sqlite3 support in motion. - - --without-mysql Disable mysql support in motion. - - --with-mysql-lib=DIR Normally, configure will scan all possible default - 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 it fails, use - this command to tell configure where mysql include - installation root directory is. - - --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 - optimizing code by platform and cpu. - - --with-developer-flags Causes practically all of the possible gcc - warning flags to be set. This may produce - a large amount of warnings. - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -motion configure Git-8619d7c17ce112e7196975905c6e840f345141ba -generated by GNU Autoconf 2.67 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -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;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # 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;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -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;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -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;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -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 : - { $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 : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$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 : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -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;} - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -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 : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -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;} - -} # ac_fn_c_check_header_compile - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -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 : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* 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 $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -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;} - -} # ac_fn_c_check_func - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -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 : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -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;} - -} # ac_fn_c_check_type - -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 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-8619d7c17ce112e7196975905c6e840f345141ba, which was -generated by GNU Autoconf 2.67. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $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 ; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_config_headers="$ac_config_headers config.h" - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -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 ; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -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 ; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -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 ; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - 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 run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -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 : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -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 ; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -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 : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -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 : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -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 : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -THREAD_CFLAGS="" -THREAD_CHECK="/usr/include/pthread.h" - -Darwin="" -FreeBSD="" - -LINUXTHREADS="no" - -# Check whether --with-linuxthreads was given. -if test "${with_linuxthreads+set}" = set; then : - withval=$with_linuxthreads; LINUXTHREADS="$withval" - -fi - - -PWCBSD="no" - -# Check whether --with-pwcbsd was given. -if test "${with_pwcbsd+set}" = set; then : - withval=$with_pwcbsd; PWCBSD="$withval" - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Darwin" >&5 -$as_echo_n "checking for Darwin... " >&6; } -Darwin=`uname -a | grep "Darwin"` - -if test "${Darwin}" = ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for *BSD" >&5 -$as_echo_n "checking for *BSD... " >&6; } - - FreeBSD=`uname -a | grep "BSD"` - if test "${FreeBSD}" = ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - VIDEO="video.o video2.o video_common.o" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - if test "${LINUXTHREADS}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Linuxthreads" >&5 -$as_echo_n "checking Linuxthreads... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping" >&5 -$as_echo "skipping" >&6; } - else - THREAD_CHECK="/usr/local/include/pthread/linuxthreads/pthread.h" - THREAD_LIB_CHECK="/usr/local/lib/liblthread.so" - fi - - if test "${PWCBSD}" != "no"; then - VIDEO="video.o video2.o video_common.o" - TEMP_CFLAGS="${CFLAGS} -I/usr/local/include -DPWCBSD" - else - VIDEO="video_freebsd.o" - TEMP_CFLAGS="${CFLAGS} -I/usr/local/include" - fi - - TEMP_LDFLAGS="${LDFLAGS} -L/usr/local/lib" - TEMP_LIBS="-L/usr/local/lib" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Build with PWCBSD support $PWCBSD" >&5 -$as_echo "Build with PWCBSD support $PWCBSD" >&6; } - - fi -else - TEMP_CFLAGS="${CFLAGS} -I/sw/include" - TEMP_LDFLAGS="${LDFLAGS} -L/sw/lib" - TEMP_LIBS="-L/sw/lib" - VIDEO="video_freebsd.o" - FINK_LIB="-L/sw/lib" - Darwin="yes" - V4L="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $Darwin" >&5 -$as_echo "$Darwin" >&6; } -fi - - - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -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 : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -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 ; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -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 : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -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 : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -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 : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -TEMP_LIBS="-lm ${TEMP_LIBS}" -TEMP_CFLAGS="${TEMP_CFLAGS} ${CFLAGS}" -TEMP_LDFLAGS="${TEMP_LDFLAGS} ${LDFLAGS}" - -if test "${FreeBSD}" != "" && test "${PWCBSD}" = "no"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking bktr headers in /usr/include/dev/bktr" >&5 -$as_echo_n "checking bktr headers in /usr/include/dev/bktr... " >&6; } - - if test -f /usr/include/dev/bktr/ioctl_meteor.h && test -f /usr/include/dev/bktr/ioctl_bt848.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - TEMP_CFLAGS="${TEMP_CFLAGS} -DOLD_BKTR" - fi -# -# Check to Exclude BKTR -# -BKTR="yes" - -# Check whether --with-bktr was given. -if test "${with_bktr+set}" = set; then : - withval=$with_bktr; BKTR="$withval" - -fi - - - if test "${BKTR}" = "no"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L" - fi - -else - -# -# Check to Exclude V4L -# -V4L="yes" - -# Check whether --with-v4l was given. -if test "${with_v4l+set}" = set; then : - withval=$with_v4l; V4L="$withval" - -fi - - -fi - - -if test "${V4L}" = "no"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L" -fi - - -if test "${FreeBSD}" != "" && test "${LINUXTHREADS}" != "no" ; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linuxthreads" >&5 -$as_echo_n "checking for linuxthreads... " >&6; } - -# -# Check for thread header -# - if test -f "${THREAD_CHECK}"; then - HEADERS_THREAD_CFLAGS="-I/usr/local/include/pthread/linuxthreads" - THREADS="yes" - else - THREADS="no" - fi - -# -# Check for thread lib -# - if test -f "${THREAD_LIB_CHECK}" ; then - THREADS="yes" - LIB_THREAD="-llthread -llgcc_r" - else - THREADS="no" - fi - -# Checks for Library linuxthreads for FreeBSD -# -# linuxthreads on freeBSD, ports collection -# /usr/local/include/pthreads/linuxthreads/pthread.h -# #include -# /usr/local/lib/libpthread.so -# - - if test "${THREADS}" = "yes"; then - TEMP_CFLAGS="${HEADERS_THREAD_CFLAGS} $TEMP_CFLAGS -DWITH_LINUXTREADS" - TEMP_LIBS="$TEMP_LIBS ${LIB_THREAD}" - THREAD_CFLAGS="-D_THREAD_SAFE" - PTHREAD_SUPPORT="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $THREADS" >&5 -$as_echo "$THREADS" >&6; } - else - PTHREAD_SUPPORT="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $THREADS" >&5 -$as_echo "$THREADS" >&6; } - echo - echo "You do not have linuxthread installed" - echo - fi - -elif test -f "${THREAD_CHECK}"; then - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking threads" >&5 -$as_echo_n "checking threads... " >&6; } - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -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; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - PTHREAD_LIB=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -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" - TEMP_CFLAGS="${TEMP_CFLAGS} -D_REENTRANT" - fi - PTHREAD_SUPPORT="yes" -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_SUPPORT" >&5 -$as_echo "$PTHREAD_SUPPORT" >&6; } - -else - echo - echo "You do not have threads support" - echo -fi - - -# -# Check for sdl library -# -SDL_SUPPORT="no" - -# Check whether --with-sdl was given. -if test "${with_sdl+set}" = set; then : - withval=$with_sdl; -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl" >&5 -$as_echo_n "checking for sdl... " >&6; } -if test "x$withval" = "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5 -$as_echo "skipped" >&6; } -else - if test "${FreeBSD}" != ""; then - CONFIG_SDL='sdl11-config' - else - CONFIG_SDL='sdl-config' - fi - if test -z "`($CONFIG_SDL --version) 2>/dev/null`" ;then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "$withval" = "yes"; then - echo "" - echo "****************************************************" - echo "* sdl-config could not be found. Please install it *" - echo "* and remove the --with-sdl configure argument. *" - echo "* libSDL can be found at http://www.libsdl.org *" - echo "****************************************************" - echo "" - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SDL_SUPPORT="yes" - TEMP_LIBS="$TEMP_LIBS `${CONFIG_SDL} --libs`" - TEMP_CFLAGS="${TEMP_CFLAGS} `${CONFIG_SDL} --cflags`" - -$as_echo "#define HAVE_SDL 1" >>confdefs.h - - SDL_OBJ="sdl.o" - - fi -fi - -# -# Check for the libjpeg-turbo library -# -JPEG_TURBO="no" -JPEG_TURBO_OK="not_found" - - -# Check whether --with-jpeg-turbo was given. -if test "${with_jpeg_turbo+set}" = set; then : - withval=$with_jpeg_turbo; JPEG_TURBO="$withval" - -fi - - -if test "${JPEG_TURBO}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libjpeg-turbo" >&5 -$as_echo_n "checking for libjpeg-turbo... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping" >&5 -$as_echo "skipping" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libjpeg-turbo in -> ${JPEG_TURBO} <-" >&5 -$as_echo_n "checking for libjpeg-turbo in -> ${JPEG_TURBO} <-... " >&6; } - if test -f ${JPEG_TURBO}/lib/libjpeg.a ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - JPEG_TURBO_OK="found" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - fi -fi - - -if test "${JPEG_TURBO_OK}" = "found"; then - saved_CFLAGS="$CFLAGS" - saved_LIBS="$LIBS" - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="-L${JPEG_TURBO}/lib" - CFLAGS="$CFLAGS -I${JPEG_TURBO}/include" - 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 : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ljpeg $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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 jpeg_start_compress (); -int -main () -{ -return jpeg_start_compress (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_jpeg_jpeg_start_compress=yes -else - ac_cv_lib_jpeg_jpeg_start_compress=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -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 : - TEMP_LIBS="$LIBS" - TEMP_CFLAGS="${CFLAGS}" - TEMP_LDFLAGS="$TEMP_LDFLAGS $LDFLAGS" - JPEG_SUPPORT="yes" -fi - - LIBS="$saved_LIBS" - CFLAGS="$saved_CFLAGS" - LDFLAGS="$saved_LDFLAGS" - JPEG_SUPPORT_TURBO="yes" -fi - - -# -# Check for the special mmx accelerated jpeg library -# -JPEG_MMX="no" -JPEG_MMX_OK="not_found" - -# Check whether --with-jpeg-mmx was given. -if test "${with_jpeg_mmx+set}" = set; then : - withval=$with_jpeg_mmx; JPEG_MMX="$withval" - -fi - - -# -# --without-jpeg-mmx or with-jpeg-mmx=no -# - -if test "${JPEG_MMX}" = "no" || test x$JPEG_SUPPORT != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libjpeg-mmx" >&5 -$as_echo_n "checking for libjpeg-mmx... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping" >&5 -$as_echo "skipping" >&6; } -elif test "${JPEG_MMX}" = "yes"; then - # AUTODETECT STATIC LIB - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libjpeg-mmx autodetecting" >&5 -$as_echo_n "checking for libjpeg-mmx autodetecting... " >&6; } - - if test -f /usr/lib/libjpeg-mmx.a ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - JPEG_MMX_OK="found" - JPEG_MMX="/usr/lib" - elif test -f /usr/local/lib/libjpeg-mmx.a ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - JPEG_MMX_OK="found" - JPEG_MMX="/usr/local/lib" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libjpeg-mmx in -> ${JPEG_MMX} <-" >&5 -$as_echo_n "checking for libjpeg-mmx in -> ${JPEG_MMX} <-... " >&6; } - if test -f ${JPEG_MMX}/libjpeg-mmx.a ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - JPEG_MMX_OK="found" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - fi -fi - -if test "${JPEG_MMX_OK}" = "found"; then - saved_CFLAGS="$CFLAGS" - saved_LIBS="$LIBS" - CFLAGS="$CFLAGS -I${JPEG_MMX}" - 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 : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ljpeg-mmx $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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 jpeg_start_compress (); -int -main () -{ -return jpeg_start_compress (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_jpeg_mmx_jpeg_start_compress=yes -else - ac_cv_lib_jpeg_mmx_jpeg_start_compress=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -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 : - TEMP_LIBS="$TEMP_LIBS -ljpeg-mmx" - TEMP_CFLAGS="${TEMP_CFLAGS} -I${JPEG_MMX}" - JPEG_SUPPORT="yes" -fi - - 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 - # Checks for libraries - LDFLAGS=$TEMP_LDFLAGS - - { $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 : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ljpeg $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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 jpeg_set_defaults (); -int -main () -{ -return jpeg_set_defaults (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_jpeg_jpeg_set_defaults=yes -else - ac_cv_lib_jpeg_jpeg_set_defaults=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -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 : - - TEMP_LIBS="$TEMP_LIBS -ljpeg" - JPEG_SUPPORT="yes" - -else - - echo - echo "You do not have libjpeg installed" - echo - - -fi - -fi - - -# -# Check for libavcodec and libavformat from ffmpeg -# -FFMPEG_DIR="yes" -FFMPEG_OK="no_found" -FFMPEG_OBJ="" - -# Check whether --with-ffmpeg was given. -if test "${with_ffmpeg+set}" = set; then : - withval=$with_ffmpeg; FFMPEG_DIR="$withval" - -fi - - -# -# ffmpeg headers custom location -# -FFMPEG_HEADERS_DIR="yes" - -# Check whether --with-ffmpeg_headers was given. -if test "${with_ffmpeg_headers+set}" = set; then : - withval=$with_ffmpeg_headers; FFMPEG_HEADERS_DIR="$withval" - -fi - - -# -# --without-ffmpeg or with-ffmpeg=no -# -if test "${FFMPEG_DIR}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg" >&5 -$as_echo_n "checking for ffmpeg... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping" >&5 -$as_echo "skipping" >&6; } -# -# with-ffmpeg= or nothing -# -else if test "${FFMPEG_DIR}" = "yes"; then - # AUTODETECT STATIC/SHARED LIB - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg autodetecting libraries" >&5 -$as_echo_n "checking for ffmpeg autodetecting libraries... " >&6; } - - if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib64" >&5 -$as_echo "found in /usr/lib64" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib64" - FFMPEG_DIR="/usr" - elif test -f /usr/lib/libavcodec.a -o -f /usr/lib/libavcodec.so && test -f /usr/lib/libavformat.a -o -f /usr/lib/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/lib" >&5 -$as_echo "found in /usr/lib" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib" - FFMPEG_DIR="/usr" - elif test -f /usr/local/lib/libavcodec.a -o -f /usr/local/lib/libavcodec.so && test -f /usr/local/lib/libavformat.a -o -f /usr/local/lib/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in /usr/local/lib" >&5 -$as_echo "found in /usr/local/lib" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="/usr/local/lib" - FFMPEG_DIR="/usr/local" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg libraries in -> ${FFMPEG_DIR} <-" >&5 -$as_echo_n "checking for ffmpeg libraries in -> ${FFMPEG_DIR} <-... " >&6; } - if test -f ${FFMPEG_DIR}/lib/libavcodec.a -o -f ${FFMPEG_DIR}/lib/libavcodec.so && test -f ${FFMPEG_DIR}/lib/libavformat.a -o -f ${FFMPEG_DIR}/lib/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - FFMPEG_OK="found" - FFMPEG_LIB="${FFMPEG_DIR}/lib" - elif test -f ${FFMPEG_DIR}/libavcodec.a -o -f ${FFMPEG_DIR}/libavcodec.so && test -f ${FFMPEG_DIR}/libavformat.a -o -f ${FFMPEG_DIR}/libavformat.so ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - FFMPEG_LIB="${FFMPEG_DIR}" - FFMPEG_OK="found" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - if test "${FFMPEG_OK}" != "found"; then - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - fi -fi - -# -# Now check for ffmpeg headers ( avformat.h ) if ffmpeg libs were found -# - -if test "${FFMPEG_OK}" = "found"; then - if test "${FFMPEG_HEADERS_DIR}" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg headers in ${FFMPEG_DIR}" >&5 -$as_echo_n "checking for ffmpeg headers in ${FFMPEG_DIR}... " >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg headers in ${FFMPEG_HEADERS_DIR}" >&5 -$as_echo_n "checking for ffmpeg headers in ${FFMPEG_HEADERS_DIR}... " >&6; } - FFMPEG_DIR="${FFMPEG_HEADERS_DIR}" - fi - - if test -f ${FFMPEG_DIR}/include/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include" - elif test -f ${FFMPEG_DIR}/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/ffmpeg/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/ffmpeg/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg" - elif test -f ${FFMPEG_DIR}/include/libavformat/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/libavformat/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/libavformat/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/libavformat" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/ffmpeg/libavformat" - elif test -f ${FFMPEG_DIR}/libavformat/avformat.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${FFMPEG_DIR}/libavformat/avformat.h" >&5 -$as_echo "found ${FFMPEG_DIR}/libavformat/avformat.h" >&6; } - FFMPEG_CFLAGS="-I${FFMPEG_DIR} -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I{FFMPEG_DIR}/libavformat" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - FFMPEG_OK="no_found" - echo "**********************************************" - echo "* avformat.h not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - -# -# If ffmpeg libs and headers have been found -# - - if test "${FFMPEG_OK}" = "found"; then - TEMP_LIBS="$TEMP_LIBS -L${FFMPEG_LIB} -lavformat -lavcodec -lavutil -lm -lz" - TEMP_LDFLAGS="${TEMP_LDFLAGS} -L${FFMPEG_LIB}" - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG ${FFMPEG_CFLAGS}" - - FFMPEG_OBJ="ffmpeg.o" - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking file_protocol is defined in ffmpeg ?" >&5 -$as_echo_n "checking file_protocol is defined in ffmpeg ?... " >&6; } - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - - - CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" - LIBS="$TEMP_LIBS" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - #include - URLProtocol test_file_protocol; - int main(void){ - test_file_protocol.url_read = file_protocol.url_read; - return 0; - } - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_NEW" - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS - fi -fi -fi - - -# -# Check SQLITE3 -# - -SQLITE3_SUPPORT="no" - -# Check whether --with-sqlite3 was given. -if test "${with_sqlite3+set}" = set; then : - withval=$with_sqlite3; SQLITE3="$withval" - # if not given argument, assume standard - -fi - - -if test "${SQLITE3}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3" >&5 -$as_echo_n "checking for sqlite3... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping" >&5 -$as_echo "skipping" >&6; } -else - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - - { $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 : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsqlite3 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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 sqlite3_open (); -int -main () -{ -return sqlite3_open (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_sqlite3_sqlite3_open=yes -else - ac_cv_lib_sqlite3_sqlite3_open=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -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 : - - TEMP_LIBS="$TEMP_LIBS -lsqlite3" - SQLITE3_SUPPORT="yes" - -$as_echo "#define HAVE_SQLITE3 1" >>confdefs.h - - - -fi - - - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS -fi - - -# -# Check Mysql -# - -MYSQL="yes" -MYSQL_SUPPORT="no" -MYSQL_HEADERS="yes" -MYSQL_LIBS="yes" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql support" >&5 -$as_echo_n "checking for mysql support... " >&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 - - - -# 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 - - - - -# 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 - - - -if test "${MYSQL}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5 -$as_echo "skipped" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: testing" >&5 -$as_echo "testing" >&6; } - # ******* Search mysql headers ******* - - if test "${MYSQL_HEADERS}" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking autodect mysql headers" >&5 -$as_echo_n "checking autodect mysql headers... " >&6; } - # Autodetect - for w in /usr/include /usr/local/include /usr/mysql /usr/local/mysql /usr/local/mysql/include /opt /opt/mysql; do - # check for plain setups - if test -f $w/mysql.h; then - MYSQL_INCDIR=$w - break - fi - # check for "/usr/include/" type setups - if test -f $w/mysql/mysql.h; then - MYSQL_INCDIR=$w/mysql - break - fi - # check for "/usr//include" type setups - if test -f $w/mysql/include/mysql.h; then - MYSQL_INCDIR=$w/mysql/include - break - fi - done - elif test "${MYSQL_HEADERS}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql headers" >&5 -$as_echo_n "checking for mysql headers... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5 -$as_echo "skipped" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql headers in $MYSQL_HEADERS" >&5 -$as_echo_n "checking for mysql headers in $MYSQL_HEADERS... " >&6; } - # Manual detection for - if test -f $MYSQL_HEADERS/mysql.h; then - MYSQL_INCDIR=$MYSQL_HEADERS - fi - fi - - if test -z "$MYSQL_INCDIR" ; then - MYSQL_HEADERS="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - echo "Invalid MySQL directory - unable to find mysql.h." - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MYSQL_INCDIR yes" >&5 -$as_echo "$MYSQL_INCDIR yes" >&6; } - MYSQL_HEADERS="yes" - fi - - - if test "${MYSQL_HEADERS}" = "yes"; then - - # ******* Search mysql libs ********* - if test "${MYSQL_LIBS}" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking autodect mysql libs" >&5 -$as_echo_n "checking autodect mysql libs... " >&6; } - # Autodetect - for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql /usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql /usr/lib/x86_64-linux-gnu; do - # check for plain setups - if test -f $w/libmysqlclient.a -o -f $w/libmysqlclient.so; then - MYSQL_LIBDIR=$w - break - fi - # check for "/usr/lib/" type setups - if test -f $w/mysql/libmysqlclient.a -o -f $w/mysql/libmysqlclient.so; then - MYSQL_LIBDIR=$w/mysql - break - fi - # check for "/usr//lib" type setups - if test -f $w/mysql/lib/libmysqlclient.a -o -f $w/mysql/lib/libmysqlclient.so; then - MYSQL_LIBDIR=$w/mysql/lib - break - fi - done - elif test "${MYSQL_LIBS}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql libs" >&5 -$as_echo_n "checking for mysql libs... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5 -$as_echo "skipped" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql libs in $MYSQL_LIBS" >&5 -$as_echo_n "checking for mysql libs in $MYSQL_LIBS... " >&6; } - # Manual detection for - if test -f $MYSQL_LIBS/libmysqlclient.a -o -f $MYSQL_LIBS/libmysqlclient.so; then - MYSQL_LIBDIR=$MYSQL_LIBS - fi - fi - - - if test -z "$MYSQL_LIBDIR" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - echo "Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so." - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MYSQL_LIBDIR" >&5 -$as_echo "$MYSQL_LIBDIR" >&6; } - #LDFLAGS="-L$MYSQL_LIBDIR" - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - CFLAGS="-I$MYSQL_INCDIR" - 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 : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmysqlclient $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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 -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_mysqlclient_mysql_init=yes -else - ac_cv_lib_mysqlclient_mysql_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -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 : - - TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient -lz" - TEMP_CFLAGS="$TEMP_CFLAGS -I$MYSQL_INCDIR" - MYSQL_SUPPORT="yes" - -$as_echo "#define HAVE_MYSQL 1" >>confdefs.h - - -else - as_fn_error $? "MySQL support can't build without MySQL libraries" "$LINENO" 5 -fi - - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS - fi - - # end mysql-include , mysql-libs - fi - -# end Mysql detection -fi - - -# -# Check PostgreSQL -# -PGSQL="yes" -PGSQL_SUPPORT="no" -PGSQL_HEADERS="yes" -PGSQL_LIBS="yes" - - - - -# 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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PostgreSQL" >&5 -$as_echo_n "checking for PostgreSQL... " >&6; } - -if test "${PGSQL}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5 -$as_echo "skipped" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: testing" >&5 -$as_echo "testing" >&6; } - - # ******* Search pgsql headers ******* - if test "${PGSQL_HEADERS}" = "yes"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking autodect pgsql headers" >&5 -$as_echo_n "checking autodect pgsql headers... " >&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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pgsql headers" >&5 -$as_echo_n "checking for pgsql headers... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5 -$as_echo "skipped" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pgsql headers in $PGSQL_HEADERS" >&5 -$as_echo_n "checking for pgsql headers in $PGSQL_HEADERS... " >&6; } - # Manual detection for - if test -f $PGSQL_HEADERS/libpq-fe.h; then - PGSQL_INCDIR=$PGSQL_HEADERS - fi - fi - - if test -z "$PGSQL_INCDIR" ; then - PGSQL_HEADERS="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - echo "Invalid PostgreSQL directory - unable to find libpq-fe.h." - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes $PGSQL_INCDIR" >&5 -$as_echo "yes $PGSQL_INCDIR" >&6; } - PGSQL_HEADERS="yes" - fi - - - if test "${PGSQL_HEADERS}" = "yes"; then - - # ******* Search pgsql libs ********* - if test "${PGSQL_LIBS}" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking autodect pgsql libs" >&5 -$as_echo_n "checking autodect pgsql libs... " >&6; } - # Autodetect - PGSQL_INCLUDE="-I$PGSQL_INCDIR" - PGSQL_LIBDIR=$PGSQL_DIR/lib - - if test -f /usr/lib64/libpq.so ; then - PGSQL_LIBDIR=/usr/lib64 - elif 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 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PGSQL_LIBDIR" >&5 -$as_echo "$PGSQL_LIBDIR" >&6; } - - elif test "${PGSQL_LIBS}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pgsql libs" >&5 -$as_echo_n "checking for pgsql libs... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5 -$as_echo "skipped" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pgsql libs in $PGSQL_LIBS" >&5 -$as_echo_n "checking for pgsql libs in $PGSQL_LIBS... " >&6; } - # Manual detection for - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "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" - { $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 : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpq $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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 PQconnectStart (); -int -main () -{ -return PQconnectStart (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pq_PQconnectStart=yes -else - ac_cv_lib_pq_PQconnectStart=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -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 : - - PGSQL_SUPPORT="yes" - TEMP_LIBS="$TEMP_LIBS -L$PGSQL_LIBDIR -lpq" - TEMP_CFLAGS="$TEMP_CFLAGS -I$PGSQL_INCDIR" - -$as_echo "#define HAVE_PGSQL 1" >>confdefs.h - - -else - as_fn_error $? "PostgreSQL support can't build without PostgreSQL libraries" "$LINENO" 5 -fi - - LDFLAGS="" - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS - fi - - fi # end pgsql-include , pgsql-libs - -# end PostgreSQL detection -fi - - -#Checks for header files. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -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 ; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -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 : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $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 : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $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 : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in 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 -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -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 : - cat >>confdefs.h <<_ACEOF -#define HAVE_GET_CURRENT_DIR_NAME 1 -_ACEOF - -fi -done - - -# Check if v4l2 is available -SUPPORTED_V4L2=false -SUPPORTED_V4L2_old=false - -if test "${V4L}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for V42L support" >&5 -$as_echo_n "checking for V42L support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping" >&5 -$as_echo "skipping" >&6; } -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 : - SUPPORTED_V4L2=true -else - SUPPORTED_V4L2=false -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for V42L support" >&5 -$as_echo_n "checking for V42L support... " >&6; } - if test x$SUPPORTED_V4L2 = xtrue; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - TEMP_CFLAGS="${TEMP_CFLAGS} -DMOTION_V4L2" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - # linux/videodev.h doesn't include videodev2.h - if test x$SUPPORTED_V4L2 = xfalse; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for V42L *old* support" >&5 -$as_echo_n "checking for V42L *old* support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: testing" >&5 -$as_echo "testing" >&6; } - for ac_header in linux/videodev2.h -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 : - cat >>confdefs.h <<_ACEOF -#define HAVE_LINUX_VIDEODEV2_H 1 -_ACEOF - SUPPORTED_V4L2_old=true -fi - -done - - fi - - - if test x$SUPPORTED_V4L2_old = xtrue; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DMOTION_V4L2 -DMOTION_V4L2_OLD" - SUPPORTED_V4L2=true - fi - -fi - - -# Check sizes of integer types -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# 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 : - $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 : - -else - if test "$ac_cv_type_short" = yes; then - { { $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 ; } - else - ac_cv_sizeof_short=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# 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 : - $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 : - -else - if test "$ac_cv_type_int" = yes; then - { { $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 ; } - else - ac_cv_sizeof_int=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# 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 : - $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 : - -else - if test "$ac_cv_type_long_int" = yes; then - { { $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 ; } - else - ac_cv_sizeof_long_int=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_int" >&5 -$as_echo "$ac_cv_sizeof_long_int" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_INT $ac_cv_sizeof_long_int -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# 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 : - $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 : - -else - if test "$ac_cv_type_long_long" = yes; then - { { $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 ; } - else - ac_cv_sizeof_long_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 -$as_echo "$ac_cv_sizeof_long_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# 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 : - $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 : - -else - if test "$ac_cv_type_int_p" = yes; then - { { $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 ; } - else - ac_cv_sizeof_int_p=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int_p" >&5 -$as_echo "$ac_cv_sizeof_int_p" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT_P $ac_cv_sizeof_int_p -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# 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 : - $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 : - -else - if test "$ac_cv_type_void_p" = yes; then - { { $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 ; } - else - ac_cv_sizeof_void_p=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p -_ACEOF - - - -if test "$ac_cv_sizeof_short" = "4"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"short\"" -else - if test "$ac_cv_sizeof_int" = "4"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"int\"" - else - if test "$ac_cv_sizeof_long_int" = "4"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"long int\"" - fi - fi -fi - - -OPTIMIZECPU="yes" - - -# Check whether --with-optimizecpu was given. -if test "${with_optimizecpu+set}" = set; then : - withval=$with_optimizecpu; OPTIMIZECPU="$withval" - -fi - - -DEVELOPER_FLAGS="no" - - -# Check whether --with-developer-flags was given. -if test "${with_developer_flags+set}" = set; then : - withval=$with_developer_flags; DEVELOPER_FLAGS="$withval" - -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 : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes -else - ac_cv_c_const=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - - -if test "${FreeBSD}" != ""; then - OPTIMIZECPU="" -fi - -if test "${OPTIMIZECPU}" = "yes"; then - -# Try to autodetect cpu type -CPU_NAME="unknown" -CPU_TYPE="unknown" -if test -e "/proc/cpuinfo" ; then - intel[30]="-march=i386" - intel[32]="-march=i386" - intel[34]="-march=i386" - intel[40]="-march=i486" - intel[41]="-march=i486" - intel[42]="-march=i486" - intel[43]="-march=i486" - intel[44]="-march=i486" - intel[45]="-march=i486" - intel[47]="-march=i486" - intel[48]="-march=i486" - intel[51]="-march=pentium" - intel[52]="-march=pentium" - intel[54]="-march=pentium-mmx" - intel[56]="-march=pentium-mmx" - intel[61]="-march=pentiumpro" - intel[63]="-march=pentium2" - intel[65]="-march=pentium2" - intel[66]="-march=pentium2" - intel[67]="-march=pentium3" - intel[68]="-march=pentium3" - intel[610]="-march=pentium3" - intel[611]="-march=pentium3" - intel[150]="-march=pentium4" - intel[151]="-march=pentium4" - intel[152]="-march=pentium4" - intel[154]="-march=pentium4" - intel[614]="-march=prescott" - intel[628]="-march=core2" - amd[50]="-march=i586" - amd[51]="-march=i586" - amd[52]="-march=i586" - amd[53]="-march=i586" - amd[56]="-march=k6" - amd[57]="-march=k6" - amd[58]="-march=k6-2" - amd[510]="-march=k6-2" - amd[59]="-march=k6-3" - amd[513]="-march=k6-3" - amd[61]="-march=athlon" - amd[62]="-march=athlon" - amd[63]="-march=athlon" - amd[64]="-march=athlon" - amd[66]="-march=athlon" - amd[67]="-march=athlon" - amd[68]="-march=athlon" - amd[610]="-march=athlon" - amd[158]="-march=athlon-xp" - amd[154]="-march=k8" - amd[155]="-march=athlon64" - amd[1543]="-march=athlon64" - amd[1544]="-march=athlon64" - amd[1565]="-march=opteron" - amd[1572]="-march=k8" - via[67]="-march=c3" - via[68]="-march=c3" - via[69]="-march=i686" - via[610]="-march=i686" - - CPU_TYPE="known" - CPU_FAMILY=`cat /proc/cpuinfo | grep "cpu family" | head -n1` - CPU_MODEL=`cat /proc/cpuinfo | grep model[^\ ] | head -n1` - CPU_NAME=`cat /proc/cpuinfo | grep "model name" | head -n1` - CPU_FLAGS=`cat /proc/cpuinfo | grep "flags" | head -n1` - CPU_VENDOR=`cat /proc/cpuinfo | grep "vendor_id" | head -n1` - CPU_FAMILY=${CPU_FAMILY#*: } - CPU_MODEL=${CPU_MODEL#*: } - CPU_NAME=${CPU_NAME#*: } - CPU_FLAGS=${CPU_FLAGS#*: } - CPU_VENDOR=${CPU_VENDOR#*: } - if test "x${CPU_VENDOR}" = "xGenuineIntel" ; then - CPU_OPTIONS=${intel[$CPU_FAMILY$CPU_MODEL]} - fi - if test "x${CPU_VENDOR}" = "xAuthenticAMD" ; then - CPU_OPTIONS=${amd[$CPU_FAMILY$CPU_MODEL]} - fi - if test "x${CPU_VENDOR}" = "xCentaurHauls"; then - CPU_OPTIONS=${via[$CPU_FAMILY$CPU_MODEL]} - fi - if test "x${CPU_OPTIONS}" = "x" ; then - CPU_TYPE="unknown" - fi - CPU_EXT="" - for i in $CPU_FLAGS ; do - case $i in - fpu) - CPU_FPU="-mfpmath=387" - ;; - mmx) - CPU_EXT="$CPU_EXT -mmmx" - ;; - sse) - CPU_FPU="-mfpmath=sse -msse" - ;; - sse2) - CPU_FPU="-mfpmath=sse -msse2" - ;; - sse3) - CPU_FPU="-msse3" - ;; - ssse3) - CPU_FPU="-mfpmath=sse -msse2 -mssse3" - ;; - 3dnow) - CPU_EXT="$CPU_EXT -m3dnow" - ;; - esac - done - CPU_OPTIONS="$CPU_OPTIONS $CPU_FPU $CPU_EXT" -fi -if test "x${CPU_TYPE}" = "xunknown"; then - CPU_TYPE=`( uname -p ) 2>&1` - case $CPU_TYPE in - i386) - CPU_OPTIONS="-march=i386" - ;; - i486) - CPU_OPTIONS="-march=i486" - ;; - Pentium2) - CPU_OPTIONS="-march=pentium2" - ;; - Pentiumpro) - CPU_OPTIONS="-march=pentiumpro" - ;; - Pentium*) - CPU_OPTIONS="-march=pentium" - ;; - k6) - CPU_OPTIONS="-march=k6" - ;; - k6-2) - CPU_OPTIONS="-march=k6-2" - ;; - k6-3) - CPU_OPTIONS="-march=k6-3" - ;; - "VIA C3 Ezra") - CPU_OPTIONS="-march=c3" - CPU_TYPE="known" - ;; - *) - CPU_OPTIONS="" - CPU_TYPE="unknown" - ;; - esac - if test "x${CPU_TYPE}" = "xunknown"; then - CPU_TYPE=`( uname -m ) 2>&1` - case $CPU_TYPE in - i386) - CPU_OPTIONS="-march=i386" - ;; - i486) - CPU_OPTIONS="-march=i486" - ;; - i586) - CPU_OPTIONS="-march=i586" - ;; - i686) - CPU_OPTIONS="-march=i686" - ;; - Pentium2) - CPU_OPTIONS="-march=pentium2" - ;; - Pentiumpro) - CPU_OPTIONS="-march=pentiumpro" - ;; - k6) - CPU_OPTIONS="-march=k6" - ;; - k6-2) - CPU_OPTIONS="-march=k6-2" - ;; - k6-3) - CPU_OPTIONS="-march=k6-3" - ;; - *) - CPU_OPTIONS="-march=native -mtune=native" - ;; - esac - 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 -done -TMPC="$I/cpu_test-$RANDOM-$$.c" -TMPO="$I/cpu_test-$RANDOM-$$.o" -cat > $TMPC << EOF -int main(void) { return 0; } -EOF -( $COMPILER $CPU_OPTIONS -o $TMPO $TMPC ) 2>&1 -TMP="$?" -rm -f $TMPO -rm -f $TMPC - - -if test "x${TMP}" = "x1" ; then - CPU_OPTIONS="" - echo "No CPU optimizations will be added" -else - echo "CPU optimization: $CPU_OPTIONS" -fi - -else - CPU_OPTIONS="" -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bswap instruction" >&5 -$as_echo_n "checking for bswap instruction... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main () -{ -unsigned int __x=0; - register unsigned int __v; - __asm("bswap %0" : "=r" (__v) : "0" (__x)); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_BSWAP" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -if test "${DEVELOPER_FLAGS}" = "yes"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -W -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wno-long-long -ggdb -g3" -fi - -CFLAGS="${TEMP_CFLAGS} $UNAME_DEFS $CPU_OPTIONS" - -LIBS="${TEMP_LIBS}" -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 : - -$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 : - -$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 : - -$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 : - -$as_echo "#define have_av_register_protocol 1" >>confdefs.h - -fi - - -# -# Add the right exec path for rc scripts -# -if test $prefix = "NONE";then - BIN_PATH="$ac_default_prefix" - if test $exec_prefix = "NONE"; then - BIN_PATH="$BIN_PATH/bin" - else - BIN_PATH="$BIN_PATH/$bindir" - fi -else - if test $exec_prefix = "NONE";then - BIN_PATH="$prefix/bin" - else - BIN_PATH="$prefix/$bindir" - fi -fi - - - - -ac_config_files="$ac_config_files thread1.conf thread2.conf thread3.conf thread4.conf motion-dist.conf motion.init-FreeBSD.sh motion.init-Debian motion.init-Fedora motion.spec Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\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" && - { $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 - 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;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# 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-8619d7c17ce112e7196975905c6e840f345141ba, which was -generated by GNU Autoconf 2.67. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to the package provider." - -_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-8619d7c17ce112e7196975905c6e840f345141ba -configured by $0, generated by GNU Autoconf 2.67, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "thread1.conf") CONFIG_FILES="$CONFIG_FILES thread1.conf" ;; - "thread2.conf") CONFIG_FILES="$CONFIG_FILES thread2.conf" ;; - "thread3.conf") CONFIG_FILES="$CONFIG_FILES thread3.conf" ;; - "thread4.conf") CONFIG_FILES="$CONFIG_FILES thread4.conf" ;; - "motion-dist.conf") CONFIG_FILES="$CONFIG_FILES motion-dist.conf" ;; - "motion.init-FreeBSD.sh") CONFIG_FILES="$CONFIG_FILES motion.init-FreeBSD.sh" ;; - "motion.init-Debian") CONFIG_FILES="$CONFIG_FILES motion.init-Debian" ;; - "motion.init-Fedora") CONFIG_FILES="$CONFIG_FILES motion.init-Fedora" ;; - "motion.spec") CONFIG_FILES="$CONFIG_FILES motion.spec" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -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" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# 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 || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# 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 - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$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 `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - 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'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -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 - -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"; } && - { $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" - case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$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 - { $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" \ - || 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" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi - ;; - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - -echo "" -echo " **************************" -echo " Configure status " -echo " ${PACKAGE_NAME} ${PACKAGE_VERSION}" -echo " **************************" -echo - - -if test "${Darwin}" != ""; then - echo "OS : Darwin" -elif test "${FreeBSD}" != ""; then - echo "OS : *BSD" -else - echo "OS : Linux" -fi - -if test "${PTHREAD_SUPPORT}" = "yes"; then - echo "pthread support: Yes" -else - echo "pthread support: No" - echo "**********************************************" - echo "** Fatal Error YOU MUST HAVE pthread Support *" - echo "**********************************************" -fi - - -if test "${JPEG_SUPPORT_TURBO}" = "yes"; then - echo "jpeg turbo support: Yes" -elif test "${JPEG_SUPPORT_MMX}" = "yes"; then - echo "jpeg-mmx support: Yes" -elif test "${JPEG_SUPPORT}" = "yes"; then - echo "jpeg support: Yes" -else - echo "jpeg support: No" - echo "**********************************************" - echo "** Fatal Error YOU MUST HAVE jpeg Support ***" - echo "**********************************************" -fi - -if test "${FreeBSD}" != ""; then - if test "${BKTR}" = "yes"; then - echo "BKTR included: Yes" - else - echo "BKTR included: No" - fi - - if test "${PWCBSD}" = "yes"; then - echo "PWCBSD include: Yes" - else - echo "PWCBSD include: No" - fi - -else - if test "${V4L}" = "yes"; then - echo "V4L support: Yes" - else - echo "V4L support: No" - fi - - if test x$SUPPORTED_V4L2 = xtrue; then - echo "V4L2 support: Yes" - else - echo "V4L2 support: No" - fi -fi - -if test "${SDL_SUPPORT}" = "yes"; then - echo "SDL support: Yes" -else - echo "SDL support: No" -fi - -if test "${FFMPEG_OK}" = "found"; then - echo "FFmpeg support: Yes" -else - echo "FFmpeg support: No" -fi - -if test "${SQLITE3_SUPPORT}" = "yes"; then - echo "SQLite3 support: Yes" -else - echo "SQLite3 support: No" -fi - -if test "${MYSQL_SUPPORT}" = "yes"; then - echo "MYSQL support: Yes" -else - echo "MYSQL support: No" -fi - -if test "${PGSQL_SUPPORT}" = "yes"; then - echo "PostgreSQL support: Yes" -else - echo "PostgreSQL support: No" -fi -echo -echo "CFLAGS: $CFLAGS" -echo "LIBS: $LIBS" -echo "LDFLAGS: $LDFLAGS" -echo -echo "Install prefix: $prefix" -echo - diff --git a/configure.in b/configure.in deleted file mode 100644 index 38271fa..0000000 --- a/configure.in +++ /dev/null @@ -1,1354 +0,0 @@ -# Process this file with autoconf to produce a configure script - -AC_INIT(motion, esyscmd(['./version.sh'])) -AC_CONFIG_SRCDIR([motion.c]) -AC_CONFIG_HEADERS(config.h) -AC_PROG_CC - - -THREAD_CFLAGS="" -THREAD_CHECK="/usr/include/pthread.h" - -Darwin="" -FreeBSD="" - -LINUXTHREADS="no" -AC_ARG_WITH(linuxthreads, -[ --with-linuxthreads Use linuxthreads in BSD instead of native pthreads - ] - , -LINUXTHREADS="$withval" -) - -PWCBSD="no" -AC_ARG_WITH(pwcbsd, -[ --with-pwcbsd Use pwcbsd based webcams ( only BSD ) -] -, -PWCBSD="$withval" -) - - -AC_MSG_CHECKING(for Darwin) -Darwin=`uname -a | grep "Darwin"` - -if test "${Darwin}" = ""; then - AC_MSG_RESULT(no) - AC_MSG_CHECKING(for *BSD) - - FreeBSD=`uname -a | grep "BSD"` - if test "${FreeBSD}" = ""; then - AC_MSG_RESULT(no) - VIDEO="video.o video2.o video_common.o" - else - AC_MSG_RESULT(yes) - if test "${LINUXTHREADS}" = "no"; then - AC_MSG_CHECKING(Linuxthreads) - AC_MSG_RESULT(skipping) - else - THREAD_CHECK="/usr/local/include/pthread/linuxthreads/pthread.h" - THREAD_LIB_CHECK="/usr/local/lib/liblthread.so" - fi - - if test "${PWCBSD}" != "no"; then - VIDEO="video.o video2.o video_common.o" - TEMP_CFLAGS="${CFLAGS} -I/usr/local/include -DPWCBSD" - else - VIDEO="video_freebsd.o" - TEMP_CFLAGS="${CFLAGS} -I/usr/local/include" - fi - - TEMP_LDFLAGS="${LDFLAGS} -L/usr/local/lib" - TEMP_LIBS="-L/usr/local/lib" - AC_MSG_RESULT(Build with PWCBSD support $PWCBSD) - - fi -else - TEMP_CFLAGS="${CFLAGS} -I/sw/include" - TEMP_LDFLAGS="${LDFLAGS} -L/sw/lib" - TEMP_LIBS="-L/sw/lib" - VIDEO="video_freebsd.o" - FINK_LIB="-L/sw/lib" - Darwin="yes" - V4L="no" - AC_MSG_RESULT($Darwin) -fi - - -AC_SUBST(VIDEO) - -# Checks for programs. -AC_PROG_CC - -TEMP_LIBS="-lm ${TEMP_LIBS}" -TEMP_CFLAGS="${TEMP_CFLAGS} ${CFLAGS}" -TEMP_LDFLAGS="${TEMP_LDFLAGS} ${LDFLAGS}" - -if test "${FreeBSD}" != "" && test "${PWCBSD}" = "no"; then - - AC_MSG_CHECKING(bktr headers in /usr/include/dev/bktr) - - if test -f /usr/include/dev/bktr/ioctl_meteor.h && test -f /usr/include/dev/bktr/ioctl_bt848.h; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - TEMP_CFLAGS="${TEMP_CFLAGS} -DOLD_BKTR" - fi -# -# Check to Exclude BKTR -# -BKTR="yes" -AC_ARG_WITH(bktr, -[ --without-bktr Exclude to use bktr subsystem , that usually useful - for devices as network cameras ( ONLY used in *BSD). - ] - , -BKTR="$withval" -) - - if test "${BKTR}" = "no"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L" - fi - -else - -# -# Check to Exclude V4L -# -V4L="yes" -AC_ARG_WITH(v4l, -[ --without-v4l Exclude using v4l (video4linux) subsystem. - Makes Motion so it only supports network cameras. - ], -V4L="$withval" -) - -fi - - -if test "${V4L}" = "no"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L" -fi - - -if test "${FreeBSD}" != "" && test "${LINUXTHREADS}" != "no" ; then - -AC_MSG_CHECKING(for linuxthreads) - -# -# Check for thread header -# - if test -f "${THREAD_CHECK}"; then - HEADERS_THREAD_CFLAGS="-I/usr/local/include/pthread/linuxthreads" - THREADS="yes" - else - THREADS="no" - fi - -# -# Check for thread lib -# - if test -f "${THREAD_LIB_CHECK}" ; then - THREADS="yes" - LIB_THREAD="-llthread -llgcc_r" - else - THREADS="no" - fi - -# Checks for Library linuxthreads for FreeBSD -# -# linuxthreads on freeBSD, ports collection -# /usr/local/include/pthreads/linuxthreads/pthread.h -# #include -# /usr/local/lib/libpthread.so -# - - if test "${THREADS}" = "yes"; then - TEMP_CFLAGS="${HEADERS_THREAD_CFLAGS} $TEMP_CFLAGS -DWITH_LINUXTREADS" - TEMP_LIBS="$TEMP_LIBS ${LIB_THREAD}" - THREAD_CFLAGS="-D_THREAD_SAFE" - PTHREAD_SUPPORT="yes" - AC_MSG_RESULT($THREADS) - else - PTHREAD_SUPPORT="no" - AC_MSG_RESULT($THREADS) - echo - echo "You do not have linuxthread installed" - echo - fi - -elif test -f "${THREAD_CHECK}"; then - - -AC_MSG_CHECKING(threads) -AC_TRY_LINK([#include ], -[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" - 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 - - -# -# Check for sdl library -# -SDL_SUPPORT="no" -AC_ARG_WITH(sdl, -[ --without-sdl Compile without sdl support to get stream in SDL window. -], -[], -[]) -AC_MSG_CHECKING(for sdl) -if test "x$withval" = "xno"; then - AC_MSG_RESULT(skipped) -else - if test "${FreeBSD}" != ""; then - CONFIG_SDL='sdl11-config' - else - CONFIG_SDL='sdl-config' - fi - if test -z "`($CONFIG_SDL --version) 2>/dev/null`" ;then - AC_MSG_RESULT(no) - if test "$withval" = "yes"; then - echo "" - echo "****************************************************" - echo "* sdl-config could not be found. Please install it *" - echo "* and remove the --with-sdl configure argument. *" - echo "* libSDL can be found at http://www.libsdl.org *" - echo "****************************************************" - echo "" - fi - else - AC_MSG_RESULT(yes) - SDL_SUPPORT="yes" - TEMP_LIBS="$TEMP_LIBS `${CONFIG_SDL} --libs`" - TEMP_CFLAGS="${TEMP_CFLAGS} `${CONFIG_SDL} --cflags`" - AC_DEFINE([HAVE_SDL],1,[Define to 1 if you have SDL support]) - SDL_OBJ="sdl.o" - AC_SUBST(SDL_OBJ) - fi -fi - -# -# Check for the libjpeg-turbo library -# -JPEG_TURBO="no" -JPEG_TURBO_OK="not_found" - -AC_ARG_WITH(jpeg-turbo, -[ --with-jpeg-turbo[=DIR] Specify the prefix for the install path for - jpeg-turbo for optimized jpeg handling (optional). - ], -JPEG_TURBO="$withval" -) - -if test "${JPEG_TURBO}" = "no"; then - AC_MSG_CHECKING(for libjpeg-turbo) - AC_MSG_RESULT(skipping) -else - AC_MSG_CHECKING(for libjpeg-turbo in -> [${JPEG_TURBO}] <-) - if test -f ${JPEG_TURBO}/lib/libjpeg.a ; then - AC_MSG_RESULT(found) - JPEG_TURBO_OK="found" - else - AC_MSG_RESULT(not found) - fi -fi - - -if test "${JPEG_TURBO_OK}" = "found"; then - saved_CFLAGS="$CFLAGS" - saved_LIBS="$LIBS" - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="-L${JPEG_TURBO}/lib" - CFLAGS="$CFLAGS -I${JPEG_TURBO}/include" - LIBS="$LIBS -L${JPEG_TURBO}/lib -ljpeg" - AC_CHECK_LIB(jpeg, jpeg_start_compress, - [ TEMP_LIBS="$LIBS" - TEMP_CFLAGS="${CFLAGS}" - TEMP_LDFLAGS="$TEMP_LDFLAGS $LDFLAGS" - JPEG_SUPPORT="yes"],,) - LIBS="$saved_LIBS" - CFLAGS="$saved_CFLAGS" - LDFLAGS="$saved_LDFLAGS" - JPEG_SUPPORT_TURBO="yes" -fi - - -# -# Check for the special mmx accelerated jpeg library -# -JPEG_MMX="no" -JPEG_MMX_OK="not_found" -AC_ARG_WITH(jpeg-mmx, -[ --with-jpeg-mmx[=DIR] Specify the prefix for the install path for - jpeg-mmx for optimized jpeg handling (optional). - If this is not specified motion will try to find - the library /usr/lib/libjpeg-mmx.a /usr/local/lib/libjpeg-mmx.a. - ], -JPEG_MMX="$withval" -) - -# -# --without-jpeg-mmx or with-jpeg-mmx=no -# - -if test "${JPEG_MMX}" = "no" || test x$JPEG_SUPPORT != xyes; then - AC_MSG_CHECKING(for libjpeg-mmx) - AC_MSG_RESULT(skipping) -elif test "${JPEG_MMX}" = "yes"; then - # AUTODETECT STATIC LIB - AC_MSG_CHECKING(for libjpeg-mmx autodetecting) - - if test -f /usr/lib/libjpeg-mmx.a ; then - AC_MSG_RESULT(found) - JPEG_MMX_OK="found" - JPEG_MMX="/usr/lib" - elif test -f /usr/local/lib/libjpeg-mmx.a ; then - AC_MSG_RESULT(found) - JPEG_MMX_OK="found" - JPEG_MMX="/usr/local/lib" - else - AC_MSG_RESULT(not found) - fi -else - AC_MSG_CHECKING(for libjpeg-mmx in -> [${JPEG_MMX}] <-) - if test -f ${JPEG_MMX}/libjpeg-mmx.a ; then - AC_MSG_RESULT(found) - JPEG_MMX_OK="found" - else - AC_MSG_RESULT(not found) - fi -fi - -if test "${JPEG_MMX_OK}" = "found"; then - 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="$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 - # Checks for libraries - LDFLAGS=$TEMP_LDFLAGS - - AC_CHECK_LIB(jpeg, jpeg_set_defaults, [ - TEMP_LIBS="$TEMP_LIBS -ljpeg" - JPEG_SUPPORT="yes" - ], [ - echo - echo "You do not have libjpeg installed" - echo - ] - ) -fi - - -# -# Check for libavcodec and libavformat from ffmpeg -# -FFMPEG_DIR="yes" -FFMPEG_OK="no_found" -FFMPEG_OBJ="" -AC_ARG_WITH(ffmpeg, -[ --with-ffmpeg[=DIR] Specify the prefix for the install path for - libavcodec/libavformat (part of ffmpeg) be able to - encode mpeg movies realtime. - If this is not specified motion will try to find - the libraries in /usr and /usr/local. - ], -FFMPEG_DIR="$withval" -) - -# -# ffmpeg headers custom location -# -FFMPEG_HEADERS_DIR="yes" -AC_ARG_WITH(ffmpeg_headers, -[ --with-ffmpeg-headers[=DIR] Specify the prefix for ffmpeg headers. - ], -FFMPEG_HEADERS_DIR="$withval" -) - -# -# --without-ffmpeg or with-ffmpeg=no -# -if test "${FFMPEG_DIR}" = "no"; then - AC_MSG_CHECKING(for ffmpeg) - AC_MSG_RESULT(skipping) -# -# with-ffmpeg= or nothing -# -else if test "${FFMPEG_DIR}" = "yes"; then - # AUTODETECT STATIC/SHARED LIB - AC_MSG_CHECKING(for ffmpeg autodetecting libraries) - - if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then - AC_MSG_RESULT(found in /usr/lib64) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib64" - FFMPEG_DIR="/usr" - elif test -f /usr/lib/libavcodec.a -o -f /usr/lib/libavcodec.so && test -f /usr/lib/libavformat.a -o -f /usr/lib/libavformat.so ; then - AC_MSG_RESULT(found in /usr/lib) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/lib" - FFMPEG_DIR="/usr" - elif test -f /usr/local/lib/libavcodec.a -o -f /usr/local/lib/libavcodec.so && test -f /usr/local/lib/libavformat.a -o -f /usr/local/lib/libavformat.so ; then - AC_MSG_RESULT(found in /usr/local/lib) - FFMPEG_OK="found" - FFMPEG_LIB="/usr/local/lib" - FFMPEG_DIR="/usr/local" - else - AC_MSG_RESULT(not found) - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi -else - AC_MSG_CHECKING(for ffmpeg libraries in -> [${FFMPEG_DIR}] <-) - if test -f ${FFMPEG_DIR}/lib/libavcodec.a -o -f ${FFMPEG_DIR}/lib/libavcodec.so && test -f ${FFMPEG_DIR}/lib/libavformat.a -o -f ${FFMPEG_DIR}/lib/libavformat.so ; then - AC_MSG_RESULT(found) - FFMPEG_OK="found" - FFMPEG_LIB="${FFMPEG_DIR}/lib" - elif test -f ${FFMPEG_DIR}/libavcodec.a -o -f ${FFMPEG_DIR}/libavcodec.so && test -f ${FFMPEG_DIR}/libavformat.a -o -f ${FFMPEG_DIR}/libavformat.so ; then - AC_MSG_RESULT(found) - FFMPEG_LIB="${FFMPEG_DIR}" - FFMPEG_OK="found" - else - AC_MSG_RESULT(not found) - if test "${FFMPEG_OK}" != "found"; then - echo "" - echo "**********************************************" - echo "* libavcodec.a or libavcodec.so or *" - echo "* libavformat.a or libavformat.so not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - fi -fi - -# -# Now check for ffmpeg headers ( avformat.h ) if ffmpeg libs were found -# - -if test "${FFMPEG_OK}" = "found"; then - if test "${FFMPEG_HEADERS_DIR}" = "yes"; then - AC_MSG_CHECKING(for ffmpeg headers in ${FFMPEG_DIR}) - else - AC_MSG_CHECKING(for ffmpeg headers in ${FFMPEG_HEADERS_DIR}) - FFMPEG_DIR="${FFMPEG_HEADERS_DIR}" - fi - - if test -f ${FFMPEG_DIR}/include/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include" - elif test -f ${FFMPEG_DIR}/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg" - elif test -f ${FFMPEG_DIR}/include/libavformat/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/libavformat/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/libavformat" - elif test -f ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I${FFMPEG_DIR}/include/ffmpeg/libavformat" - elif test -f ${FFMPEG_DIR}/libavformat/avformat.h; then - AC_MSG_RESULT(found ${FFMPEG_DIR}/libavformat/avformat.h) - FFMPEG_CFLAGS="-I${FFMPEG_DIR} -DFFMPEG_NEW_INCLUDES" - AVFORMAT="-I{FFMPEG_DIR}/libavformat" - else - AC_MSG_RESULT(not found) - FFMPEG_OK="no_found" - echo "**********************************************" - echo "* avformat.h not found: *" - echo "* ALL FFMPEG FEATURES DISABLED *" - echo "* *" - echo "* Please read the Motion Guide for help: *" - echo "* http://motion.sourceforge.net *" - echo "**********************************************" - echo "" - fi - -# -# If ffmpeg libs and headers have been found -# - - if test "${FFMPEG_OK}" = "found"; then - TEMP_LIBS="$TEMP_LIBS -L${FFMPEG_LIB} -lavformat -lavcodec -lavutil -lm -lz" - TEMP_LDFLAGS="${TEMP_LDFLAGS} -L${FFMPEG_LIB}" - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG ${FFMPEG_CFLAGS}" - - FFMPEG_OBJ="ffmpeg.o" - AC_SUBST(FFMPEG_OBJ) - - AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?]) - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - - - CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" - LIBS="$TEMP_LIBS" - - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - [ - #include - URLProtocol test_file_protocol; - int main(void){ - test_file_protocol.url_read = file_protocol.url_read; - return 0; - } - ]])], - [AC_MSG_RESULT(yes)], - [ - AC_MSG_RESULT(no) - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_NEW" - ] - ) - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS - fi -fi -fi - - -# -# Check SQLITE3 -# - -SQLITE3_SUPPORT="no" -AC_ARG_WITH(sqlite3, - [ --without-sqlite3 Disable sqlite3 support in motion. - ], - SQLITE3="$withval" - # if not given argument, assume standard -) - -if test "${SQLITE3}" = "no"; then - AC_MSG_CHECKING(for sqlite3) - AC_MSG_RESULT(skipping) -else - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - - AC_CHECK_LIB(sqlite3, sqlite3_open, - [ - TEMP_LIBS="$TEMP_LIBS -lsqlite3" - SQLITE3_SUPPORT="yes" - AC_DEFINE([HAVE_SQLITE3],1,[Define to 1 if you have SQLITE3 support]) - ] - ) - - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS -fi - - -# -# Check Mysql -# - -MYSQL="yes" -MYSQL_SUPPORT="no" -MYSQL_HEADERS="yes" -MYSQL_LIBS="yes" - -AC_MSG_CHECKING(for mysql support) - -AC_ARG_WITH(mysql, -[ --without-mysql Disable mysql support in motion. - ], -MYSQL="$withval" -# 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 it fails, use - this command to tell configure where mysql libs - installation root directory is. - ], -MYSQL_LIBS="$withval" -# 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 it fails, use - this command to tell configure where mysql include - installation root directory is. - ], -MYSQL_HEADERS="$withval" -# if not given argument, assume standard -) - - -if test "${MYSQL}" = "no"; then - AC_MSG_RESULT(skipped) -else - AC_MSG_RESULT(testing) - # ******* Search mysql headers ******* - - if test "${MYSQL_HEADERS}" = "yes"; then - AC_MSG_CHECKING(autodect mysql headers) - # Autodetect - for w in /usr/include /usr/local/include /usr/mysql /usr/local/mysql /usr/local/mysql/include /opt /opt/mysql; do - # check for plain setups - if test -f $w/mysql.h; then - MYSQL_INCDIR=$w - break - fi - # check for "/usr/include/" type setups - if test -f $w/mysql/mysql.h; then - MYSQL_INCDIR=$w/mysql - break - fi - # check for "/usr//include" type setups - if test -f $w/mysql/include/mysql.h; then - MYSQL_INCDIR=$w/mysql/include - break - fi - done - elif test "${MYSQL_HEADERS}" = "no"; then - AC_MSG_CHECKING(for mysql headers) - AC_MSG_RESULT(skipped) - else - AC_MSG_CHECKING(for mysql headers in $MYSQL_HEADERS) - # Manual detection for - if test -f $MYSQL_HEADERS/mysql.h; then - MYSQL_INCDIR=$MYSQL_HEADERS - fi - fi - - if test -z "$MYSQL_INCDIR" ; then - MYSQL_HEADERS="no" - AC_MSG_RESULT(not found) - echo "Invalid MySQL directory - unable to find mysql.h." - else - AC_MSG_RESULT($MYSQL_INCDIR yes) - MYSQL_HEADERS="yes" - fi - - - if test "${MYSQL_HEADERS}" = "yes"; then - - # ******* Search mysql libs ********* - if test "${MYSQL_LIBS}" = "yes"; then - AC_MSG_CHECKING(autodect mysql libs) - # Autodetect - for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql /usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql /usr/lib/x86_64-linux-gnu; do - # check for plain setups - if test -f $w/libmysqlclient.a -o -f $w/libmysqlclient.so; then - MYSQL_LIBDIR=$w - break - fi - # check for "/usr/lib/" type setups - if test -f $w/mysql/libmysqlclient.a -o -f $w/mysql/libmysqlclient.so; then - MYSQL_LIBDIR=$w/mysql - break - fi - # check for "/usr//lib" type setups - if test -f $w/mysql/lib/libmysqlclient.a -o -f $w/mysql/lib/libmysqlclient.so; then - MYSQL_LIBDIR=$w/mysql/lib - break - fi - done - elif test "${MYSQL_LIBS}" = "no"; then - AC_MSG_CHECKING(for mysql libs) - AC_MSG_RESULT(skipped) - else - AC_MSG_CHECKING(for mysql libs in $MYSQL_LIBS) - # Manual detection for - if test -f $MYSQL_LIBS/libmysqlclient.a -o -f $MYSQL_LIBS/libmysqlclient.so; then - MYSQL_LIBDIR=$MYSQL_LIBS - fi - fi - - - if test -z "$MYSQL_LIBDIR" ; then - AC_MSG_RESULT(not found) - echo "Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so." - else - AC_MSG_RESULT($MYSQL_LIBDIR) - #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 - fi - -# end Mysql detection -fi - - -# -# 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_ARG_WITH(pgsql, -[ --without-pgsql Disable PostgreSQL support in motion. - ], -PGSQL="$withval" -# 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) -else - AC_MSG_RESULT(testing) - - # ******* Search pgsql headers ******* - if test "${PGSQL_HEADERS}" = "yes"; then - - 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 - AC_MSG_CHECKING(for pgsql headers in $PGSQL_HEADERS) - # Manual detection for - if test -f $PGSQL_HEADERS/libpq-fe.h; then - PGSQL_INCDIR=$PGSQL_HEADERS - fi - fi - - 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 /usr/lib64/libpq.so ; then - PGSQL_LIBDIR=/usr/lib64 - elif 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 - 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="" - 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) - -AC_CHECK_FUNCS(get_current_dir_name) - -# Check if v4l2 is available -SUPPORTED_V4L2=false -SUPPORTED_V4L2_old=false - -if test "${V4L}" = "no"; then - AC_MSG_CHECKING(for V42L support) - AC_MSG_RESULT(skipping) -else - AC_CHECK_TYPE([struct v4l2_buffer], - [SUPPORTED_V4L2=true], - [SUPPORTED_V4L2=false], - [#include - #include ]) - - AC_MSG_CHECKING(for V42L support) - if test x$SUPPORTED_V4L2 = xtrue; then - AC_MSG_RESULT(yes) - TEMP_CFLAGS="${TEMP_CFLAGS} -DMOTION_V4L2" - else - AC_MSG_RESULT(no) - fi - - # 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) - AC_CHECK_HEADERS(linux/videodev2.h,[SUPPORTED_V4L2_old=true],[], [#include ]) - fi - - - if test x$SUPPORTED_V4L2_old = xtrue; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DMOTION_V4L2 -DMOTION_V4L2_OLD" - SUPPORTED_V4L2=true - fi - -fi - - -# Check sizes of integer types -AC_CHECK_SIZEOF(short) -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(long int) -AC_CHECK_SIZEOF(long long) -AC_CHECK_SIZEOF(int *) -AC_CHECK_SIZEOF(void *) - -if test "$ac_cv_sizeof_short" = "4"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"short\"" -else - if test "$ac_cv_sizeof_int" = "4"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"int\"" - else - if test "$ac_cv_sizeof_long_int" = "4"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"long int\"" - fi - fi -fi - - -OPTIMIZECPU="yes" - -AC_ARG_WITH(optimizecpu, -[ --without-optimizecpu Exclude autodetecting platform and cpu type. - This will disable the compilation of gcc - optimizing code by platform and cpu. - ], -OPTIMIZECPU="$withval" -) - -DEVELOPER_FLAGS="no" - -AC_ARG_WITH(developer-flags, -[ --with-developer-flags Causes practically all of the possible gcc - warning flags to be set. This may produce - a large amount of warnings.], -DEVELOPER_FLAGS="$withval" -) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST - -if test "${FreeBSD}" != ""; then - OPTIMIZECPU="" -fi - -if test "${OPTIMIZECPU}" = "yes"; then - -# Try to autodetect cpu type -CPU_NAME="unknown" -CPU_TYPE="unknown" -if test -e "/proc/cpuinfo" ; then - intel[[30]]="-march=i386" - intel[[32]]="-march=i386" - intel[[34]]="-march=i386" - intel[[40]]="-march=i486" - intel[[41]]="-march=i486" - intel[[42]]="-march=i486" - intel[[43]]="-march=i486" - intel[[44]]="-march=i486" - intel[[45]]="-march=i486" - intel[[47]]="-march=i486" - intel[[48]]="-march=i486" - intel[[51]]="-march=pentium" - intel[[52]]="-march=pentium" - intel[[54]]="-march=pentium-mmx" - intel[[56]]="-march=pentium-mmx" - intel[[61]]="-march=pentiumpro" - intel[[63]]="-march=pentium2" - intel[[65]]="-march=pentium2" - intel[[66]]="-march=pentium2" - intel[[67]]="-march=pentium3" - intel[[68]]="-march=pentium3" - intel[[610]]="-march=pentium3" - intel[[611]]="-march=pentium3" - intel[[150]]="-march=pentium4" - intel[[151]]="-march=pentium4" - intel[[152]]="-march=pentium4" - intel[[154]]="-march=pentium4" - intel[[614]]="-march=prescott" - intel[[628]]="-march=core2" - amd[[50]]="-march=i586" - amd[[51]]="-march=i586" - amd[[52]]="-march=i586" - amd[[53]]="-march=i586" - amd[[56]]="-march=k6" - amd[[57]]="-march=k6" - amd[[58]]="-march=k6-2" - amd[[510]]="-march=k6-2" - amd[[59]]="-march=k6-3" - amd[[513]]="-march=k6-3" - amd[[61]]="-march=athlon" - amd[[62]]="-march=athlon" - amd[[63]]="-march=athlon" - amd[[64]]="-march=athlon" - amd[[66]]="-march=athlon" - amd[[67]]="-march=athlon" - amd[[68]]="-march=athlon" - amd[[610]]="-march=athlon" - amd[[158]]="-march=athlon-xp" - amd[[154]]="-march=k8" - amd[[155]]="-march=athlon64" - amd[[1543]]="-march=athlon64" - amd[[1544]]="-march=athlon64" - amd[[1565]]="-march=opteron" - amd[[1572]]="-march=k8" - via[[67]]="-march=c3" - via[[68]]="-march=c3" - via[[69]]="-march=i686" - via[[610]]="-march=i686" - - CPU_TYPE="known" - CPU_FAMILY=`cat /proc/cpuinfo | grep "cpu family" | head -n1` - CPU_MODEL=`cat /proc/cpuinfo | grep model[[^\ ]] | head -n1` - CPU_NAME=`cat /proc/cpuinfo | grep "model name" | head -n1` - CPU_FLAGS=`cat /proc/cpuinfo | grep "flags" | head -n1` - CPU_VENDOR=`cat /proc/cpuinfo | grep "vendor_id" | head -n1` - CPU_FAMILY=${CPU_FAMILY#*: } - CPU_MODEL=${CPU_MODEL#*: } - CPU_NAME=${CPU_NAME#*: } - CPU_FLAGS=${CPU_FLAGS#*: } - CPU_VENDOR=${CPU_VENDOR#*: } - if test "x${CPU_VENDOR}" = "xGenuineIntel" ; then - CPU_OPTIONS=${intel[[$CPU_FAMILY$CPU_MODEL]]} - fi - if test "x${CPU_VENDOR}" = "xAuthenticAMD" ; then - CPU_OPTIONS=${amd[[$CPU_FAMILY$CPU_MODEL]]} - fi - if test "x${CPU_VENDOR}" = "xCentaurHauls"; then - CPU_OPTIONS=${via[[$CPU_FAMILY$CPU_MODEL]]} - fi - if test "x${CPU_OPTIONS}" = "x" ; then - CPU_TYPE="unknown" - fi - CPU_EXT="" - for i in $CPU_FLAGS ; do - case $i in - fpu) - CPU_FPU="-mfpmath=387" - ;; - mmx) - CPU_EXT="$CPU_EXT -mmmx" - ;; - sse) - CPU_FPU="-mfpmath=sse -msse" - ;; - sse2) - CPU_FPU="-mfpmath=sse -msse2" - ;; - sse3) - CPU_FPU="-msse3" - ;; - ssse3) - CPU_FPU="-mfpmath=sse -msse2 -mssse3" - ;; - 3dnow) - CPU_EXT="$CPU_EXT -m3dnow" - ;; - esac - done - CPU_OPTIONS="$CPU_OPTIONS $CPU_FPU $CPU_EXT" -fi -if test "x${CPU_TYPE}" = "xunknown"; then - CPU_TYPE=`( uname -p ) 2>&1` - case $CPU_TYPE in - i386) - CPU_OPTIONS="-march=i386" - ;; - i486) - CPU_OPTIONS="-march=i486" - ;; - Pentium2) - CPU_OPTIONS="-march=pentium2" - ;; - Pentiumpro) - CPU_OPTIONS="-march=pentiumpro" - ;; - Pentium*) - CPU_OPTIONS="-march=pentium" - ;; - k6) - CPU_OPTIONS="-march=k6" - ;; - k6-2) - CPU_OPTIONS="-march=k6-2" - ;; - k6-3) - CPU_OPTIONS="-march=k6-3" - ;; - "VIA C3 Ezra") - CPU_OPTIONS="-march=c3" - CPU_TYPE="known" - ;; - *) - CPU_OPTIONS="" - CPU_TYPE="unknown" - ;; - esac - if test "x${CPU_TYPE}" = "xunknown"; then - CPU_TYPE=`( uname -m ) 2>&1` - case $CPU_TYPE in - i386) - CPU_OPTIONS="-march=i386" - ;; - i486) - CPU_OPTIONS="-march=i486" - ;; - i586) - CPU_OPTIONS="-march=i586" - ;; - i686) - CPU_OPTIONS="-march=i686" - ;; - Pentium2) - CPU_OPTIONS="-march=pentium2" - ;; - Pentiumpro) - CPU_OPTIONS="-march=pentiumpro" - ;; - k6) - CPU_OPTIONS="-march=k6" - ;; - k6-2) - CPU_OPTIONS="-march=k6-2" - ;; - k6-3) - CPU_OPTIONS="-march=k6-3" - ;; - *) - CPU_OPTIONS="-march=native -mtune=native" - ;; - esac - 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 -done -TMPC="$I/cpu_test-$RANDOM-$$.c" -TMPO="$I/cpu_test-$RANDOM-$$.o" -cat > $TMPC << EOF -int main(void) { return 0; } -EOF -( $COMPILER $CPU_OPTIONS -o $TMPO $TMPC ) 2>&1 -TMP="$?" -rm -f $TMPO -rm -f $TMPC - - -if test "x${TMP}" = "x1" ; then - CPU_OPTIONS="" - echo "No CPU optimizations will be added" -else - echo "CPU optimization: $CPU_OPTIONS" -fi - -else - CPU_OPTIONS="" -fi - - -AC_MSG_CHECKING(for bswap instruction) -AC_LINK_IFELSE([ - AC_LANG_PROGRAM([ ], - [unsigned int __x=0; - register unsigned int __v; - __asm("bswap %0" : "=r" (__v) : "0" (__x));]) - ], - [ - TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_BSWAP" - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - ]) - - -if test "${DEVELOPER_FLAGS}" = "yes"; then - TEMP_CFLAGS="${TEMP_CFLAGS} -W -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wno-long-long -ggdb -g3" -fi - -CFLAGS="${TEMP_CFLAGS} $UNAME_DEFS $CPU_OPTIONS" - -LIBS="${TEMP_LIBS}" -LDFLAGS="${TEMP_LDFLAGS}" - - -AC_CHECK_FUNC(avformat_alloc_context, AC_DEFINE([have_avformat_alloc_context],1,[Define to 1 if you have avformat_alloc_context support])) -AC_CHECK_FUNC(av_avformat_alloc_context, AC_DEFINE([have_av_avformat_alloc_context],1,[Define to 1 if you have av_avformat_alloc_context support])) -AC_CHECK_FUNC(av_register_protocol2, AC_DEFINE([have_av_register_protocol2],1,[Define to 1 if you have av_register_protocol2 support])) -AC_CHECK_FUNC(av_register_protocol, AC_DEFINE([have_av_register_protocol],1,[Define to 1 if you have av_register_protocol support])) - -# -# Add the right exec path for rc scripts -# -if test $prefix = "NONE";then - BIN_PATH="$ac_default_prefix" - if test $exec_prefix = "NONE"; then - BIN_PATH="$BIN_PATH/bin" - else - BIN_PATH="$BIN_PATH/$bindir" - fi -else - if test $exec_prefix = "NONE";then - BIN_PATH="$prefix/bin" - else - BIN_PATH="$prefix/$bindir" - fi -fi - - -AC_SUBST(BIN_PATH) - -AC_CONFIG_FILES([ -thread1.conf -thread2.conf -thread3.conf -thread4.conf -motion-dist.conf -motion.init-FreeBSD.sh -motion.init-Debian -motion.init-Fedora -motion.spec -Makefile -]) -AC_OUTPUT - -echo "" -echo " **************************" -echo " Configure status " -echo " ${PACKAGE_NAME} ${PACKAGE_VERSION}" -echo " **************************" -echo - - -if test "${Darwin}" != ""; then - echo "OS : Darwin" -elif test "${FreeBSD}" != ""; then - echo "OS : *BSD" -else - echo "OS : Linux" -fi - -if test "${PTHREAD_SUPPORT}" = "yes"; then - echo "pthread support: Yes" -else - echo "pthread support: No" - echo "**********************************************" - echo "** Fatal Error YOU MUST HAVE pthread Support *" - echo "**********************************************" -fi - - -if test "${JPEG_SUPPORT_TURBO}" = "yes"; then - echo "jpeg turbo support: Yes" -elif test "${JPEG_SUPPORT_MMX}" = "yes"; then - echo "jpeg-mmx support: Yes" -elif test "${JPEG_SUPPORT}" = "yes"; then - echo "jpeg support: Yes" -else - echo "jpeg support: No" - echo "**********************************************" - echo "** Fatal Error YOU MUST HAVE jpeg Support ***" - echo "**********************************************" -fi - -if test "${FreeBSD}" != ""; then - if test "${BKTR}" = "yes"; then - echo "BKTR included: Yes" - else - echo "BKTR included: No" - fi - - if test "${PWCBSD}" = "yes"; then - echo "PWCBSD include: Yes" - else - echo "PWCBSD include: No" - fi - -else - if test "${V4L}" = "yes"; then - echo "V4L support: Yes" - else - echo "V4L support: No" - fi - - if test x$SUPPORTED_V4L2 = xtrue; then - echo "V4L2 support: Yes" - else - echo "V4L2 support: No" - fi -fi - -if test "${SDL_SUPPORT}" = "yes"; then - echo "SDL support: Yes" -else - echo "SDL support: No" -fi - -if test "${FFMPEG_OK}" = "found"; then - echo "FFmpeg support: Yes" -else - echo "FFmpeg support: No" -fi - -if test "${SQLITE3_SUPPORT}" = "yes"; then - echo "SQLite3 support: Yes" -else - echo "SQLite3 support: No" -fi - -if test "${MYSQL_SUPPORT}" = "yes"; then - echo "MYSQL support: Yes" -else - echo "MYSQL support: No" -fi - -if test "${PGSQL_SUPPORT}" = "yes"; then - echo "PostgreSQL support: Yes" -else - echo "PostgreSQL support: No" -fi -echo -echo "CFLAGS: $CFLAGS" -echo "LIBS: $LIBS" -echo "LDFLAGS: $LDFLAGS" -echo -echo "Install prefix: $prefix" -echo - diff --git a/coord.h b/coord.h new file mode 100644 index 0000000..95e4f39 --- /dev/null +++ b/coord.h @@ -0,0 +1,22 @@ +/* + * coord.h + * + * Created on: 19 Apr 2014 + * Author: ntuckett + */ + +#ifndef COORD_H_ +#define COORD_H_ + +struct coord { + int x; + int y; + int width; + int height; + int minx; + int maxx; + int miny; + int maxy; +}; + +#endif /* COORD_H_ */ diff --git a/draw.c b/draw.c index 9afdb15..8097c5d 100644 --- a/draw.c +++ b/draw.c @@ -1167,6 +1167,18 @@ int draw_text(unsigned char *image, unsigned int startx, unsigned int starty, un return 0; } +int draw_final_image_text(struct context* cnt, struct image_data* imgdata, unsigned int startx, unsigned int starty, const char *text, unsigned int factor) +{ + draw_text(imgdata->image, startx, starty, cnt->imgs.width, text, factor); + + if (imgdata->secondary_image && cnt->imgs.secondary_type == SECONDARY_TYPE_RAW) { + draw_text(imgdata->secondary_image, startx * cnt->imgs.secondary_width_scale, starty * cnt->imgs.secondary_height_scale, + cnt->imgs.secondary_width, text, factor); + } + + return 0; +} + /** * initialize_chars */ diff --git a/event.c b/event.c index e93c8d5..87f679a 100644 --- a/event.c +++ b/event.c @@ -253,10 +253,29 @@ static void event_stop_stream(struct context *cnt, int type ATTRIBUTE_UNUSED, static void event_stream_put(struct context *cnt, int type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, - void *dummy2 ATTRIBUTE_UNUSED, struct tm *tm ATTRIBUTE_UNUSED) + void *eventdata, struct tm *tm ATTRIBUTE_UNUSED) { - if (cnt->conf.stream_port) - stream_put(cnt, img); + if (cnt->conf.stream_port) { + if (eventdata && !img) { + struct image_data* imgdata = (struct image_data*)eventdata; + + if (imgdata->secondary_image && cnt->conf.stream_secondary) { + if (cnt->imgs.secondary_type == SECONDARY_TYPE_RAW) { + stream_put(cnt, imgdata->secondary_image, cnt->imgs.secondary_width, cnt->imgs.secondary_height, cnt->imgs.secondary_size); + } + else if (cnt->imgs.secondary_type == SECONDARY_TYPE_JPEG) { + stream_put_encoded(cnt, imgdata->secondary_image, cnt->imgs.secondary_width, cnt->imgs.secondary_height, imgdata->secondary_size); + } + } + else { + img = imgdata->image; + } + } + + if (img) { + stream_put(cnt, img, cnt->imgs.width, cnt->imgs.height, cnt->imgs.size); + } + } } #ifdef HAVE_SDL @@ -290,14 +309,15 @@ const char *imageext(struct context *cnt) } static void event_image_detect(struct context *cnt, int type ATTRIBUTE_UNUSED, - unsigned char *newimg, char *dummy1 ATTRIBUTE_UNUSED, - void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) + unsigned char *dummy1 ATTRIBUTE_UNUSED, char *dummy2 ATTRIBUTE_UNUSED, + void *eventdata, struct tm *currenttime_tm) { char fullfilename[PATH_MAX]; char filename[PATH_MAX]; if (cnt->new_img & NEWIMG_ON) { const char *imagepath; + struct image_data * imgdat = (struct image_data*) eventdata; /* * conf.imagepath would normally be defined but if someone deleted it by control interface @@ -311,7 +331,7 @@ static void event_image_detect(struct context *cnt, int type ATTRIBUTE_UNUSED, mystrftime(cnt, filename, sizeof(filename), imagepath, currenttime_tm, NULL, 0); snprintf(fullfilename, PATH_MAX, "%s/%s.%s", cnt->conf.filepath, filename, imageext(cnt)); - put_picture(cnt, fullfilename, newimg, FTYPE_IMAGE); + put_image(cnt, fullfilename, imgdat, FTYPE_IMAGE); } } @@ -346,10 +366,11 @@ static void event_imagem_detect(struct context *cnt, int type ATTRIBUTE_UNUSED, } static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, - unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, - void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) + unsigned char *dummy1 ATTRIBUTE_UNUSED, char * dummy2 ATTRIBUTE_UNUSED, + void *eventdata, struct tm *currenttime_tm) { char fullfilename[PATH_MAX]; + struct image_data * imgdat = (struct image_data*) eventdata; if (strcmp(cnt->conf.snappath, "lastsnap")) { char filename[PATH_MAX]; @@ -368,7 +389,7 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, mystrftime(cnt, filepath, sizeof(filepath), snappath, currenttime_tm, NULL, 0); snprintf(filename, PATH_MAX, "%s.%s", filepath, imageext(cnt)); snprintf(fullfilename, PATH_MAX, "%s/%s", cnt->conf.filepath, filename); - put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); + put_image(cnt, fullfilename, imgdat, FTYPE_IMAGE_SNAPSHOT); /* * Update symbolic link *after* image has been written so that @@ -385,7 +406,7 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, } else { snprintf(fullfilename, PATH_MAX, "%s/lastsnap.%s", cnt->conf.filepath, imageext(cnt)); remove(fullfilename); - put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); + put_image(cnt, fullfilename, imgdat, FTYPE_IMAGE_SNAPSHOT); } cnt->snapshot = 0; @@ -491,16 +512,28 @@ static void event_create_extpipe(struct context *cnt, int type ATTRIBUTE_UNUSED, } static void event_extpipe_put(struct context *cnt, int type ATTRIBUTE_UNUSED, - unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, - void *dummy2 ATTRIBUTE_UNUSED, struct tm *tm ATTRIBUTE_UNUSED) + unsigned char *dummy1 ATTRIBUTE_UNUSED, char * dummy2 ATTRIBUTE_UNUSED, + void * eventdata, struct tm *tm ATTRIBUTE_UNUSED) { /* Check use_extpipe enabled and ext_pipe not NULL */ if ((cnt->conf.useextpipe) && (cnt->extpipe != NULL)) { MOTION_LOG(DBG, TYPE_EVENTS, NO_ERRNO, "%s:"); + struct image_data* imgdat = (struct image_data*)eventdata; + unsigned char* img; + int imgsize; + + if (imgdat->secondary_image && cnt->conf.extpipe_secondary) { + img = imgdat->secondary_image; + imgsize = cnt->imgs.secondary_size; + } + else { + img = imgdat->image; + imgsize = cnt->imgs.size; + } /* Check that is open */ if ((cnt->extpipe_open) && (fileno(cnt->extpipe) > 0)) { - if (!fwrite(img, cnt->imgs.size, 1, cnt->extpipe)) + if (!fwrite(img, imgsize, 1, cnt->extpipe)) MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, "%s: Error writting in pipe , state error %d", ferror(cnt->extpipe)); } else { @@ -536,13 +569,28 @@ static void grey2yuv420p(unsigned char *u, unsigned char *v, int width, int heig memset(v, 128, width * height / 4); } +#define FFMPEG_SELECT_IMAGE \ + int width; \ + int height; \ + unsigned char *img; \ + if (cnt->conf.ffmpeg_output_secondary && imgdat->secondary_image && cnt->imgs.secondary_type == SECONDARY_TYPE_RAW) { \ + width = cnt->imgs.secondary_width; \ + height = cnt->imgs.secondary_height; \ + img = imgdat->secondary_image; \ + } \ + else { \ + width = cnt->imgs.width; \ + height = cnt->imgs.height; \ + img = imgdat->image; \ + } static void event_ffmpeg_newfile(struct context *cnt, int type ATTRIBUTE_UNUSED, - unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, - void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) + unsigned char *dummy1 ATTRIBUTE_UNUSED, char *dummy2 ATTRIBUTE_UNUSED, + void *eventdata, struct tm *currenttime_tm) { - int width = cnt->imgs.width; - int height = cnt->imgs.height; + struct image_data* imgdat = (struct image_data*) eventdata; + FFMPEG_SELECT_IMAGE; + unsigned char *convbuf, *y, *u, *v; char stamp[PATH_MAX]; const char *moviepath; @@ -584,7 +632,7 @@ static void event_ffmpeg_newfile(struct context *cnt, int type ATTRIBUTE_UNUSED, if ((cnt->ffmpeg_output = ffmpeg_open((char *)cnt->conf.ffmpeg_video_codec, cnt->newfilename, y, u, v, - cnt->imgs.width, cnt->imgs.height, cnt->movie_fps, cnt->conf.ffmpeg_bps, + width, height, cnt->movie_fps, cnt->conf.ffmpeg_bps, cnt->conf.ffmpeg_vbr)) == NULL) { MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, "%s: ffopen_open error creating (new) file [%s]", cnt->newfilename); @@ -598,15 +646,15 @@ static void event_ffmpeg_newfile(struct context *cnt, int type ATTRIBUTE_UNUSED, if (cnt->conf.ffmpeg_output_debug) { if (cnt->imgs.type == VIDEO_PALETTE_GREY) { - convbuf = mymalloc((width * height) / 2); + convbuf = mymalloc((cnt->imgs.width * cnt->imgs.height) / 2); y = cnt->imgs.out; u = convbuf; - v = convbuf + (width * height) / 4; - grey2yuv420p(u, v, width, height); + v = convbuf + (cnt->imgs.width * cnt->imgs.height) / 4; + grey2yuv420p(u, v, cnt->imgs.width, cnt->imgs.height); } else { y = cnt->imgs.out; - u = cnt->imgs.out + width *height; - v = u + (width * height) / 4; + u = cnt->imgs.out + cnt->imgs.width * cnt->imgs.height; + v = u + (cnt->imgs.width * cnt->imgs.height) / 4; convbuf = NULL; } @@ -626,12 +674,12 @@ static void event_ffmpeg_newfile(struct context *cnt, int type ATTRIBUTE_UNUSED, } static void event_ffmpeg_timelapse(struct context *cnt, - int type ATTRIBUTE_UNUSED, unsigned char *img, - char *dummy1 ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, + int type ATTRIBUTE_UNUSED, unsigned char *dummy1 ATTRIBUTE_UNUSED, + char *dummy2 ATTRIBUTE_UNUSED, void *eventdata, struct tm *currenttime_tm) { - int width = cnt->imgs.width; - int height = cnt->imgs.height; + struct image_data* imgdat = (struct image_data*)eventdata; + FFMPEG_SELECT_IMAGE; unsigned char *convbuf, *y, *u, *v; if (!cnt->ffmpeg_timelapse) { @@ -667,7 +715,7 @@ static void event_ffmpeg_timelapse(struct context *cnt, if ((cnt->ffmpeg_timelapse = ffmpeg_open((char *)TIMELAPSE_CODEC, cnt->timelapsefilename, y, u, v, - cnt->imgs.width, cnt->imgs.height, 24, cnt->conf.ffmpeg_bps, + width, height, 24, cnt->conf.ffmpeg_bps, cnt->conf.ffmpeg_vbr)) == NULL) { MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, "%s: ffopen_open error creating " "(timelapse) file [%s]", cnt->timelapsefilename); @@ -696,12 +744,13 @@ static void event_ffmpeg_timelapse(struct context *cnt, } static void event_ffmpeg_put(struct context *cnt, int type ATTRIBUTE_UNUSED, - unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, - void *dummy2 ATTRIBUTE_UNUSED, struct tm *tm ATTRIBUTE_UNUSED) + unsigned char *dummy1 ATTRIBUTE_UNUSED, char *dummy2 ATTRIBUTE_UNUSED, + void * eventdata, struct tm *tm ATTRIBUTE_UNUSED) { if (cnt->ffmpeg_output) { - int width = cnt->imgs.width; - int height = cnt->imgs.height; + struct image_data* imgdat = (struct image_data*)eventdata; + FFMPEG_SELECT_IMAGE; + unsigned char *y = img; unsigned char *u, *v; diff --git a/ffmpeg-0.4.8-macosx.patch b/ffmpeg-0.4.8-macosx.patch deleted file mode 100644 index 875ae43..0000000 --- a/ffmpeg-0.4.8-macosx.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff -Naupr ffmpeg-0.4.8/configure ffmpeg-0.4.8-macosx/configure ---- ffmpeg-0.4.8/configure 2003-09-28 08:26:39.000000000 -0700 -+++ ffmpeg-0.4.8-macosx/configure 2005-10-06 15:49:33.000000000 -0700 -@@ -84,7 +84,7 @@ debug="yes" - extralibs="-lm" - simpleidct="yes" - bigendian="no" --vhook="default" -+vhook="no" - dlfcn="no" - dlopen="no" - mpegaudio_hp="yes" -@@ -163,6 +163,7 @@ extralibs="-lpoll -lgnugetopt -lm" - make="gmake" - ;; - Darwin) -+SLIBSUF=".dylib" - cc="cc" - v4l="no" - audio_oss="no" -@@ -177,13 +178,13 @@ FFSLDFLAGS=-Wl,-bind_at_load - gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)" - case "$gcc_version" in - *2.95*) --CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer" -+CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer" - ;; - *3.3*) --CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic -force_cpusubtype_ALL" -+CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic -force_cpusubtype_ALL" - ;; - *) --CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic" -+CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic" - ;; - esac - ;; -diff -Naupr ffmpeg-0.4.8/libavcodec/Makefile ffmpeg-0.4.8-macosx/libavcodec/Makefile ---- ffmpeg-0.4.8/libavcodec/Makefile 2003-09-28 08:26:39.000000000 -0700 -+++ ffmpeg-0.4.8-macosx/libavcodec/Makefile 2005-10-06 17:22:21.000000000 -0700 -@@ -239,6 +239,8 @@ install: - endif - - installlib: all install-headers -+ ranlib $(LIB) -+ install -d $(prefix)/lib - install -m 644 $(LIB) $(prefix)/lib - - install-headers: -diff -Naupr ffmpeg-0.4.8/libavformat/Makefile ffmpeg-0.4.8-macosx/libavformat/Makefile ---- ffmpeg-0.4.8/libavformat/Makefile 2003-09-28 08:26:40.000000000 -0700 -+++ ffmpeg-0.4.8-macosx/libavformat/Makefile 2005-10-06 15:42:53.000000000 -0700 -@@ -102,6 +102,7 @@ install: - endif - - installlib: all install-headers -+ ranlib $(LIB) - install -m 644 $(LIB) $(prefix)/lib - - install-headers: diff --git a/ffmpeg.c b/ffmpeg.c index 1c2ae47..57eeda4 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1000,7 +1000,7 @@ void ffmpeg_deinterlace(unsigned char *img, int width, int height) /* We assume using 'PIX_FMT_YUV420P' always */ avpicture_deinterlace(&picture, &picture, PIX_FMT_YUV420P, width, height); -#ifndef __SSE_MATH__ +#if !defined(__SSE_MATH__) && (defined(__i386__) || defined(__x86_64__)) __asm__ __volatile__ ( "emms"); #endif diff --git a/filecam.c b/filecam.c new file mode 100644 index 0000000..20d508e --- /dev/null +++ b/filecam.c @@ -0,0 +1,74 @@ +/* + * filecam.c + * + * Created on: 16 Jun 2013 + * Author: ntuckett + */ + +#include "motion.h" +#include "rotate.h" + +int filecam_start (struct context *cnt) +{ + filecam_context_ptr filecam; + + filecam = mymalloc(sizeof(filecam_context)); + memset(filecam, 0, sizeof(filecam_context)); + cnt->filecam = filecam; + filecam->cnt = cnt; + + filecam->capture_file = fopen(cnt->conf.filecam_path, "rb"); + if (filecam->capture_file == NULL) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: filecam capture file %s could not be opened", cnt->conf.filecam_path); + return -1; + } + + cnt->imgs.width = cnt->conf.width; + cnt->imgs.height = cnt->conf.height; + cnt->imgs.size = (cnt->conf.width * cnt->conf.height * 3) / 2; + cnt->imgs.motionsize = cnt->conf.width * cnt->conf.height; + cnt->imgs.type = VIDEO_PALETTE_YUV420P; + + return 0; +} + +int filecam_next (struct context *cnt, struct image_data* imgdat) +{ + if (!cnt || !cnt->filecam) { + return NETCAM_FATAL_ERROR; + } + + filecam_context_ptr filecam = cnt->filecam; + + if (filecam->capture_file) { + if (fread(imgdat->image, 1, cnt->imgs.size, filecam->capture_file)) { + if (cnt->rotate_data.degrees > 0) + rotate_map(cnt, imgdat->image); + } + else { + raise(SIGQUIT); + } + } + + return 0; +} + +void filecam_cleanup (struct context *cnt) +{ + filecam_context_ptr filecam = cnt->filecam; + + if (filecam != NULL) { + if (filecam->capture_file) { + fclose(filecam->capture_file); + } + + free(filecam); + } +} + +void filecam_select_as_plugin(struct context *cnt) { + cnt->video_source.video_source_start_fn = filecam_start; + cnt->video_source.video_source_next_fn = filecam_next; + cnt->video_source.video_source_cleanup_fn = filecam_cleanup; +} + diff --git a/filecam.h b/filecam.h new file mode 100644 index 0000000..ac4b945 --- /dev/null +++ b/filecam.h @@ -0,0 +1,21 @@ +/* + * filecam.h + * + * Created on: 16 Jun 2013 + * Author: ntuckett + */ + +#ifndef FILECAM_H_ +#define FILECAM_H_ + +typedef struct filecam_context *filecam_context_ptr; + +typedef struct filecam_context { + struct context *cnt; /* pointer to parent motion + context structure */ + FILE *capture_file; +} filecam_context; + +extern void filecam_select_as_plugin(struct context *); + +#endif /* FILECAM_H_ */ diff --git a/git-commit-version.sh b/git-commit-version.sh deleted file mode 100755 index 2a47df1..0000000 --- a/git-commit-version.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -SNV_VERSION=`git show -s --format=%H` -echo -n "Git-$SNV_VERSION" - diff --git a/metrics.c b/metrics.c new file mode 100644 index 0000000..0908737 --- /dev/null +++ b/metrics.c @@ -0,0 +1,38 @@ +/* + * metrics.c + * + * Created on: 22 Jun 2013 + * Author: ntuckett + */ +#include +#include +#include "utils.h" +#include "logger.h" + +#define METRIC_NAME_MAX_LEN 256 + +static int cumulative_time = 0; +static int start_time_stamp = 0; +static char metric_name_buffer[METRIC_NAME_MAX_LEN] = ""; + +void cumulative_time_metric_start(const char *metric_name) +{ + if (!metric_name_buffer[0]) { + strncpy(metric_name_buffer, metric_name, METRIC_NAME_MAX_LEN); + metric_name_buffer[METRIC_NAME_MAX_LEN - 1] = 0; + } + + start_time_stamp = get_elapsed_time_ms(); +} + +void cumulative_time_metric_stop(const char *metric_name) +{ + cumulative_time += get_elapsed_time_ms() - start_time_stamp; +} + +void metrics_report() +{ + if (metric_name_buffer[0]) { + MOTION_LOG(NTC, TYPE_CORE, NO_ERRNO, "%s: metric %s: %d ms\n", metric_name_buffer, cumulative_time); + } +} diff --git a/metrics.h b/metrics.h new file mode 100644 index 0000000..34ef8ef --- /dev/null +++ b/metrics.h @@ -0,0 +1,16 @@ +/* + * metrics.h + * + * Created on: 22 Jun 2013 + * Author: ntuckett + */ + +#ifndef METRICS_H_ +#define METRICS_H_ + +extern void cumulative_time_metric_start(const char *metric_name); +extern void cumulative_time_metric_stop(const char *metric_name); + +extern void metrics_report(); + +#endif /* METRICS_H_ */ diff --git a/mmalcam.c b/mmalcam.c new file mode 100644 index 0000000..d1e9e3a --- /dev/null +++ b/mmalcam.c @@ -0,0 +1,792 @@ +/* + * mmalcam.c + * + * Raspberry Pi camera module using MMAL API. + * + * Built upon functionality from the Raspberry Pi userland utility raspivid. + * + * Copyright 2013 by Nicholas Tuckett + * This software is distributed under the GNU public license version 2 + * See also the file 'COPYING'. + * + */ + +#include "bcm_host.h" +#include "interface/vcos/vcos.h" +#include "interface/mmal/mmal.h" +#include "interface/mmal/mmal_buffer.h" +#include "interface/mmal/mmal_port.h" +#include "interface/mmal/util/mmal_util.h" +#include "interface/mmal/util/mmal_util_params.h" +#include "interface/mmal/util/mmal_default_components.h" +#include "interface/mmal/util/mmal_connection.h" +#include "raspicam/RaspiCamControl.h" + +#include "motion.h" +#include "rotate.h" +#include "utils.h" + +#define MMALCAM_OK 0 +#define MMALCAM_ERROR -1 + +#define MMAL_CAMERA_PREVIEW_PORT 0 +#define MMAL_CAMERA_VIDEO_PORT 1 +#define MMAL_CAMERA_STILLS_PORT 2 +#define VIDEO_FRAME_RATE_NUM 30 +#define VIDEO_FRAME_RATE_DEN 1 +#define VIDEO_OUTPUT_BUFFERS_NUM 3 + +#define STILL_PREVIEW_WIDTH 320 +#define STILL_PREVIEW_HEIGHT 240 +#define STILL_FRAME_RATE_NUM 15 +#define STILL_FRAME_RATE_DEN 1 +#define STILL_FIRST_FRAME_DELAY_MS 2500 +#define PREVIEW_FRAME_RATE_NUM 30 +#define PREVIEW_FRAME_RATE_DEN 1 + +enum +{ + CAPTURE_MODE_VIDEO = 1, + CAPTURE_MODE_STILL = 2, +}; + +static void parse_camera_control_params(const char *control_params_str, RASPICAM_CAMERA_PARAMETERS *camera_params) +{ + char *control_params_tok = alloca(strlen(control_params_str) + 1); + strcpy(control_params_tok, control_params_str); + + char *next_param = strtok(control_params_tok, " "); + + while (next_param != NULL) { + char *param_val = strtok(NULL, " "); + if (raspicamcontrol_parse_cmdline(camera_params, next_param + 1, param_val) < 2) { + next_param = param_val; + } else { + next_param = strtok(NULL, " "); + } + } +} + +static void check_disable_port(MMAL_PORT_T *port) +{ + if (port && port->is_enabled) { + mmal_port_disable(port); + } +} + +static void camera_control_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) +{ + if (buffer->cmd != MMAL_EVENT_PARAMETER_CHANGED) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "Received unexpected camera control callback event, 0x%08x", + buffer->cmd); + } + + mmal_buffer_header_release(buffer); +} + +static void set_port_format(int width, int height, MMAL_ES_FORMAT_T *format) +{ + format->encoding = MMAL_ENCODING_OPAQUE; + format->encoding_variant = MMAL_ENCODING_I420; + format->es->video.width = width; + format->es->video.height = height; + format->es->video.crop.x = 0; + format->es->video.crop.y = 0; + format->es->video.crop.width = width; + format->es->video.crop.height = height; +} + +static void set_video_port_format(mmalcam_context_ptr mmalcam, MMAL_ES_FORMAT_T *format) +{ + set_port_format(mmalcam->width, mmalcam->height, format); + format->es->video.frame_rate.num = mmalcam->framerate; + format->es->video.frame_rate.den = VIDEO_FRAME_RATE_DEN; +} + +static MMAL_STATUS_T connect_ports(MMAL_PORT_T *source_port, MMAL_PORT_T *sink_port, MMAL_CONNECTION_T **connection) +{ + MMAL_STATUS_T status; + + status = mmal_connection_create(connection, source_port, sink_port, MMAL_CONNECTION_FLAG_TUNNELLING | MMAL_CONNECTION_FLAG_ALLOCATION_ON_INPUT); + + if (status == MMAL_SUCCESS) { + status = mmal_connection_enable(*connection); + if (status != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Unable to enable connection: error %d", status); + mmal_connection_destroy(*connection); + } + } + else { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Unable to create connection: error %d", status); + } + + return status; +} + +static int create_splitter_component(mmalcam_context_ptr mmalcam, MMAL_PORT_T *source_port) +{ + MMAL_STATUS_T status; + MMAL_COMPONENT_T *splitter_component; + MMAL_PORT_T *input_port; + + status = mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_SPLITTER, &splitter_component); + + if (status != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Failed to create splitter component"); + goto error; + } + + input_port = splitter_component->input[0]; + mmal_format_copy(input_port->format, source_port->format); + input_port->buffer_num = 3; + status = mmal_port_format_commit(input_port); + if (status != MMAL_SUCCESS) + { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s:Couldn't set splitter input port format : error %d", status); + goto error; + } + + for(int i = 0; i < splitter_component->output_num; i++) + { + MMAL_PORT_T *output_port = splitter_component->output[i]; + output_port->buffer_num = 3; + mmal_format_copy(output_port->format,input_port->format); + status = mmal_port_format_commit(output_port); + if (status != MMAL_SUCCESS) + { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s:Couldn't set splitter output port format : error %d", status); + goto error; + } + } + + mmalcam->splitter_component = splitter_component; + return MMALCAM_OK; + + error: + if (splitter_component) { + mmal_component_destroy(splitter_component); + } + return MMALCAM_ERROR; +} + +static int create_resize_component(mmalcam_context_ptr mmalcam, MMAL_PORT_T *source_port, int width, int height) +{ + MMAL_STATUS_T status; + MMAL_COMPONENT_T *resize_component; + MMAL_PORT_T *input_port; + + status = mmal_component_create("vc.ril.resize", &resize_component); + + if (status != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Failed to create resize component"); + goto error; + } + + input_port = resize_component->input[0]; + mmal_format_copy(input_port->format, source_port->format); + input_port->buffer_num = 3; + status = mmal_port_format_commit(input_port); + if (status != MMAL_SUCCESS) + { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s:Couldn't set resize input port format : error %d", status); + goto error; + } + + MMAL_PORT_T *output_port = resize_component->output[0]; + output_port->buffer_num = 3; + mmal_format_copy(output_port->format,input_port->format); + output_port->format->es->video.width = width; + output_port->format->es->video.height = height; + output_port->format->es->video.crop.x = 0; + output_port->format->es->video.crop.y = 0; + output_port->format->es->video.crop.width = width; + output_port->format->es->video.crop.height = height; + + status = mmal_port_format_commit(output_port); + if (status != MMAL_SUCCESS) + { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s:Couldn't set resize output port format : error %d", status); + goto error; + } + + mmalcam->resize_component = resize_component; + return MMALCAM_OK; + + error: + if (resize_component) { + mmal_component_destroy(resize_component); + } + return MMALCAM_ERROR; +} + +static int create_jpeg_component(mmalcam_context_ptr mmalcam) +{ + MMAL_STATUS_T status; + MMAL_COMPONENT_T *jpeg_component; + MMAL_PORT_T *input_port; + MMAL_PORT_T *output_port; + + status = mmal_component_create(MMAL_COMPONENT_DEFAULT_IMAGE_ENCODER, &jpeg_component); + + if (status != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Failed to create jpeg component"); + goto error; + } + + input_port = jpeg_component->input[0]; + output_port = jpeg_component->output[0]; + mmal_format_copy(output_port->format, input_port->format); + + output_port->format->encoding = MMAL_ENCODING_JPEG; + output_port->buffer_size = output_port->buffer_size_recommended; + output_port->buffer_num = output_port->buffer_num_recommended; + + if (output_port->buffer_size < output_port->buffer_size_min) + { + output_port->buffer_size = output_port->buffer_size_min; + } + if (output_port->buffer_num < output_port->buffer_num_min) + { + output_port->buffer_num = output_port->buffer_num_min; + } + + status = mmal_port_format_commit(output_port); + if (status != MMAL_SUCCESS) + { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s:Couldn't set jpeg output port format : error %d", status); + goto error; + } + + status = mmal_port_parameter_set_uint32(output_port, MMAL_PARAMETER_JPEG_Q_FACTOR, mmalcam->cnt->conf.mmalcam_buffer2_jpeg); + if (status != MMAL_SUCCESS) + { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s:Couldn't set jpeg quality : error %d", status); + goto error; + } + + mmalcam->jpeg_component = jpeg_component; + return MMALCAM_OK; + + error: + if (jpeg_component) { + mmal_component_destroy(jpeg_component); + } + return MMALCAM_ERROR; +} + +static void destroy_components(mmalcam_context_ptr mmalcam); +static int create_camera_component(mmalcam_context_ptr mmalcam, const char *mmalcam_name, int capture_mode) +{ + MMAL_STATUS_T status; + MMAL_COMPONENT_T *camera_component; + MMAL_PORT_T *capture_port = NULL; + + status = mmal_component_create(mmalcam_name, &camera_component); + + if (status != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "Failed to create MMAL camera component %s", mmalcam_name); + goto error; + } + + if (camera_component->output_num == 0) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "MMAL camera %s doesn't have output ports", mmalcam_name); + goto error; + } + + status = mmal_port_enable(camera_component->control, camera_control_callback); + + if (status) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "Unable to enable control port : error %d", status); + goto error; + } + + // set up the camera configuration + MMAL_PARAMETER_CAMERA_CONFIG_T cam_config = { + { MMAL_PARAMETER_CAMERA_CONFIG, sizeof(cam_config) }, + .max_stills_w = mmalcam->width, + .max_stills_h = mmalcam->height, + .stills_yuv422 = 0, + .one_shot_stills = capture_mode == CAPTURE_MODE_STILL ? 1 : 0, + .max_preview_video_w = mmalcam->width, // these must match the chosen resolution otherwise + .max_preview_video_h = mmalcam->height, // video capture does not work + .num_preview_video_frames = 3, + .stills_capture_circular_buffer_height = 0, + .fast_preview_resume = 0, + .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RESET_STC }; + + mmal_port_parameter_set(camera_component->control, &cam_config.hdr); + raspicamcontrol_set_all_parameters(camera_component, mmalcam->camera_parameters); + + MMAL_PORT_T *preview_port = camera_component->output[MMAL_CAMERA_PREVIEW_PORT]; + + switch(capture_mode) + { + case CAPTURE_MODE_VIDEO: + { + set_video_port_format(mmalcam, preview_port->format); + if (mmal_port_format_commit(preview_port)) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "camera setup couldn't configure preview"); + goto error; + } + + capture_port = camera_component->output[MMAL_CAMERA_VIDEO_PORT]; + set_video_port_format(mmalcam, capture_port->format); + capture_port->format->encoding = MMAL_ENCODING_I420; + status = mmal_port_format_commit(capture_port); + + MMAL_PORT_T *stills_port = camera_component->output[MMAL_CAMERA_STILLS_PORT]; + mmal_format_full_copy(stills_port->format, preview_port->format); + stills_port->format->es->video.frame_rate.num = 1; + stills_port->format->es->video.frame_rate.den = 1; + if (mmal_port_format_commit(stills_port)) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "video camera setup couldn't configure (unused) still port"); + goto error; + } + break; + } + + case CAPTURE_MODE_STILL: + { + set_port_format(STILL_PREVIEW_WIDTH, STILL_PREVIEW_HEIGHT, preview_port->format); + preview_port->format->es->video.frame_rate.num = PREVIEW_FRAME_RATE_NUM; + preview_port->format->es->video.frame_rate.den = PREVIEW_FRAME_RATE_DEN; + if (mmal_port_format_commit(preview_port)) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "camera setup couldn't configure preview"); + goto error; + } + + capture_port = camera_component->output[MMAL_CAMERA_STILLS_PORT]; + set_port_format(mmalcam->width, mmalcam->height, capture_port->format); + capture_port->format->encoding = MMAL_ENCODING_I420; + capture_port->format->es->video.frame_rate.num = STILL_FRAME_RATE_NUM; + capture_port->format->es->video.frame_rate.den = STILL_FRAME_RATE_DEN; + + // Duplicate preview format onto unused video port + mmal_format_full_copy(camera_component->output[MMAL_CAMERA_VIDEO_PORT]->format, preview_port->format); + if (mmal_port_format_commit(camera_component->output[MMAL_CAMERA_VIDEO_PORT])) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "still camera setup couldn't configure (unused) video port"); + goto error; + } + + status = mmal_port_format_commit(capture_port); + break; + } + } + + if (status) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "camera video format couldn't be set"); + goto error; + } + + // Ensure there are enough buffers to avoid dropping frames + if (capture_port->buffer_num < VIDEO_OUTPUT_BUFFERS_NUM) { + capture_port->buffer_num = VIDEO_OUTPUT_BUFFERS_NUM; + } + + status = mmal_component_enable(camera_component); + + if (status) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "camera component couldn't be enabled"); + goto error; + } + + // Create a null sink for preview + MMAL_COMPONENT_T *null_sink = NULL; + if (capture_mode == CAPTURE_MODE_STILL) { + status = mmal_component_create("vc.null_sink", &null_sink); + if (status) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "null sink component couldn't be created"); + goto error; + } + + status = mmal_component_enable(null_sink); + if (status) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "null_sink component couldn't be enabled"); + goto error; + } + + status = connect_ports(camera_component->output[MMAL_CAMERA_PREVIEW_PORT], + null_sink->input[0], + &mmalcam->preview_connection); + if (status) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "preview connection setup failed"); + goto error; + } + } + + mmalcam->camera_component = camera_component; + mmalcam->preview_component = null_sink; + mmalcam->camera_capture_port = capture_port; + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "MMAL camera component created"); + return MMALCAM_OK; + + error: + if (null_sink) { + mmal_component_destroy(null_sink); + } + if (camera_component) { + mmal_component_destroy(camera_component); + } + return MMALCAM_ERROR; +} + +static void disable_components_and_ports(mmalcam_context_ptr mmalcam) +{ + if (mmalcam->jpeg_connection) { + mmal_connection_destroy(mmalcam->jpeg_connection); + mmalcam->jpeg_connection = NULL; + } + + if (mmalcam->splitter_connection) { + mmal_connection_destroy(mmalcam->splitter_connection); + mmalcam->splitter_connection = NULL; + } + + if (mmalcam->resize_connection) { + mmal_connection_destroy(mmalcam->resize_connection); + mmalcam->resize_connection = NULL; + } + + if (mmalcam->preview_connection) { + mmal_connection_destroy(mmalcam->preview_connection); + mmalcam->preview_connection = NULL; + } + + check_disable_port(mmalcam->camera_component->output[MMAL_CAMERA_VIDEO_PORT]); + check_disable_port(mmalcam->camera_component->output[MMAL_CAMERA_STILLS_PORT]); + + if (mmalcam->jpeg_component) { + mmal_component_disable(mmalcam->jpeg_component); + } + + if (mmalcam->splitter_component) { + mmal_component_disable(mmalcam->splitter_component); + } + + if (mmalcam->resize_component) { + mmal_component_disable(mmalcam->resize_component); + } + + if (mmalcam->preview_component) { + mmal_component_disable(mmalcam->preview_component); + } + + if (mmalcam->camera_component) { + mmal_component_disable(mmalcam->camera_component); + } +} + +static void destroy_components(mmalcam_context_ptr mmalcam) +{ + if (mmalcam->jpeg_component) { + mmal_component_destroy(mmalcam->jpeg_component); + mmalcam->jpeg_component = NULL; + } + if (mmalcam->splitter_component) { + mmal_component_destroy(mmalcam->splitter_component); + mmalcam->splitter_component = NULL; + } + if (mmalcam->resize_component) { + mmal_component_destroy(mmalcam->resize_component); + mmalcam->resize_component = NULL; + } + if (mmalcam->preview_component) { + mmal_component_destroy(mmalcam->preview_component); + mmalcam->preview_component = NULL; + } + if (mmalcam->camera_component) { + mmal_component_destroy(mmalcam->camera_component); + mmalcam->camera_component = NULL; + } +} + +/** + * mmalcam_start + * + * This routine is called from the main motion thread. It's job is + * to open up the requested camera device via MMAL and do any required + * initialisation. + * + * Parameters: + * + * cnt Pointer to the motion context structure for this device. + * + * Returns: 0 on success + * -1 on any failure + */ + +int mmalcam_start(struct context *cnt) +{ + mmalcam_context_ptr mmalcam; + + cnt->mmalcam = (mmalcam_context*) mymalloc(sizeof(struct mmalcam_context)); + memset(cnt->mmalcam, 0, sizeof(mmalcam_context)); + mmalcam = cnt->mmalcam; + mmalcam->cnt = cnt; + + MOTION_LOG(ALR, TYPE_VIDEO, NO_ERRNO, + "%s: MMAL Camera thread starting... for camera (%s) of %d x %d at %d fps", + cnt->conf.mmalcam_name, cnt->conf.width, cnt->conf.height, cnt->conf.frame_limit); + + mmalcam->camera_parameters = (RASPICAM_CAMERA_PARAMETERS*)malloc(sizeof(RASPICAM_CAMERA_PARAMETERS)); + if (mmalcam->camera_parameters == NULL) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "camera params couldn't be allocated"); + return MMALCAM_ERROR; + } + + raspicamcontrol_set_defaults(mmalcam->camera_parameters); + mmalcam->width = cnt->conf.width; + mmalcam->height = cnt->conf.height; + mmalcam->framerate = cnt->conf.frame_limit; + + if (mmalcam->width & 15) { + mmalcam->width += 16 - (mmalcam->width & 15); + } + + if (mmalcam->height & 15) { + mmalcam->height += 16 - (mmalcam->height & 15); + } + + if (cnt->conf.mmalcam_control_params) { + parse_camera_control_params(cnt->conf.mmalcam_control_params, mmalcam->camera_parameters); + } + + int capture_mode; + + if (cnt->conf.mmalcam_use_still) { + MOTION_LOG(ALR, TYPE_VIDEO, NO_ERRNO, "%s: MMAL Camera using still capture"); + capture_mode = CAPTURE_MODE_STILL; + + if (cnt->conf.minimum_frame_time > 0) { + mmalcam->still_capture_delay_ms = cnt->conf.minimum_frame_time * 1000; + } + else { + mmalcam->still_capture_delay_ms = 1000 / cnt->conf.frame_limit; + } + } + else { + MOTION_LOG(ALR, TYPE_VIDEO, NO_ERRNO, "%s: MMAL Camera using video capture"); + capture_mode = CAPTURE_MODE_VIDEO; + } + + cnt->imgs.width = mmalcam->width; + cnt->imgs.height = mmalcam->height; + cnt->imgs.size = (mmalcam->width * mmalcam->height * 3) / 2; + cnt->imgs.motionsize = mmalcam->width * mmalcam->height; + cnt->imgs.type = VIDEO_PALETTE_YUV420P; + + if (cnt->conf.mmalcam_buffer2_upscale > 0) { + cnt->imgs.secondary_type = SECONDARY_TYPE_RAW; + cnt->imgs.secondary_width = mmalcam->width * cnt->conf.mmalcam_buffer2_upscale; + cnt->imgs.secondary_height = mmalcam->height * cnt->conf.mmalcam_buffer2_upscale; + cnt->imgs.secondary_size = (cnt->imgs.secondary_width * cnt->imgs.secondary_height * 3) / 2; + + mmalcam->width *= cnt->conf.mmalcam_buffer2_upscale; + mmalcam->height *= cnt->conf.mmalcam_buffer2_upscale; + } + + int retval = create_camera_component(mmalcam, cnt->conf.mmalcam_name, capture_mode); + + if (cnt->imgs.secondary_size) + { + if (retval == 0) { + retval = create_splitter_component(mmalcam, mmalcam->camera_capture_port); + + if (retval == 0) { + retval = connect_ports(mmalcam->camera_capture_port, mmalcam->splitter_component->input[0], &mmalcam->splitter_connection); + } + } + + if (retval == 0) { + retval = create_resize_component(mmalcam, mmalcam->splitter_component->output[1], cnt->imgs.width, cnt->imgs.height); + + if (retval == 0) { + retval = connect_ports(mmalcam->splitter_component->output[1], mmalcam->resize_component->input[0], &mmalcam->resize_connection); + } + } + + if (retval == 0) { + retval = mmal_output_init("mmalcam", &mmalcam->camera_output, mmalcam->resize_component->output[0], 0); + } + + if (retval == 0) { + if (cnt->conf.mmalcam_buffer2_jpeg > 0) { + retval = create_jpeg_component(mmalcam); + + if (retval == 0) { + retval = connect_ports(mmalcam->splitter_component->output[0], mmalcam->jpeg_component->input[0], &mmalcam->jpeg_connection); + + if (retval == 0) { + retval = mmal_output_init("secondary", &mmalcam->secondary_output, mmalcam->jpeg_component->output[0], MMAL_OUTPUT_INCREMENTAL); + + if (retval == 0) { + cnt->imgs.secondary_type = SECONDARY_TYPE_JPEG; + } + } + } + } + else { + retval = mmal_output_init("secondary", &mmalcam->secondary_output, mmalcam->splitter_component->output[0], 0); + } + } + + if (retval == 0) { + if (mmal_output_enable(&mmalcam->secondary_output)) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "MMAL resize output enabling failed"); + retval = MMALCAM_ERROR; + } + } + } + else { + if (retval == 0) { + retval = mmal_output_init("mmalcam", &mmalcam->camera_output, mmalcam->camera_capture_port, 0); + } + } + + if (retval == 0) { + if (mmal_output_enable(&mmalcam->camera_output)) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "MMAL camera output enabling failed"); + retval = MMALCAM_ERROR; + } + } + + if (retval == 0) { + if (mmal_port_parameter_set_boolean(mmalcam->camera_capture_port, MMAL_PARAMETER_CAPTURE, 1) + != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "MMAL camera capture start failed"); + retval = MMALCAM_ERROR; + } + if (capture_mode == CAPTURE_MODE_STILL) { + // Allow exposure to stabilise for first frame + vcos_sleep(STILL_FIRST_FRAME_DELAY_MS); + } + mmalcam->last_still_capture_time_ms = get_elapsed_time_ms(); + } + + if (retval == 0) { + retval = mmal_output_send_buffers_to_port(&mmalcam->camera_output); + } + + if (retval == 0 && cnt->imgs.secondary_size) { + retval = mmal_output_send_buffers_to_port(&mmalcam->secondary_output); + } + + if (retval == 0) { + if (mmalcam->cnt->conf.mmalcam_raw_capture_file) { + mmalcam->raw_capture_file = fopen(mmalcam->cnt->conf.mmalcam_raw_capture_file, "wb"); + if (mmalcam->raw_capture_file == NULL) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: MMAL couldn't open raw capture file %s", mmalcam->cnt->conf.mmalcam_raw_capture_file); + } + } + } + return retval; +} + +/** + * mmalcam_cleanup + * + * This routine shuts down any MMAL resources, then releases any allocated data + * within the mmalcam context and frees the context itself. + * This function is also called from motion_init if first time connection + * fails and we start retrying until we get a valid first frame from the + * camera. + * + * Parameters: + * + * mmalcam Pointer to a mmalcam context + * + * Returns: Nothing. + * + */ +void mmalcam_cleanup(struct context *cnt) +{ + mmalcam_context *mmalcam = cnt->mmalcam; + + MOTION_LOG(ALR, TYPE_VIDEO, NO_ERRNO, "MMAL Camera cleanup"); + + if (mmalcam != NULL ) { + + disable_components_and_ports(mmalcam); + mmal_output_deinit(&mmalcam->camera_output); + mmal_output_deinit(&mmalcam->secondary_output); + destroy_components(mmalcam); + + if (mmalcam->camera_parameters) { + free(mmalcam->camera_parameters); + } + + if (mmalcam->raw_capture_file) { + fclose(mmalcam->raw_capture_file); + } + + free(mmalcam); + } +} + +/** + * mmalcam_next + * + * This routine is called when the main 'motion' thread wants a new + * frame of video. It fetches the most recent frame available from + * the Pi camera already in YUV420P, and returns it to motion. + * + * Parameters: + * cnt Pointer to the context for this thread + * map Pointer to a buffer for the returned image + * imgdat Pointer + * + * Returns: Error code + */ +int mmalcam_next(struct context *cnt, struct image_data* imgdat) +{ + mmalcam_context_ptr mmalcam; + + if ((!cnt) || (!cnt->mmalcam)) + return NETCAM_FATAL_ERROR; + + mmalcam = cnt->mmalcam; + + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: mmalcam_next - start"); + mmal_output_process_buffer(&mmalcam->camera_output, imgdat->image, cnt->imgs.size); + + if (cnt->imgs.secondary_size && imgdat != NULL) { + imgdat->secondary_size = mmal_output_process_buffer(&mmalcam->secondary_output, imgdat->secondary_image, cnt->imgs.secondary_size); + } + + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: mmalcam_next - buffer processing completed"); + + if (mmalcam->cnt->conf.mmalcam_use_still) { + int curr_time = get_elapsed_time_ms(); + int capture_time_delta = curr_time - mmalcam->last_still_capture_time_ms; + if (capture_time_delta < mmalcam->still_capture_delay_ms) + { + vcos_sleep(mmalcam->still_capture_delay_ms - capture_time_delta); + } + + // According to RaspiCam source, may need to set shutter speed each time + mmal_port_parameter_set_uint32(mmalcam->camera_component->control, MMAL_PARAMETER_SHUTTER_SPEED, + mmalcam->camera_parameters->shutter_speed); + if (mmal_port_parameter_set_boolean(mmalcam->camera_capture_port, MMAL_PARAMETER_CAPTURE, 1) + != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: MMAL camera capture start failed"); + } + + mmalcam->last_still_capture_time_ms = curr_time; + } + + if (mmalcam->raw_capture_file) { + fwrite(imgdat->image, 1, cnt->imgs.size, mmalcam->raw_capture_file); + } + + if (cnt->rotate_data.degrees > 0) + rotate_map(cnt, imgdat->image); + + return 0; +} + +void mmalcam_select_as_plugin(struct context *cnt) +{ + cnt->video_source.video_source_start_fn = mmalcam_start; + cnt->video_source.video_source_next_fn = mmalcam_next; + cnt->video_source.video_source_cleanup_fn = mmalcam_cleanup; +} diff --git a/mmalcam.h b/mmalcam.h new file mode 100644 index 0000000..c56d747 --- /dev/null +++ b/mmalcam.h @@ -0,0 +1,48 @@ +/* + * mmalcam.h + * + * Include file for mmalcam.c + * + * Copyright 2013 by Nicholas Tuckett + * This software is distributed under the GNU public license version 2 + * See also the file 'COPYING'. + */ + +#ifndef MMALCAM_H_ +#define MMALCAM_H_ + +#include "mmaloutput.h" + +typedef struct mmalcam_context *mmalcam_context_ptr; +struct MMAL_BUFFER_HEADER_T; + +typedef struct mmalcam_context { + struct context *cnt; /* pointer to parent motion + context structure */ + int width; + int height; + int framerate; + int last_still_capture_time_ms; + int still_capture_delay_ms; + FILE *raw_capture_file; + + struct MMAL_COMPONENT_T *camera_component; + struct MMAL_PORT_T *camera_capture_port; + struct RASPICAM_CAMERA_PARAMETERS *camera_parameters; + struct MMAL_COMPONENT_T *preview_component; + struct MMAL_CONNECTION_T *preview_connection; + struct MMAL_COMPONENT_T *splitter_component; + struct MMAL_CONNECTION_T *splitter_connection; + struct MMAL_COMPONENT_T *resize_component; + struct MMAL_CONNECTION_T *resize_connection; + struct MMAL_COMPONENT_T *jpeg_component; + struct MMAL_CONNECTION_T *jpeg_connection; + + struct mmal_output camera_output; + struct mmal_output secondary_output; + +} mmalcam_context; + +extern void mmalcam_select_as_plugin(struct context *); + +#endif /* MMALCAM_H_ */ diff --git a/mmaloutput.c b/mmaloutput.c new file mode 100644 index 0000000..13093a5 --- /dev/null +++ b/mmaloutput.c @@ -0,0 +1,166 @@ +/* + * mmaloutput.c + * + * Created on: 13 Apr 2014 + * Author: ntuckett + */ +#include "bcm_host.h" +#include "interface/vcos/vcos.h" +#include "interface/mmal/mmal.h" +#include "interface/mmal/mmal_buffer.h" +#include "interface/mmal/mmal_port.h" +#include "interface/mmal/util/mmal_util.h" +#include "interface/mmal/util/mmal_util_params.h" +#include "interface/mmal/util/mmal_default_components.h" +#include "interface/mmal/util/mmal_connection.h" +#include "mmaloutput.h" +#include "motion.h" + +static void buffer_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) +{ + mmal_output* output = (mmal_output*) port->userdata; + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: Output %s: buffer_callback - entry", output->name); + mmal_queue_put(output->buffer_queue, buffer); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: Output %s: buffer_callback - exit", output->name); +} + +int mmal_output_init(const char* name, mmal_output* output, struct MMAL_PORT_T* port, int flags) +{ + memset(output, 0, sizeof(mmal_output)); + + strncpy(output->name, name, MMAL_OUTPUT_NAME_LEN); + output->name[MMAL_OUTPUT_NAME_LEN] = 0; + output->flags = flags; + + output->buffer_pool = mmal_pool_create(port->buffer_num, port->buffer_size); + if (output->buffer_pool == NULL) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: MMAL Output %s: buffer pool creation failed", output->name); + mmal_output_deinit(output); + return -1; + } + + output->buffer_queue = mmal_queue_create(); + if (output->buffer_queue == NULL ) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: MMAL Output %s: buffer queue creation failed", output->name); + mmal_output_deinit(output); + return -1; + } + + output->port = port; + return 0; +} + +int mmal_output_enable(mmal_output* output) +{ + output->port->userdata = (struct MMAL_PORT_USERDATA_T*) output; + MMAL_STATUS_T status = mmal_port_enable(output->port, buffer_callback); + + if (status) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Unable to enable output %s port : error %d", output->name, status); + return -1; + } + + return 0; +} + +int mmal_output_send_buffers_to_port(mmal_output* output) +{ + int num = mmal_queue_length(output->buffer_pool->queue); + + for (int i = 0; i < num; i++) { + MMAL_BUFFER_HEADER_T *buffer = mmal_queue_get(output->buffer_pool->queue); + + if (!buffer) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Output %s: Unable to get a required buffer %d from pool queue", output->name, i); + return -1; + } + + if (mmal_port_send_buffer(output->port, buffer) != MMAL_SUCCESS) { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Output %s: Unable to send a buffer to port (%d)", output->name, i); + return -1; + } + } + + return 0; +} + +size_t mmal_output_process_buffer(mmal_output* output, void* dest, size_t size) +{ + int buffer_complete = 0; + size_t buffer_progress = 0; + char* buffer_dest = (char*)dest; + + do { + MMAL_BUFFER_HEADER_T *buffer = mmal_queue_wait(output->buffer_queue); + + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: Output %s - got buffer", output->name); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: cmd %d flags %08x size %d/%d at %08x", + buffer->cmd, buffer->flags, buffer->length, buffer->alloc_size, buffer->data); + if (output->flags & MMAL_OUTPUT_INCREMENTAL) { + if (buffer->cmd == 0) { + if (size >= buffer_progress + buffer->length) { + mmal_buffer_header_mem_lock(buffer); + memcpy(buffer_dest + buffer_progress, buffer->data, buffer->length); + mmal_buffer_header_mem_unlock(buffer); + buffer_progress += buffer->length; + buffer_complete = buffer->flags & MMAL_BUFFER_HEADER_FLAG_FRAME_END; + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: buffer progress %d/%d", buffer_progress, size); + } + else { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Output %s - buffer overflow", output->name); + buffer_complete = 1; + buffer_progress = 0; + } + } + } else if (buffer->cmd == 0 && (buffer->flags & MMAL_BUFFER_HEADER_FLAG_FRAME_END)) { + if (dest != NULL) { + if (buffer->length == size) { + mmal_buffer_header_mem_lock(buffer); + memcpy(dest, buffer->data, size); + mmal_buffer_header_mem_unlock(buffer); + buffer_progress = buffer->length; + } + else { + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Output %s - buffer size %d does not match destination %d", output->name, buffer->length, size); + } + } + buffer_complete = 1; + } + + mmal_buffer_header_release(buffer); + + if (output->port->is_enabled) { + MMAL_STATUS_T status; + MMAL_BUFFER_HEADER_T *new_buffer = mmal_queue_get(output->buffer_pool->queue); + + if (new_buffer) { + status = mmal_port_send_buffer(output->port, new_buffer); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "%s: Output %s - new buffer returned", output->name); + } + + if (!new_buffer || status != MMAL_SUCCESS) + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: Unable to return a buffer to output %s port", output->name); + } + } while (!buffer_complete && output->port->is_enabled); + + return buffer_progress; +} + +void mmal_output_deinit(mmal_output* output) +{ + if (output->buffer_queue != NULL) { + mmal_queue_destroy(output->buffer_queue); + } + + if (output->buffer_pool != NULL) { + mmal_pool_destroy(output->buffer_pool); + } + + if (output->port != NULL && output->port->is_enabled) { + mmal_port_disable(output->port); + } + + memset(output, 0, sizeof(mmal_output)); +} + + diff --git a/mmaloutput.h b/mmaloutput.h new file mode 100644 index 0000000..1ca01c1 --- /dev/null +++ b/mmaloutput.h @@ -0,0 +1,29 @@ +/* + * mmaloutput.h + * + * Created on: 13 Apr 2014 + * Author: ntuckett + */ + +#ifndef MMALOUTPUT_H_ +#define MMALOUTPUT_H_ + +#define MMAL_OUTPUT_NAME_LEN 63 + +#define MMAL_OUTPUT_INCREMENTAL 1 // Indicate the output gets filled by multiple buffer iterations + +typedef struct mmal_output { + char name[MMAL_OUTPUT_NAME_LEN + 1]; + struct MMAL_PORT_T* port; + struct MMAL_POOL_T* buffer_pool; + struct MMAL_QUEUE_T* buffer_queue; + int flags; +} mmal_output; + +extern int mmal_output_init(const char* name, mmal_output* output, struct MMAL_PORT_T* output_port, int flags); +extern int mmal_output_enable(mmal_output* output); +extern int mmal_output_send_buffers_to_port(mmal_output* output); +extern size_t mmal_output_process_buffer(mmal_output* output, void* dest, size_t size); +extern void mmal_output_deinit(mmal_output* output); + +#endif /* MMALOUTPUT_H_ */ diff --git a/motion.1 b/motion.1 deleted file mode 100644 index a023f83..0000000 --- a/motion.1 +++ /dev/null @@ -1,901 +0,0 @@ -.TH MOTION 1 2011-12-12 "Motion" "Motion Options and Config Files" -.SH NAME -motion \- Detect motion using a video4linux device -.SH SYNOPSIS -.B motion -[ -hmns ] [ -c config file path ] [ -d log level ] [ -k log type ] [ -p process_id_file ] [ -l logfile ] -.SH DESCRIPTION -.I Motion -uses a video4linux device to detect motion. If motion is detected both normal -and motion pictures will be taken. Motion can also take actions to notify you -if needed. Creation of automated snapshots is also possible. -.SH OPTIONS -.TP -.B \-c -Full path and filename of config file. E.g. /home/kurt/motion.conf. Default is /usr/local/etc unless specified differently when building Motion. Many RPMs and debian packages will most likely use /etc or /etc/motion as default. -.TP -.B \-h -Show help screen. -.TP -.B \-m -Disable motion detection at startup. -.TP -.B \-n -Run in non-daemon mode. -.TP -.B \-s -Run in setup mode. Also forces non-daemon mode -.TP -.B \-d log level -Set log level [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC) -.TP -.B \-k log type -Set type of log (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL) -.TP -.B \-p -Full path and filename for process id file (pid file). E.g /var/run/motion.pid. Default is not defined. Pid file is only created when Motion is started in daemon mode. -.TP -.B \-l -Full path and filename of log file. ( use -l syslog to log to stderr and syslog ) -.TP -.SH "CONFIG FILE OPTIONS" -These are the options that can be used in the config file. -.I They are overridden by the commandline! -All number values are integer numbers (no decimals allowed). -Boolean options can be on or off (values "1", "yes" and "on" all means true and any other value means false). -.TP -.B area_detect integer -Values: 0 - 999999999 / Default: Not defined -.br -Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3 -.br -A script (on_area_detected) is started immediately when motion is 4 5 6 -.br -detected in one of the given areas, but only once during an event. 7 8 9 -.br -One or more areas can be specified with this option. Take care: This option does NOT restrict detection to these areas! (Default: not defined) -.TP -.B auto_brightness boolean -Values: on, off / Default: off -.br -Let motion regulate the brightness of a video device. Only recommended for cameras without auto brightness -.TP -.B brightness integer -Values: 0 - 255 / Default: 0 (disabled) -.br -The brightness level for the video device. -.TP -.B contrast boolean -Values: 0 - 255 / Default: 0 (disabled) -.br -The contrast level for the video device. -.TP -.B daemon boolean -Values: on, off / Default: off -.br -Start in daemon (background) mode and release terminal. This option must be placed in motion.conf and not in a thread config file. -.TP -.B database_dbname string -Values: Max 4095 characters / Default: Not defined -.br -Name of the database. -.TP -.B database_host string -Values: Max 4095 characters / Default: localhost -.br -IP address or domain name for the database server. Use "localhost" if motion and database runs on the same server. -.TP -.B database_password string -Values: Max 4095 characters / Default: Not defined -.br -The database password. -.TP -.B database_port integer -Values: 0 - 65535 / Default: Not defined -.br -The database server port number. -.TP -.B database_type discrete strings -Values: mysql, postgresql / Default: Not defined -.br -The database type ( mysql , postgresql ). -.TP -.B database_user string -Values: Max 4095 characters / Default: Not defined -.br -The database user name. -.TP -.B despeckle_filter string -Values: EedDl / Default: Not defined -.br -Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling. -.TP -.B emulate_motion boolean -Values: on, off / Default: off -.br -Picture are saved continuously as if motion was detected all the time. -.TP -.B event_gap integer -Values: 0 - 2147483647 / Default: 60 -.br -Event Gap is the seconds of no motion detection that triggers the end of an event. An event is defined as a series of motion images taken within a short timeframe. -.TP -.B exif_text string -Values: Max 4095 characters / Default: Not defined -.br -Text to include in a JPEG EXIF comment , may be any text, including conversion specifiers. The EXIF timestamp is included independent of this text. -.TP -.B extpipe string -Values: Max 4095 characters / Default: Not defined -.br -pipe raw video to generally - 'STDIN', allowing to use an external video encoder. -.br -e.g. using memcoder : -.br -extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt: threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps -.TP -.B ffmpeg_bps integer -Values: 0 - 9999999 / Default: 400000 -.br -Bitrate of movies produced by ffmpeg. Bitrate is bits per second. Default: 400000 (400kbps). Higher value mans better quality and larger files. Option requires that ffmpeg libraries are installed. -.TP -.B ffmpeg_output_debug_movies boolean -Values: on, off / Default: off -.br -Use ffmpeg libraries to encode motion type movies where you only see the pixels that changes. -.TP -.B ffmpeg_output_movies boolean -Values: on, off / Default: off -.br -Use ffmpeg libraries to encode movies in realtime. -.TP -.B ffmpeg_deinterlace boolean -Values: on, off / Default: off -.br -Use ffmpeg to deinterlace video. Necessary if you use an analog camera and see horizontal combing on moving objects in video or pictures. -.TP -.B ffmpeg_timelapse integer -Values: 0 - 2147483647 / Default: 0 (disabled) -.br -Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used. -.TP -.B ffmpeg_timelapse_mode discrete strings -Values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual / Default: daily -.br -The file rollover mode of the timelapse video. -.TP -.B ffmpeg_variable_bitrate integer -Values: 0, 2 - 31 / Default: 0 (disabled) -.br -Enables and defines variable bitrate for the ffmpeg encoder. ffmpeg_bps is ignored if variable bitrate is enabled. Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, or the range 2 - 31 where 2 means best quality and 31 is worst. -.TP -.B ffmpeg_video_codec discrete strings -Values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf , flv , ffv1, mov, ogg / Default: mpeg4 -.br -Codec to be used by ffmpeg for the video compression. Timelapse movies are always made in mpeg1 format independent from this option. -.TP -.B framerate integer -Values: 2 - 100 / Default: 100 (no limit) -.br -Maximum number of frames to be captured from the camera per second. -.TP -.B frequency integer -Values: 0 - 999999 / Default: 0 (Not set) -.br -The frequency to set the tuner to (kHz). Valid range: per tuner spec, default: 0 (Don't set it) -.TP -.B height integer -Values: Device Dependent / Default: 288 -.br -The height of each frame in pixels. -.TP -.B hue integer -Values: 0 - 255 / Default: 0 (disabled) -.br -The hue level for the video device. -.TP -.B input integer -Values: -1 - 64, -1 = disabled / Default: -1 (disabled) -.br -Input channel to use expressed as an integer number starting from -1. Should normally be set to 1 for video/TV cards, and -1 for USB cameras. -.TP -.B ipv6_enabled boolean -Values: on, off / Default: off -.br -Enable or disable IPV6 for http control and stream. -.TP -.B lightswitch integer -Values: 0 - 100 / Default: 0 (disabled) -.br -Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity. -.TP -.B locate_motion discrete strings -Values: on, off, redbox, center, redcross, preview / Default: off -.br -Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved movie. -.TP -.B logfile string -Values: Max 4095 characters / Default: Not defined -.br -Use a file to save logs messages, if not defined stderr and syslog is used. -.TP -.B logfile string -Values: Max 4095 characters / Default: Not defined -.br -Use a file to save logs messages, if not defined stderr and syslog is used. ( if syslog is set then will log to stderr and syslog ) -.TP -.B log_level integer -Values: 1 - 9 / Default: 6 -.br -Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, ERR, DBG, ALL). (default: 6 / NTC). -.TP -.B log_type discrete strings -Values: STR, ENC, NET, DBL, EVT, TRK, VID, ALL / Default: ALL -.br -Filter to log messages by type (STR, ENC, NET, DBL, EVT, TRK, VID, ALL). -.TP -.B mask_file string -Values: Max 4095 characters / Default: Not defined -.br -PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format. -.TP -.B max_movie_time integer -Values: 0 (infinite) - 2147483647 / Default: 3600 -.br -The maximum length of a movie in seconds. Set this to zero for unlimited length. -.TP -.B minimum_frame_time integer -Values: 0 - 2147483647 / Default: 0 -.br -Minimum time in seconds between the capturing picture frames from the camera. Default: 0 = disabled - the capture rate is given by the camera framerate. -.TP -.B minimum_motion_frames integer -Values: 1 - 1000s / Default: 1 -.br -Picture frames must contain motion at least the specified number of frames in a row before they are detected as true motion. At the default of 1, all motion is detected. Valid range is 1 to thousands, but it is recommended to keep it within 1-5. -.TP -.B motion_video_pipe string -Values: Max 4095 characters / Default: Not defined -.br -The video4linux video loopback input device for motion images. If a particular pipe is to be used then use the device filename of this pipe, if a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. Default: not set -.TP -.B movie_filename string -Values: Max 4095 characters / Default: %v-%Y%m%d%H%M%S -.br -File path for motion triggered ffmpeg movies relative to target_dir. This was previously called ffmpeg_filename. -.TP -.B netcam_tolerant_check boolean -Values: on, off / Default: off -.br -Set less strict jpeg checks for network cameras with a poor/buggy firmware. -.TP -.B netcam_keepalive discrete string -Values: off , force, on / Default: off -.br -The setting for keep-alive of network socket, should improve performance on compatible net cameras. -.TP -.B netcam_proxy string -Values: Max 4095 characters / Default: Not defined -.br -URL to use for a netcam proxy server, if required. The syntax is http://myproxy:portnumber -.TP -.B netcam_url string -Values: Max 4095 characters / Default: Not defined -.br -Specify an url to a downloadable jpeg file or raw mjpeg stream to use as input device. Such as an AXIS 2100 network camera. -.br -http:// ftp:// mjpg:// or file:/// ( mjpg:// is for network cameras with codec mjpeg ). -.TP -.B netcam_userpass string -Values: Max 4095 characters / Default: Not defined -.br -For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. -.TP -.B noise_level integer -Values: 1 - 255 / Default: 32 -.br -The noise level is used as a threshold for distinguishing between noise and motion. -.TP -.B noise_tune boolean -Values: on, off / Default: on -.br -Activates the automatic tuning of noise level. -.TP -.B norm integer -Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour) / Default: 0 (PAL) -.br -Select the norm of the video device. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) -.TP -.B on_area_detected string -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when motion in a predefined area is detected, check option area_detect. -.TP -.B on_camera_lost -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when a camera can't be opened or if it is lost. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. -.TP -.B on_event_end string -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option event_gap. You can use Conversion Specifiers and spaces as part of the command. -.TP -.B on_event_start string -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when an event starts. An event starts at first motion detected after a period of no motion defined by event_gap. You can use ConversionSpecifiers and spaces as part of the command. -.TP -.B on_motion_detected string -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when a motion frame is detected. You can use Conversion Specifiers and spaces as part of the command. -.TP -.B on_movie_end string -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when an ffmpeg movie is closed at the end of an event. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. -.TP -.B on_movie_start string -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when a movie is created. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. -.TP -.B on_picture_save string -Values: Max 4095 characters / Default: Not defined -.br -Command to be executed when an image is saved. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. -.TP -.B output_debug_pictures boolean -Values: on, off / Default: off -.br -Output pictures with only the moving object. This feature generates the special motion type movies where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red. -.TP -.B output_pictures discrete strings -Values: on, off, first, best, center / Default: on -.br -Normal image is an image that is stored when motion is detected. It is the same image that was taken by the camera. I.e. not a motion image like defined by output_motion. Default is that normal images are stored. -.TP -.B picture_filename string -Values: Max 4095 characters / Default: %v-%Y%m%d%H%M%S-%q -.br -File path for motion triggered images (jpeg or ppm) relative to target_dir. Value 'preview' makes a jpeg filename with the same name body as the associated saved movie file. -.TP -.B picture_type discrete strings -Values: jpeg , ppm / Default: jpeg -.br -Type of images motion will trigger when motion is detected. -.TP -.B post_capture integer -Values: 0 - 2147483647 / Default: 0 (disabled) -.br -Specifies the number of frames to be captured after motion has been detected. -.TP -.B pre_capture integer -Values: 0 - 100s / Default: 0 (disabled) -.br -Specifies the number of previous frames to be outputted at motion detection. Recommended range: 0 to 5, default=0. Do not use large values! Large values will cause Motion to skip video frames and cause unsmooth movies. To smooth movies use larger values of post_capture instead. -.TP -.B process_id_file string -Values: Max 4095 characters / Default: Not defined -.br -File to store the process ID, also called pid file. Recommended value when used: /var/run/motion.pid -.TP -.B quality integer -Values: 1 - 100 / Default: 75 -.br -The quality for the jpeg images in percent. -.TP -.B quiet boolean -Values: on, off / Default: off -.br -Be quiet, don't output beeps when detecting motion. -.TP -.B rotate discrete strings -Values: 0, 90, 180, 270 / Default: 0 (not rotated) -.br -Rotate image the given number of degrees. The rotation affects all saved images as well as movies. -.TP -.B roundrobin_frames integer -Values: 1 - 2147483647 / Default: 1 -.br -Specifies the number of frames to capture before switching inputs, this way also slow switching (e.g. every second) is possible. -.TP -.B roundrobin_skip integer -Values: 1 - 2147483647 / Default: 1 -.br -Specifies the number of frames to skip after a switch. (1 if you are feeling lucky, 2 if you want to be safe). -.TP -.B saturation integer -Values: 0 - 255 / Default: 0 (disabled) -.br -The colour saturation level for the video device. -.TP -.B sdl_threadnr -Values: 0 - 2147483647 / Default: 0 (disabled) -.br -Number of motion thread to show in SDL Window (default: 0 = disabled) -.TP -.B setup_mode boolean -Values: on, off / Default: off -.br -Run Motion in setup mode. -.TP -.B smart_mask_speed integer -Values: 0 - 10 / Default: 0 (disabled) -.br -Slugginess of the smart mask. Default is 0 = DISABLED. 1 is slow, 10 is fast. -.TP -.B snapshot_filename string -Values: Max 4095 characters / Default: %v-%Y%m%d%H%M%S-snapshot -.br -File path for snapshots (jpeg or ppm) relative to target_dir. -.TP -.B snapshot_interval integer -Values: 0 - 2147483647 / Default: 0 (disabled) -.br -Make automated snapshots every 'snapshot_interval' seconds. -.TP -.B sql_log_picture boolean -Values: on, off / Default: on -.br -Log to the database when creating motion triggered image file. -.TP -.B sql_log_movie boolean -Values: on, off / Default: off -.br -Log to the database when creating motion triggered movie file. -.TP -.B sql_log_snapshot boolean -Values: on, off / Default: on -.br -Log to the database when creating a snapshot image file. -.TP -.B sql_log_timelapse boolean -Values: on, off / Default: off -.br -Log to the database when creating timelapse movie file -.TP -.B sql_query string -Values: Max 4095 characters / Default: insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') -.br -SQL query string that is sent to the database. The values for each field are given by using convertion specifiers -.TP -.B stream_auth_method integer -Values: 0 = disabled , 1 = Basic authentication ,2 = MD5 digest (the safer authentication). / Default: 0 (disabled) -.br -Set the authentication method for stream. -.TP -.B stream_authentication string -Values: username:password / Default: not defined (disabled) -.br -Authentication for the stream. -.TP -.B stream_limit integer -Values: 0 - 2147483647 / Default: 0 (unlimited) -.br -Limit the number of frames to number frames. After 'stream_limit' number of frames the connection will be closed by motion. The value 0 means unlimited. -.TP -.B stream_localhost boolean -Values: on, off / Default: on -.br -Limits the access to the stream to the localhost. -.TP -.B stream_maxrate integer -Values: 1 - 100 / Default: 1 -.br -Limit the framerate of the stream in frames per second. Default is 1. Set the value to 100 for practically unlimited. -.TP -.B stream_motion boolean -Values: on, off / Default: off -.br -If set to 'on' Motion sends slows down the stream to 1 picture per second when no motion is detected. When motion is detected the stream runs as defined by stream_maxrate. When 'off' the stream always runs as defined by stream_maxrate. -.TP -.B stream_port integer -Values: 0 - 65535 / Default: 0 (disabled) -.br -TCP port on which motion will listen for incoming connects with its stream server. -.TP -.B stream_quality integer -Values: 1 - 100 / Default: 50 -.br -Quality setting in percent for the mjpeg picture frames transferred over the stream connection. Keep it low to restrict needed bandwidth. -.TP -.B switchfilter boolean -Values: on, off / Default: off -.br -Turns the switch filter on or off. The filter can distinguish between most switching noise and real motion. With this you can even set roundrobin_skip to 1 without generating much false detection. -.TP -.B target_dir string -Values: Max 4095 characters / Default: Not defined = current working directory -.br -Target directory for picture and movie files. -.TP -.B text_changes boolean -Values: on, off / Default: off -.br -Turns the text showing changed pixels on/off. -.TP -.B text_double boolean -Values: on, off / Default: off -.br -Draw characters at twice normal size on images. -.TP -.B text_event string -Values: Max 4095 characters / Default: %Y%m%d%H%M%S -.br -This option defines the value of the special event conversion specifier %C. You can use any conversion specifier in this option except %C. Date and time values are from the timestamp of the first image in the current event. -.TP -.B text_left string -Values: Max 4095 characters / Default: Not defined -.br -User defined text overlayed on each in the lower left corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > | , . : - + _ \n and conversion specifiers (codes starting by a %). -.TP -.B text_right string -Values: Max 4095 characters / Default: %Y-%m-%d\n%T -.br -User defined text overlayed on each in the lower right corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > | , . : - + _ \n and conversion specifiers (codes starting by a %). Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock -.TP -.B thread string -Values: Max 4095 characters / Default: Not defined -.br -Specifies full path and filename for a thread config file. Each camera needs a thread config file containing the options that are unique to the camera. If you only have one camera you do not need thread config files. If you have two or more cameras you need one thread config file for each camera in addition to motion.conf. This option must be placed in motion.conf and not in a thread config file. -.TP -.B threshold integer -Values: 1 - 2147483647 / Default: 1500 -.br -Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling. -.TP -.B threshold_tune boolean -Values: on, off / Default: off -.br -Activates the automatic tuning of threshold level. -.TP -.B timelapse_filename string -Values: Max 4095 characters / Default: %v-%Y%m%d-timelapse -.br -File path for timelapse movies relative to target_dir (ffmpeg only). -.TP -.B track_auto boolean -Values: on, off / Default: off -.br -Enable auto tracking -.TP -.B track_iomojo_id integer -Values: 0 - 65535 / Default: 0 -.br -Use this option if you have an iomojo smilecam connected to the serial port instead of a general stepper motor controller. -.TP -.B track_maxx integer -Values: 0 - 65535 / Default: 0 -.br -The maximum position for servo x. -.TP -.B track_maxy integer -Values: 0 - 65535 / Default: 0 -.br -The maximum position for servo y. -.TP -.B track_motorx integer -Values: 0 - 65535 / Default: 0 -.br -The motor number that is used for controlling the x-axis. -.TP -.B track_motory integer -Values: 0 - 65535 / Default: 0 -.br -The motor number that is used for controlling the y-axis. -.TP -.B track_move_wait integer -Values: 0 - 65535 / Default: 10 -.br -Delay during which tracking is disabled after auto tracking has moved the camera. Delay is defined as number of picture frames. -.TP -.B track_port string -Values: Max 4095 characters / Default: Not defined -.br -This is the device name of the serial port to which the stepper motor interface is connected. -.TP -.B track_speed integer -Values: 0 - 255 / Default: 255 -.br -Speed to set the motor to. -.TP -.B track_step_angle_x integer -Values: 0-90 / Default: 10 -.br -Angle in degrees the camera moves per step on the X-axis with auto tracking. Currently only used with pwc type cameras. -.TP -.B track_step_angle_y integer -Values: 0-40 / Default: 10 -.br -Angle in degrees the camera moves per step on the Y-axis with auto tracking. Currently only used with pwc type cameras. -.TP -.B track_stepsize integer -Values: 0 - 255 / Default: 40 -.br -Number of steps to make. -.TP -.B track_type discrete strings -Values: 0 (none), 1 (stepper), 2 (iomojo), 3 (pwc), 4 (generic), 5 (uvcvideo) / Default: 0 (None) -.br -Type of tracker. -.TP -.B tunerdevice string -Values: Max 4095 characters / Default: /dev/tuner0 -.br -The tuner device used for controlling the tuner in a tuner card. This option is only used when Motion is compiled for FreeBSD. -.TP -.B use_extpipe boolean -Values: on, off / Default: off -.br -Enables extpipe to use an external video encoder feeding with YUV420 using a pipe . -.TP -.B v4l2_palette discrete strings -Values: 0 - 8 / Default: 8 -.br -Allow to choose preferable palette to be use by motion to capture from those supported by your videodevice. -.TP -.B video_pipe string -Values: Max 4095 characters / Default: Not defined -.br -The video4linux video loopback input device for normal images. If a particular pipe is to be used then use the device filename of this pipe. If a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. -.TP -.B videodevice string -Values: Max 4095 characters / Default: /dev/video0 (FreeBSD: /dev/bktr0) -.br -The video device to be used for capturing. Default for Linux is /dev/video0. for FreeBSD the default is /dev/bktr0. -.TP -.B webcontrol_authentication string -Values: Max 4096 characters / Default: Not defined -.br -To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username: password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file. -.TP -.B webcontrol_html_output boolean -Values: on, off / Default: on -.br -Enable HTML in the answer sent back to a browser connecting to the webcontrol_port. This option must be placed in motion.conf and not in a thread config file. -.TP -.B webcontrol_localhost boolean -Values: on, off / Default: on -.br -Limits the webcontrol to the localhost. This option must be placed in motion.conf and not in a thread config file. -.TP -.B webcontrol_port integer -Values: 0 - 65535 / Default: 0 (disabled) -.br -Sets the port number for the http (html using browser) based remote webcontrol. This option must be placed in motion.conf and not in a thread config file. - -.TP -.B width integer -Values: Device Dependent / Default: 352 -.br -The width in pixels of each frame. Valid range is camera dependent. - -.SH SIGNALS -Motion responds to the following signals: -.TP -.B SIGHUP -The config file will be reread. -.TP -.B SIGTERM -If needed motion will create a movie file of the last event and exit -.TP -.B SIGUSR1 -Motion will create a movie file of the current event. -.SH NOTES -.TP -.B Snapshot -A snapshot is a picture taken at regular intervals independently of any movement in the picture. -.TP -.B Motion image -A "motion" image/movie shows the pixels that have actually changed during the last frames. These pictures are not very useful for normal presentation to the public but they are quite useful for testing and tuning and making mask files as you can see exactly where motion sees something moving. Motion is shown in greytones. If labelling is enabled the largest area is marked as blue. Smart mask is shown in read. -.TP -.B Normal image -A "normal" image is the real image taken by the camera with text overlayed. -.TP -.B Threads and config files -If Motion was invoked with command line option -c pathname Motion will expect the config file to be as specified. When you specify the config file on the command line with -c you can call it anything. -.br -If you do not specify -c or the filename you give Motion does not exist, Motion will search for the configuration file called 'motion.conf' in the following order: -.br -1. Current directory from where motion was invoked -.br -2. Then in a directory called '.motion' in the current users home directory (shell environment variable $HOME). E.g. /home/goofy/.motion/motion.conf -.br -3. The directory defined by the --sysconfdir=DIR when running .configure during installation of Motion (If this option was not defined the default is /usr/local/etc/) -.br -If you have write access to /usr/local/etc then the editor recommends having only one motion.conf file in the default /usr/local/etc/ directory. -.br -Motion has a configuration file in the distribution package called motion-dist.conf. When you run 'make install' this files gets copied to the /usr/local/etc directory. -.br -The configuration file needs to be renamed from motion-dist.conf to motion.conf. The original file is called motion-dist.conf so that your perfectly working motion.conf file does not accidentally get overwritten when you re-install or upgrade to a newer version of Motion. -.br -If you have more than one camera you should not try and invoke Motion more times. Motion is made to work with more than one camera in a very elegant way and the way to do it is to create a number of thread config files. Motion will then create an extra tread of itself for each camera. If you only have one camera you only need the motion.conf file. The minute you have two or more cameras you must have one thread config file per camera besides the motion.conf file. -.br -So if you have for example two cameras you need motion.conf and two thread config files. Total of 3 config files. -.br -An option that is common to all cameras can be placed in motion.conf. (You can also put all parameters in the thread files but that makes a lot of editing when you change a common thing). -.br -An option that is unique to a camera must be defined in each thread file. -.br -The first camera is defined in the first thread file called from motion.conf. The 2nd camera is defined in the 2nd thread file called from motion.conf etc. -.br -Any option defined in motion.conf will be used for all cameras except for the cameras in which the same option is defined in a thread config file. -.br -Motion reads its configuration parameters in the following sequence. If the same parameter exists more than one place the last one read wins. -.br -1. Motion reads the configuration file motion.conf from the beginning of the file going down line by line. -.br -2. If the option "thread" is defined in motion.conf, the thread configuration file(s) is/(are) read. -.br -3. Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in a thread config file. -.br -4. Motion reads the command line option again overruling any previously defined options. -.br -So always call the thread config files in the end of the motion.conf file. If you define options in motion.conf AFTER the thread file calls, the same options in the thread files will never be used. So always put the thread file call at the end of motion.conf. -.br -If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features. You do not have to remove them or comment them out. -.br -If you run the webcontrol command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the thread.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do. -.TP -.B Conversion Specifiers for Advanced Filename and Text Features -The table below shows all the supported Conversion Specifiers you can use in the options text_left, text_right, snapshot_filename, picture_filename, movie_filename, timelapse_filename, on_area_detected, on_camera_lost, on_event_start, on_event_end, on_picture_save, on_movie_start, on_movie_end, and on_motion_detected. -.br -In text_left and text_right you can additionally use '\n' for new line. - -.TP -.B %a -The abbreviated weekday name according to the current locale. -.TP -.B %A -The full weekday name according to the current locale. -.TP -.B %b -The abbreviated month name according to the current locale. -.TP -.B %B -The full month name according to the current locale. -.TP -.B %c -The preferred date and time representation for the current locale. -.TP -.B %C -Text defined by the text_event feature -.TP -.B %d -The day of the month as a decimal number (range 01 to 31). -.TP -.B %D -Number of pixels detected as Motion. If labelling is enabled the number is the number of pixels in the largest labelled motion area. -.TP -.B %E -Modifier: use alternative format, see below. -.TP -.B %f -File name - used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features. -.TP -.B %F -Equivalent to %Y-%m-%d (the ISO 8601 date format). -.TP -.B %H -The hour as a decimal number using a 24-hour clock (range 00 to 23). -.TP -.B %i -Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate_motion is on). -.TP -.B %I -The hour as a decimal number using a 12-hour clock (range 01 to 12). -.TP -.B %j -The day of the year as a decimal number (range 001 to 366). -.TP -.B %J -Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate_motion is on). -.TP -.B %k -The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.) -.TP -.B %K -X coordinate in pixels of the center point of motion. Origin is upper left corner. -.TP -.B %l -The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.) -.TP -.B %L -Y coordinate in pixels of the center point of motion. Origin is upper left corner and number is positive moving downwards (I may change this soon). -.TP -.B %m -The month as a decimal number (range 01 to 12). -.TP -.B %M -The minute as a decimal number (range 00 to 59). -.TP -.B %n -Filetype as used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features. -.TP -.B %N -Noise level. -.TP -.B %o -Threshold. The number of detected pixels required to trigger motion. When threshold_tune is 'on' this can be used to show the current tuned value of threshold. -.TP -.B %p -Either 'AM' or 'PM' according to the given time value, or the corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'. -.TP -.B %P -Like %p but in lowercase: `am' or `pm' or a corresponding string for the current locale. -.TP -.B %q -Picture frame number within current second. For jpeg filenames this should always be included in the filename if you save more then 1 picture per second to ensure unique filenames. It is not needed in filenames for movies. -.TP -.B %Q -Number of detected labels found by the despeckle feature -.TP -.B %r -The time in a.m. or p.m. notation. -.TP -.B %R -The time in 24-hour notation (%H:%M). -.TP -.B %s -The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC. -.TP -.B %S -The second as a decimal number (range 00 to 61). -.TP -.B %t -Thread number (camera number) -.TP -.B %T -The time in 24-hour notation (%H:%M:%S). -.TP -.B %u -The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w. -.TP -.B %U -The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W. -.TP -.B %v -Event number. An event is a series of motion detections happening with less than 'gap' seconds between them. -.TP -.B %V -The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also %U and %W. -.TP -.B %w -The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u. -.TP -.B %W -The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01. -.TP -.B %x -The preferred date representation for the current locale without the time. -.TP -.B %X -The preferred time representation for the current locale without the date. -.TP -.B %y -The year as a decimal number without a century (range 00 to 99). -.TP -.B %Y -The year as a decimal number including the century. -.TP -.B %z -The time-zone as hour offset from GMT. -.TP -.B %Z -The time zone or name or abbreviation. - -.TP -.B More information -Motion homepage: http://motion.sourceforge.net/ - -Motion Guide (user and installation guide): -.br -http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide -.br -http://www.lavrsen.dk/twiki/bin/view/Motion/VideoFourLinuxLoopbackDevice -.SH AUTHORS -Jeroen Vreeken (pe1rxq@amsat.org), -Folkert van Heusden, -Kenneth Lavrsen (kenneth@lavrsen.dk) diff --git a/motion.c b/motion.c index 5666770..b379197 100644 --- a/motion.c +++ b/motion.c @@ -21,6 +21,11 @@ #include "event.h" #include "picture.h" #include "rotate.h" +#include "metrics.h" + +#ifdef _PROFILING +#include "gperftools/profiler.h" +#endif /* Forward declarations */ static int motion_init(struct context *cnt); @@ -126,6 +131,14 @@ static void image_ring_resize(struct context *cnt, int new_size) tmp[i].image = mymalloc(cnt->imgs.size); memset(tmp[i].image, 0x80, cnt->imgs.size); /* initialize to grey */ } + + if (cnt->imgs.secondary_size) { + for(i = smallest; i < new_size; i++) { + tmp[i].secondary_image = mymalloc(cnt->imgs.secondary_size); + if (cnt->imgs.secondary_type == SECONDARY_TYPE_RAW) + memset(tmp[i].secondary_image, 0x80, cnt->imgs.secondary_size); /* initialize to grey */ + } + } } /* Free the old ring */ @@ -185,15 +198,21 @@ static void image_ring_destroy(struct context *cnt) static void image_save_as_preview(struct context *cnt, struct image_data *img) { void * image; + void * secondary_image; /* Save preview image pointer */ image = cnt->imgs.preview_image.image; + secondary_image = cnt->imgs.preview_image.secondary_image; + /* Copy all info */ memcpy(&cnt->imgs.preview_image.image, img, sizeof(struct image_data)); /* restore image pointer */ cnt->imgs.preview_image.image = image; + cnt->imgs.preview_image.secondary_image = secondary_image; /* Copy image */ memcpy(cnt->imgs.preview_image.image, img->image, cnt->imgs.size); + if (secondary_image) + memcpy(cnt->imgs.preview_image.secondary_image, img->secondary_image, cnt->imgs.secondary_size); /* * If we set output_all to yes and during the event @@ -206,18 +225,18 @@ static void image_save_as_preview(struct context *cnt, struct image_data *img) if (cnt->locate_motion_mode == LOCATE_PREVIEW) { if (cnt->locate_motion_style == LOCATE_BOX) { - alg_draw_location(&img->location, &cnt->imgs, cnt->imgs.width, cnt->imgs.preview_image.image, + alg_draw_location(&img->location, &cnt->imgs, &cnt->imgs.preview_image, LOCATE_BOX, LOCATE_NORMAL, cnt->process_thisframe); } else if (cnt->locate_motion_style == LOCATE_REDBOX) { - alg_draw_red_location(&img->location, &cnt->imgs, cnt->imgs.width, cnt->imgs.preview_image.image, + alg_draw_red_location(&img->location, &cnt->imgs, &cnt->imgs.preview_image, LOCATE_REDBOX, LOCATE_NORMAL, cnt->process_thisframe); } else if (cnt->locate_motion_style == LOCATE_CROSS) { - alg_draw_location(&img->location, &cnt->imgs, cnt->imgs.width, cnt->imgs.preview_image.image, + alg_draw_location(&img->location, &cnt->imgs, &cnt->imgs.preview_image, LOCATE_CROSS, LOCATE_NORMAL, cnt->process_thisframe); } else if (cnt->locate_motion_style == LOCATE_REDCROSS) { - alg_draw_red_location(&img->location, &cnt->imgs, cnt->imgs.width, cnt->imgs.preview_image.image, + alg_draw_red_location(&img->location, &cnt->imgs, &cnt->imgs.preview_image, LOCATE_REDCROSS, LOCATE_NORMAL, cnt->process_thisframe); - } + } } } @@ -418,16 +437,16 @@ static void motion_detected(struct context *cnt, int dev, struct image_data *img if (cnt->locate_motion_mode == LOCATE_ON) { if (cnt->locate_motion_style == LOCATE_BOX) { - alg_draw_location(location, imgs, imgs->width, img->image, LOCATE_BOX, + alg_draw_location(location, imgs, img, LOCATE_BOX, LOCATE_BOTH, cnt->process_thisframe); } else if (cnt->locate_motion_style == LOCATE_REDBOX) { - alg_draw_red_location(location, imgs, imgs->width, img->image, LOCATE_REDBOX, + alg_draw_red_location(location, imgs, img, LOCATE_REDBOX, LOCATE_BOTH, cnt->process_thisframe); } else if (cnt->locate_motion_style == LOCATE_CROSS) { - alg_draw_location(location, imgs, imgs->width, img->image, LOCATE_CROSS, + alg_draw_location(location, imgs, img, LOCATE_CROSS, LOCATE_BOTH, cnt->process_thisframe); } else if (cnt->locate_motion_style == LOCATE_REDCROSS) { - alg_draw_red_location(location, imgs, imgs->width, img->image, LOCATE_REDCROSS, + alg_draw_red_location(location, imgs, img, LOCATE_REDCROSS, LOCATE_BOTH, cnt->process_thisframe); } } @@ -462,7 +481,7 @@ static void motion_detected(struct context *cnt, int dev, struct image_data *img cnt->conf.text_event, cnt->eventtime_tm, NULL, 0); /* EVENT_FIRSTMOTION triggers on_event_start_command and event_ffmpeg_newfile */ - event(cnt, EVENT_FIRSTMOTION, img->image, NULL, NULL, &img->timestamp_tm); + event(cnt, EVENT_FIRSTMOTION, NULL, NULL, img, &img->timestamp_tm); MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Motion detected - starting event %d", cnt->event_nr); @@ -486,7 +505,7 @@ static void motion_detected(struct context *cnt, int dev, struct image_data *img * We also disable this in setup_mode. */ if (conf->stream_motion && !conf->setup_mode && img->shot != 1) - event(cnt, EVENT_STREAM, img->image, NULL, NULL, &img->timestamp_tm); + event(cnt, EVENT_STREAM, NULL, NULL, img, &img->timestamp_tm); /* * Save motion jpeg, if configured @@ -550,15 +569,15 @@ static void process_image_ring(struct context *cnt, unsigned int max_images) mystrftime(cnt, tmp, sizeof(tmp), "%H%M%S-%q", &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm, NULL, 0); - draw_text(cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, 10, 20, - cnt->imgs.width, tmp, cnt->conf.text_double); - draw_text(cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, 10, 30, - cnt->imgs.width, t, cnt->conf.text_double); + draw_final_image_text(cnt, &cnt->imgs.image_ring[cnt->imgs.image_ring_out], 10, 20, + tmp, cnt->conf.text_double); + draw_final_image_text(cnt, &cnt->imgs.image_ring[cnt->imgs.image_ring_out], 10, 30, + 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, + NULL, NULL, &cnt->imgs.image_ring[cnt->imgs.image_ring_out], &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm); /* @@ -583,15 +602,15 @@ static void process_image_ring(struct context *cnt, unsigned int max_images) 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); + draw_final_image_text(cnt, &cnt->imgs.image_ring[cnt->imgs.image_ring_out], 10, 40, + tmp, cnt->conf.text_double); } } /* Check how many frames it was last sec */ while ((cnt->movie_last_shot + 1) < cnt->movie_fps) { /* Add a filler frame into encoder */ event(cnt, EVENT_FFMPEG_PUT, - cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, NULL, NULL, + NULL, NULL, &cnt->imgs.image_ring[cnt->imgs.image_ring_out], &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm); cnt->movie_last_shot++; @@ -695,6 +714,7 @@ static int motion_init(struct context *cnt) cnt->conf.filepath = mystrdup("."); /* set the device settings */ + video_source_plugins_init(cnt); cnt->video_dev = vid_start(cnt); /* @@ -723,7 +743,7 @@ static int motion_init(struct context *cnt) memset(cnt->imgs.out, 0, cnt->imgs.size); /* contains the moving objects of ref. frame */ - cnt->imgs.ref_dyn = mymalloc(cnt->imgs.motionsize * sizeof(cnt->imgs.ref_dyn)); + cnt->imgs.ref_dyn = mymalloc(cnt->imgs.motionsize * sizeof(cnt->imgs.ref_dyn[0])); cnt->imgs.image_virgin = mymalloc(cnt->imgs.size); cnt->imgs.smartmask = mymalloc(cnt->imgs.motionsize); cnt->imgs.smartmask_final = mymalloc(cnt->imgs.motionsize); @@ -740,12 +760,31 @@ static int motion_init(struct context *cnt) /* allocate buffer here for preview buffer */ cnt->imgs.preview_image.image = mymalloc(cnt->imgs.size); + if (cnt->imgs.secondary_size) + cnt->imgs.preview_image.secondary_image = mymalloc(cnt->imgs.secondary_size); + else + cnt->imgs.preview_image.secondary_image = NULL; + /* * Allocate a buffer for temp. usage in some places * Only despeckle & bayer2rgb24() for now for now... */ cnt->imgs.common_buffer = mymalloc(3 * cnt->imgs.width * cnt->imgs.height); + if (cnt->imgs.secondary_width) { + cnt->imgs.secondary_width_scale = (float)cnt->imgs.secondary_width / (float)cnt->imgs.width; + } + else { + cnt->imgs.secondary_width_scale = 1.0f; + } + + if (cnt->imgs.secondary_height) { + cnt->imgs.secondary_height_scale = (float)cnt->imgs.secondary_height / (float)cnt->imgs.height; + } + else { + cnt->imgs.secondary_height_scale = 1.0f; + } + /* * Now is a good time to init rotation data. Since vid_start has been * called, we know that we have imgs.width and imgs.height. When capturing @@ -762,7 +801,7 @@ static int motion_init(struct context *cnt) int i; for (i = 0; i < 5; i++) { - if (vid_next(cnt, cnt->imgs.image_virgin) == 0) + if (vid_next(cnt, cnt->imgs.image_virgin, NULL) == 0) break; SLEEP(2, 0); } @@ -1092,6 +1131,7 @@ static void *motion_loop(void *arg) unsigned int text_size_factor; unsigned int passflag = 0; long int *rolling_average_data = NULL; + long int *rolling_elapsed_data = NULL; long int rolling_average_limit, required_frame_time, frame_delay, delay_time_nsec; int rolling_frame = 0; struct timeval tv1, tv2; @@ -1154,11 +1194,13 @@ static void *motion_loop(void *arg) */ rolling_average_limit = 10 * cnt->conf.frame_limit; rolling_average_data = mymalloc(sizeof(rolling_average_data) * rolling_average_limit); + rolling_elapsed_data = mymalloc(sizeof(rolling_elapsed_data) * rolling_average_limit); /* Preset history buffer with expected frame rate */ - for (j = 0; j < rolling_average_limit; j++) + for (j = 0; j < rolling_average_limit; j++) { rolling_average_data[j] = required_frame_time; - + rolling_elapsed_data[j] = required_frame_time; + } if (cnt->track.type) cnt->moved = track_center(cnt, cnt->video_dev, 0, 0, 0); @@ -1178,6 +1220,10 @@ static void *motion_loop(void *arg) * Should go on forever... unless you bought vaporware :) */ +#ifdef _PROFILING + ProfilerStart("motion.prof"); +#endif + while (!cnt->finish || cnt->makemovie) { /***** MOTION LOOP - PREPARE FOR NEW FRAME SECTION *****/ @@ -1192,12 +1238,13 @@ static void *motion_loop(void *arg) * Calculate detection rate limit. Above 5fps we limit the detection * rate to 3fps to reduce load at higher framerates. */ - cnt->process_thisframe = 0; - rate_limit++; - if (rate_limit >= (cnt->lastrate / 3)) { - rate_limit = 0; - cnt->process_thisframe = 1; - } + cnt->process_thisframe = 1; +// Rate limit disabled as it doesn't help on Pi +// rate_limit++; +// if (rate_limit >= (cnt->lastrate / 3)) { +// rate_limit = 0; +// cnt->process_thisframe = 1; +// } /* * Since we don't have sanity checks done when options are set, @@ -1251,6 +1298,7 @@ static void *motion_loop(void *arg) /* Increase the shots variable for each frame captured within this second */ cnt->shots++; + cnt->total_shots++; if (cnt->startup_frames > 0) cnt->startup_frames--; @@ -1305,6 +1353,7 @@ static void *motion_loop(void *arg) /* Store shot number with pre_captured image */ cnt->current_image->shot = cnt->shots; + cnt->current_image->total_shots = cnt->total_shots; /***** MOTION LOOP - RETRY INITIALIZING SECTION *****/ /* @@ -1349,7 +1398,7 @@ static void *motion_loop(void *arg) * >0 = non fatal error - copy last image or show grey image with message */ if (cnt->video_dev >= 0) - vid_return_code = vid_next(cnt, cnt->current_image->image); + vid_return_code = vid_next(cnt, cnt->current_image->image, cnt->current_image); else vid_return_code = 1; /* Non fatal error */ @@ -1368,8 +1417,12 @@ static void *motion_loop(void *arg) #ifdef HAVE_FFMPEG /* Deinterlace the image with ffmpeg, before the image is modified. */ - if (cnt->conf.ffmpeg_deinterlace) + if (cnt->conf.ffmpeg_deinterlace) { ffmpeg_deinterlace(cnt->current_image->image, cnt->imgs.width, cnt->imgs.height); + if (cnt->current_image->secondary_image && cnt->imgs.secondary_type == SECONDARY_TYPE_RAW) { + ffmpeg_deinterlace(cnt->current_image->secondary_image, cnt->imgs.secondary_width, cnt->imgs.secondary_height); + } + } #endif /* @@ -1464,8 +1517,8 @@ static void *motion_loop(void *arg) localtime_r(&cnt->connectionlosttime, &tmptime); memset(cnt->current_image->image, 0x80, cnt->imgs.size); mystrftime(cnt, tmpout, sizeof(tmpout), tmpin, &tmptime, NULL, 0); - draw_text(cnt->current_image->image, 10, 20 * text_size_factor, cnt->imgs.width, - tmpout, cnt->conf.text_double); + draw_final_image_text(cnt, cnt->current_image, 10, 20 * text_size_factor, + tmpout, cnt->conf.text_double); /* Write error message only once */ if (cnt->missing_frame_counter == MISSING_FRAMES_TIMEOUT * cnt->conf.frame_limit) { @@ -1702,8 +1755,8 @@ static void *motion_loop(void *arg) else sprintf(tmp, "-"); - draw_text(cnt->current_image->image, cnt->imgs.width - 10, 10, - cnt->imgs.width, tmp, cnt->conf.text_double); + draw_final_image_text(cnt, cnt->current_image, cnt->imgs.width - 10, 10, + tmp, cnt->conf.text_double); } /* @@ -1726,8 +1779,8 @@ static void *motion_loop(void *arg) char tmp[PATH_MAX]; mystrftime(cnt, tmp, sizeof(tmp), cnt->conf.text_left, &cnt->current_image->timestamp_tm, NULL, 0); - draw_text(cnt->current_image->image, 10, cnt->imgs.height - 10 * text_size_factor, - cnt->imgs.width, tmp, cnt->conf.text_double); + draw_final_image_text(cnt, cnt->current_image, 10, cnt->imgs.height - 10 * text_size_factor, + tmp, cnt->conf.text_double); } /* Add text in lower right corner of the pictures */ @@ -1735,9 +1788,8 @@ static void *motion_loop(void *arg) char tmp[PATH_MAX]; mystrftime(cnt, tmp, sizeof(tmp), cnt->conf.text_right, &cnt->current_image->timestamp_tm, NULL, 0); - draw_text(cnt->current_image->image, cnt->imgs.width - 10, - cnt->imgs.height - 10 * text_size_factor, - cnt->imgs.width, tmp, cnt->conf.text_double); + draw_final_image_text(cnt, cnt->current_image, cnt->imgs.width - 10, cnt->imgs.height - 10 * text_size_factor, + tmp, cnt->conf.text_double); } @@ -1986,7 +2038,7 @@ static void *motion_loop(void *arg) if ((cnt->conf.snapshot_interval > 0 && cnt->shots == 0 && time_current_frame % cnt->conf.snapshot_interval <= time_last_frame % cnt->conf.snapshot_interval) || cnt->snapshot) { - event(cnt, EVENT_IMAGE_SNAPSHOT, cnt->current_image->image, NULL, NULL, &cnt->current_image->timestamp_tm); + event(cnt, EVENT_IMAGE_SNAPSHOT, NULL, NULL, cnt->current_image, &cnt->current_image->timestamp_tm); cnt->snapshot = 0; } @@ -2051,7 +2103,7 @@ static void *motion_loop(void *arg) */ if (cnt->shots == 0 && time_current_frame % cnt->conf.timelapse <= time_last_frame % cnt->conf.timelapse) - event(cnt, EVENT_TIMELAPSE, cnt->current_image->image, NULL, NULL, + event(cnt, EVENT_TIMELAPSE, NULL, NULL, cnt->current_image, &cnt->current_image->timestamp_tm); } else if (cnt->ffmpeg_timelapse) { /* @@ -2091,7 +2143,7 @@ static void *motion_loop(void *arg) &cnt->pipe, &cnt->current_image->timestamp_tm); if (!cnt->conf.stream_motion || cnt->shots == 1) - event(cnt, EVENT_STREAM, cnt->current_image->image, NULL, NULL, + event(cnt, EVENT_STREAM, NULL, NULL, cnt->current_image, &cnt->current_image->timestamp_tm); #ifdef HAVE_SDL if (cnt_list[0]->conf.sdl_threadnr == cnt->threadnr) @@ -2193,8 +2245,10 @@ static void *motion_loop(void *arg) * Update history buffer but ignore first pass as timebefore * variable will be inaccurate */ - if (passflag) + if (passflag) { rolling_average_data[rolling_frame] = timenow-timebefore; + rolling_elapsed_data[rolling_frame] = elapsedtime; + } else passflag = 1; @@ -2211,6 +2265,22 @@ static void *motion_loop(void *arg) rolling_average /= rolling_average_limit; frame_delay = required_frame_time-elapsedtime - (rolling_average - required_frame_time); + if (rolling_frame == 0 || rolling_frame == rolling_average_limit / 2) { + int idle_time = 0; + int overrun_time = 0; + for (j = 0; j < rolling_average_limit; j++) + if (rolling_elapsed_data[j] < required_frame_time) + idle_time += required_frame_time - rolling_elapsed_data[j]; + else + overrun_time += rolling_elapsed_data[j] - required_frame_time; + + float fps = 1000000.0f / (float)rolling_average; + float time_range = rolling_average_limit * required_frame_time; + float percent_idle = ((float)idle_time / time_range) * 100.0f; + float percent_over = ((float)overrun_time / time_range) * 100.0f; + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: fps: %f idle %0.2f%% over %0.2f%%", fps, percent_idle, percent_over); + } + if (frame_delay > 0) { /* Apply delay to meet frame time */ if (frame_delay > required_frame_time) @@ -2227,11 +2297,17 @@ static void *motion_loop(void *arg) } } +#ifdef _PROFILING + ProfilerStop(); +#endif + /* * END OF MOTION MAIN LOOP * If code continues here it is because the thread is exiting or restarting */ err: + if (rolling_elapsed_data) + free(rolling_elapsed_data); if (rolling_average_data) free(rolling_average_data); @@ -2823,6 +2899,7 @@ int main (int argc, char **argv) cnt_list[0]->finish = 1; SLEEP(1, 0); MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Motion terminating"); + metrics_report(); /* Perform final cleanup. */ pthread_key_delete(tls_key_threadnr); @@ -3156,6 +3233,10 @@ size_t mystrftime(const struct context *cnt, char *s, size_t max, const char *us sprintf(tempstr, "%02d", cnt->current_image->shot); break; + case 'g': // shots + sprintf(tempstr, "%04d", cnt->current_image->total_shots); + break; + case 'D': // diffs sprintf(tempstr, "%d", cnt->current_image->diffs); break; diff --git a/motion.h b/motion.h index c08d84f..65e9161 100644 --- a/motion.h +++ b/motion.h @@ -61,6 +61,7 @@ #include "conf.h" #include "stream.h" #include "webhttpd.h" +#include "videosourceplugin.h" #ifdef HAVE_SDL #include "sdl.h" @@ -207,6 +208,10 @@ #define UPDATE_REF_FRAME 1 #define RESET_REF_FRAME 2 +#define SECONDARY_TYPE_NONE 0 +#define SECONDARY_TYPE_RAW 1 +#define SECONDARY_TYPE_JPEG 2 + #define BUFSIZE_1MEG (1024 * 1024) /* Forward declaration, used in track.h */ @@ -214,6 +219,11 @@ struct images; #include "track.h" #include "netcam.h" +#include "filecam.h" + +#ifdef HAVE_MMAL +#include "mmalcam.h" +#endif /* * Structure to hold images information @@ -237,6 +247,7 @@ struct image_data { time_t timestamp; /* Timestamp when image was captured */ struct tm timestamp_tm; int shot; /* Sub second timestamp count */ + int total_shots; /* Total shots taken so far */ /* * Movement center to img center distance @@ -249,6 +260,9 @@ struct image_data { struct coord location; /* coordinates for center and size of last motion detection*/ int total_labels; + + unsigned char *secondary_image; + int secondary_size; }; /* @@ -279,6 +293,8 @@ struct image_data { /* date/time drawing, draw.c */ int draw_text(unsigned char *image, unsigned int startx, unsigned int starty, unsigned int width, const char *text, unsigned int factor); +int draw_final_image_text(struct context* cnt, struct image_data* imgdata, unsigned int startx, unsigned int starty, + const char *text, unsigned int factor); int initialize_chars(void); struct images { @@ -309,6 +325,13 @@ struct images { int labels_above; int labelsize_max; int largest_label; + + int secondary_type; + int secondary_width; + int secondary_height; + int secondary_size; + float secondary_width_scale; + float secondary_height_scale; }; /* Contains data for image rotation, see rotate.c. */ @@ -347,9 +370,14 @@ struct context { unsigned int log_type; struct config conf; + struct video_source_plugin video_source; struct images imgs; struct trackoptions track; struct netcam_context *netcam; + struct filecam_context *filecam; +#ifdef HAVE_MMAL + struct mmalcam_context *mmalcam; +#endif struct image_data *current_image; /* Pointer to a structure where the image, diffs etc is stored */ unsigned int new_img; @@ -382,6 +410,7 @@ struct context { int postcap; /* downcounter, frames left to to send post event */ int shots; + int total_shots; unsigned int detecting_motion; struct tm *currenttime_tm; struct tm *eventtime_tm; diff --git a/motion.init-Debian.in b/motion.init-Debian.in deleted file mode 100644 index 3632a54..0000000 --- a/motion.init-Debian.in +++ /dev/null @@ -1,69 +0,0 @@ -#! /bin/bash -# -# @PACKAGE_NAME@ @PACKAGE_VERSION@ -# Start the motion detection . -# - -NAME=@PACKAGE_NAME@ -PATH=/bin:/usr/bin:/sbin:/usr/sbin -DAEMON=@BIN_PATH@/@PACKAGE_NAME@ -PIDFILE=/var/run/@PACKAGE_NAME@/$NAME.pid - - -trap "" 1 -export LANG=C -export PATH - -test -f $DAEMON || exit 0 - - -case "$1" in - start) - echo "Starting @PACKAGE_NAME@ detection : $NAME" - start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --chuid motion - ;; - - stop) - echo "Stopping @PACKAGE_NAME@ detection : $NAME" - start-stop-daemon --stop --pidfile $PIDFILE --oknodo --exec $DAEMON --retry 30 - ;; - - status) - echo "Status @PACKAGE_NAME@ detection : $NAME" - if (test -f $PIDFILE); then - echo -n "Running process for $NAME : " - pidof $NAME - else - echo "Stopped" - fi - ;; - - reload-config) - echo "Reloading $NAME configuration" - start-stop-daemon --stop --pidfile $PIDFILE --signal HUP --exec $DAEMON - ;; - - restart-motion) - echo "Restarting $NAME" - start-stop-daemon --stop --pidfile $PIDFILE --oknodo --exec $DAEMON --retry 30 - start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --chuid motion - ;; - - restart) - $0 restart-motion - exit $? - ;; - - *) - echo "Usage: /etc/init.d/$NAME {start|stop|status|reload-config|restart}" - exit 1 - ;; -esac - -if [ $? == 0 ]; then - echo . - exit 0 -else - echo failed - exit 1 -fi diff --git a/motion.init-Fedora.in b/motion.init-Fedora.in deleted file mode 100644 index a21f955..0000000 --- a/motion.init-Fedora.in +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash -# -# motion Startup script for the Motion Detection System -# -# chkconfig: - 85 15 -# description: Motion detection system. It is used to detect movement based \ -# on compare images. -# processname: @PACKAGE_NAME@ -# pidfile: /var/run/@PACKAGE_NAME@.pid -# config: /etc/@PACKAGE_NAME@.conf -# -### BEGIN INIT INFO -# Provides: motion -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Default-Start: -# Default-Stop: -# Short-Description: Start and stop motion detection system -# Description: The Motion detection system is used to detect movement based -# on image comparison. -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -motion=${MOTION-/usr/bin/motion} -prog=motion -pidfile=/var/run/motion.pid -lockfile=/var/lock/subsys/motion - -start() { - [ -x $exec ] || exit 5 - [ -f $config ] || exit 6 - echo -n $"Starting $prog: " - # We try to determine which architecture we have so we can - # load libv4l to support more USB cameras. x86_64 and ppc64 - # are both supported by rpmfusion. - case $(uname -i) in - "x86_64" ) - #We load libv4l for 64 Bit x86 architectures - LD_PRELOAD=/usr/lib64/libv4l/v4l2convert.so daemon $motion 2> /dev/null ;; - "ppc64" ) - #We load libv4l for 64 Bit PPC architectures - LD_PRELOAD=/usr/lib64/libv4l/v4l2convert.so daemon $motion 2> /dev/null ;; - * ) - #Default case, we load libv4l for all 32 Bit architectures - LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so daemon $motion 2> /dev/null ;; - esac - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - killproc $motion - retval=$? - echo - [ $retval = 0 ] && rm -f $lockfile -} - -restart() { - stop - start -} - -reload() { - echo -n $"Reloading $prog configuration: " - killproc $motion -HUP - retval=$? - echo - return $retval -} - -rh_status() { - # run checks to determine if the service is running or use generic status - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - #force_reload - reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 1 -esac -exit $? diff --git a/motion.init-FreeBSD.sh.in b/motion.init-FreeBSD.sh.in deleted file mode 100644 index a7b6e3d..0000000 --- a/motion.init-FreeBSD.sh.in +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# motion.sh for rc.d usage 2006 Angel Carpintero -# -# Add the following line in /etc/rc.conf to enable @PACKAGE_NAME@ at startup -# -# motion_enable="YES" -# - -# PROVIDE: @PACKAGE_NAME@ -# REQUIRE: DAEMON -# KEYWORD: shutdown - -. /etc/rc.subr - -motion_enable="${motion_enable-NO}" - -name="@PACKAGE_NAME@" -rcvar=`set_rcvar` - -command="@BIN_PATH@/${name}" -pidfile="/var/run/${name}.pid" -required_files="/usr/local/etc/${name}.conf" - -load_rc_config $name -run_rc_command "$1" diff --git a/motion.spec.in b/motion.spec.in deleted file mode 100644 index 6cebd6c..0000000 --- a/motion.spec.in +++ /dev/null @@ -1,134 +0,0 @@ -Name: @PACKAGE_NAME@ -Version: @PACKAGE_VERSION@ -Release: 1%{?dist} -Summary: A motion detection system - -Group: Applications/Multimedia -License: GPLv2+ -URL: http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome -Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: libjpeg-devel ffmpeg-devel zlib-devel -#This requires comes from the startup script, it will be there until motion supports libv4l calls in the code -Requires: libv4l -Requires(post): chkconfig -Requires(preun): chkconfig initscripts -Requires(postun): initscripts - -%description -Motion is a software motion detector. It grabs images from video4linux devices -and/or from webcams (such as the axis network cameras). Motion is the perfect -tool for keeping an eye on your property keeping only those images that are -interesting. Motion is strictly command line driven and can run as a daemon -with a rather small footprint. This version is built with ffmpeg support but -without MySQL and PostgreSQL support. - -%prep -%setup -q - -%build -%configure --sysconfdir=%{_sysconfdir}/%{name} --without-optimizecpu --with-ffmpeg --without-mysql --without-pgsql -make %{?_smp_mflags} - -%install -rm -rf %{buildroot} -make install DESTDIR=%{buildroot} -#We rename the configuration file -mv %{buildroot}%{_sysconfdir}/%{name}/motion-dist.conf %{buildroot}%{_sysconfdir}/%{name}/motion.conf -#We change the PID file path to match the one in the startup script -sed -i 's|/var/run/motion/motion.pid|/var/run/motion.pid|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -#We remove SQL directives in the configuration file, as we don't use them -sed -i 's|sql_log_image|; sql_log_image|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -sed -i 's|sql_log_snapshot|; sql_log_snapshot|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -sed -i 's|sql_log_mpeg|; sql_log_mpeg|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -sed -i 's|sql_log_timelapse|; sql_log_timelapse|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -sed -i 's|sql_query|; sql_query|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -#We set the log file and target directory - logging is for 3.3 branch -sed -i 's|;logfile|logfile /var/log/motion.log|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -sed -i 's|target_dir /usr/local/apache2/htdocs/cam1|target_dir /var/motion|g' %{buildroot}%{_sysconfdir}/%{name}/motion.conf -#We install our startup script -install -D -m 0755 motion.init-Fedora %{buildroot}%{_initrddir}/%{name} - -%post -#We add the motion init script to the services when installing -/sbin/chkconfig --add %{name} - -%preun -#We stop the service and remove it from init scripts when erasing -if [ $1 = 0 ] ; then - /sbin/service %{name} stop >/dev/null 2>&1 - /sbin/chkconfig --del %{name} -fi - -%postun -#We restart the service during an upgrade -if [ "$1" -ge "1" ] ; then - /sbin/service %{name} condrestart >/dev/null 2>&1 -fi - -%clean -rm -rf %{buildroot} - -%files -#Permissions are bogus upstream, we need to be sure to set them here -%defattr (-,root,root,-) -%dir %{_sysconfdir}/%{name} -%dir %{_datadir}/%{name}-%{version} -%dir %{_datadir}/%{name}-%{version}/examples -%doc CHANGELOG COPYING CREDITS INSTALL README motion_guide.html -%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/motion-dist.conf -%attr(0755,root,root) %{_datadir}/%{name}-%{version}/examples/motion.init-Debian -%attr(0755,root,root) %{_datadir}/%{name}-%{version}/examples/motion.init-FreeBSD.sh -%attr(0755,root,root) %{_datadir}/%{name}-%{version}/examples/motion.init-Fedora -%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread1.conf -%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread2.conf -%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread3.conf -%attr(0644,root,root) %{_datadir}/%{name}-%{version}/examples/thread4.conf -%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/motion.conf -%attr(0755,root,root) %{_bindir}/motion -%attr(0644,root,root) %{_mandir}/man1/motion.1* -%attr(0755,root,root) %{_initrddir}/%{name} - -%changelog -* Thu Mar 06 2010 Steven Moix - 3.2.12-1 -- New upstream release, important bugfixes only - -* Wed Oct 21 2009 Thorsten Leemhuis - 3.2.11.1-3 -- rebuild for new ffmpeg - -* Tue Aug 11 2009 Steven Moix - 3.2.11.1-1 -- Drop patch for ffmpeg 0.5 compatibility -- Drop ffmpeg detection patch -- Moved default output directory to /var/motion -- New startup script with added v4l2convert to support more cameras - https://bugzilla.rpmfusion.org/show_bug.cgi?id=681 -- Fix Segfault on reload or quit for vloopback (maybe other v4l1 devices too) -- Fix fd leaks in external pipe -- Avoid possible stack smashing in v4l_open_vidpipe() -- Fix segfault for new libjpeg v7 - -* Mon Jul 06 2009 Steven Moix - 3.3.0-1 -- SPEC Preparation for the 3.3 branch - -* Sun Jun 05 2009 Steven Moix - 3.2.11-5 -- Patch and rebuild for ffmpeg 0.5 - -* Sun Mar 29 2009 Thorsten Leemhuis - 3.2.11-4 -- rebuild for new F11 features - -* Wed Mar 18 2009 Steven Moix - 3.2.11-3 -- Even more corrected init script thanks to Stewart Adam - -* Sun Mar 15 2009 Steven Moix - 3.2.11-2 -- Removed the ffmpeg requires -- Corrected the spec file -- New init script with a corrected start() function and LSB header support - -* Tue Mar 03 2009 Steven Moix - 3.2.11-1 -- Updated to Fedora 10 standard - -* Sun Sep 18 2005 Kenneth Lavrsen - 3.2.4-1 -- Generic version of livna spec file replacing the old less optimal specfile. - -* Thu Sep 15 2005 Dams - 3.2.3-0.lvn.1 -- Initial released based upon upstream spec file diff --git a/motion_guide.html b/motion_guide.html deleted file mode 100644 index c23bb02..0000000 --- a/motion_guide.html +++ /dev/null @@ -1,3542 +0,0 @@ -

Motion Guide - One Large Document.

-This version of the Guide is made for inclusion in the Motion download package for off line reading. -

-If you read this document from the distribution package of Motion or from some not up to date mirror you should know that the URL for the always up to date version is http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide. If you are already on the new TWiki based Motion site clicking the link just mentioned will lead you to the index page for the Motion Guide documents. -


-This topic consists of the following subtopics: -MotionOverview, KnownProblems, InstallOverview, PrepareInstall, ConfigureScript, MakeInstall, UpgradingFromOlderVersion, RunningMotionConfigFiles, CommandLineOptions, ConfigFileOptions, SignalsKill, ErrorLogging, CaptureDeviceOptions, MotionDetectionSettings, ImageFileOutput, TuningMotion, MpegFilmsFFmpeg, SnapshotsWebCam, TextFeatures, AdvancedFilenames, ConversionSpecifiers, WebcamServer, RemoteControlHttp, ExternalCommands, TrackingControl, UsingDatabases, LoopbackDevice. -
-

-

-
-

-

Motion Guide - Installation

-

-

Motion Overview

-

-

What is Motion?

-Motion is a program that monitors the video signal from one or more cameras and is able to detect if a significant part of the picture has changed. Or in other words, it can detect motion. -

-The program is written in C and is made for the Linux operating system. -

-Motion is a command line based tool. It has absolutely no graphical user interface. Everything is setup either via the command line or via a set of configuration files (simple ASCII files that can be edited by any ASCII editor). -

-The output from motion can be: -

    -
  • jpg files -
  • ppm format files -
  • mpeg video sequences -
-

-

How do I get Motion and what does it cost?

-Motion is an open source type of project. It does not cost anything. Motion is published under the GNU GENERAL PUBLIC LICENSE (GPL) version 2 or later. It may be a bit difficult to understand all the details of the license text (especially if your first language is not English). It means that you can get the program, install it and use it freely. You do not have to pay anything and you do not have to register anywhere or ask the author or publisher for permission. The GPL gives you both rights and some very reasonable duties when it comes to copying, distribution and modification of the program. So in very general terms you do not have to worry about licensing as a normal hobby user. If you want to use Motion in a commercial product, if you want to distribute either modified or original versions of Motion - for free or for a fee, you should read the license carefully. For more information about free software and the GPL, I encourage you to study the very interesting documents about the subject available the of the Free Software Foundation pages about the Philosophy of the GNU Project. -

-

Maintenance and Support

-Both Motion and the Motion Guide are written by people that do all this as a hobby and without asking for any payments or donations. We have a life other than developing Motion and its documentation. This means that bugfixes and updates to this guide are done as our time and families allow it. You are however encouraged to participate and contribute in a very active mailing list. It is a list with a very "positive attitude" and with many contributors that propose features, post patches, discuss problems and patiently answer newbie questions with a very positive spirit. Expect 1-10 emails per day. -

-To get motion direct your browser to the Motion Homepage. -

-On the Download Files page you will find a links to the latest stable version both as sources and binaries for some of the most popular Linux distributions. You will also find links to development versions. Snapshot releases are special test releases that are normally very stable. Every day a Motion Daily Source Snap is created from the Motion Subversion -

-Motion was originally written by Jeroen Vreeken who still actively participates in the development of Motion and later Folkert van Heusden continued as a lead programmer with Kenneth Lavrsen responsible for Motion Guide, website and releases on Sourceforge. -

-From version 3.1.12 Motion is now project managed entirely by Kenneth Lavrsen, and the project now shift towards being developed by many contributers. -

-For support we encourage you to join the mailing list instead of writing to Jeroen, Folkert or Kenneth directly. We are all very active on the mailing list and by using the mailing list much more users will have benefit of the answers. Newbies and stupid questions are welcome on the list. Contributions in the form of patches are also very welcome on the mailing list. -

-

Which version to download and use?

-Versions 3.2.X are the current version. There is at the moment no development branch. The versions 3.1.X ended at 3.1.20 and there will be no more 3.1.X releases. If you use use a version older than 3.2.X you are encouraged to update. -

-Since 3.1.13 quite many options have been renamed to make setting up Motion easier. From 3.1.17-18 some unfinished features have been removed. The Berkeley mpeg feature is now removed because the ffmpeg feature is now mature and much better working. At version 3.1.18 a new network camera feature was introduced replacing the old cURL based netcam code and introducing support of mjpeg streaming cameras. However this new code was quite difficult to get stable. During the development of 3.2.2 the network camera code was totally rewritten again learning from our experience and now finally it seems to be stable. -

-Since 3.2.3 Debian users can find binary packages on the Motion Sourceforge file download page. You can find Debian versions of Motion in different Debian repositories but they are all out of date and hardly ever get updated. -

-

What features does Motion have?

-See more description at the Motion Homepage.
    -
  • Taking snapshots of movement -
  • Watch multiple video devices at the same time -
  • Watch multiple inputs on one capture card at the same time -
  • Live streaming webcam (using multipart/x-mixed-replace) -
  • Real time creation of mpeg movies using libraries from ffmpeg -
  • Take automated snapshots on regular intervals -
  • Take automated snapshots at irregular intervals using cron -
  • Executing external program when detecting movement -
  • Execute external program at the beginning of an event of several motion detections. -
  • Execute external program at the end of an event of several motion detections. -
  • Execute external program when a picture is saved. -
  • Execute external program when a movie mpeg is created (opened) -
  • Execite external program when a movie mpeg ends (closed) -
  • Motion tracking -
  • Feed events to an MySQL or PostgreSQL database. -
  • Feed video back to a video4linux loopback for real time viewing -
  • Web interface using Motion Related Projects such as motion.cgi, Kenneths Webcam Package, Kevins Webpage, X-Motion and many more. -
  • User configurable and user defined on screen display. -
  • Control via simple web interface. -
  • Automatic noise and threshold control -
  • Ability to control the pan/tilt of a Logitech Sphere (or Orbit) camera -
  • Highly configurable display of text on images. -
  • High configurable definition of path and file names of the stored images and films. -
-

-You can find more information and links at the Motion Homepage. -

-

FreeBSD

-

-Motion is originally developed for Linux and it is still mainly developed and supported for this platform. From version 3.1.15 an experimental port has been made by Angel Carpintero. Not all features of Motion are supported at this time and it still needs a lot of test time on different hardware. Angel is very interested in feedback. Join the Motion Mailing List and give your feedback there. Patches for bugfixes and for enabling the missing features are very welcome. The rest of this guide is still mainly targeted for Linux users. Follow this topic to Install FreeBSD. -

-

MacOSX

-

-From Motion version 3.2.4 it is now also possible to build and install Motion under MacOSX. Feature set it the same as for FreeBSD. See the MacOSX topic for specific help how to install Motion and its dependencies on MacOSX. Again this port has been contributed by Angel Carpintero. -

-

Documentation

-You have the following sources of information: -

-

-

Supported Hardware

-Input devices: Here we are thinking about the cameras. -

-Motion supports video input from two kinds of sources. -

-Standard video4linux devices (e.g. /dev/video0). Motion has no drivers for cameras. Installing the camera itself is outside the scope of this document. But here are some nice links.

-Network cameras (which are actually cameras with a built in web server that can be connected directory to your network). -

-

-

Known Problems

-See also the Frequently Asked Questions and Bug Reports for known open bugs. -

-Kernel 2.6 and pwc. Note that for kernel 2.6 there is a new release of the Philips WebCam (pwc) drivers 10.0.X. It is recommended to install this. At the time of this being written the 2.6.12+ kernels have a version of pwc built-in but it is a cripled version which can only support very small picture size. You can however download the latest source code of the pwc driver (at this time 10.0.11) and build it without having to rebuild your kernel. But you will need to have either the kernel sources or a special kernel-header package installed to compile it. See Installation of PWC page which is also hosted in this wiki. -

-If you use use a Logitech Quickcam Orbit or Sphere using the driver pwc/pwcx and kernel 2.6.X you should replace the file in the Motion sources called pwc-ioctl.h with the one that comes with the your pwc version. Motion is shipped with 3 versions of pwc-ioctl.h-VERSION. Rename the one that fits your major pwc version number best to pwc-ioctl.h (after renaming the current to something else). There has been some small adjustments in the API that requires that you have the right header file. -

-Camera picture dimensions must be multiple of 16 -Dimentions of camera image must have both height and width that are a multiple of 16. Thís is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16. But if you intend to monitor a network camera which is saving jpeg images you may have to pay attention to the dimensions of the picture. -

-ffmpeg_filename has changed name to movie_filename -The 3.2.5 release contains a motion_guide and man page in which it was forgotten to change ffmpeg_filename to movie_filename. Please note that the option that defines the filenames for mpeg movies is now called movie_filename. This change is made because we may soon implement alternatives to ffmpeg and then ffmpeg_filename will be a bad name. This is fixed in release 3.2.5.1. -

-error: `time_current_frame' undeclared (first use in this function) -A bug in 3.2.5 and 3.2.5.1 where a bugfix related to snapshot feature has created a new bug when you compile Motion without ffmpeg libs installed. This is fixed in 3.2.6. -

-

-

How do I install Motion?

-Motion is mainly distributed as source files that you must compile yourself. There is also an RPM made on Fedora Core 3. And Debian packages are available for selected versions. -

-The short overview of the steps to install Motion from sources.

    -
  • Preparation: Motion uses a number of shared libraries that must be installed on your computer before you can build Motion. The needed shared libraries depends on the features you wish to use. Features network camera, ffmpeg, MySQL and PostgreSQL needs specific shared libraries installed. See preparation section for more information. -
-

    -
  • Download the motion source files (distributed as tar'ed and compressed files). Place the file in a place of your own choice. -
-

    -
  • Untar and uncompress the file to the place you want the program installed. Editor recommends placing the motion source file directory in /usr/local. If you do not have write access to the /usr/local directory (you are under the mercy of an ignorant system administrator with a severe case of paranoia) - you can install the program in a directory in your home directory. You will then need to read the next section about how to configure before you compile the program. Below is shown the exact commands using version 3.2.X installed in /usr/local as an example (replace /path/to with the actual placement of the tar.gz file). -
-
    -
    -cd /usr/local
    -tar -xvzf /path/to/motion-3.2.X.tar.gz
    -
    -
    -
  • You will now have created a directory called motion-3.2.X. You can rename it to motion (mv motion-3.1.X motion). I recommend creating a symbolic link to the current version. This way you can more easily experiment with different version simply by changing the link. -
-
    -
    -ln -s motion-3.2.X motion
    -
    -
    -
  • Now change to the new directory -
-
    -
    -cd motion
    -
    -
    -
  • Run configure. You can start with the defaults. If you need to modify the installation parameters you can read the next section. -
-
    -
    -./configure
    -
    -
    -
  • Build the code -
-
    -
    -make
    -
    -
    -
  • Install the code, manual page, etc -
-
    -
    -make install
    -
    -
    -
  • In /etc/motion/etc you will find a file called motion-dist.conf. If it is the first time you install Motion - rename this file to motion.conf and edit as a minimum the settings: videodevice, input, norm, frequency, width, height and target_dir. That should get you going. -
-

    -
  • Run the program. To enable more features you must modify the config file. -
-
    -
    -motion
    -
    -
-

-

-

Preparation For Install

-

-Note: If you're using SuSE 9.2, you might want to ADDITIONALLY have a look at Compiling on SuSE 9.2. As mentioned on that page as well, you will still need to read the instructions here as well. -

-Before you start you may need to install a number of shared libraries that Motion uses. If they are missing the feature will simply normally not be included. Most of these libraries can be found on the CDs of your distribution. A few will have to be downloaded from the Internet. Note that when you install software using pre-compiled binaries (Redhat type RPMs, Debian debs etc) you normally only get what is needed to run the programs themselves. In order to compile other programs from source that uses these pre-compiled libraries you also need to installed the development packages. These are normally called the same name as the package suffixed by -devel or -dev. These development packages contains the header files (xxx.h) that Motion needs to build with the shared libraries. If you build a library from sources you already have these header files. It is recommended to simply install the pre-compiled binary packages and their development brothers. -

-This is a list of shared libraries used by Motion and the RPM packages that provides them. -

-Motion will always need these libraries to be built and work - - - - -
Library RPM Packages Debian Packages
libm, libresolv, libdl, libpthread, libc, ld-linux, libcrypt, and libnsl glibc and glibc-devel libc6 , libc6-dev ,libglib1.2
libjpeg libjpeg and libjpeg-devel libjpeg62 and libjpeg62-dev ( optional libjpeg-mmx-dev )
libz zlib and zlib-devel zlib1g and zlib1g-dev
-

-For generating mpeg films with ffmpeg you need this library:
-(See also the section Generating MPEG films with ffmpeg for how to install ffmpeg and libavformat/libavcodec)
-Motion must be installed with revision 0.4.8 or 0.4.9pre1 of ffmpeg. Motion will also work with later CVS snapshots of ffmpeg but the API of the ffmpeg libraries changes all the time and without warning. If you have problems compiling Motion or with running an RPM of Motion you may try with an older CVS snapshot of ffmpeg. The Motion developers will like to know when ffmpeg changes and breaks Motion so we can fix it. Please file a bug report then with the exact date of the ffmpeg CVS version you have trouble with. -

- - -
Library RPM Packages Debian Packages
libavcodec, libavformat ffmpeg and ffmpeg-devel or install from source libavcodec-dev libavcodec0d libavformat-dev libavformat0d (*)
-

-Debian has not provided deb packages for ffmpeg due patent issues. However this is about to change so checkout for availability of newer versions of debian ffmpeg debs. You can build yourself from source or from Christian Marillat website or apt repository. -

-deb http://www.debian-multimedia.org stable main # ( etch )
-deb http://www.debian-multimedia.org testing main # ( lenny )
-deb http://www.debian-multimedia.org unstable main # ( sid )
-
-
-Add the suitable line to your /etc/apt/sources.list and run this: -
-apt-get update ; apt-get -y install libavcodec-dev libavcodec0d libavformat-dev libavformat0d
-
-

-For logging in MySQL you need this library: - - -
Library RPM Packages Debian Packages
libmysqlclient mysql and mysql-devel libmysqlclient15-off and libmysqlclient15-dev
-

-For logging in PostgreSQL you need this library: - - -
Library RPM Packages Debian Packages
libpq postgresql-libs and postgresql-devel libpq-dev and libpq4
-

-

-

Configure Script

-Configure is script that you run to setup the build environment for the C-compiler. It generates the "Makefile" which the program "make" uses to compile and install the software. -

-To run configure your current directory must be the motion directory. You type -

-./configure -

-You can add the parameter ./configure --help to get help on the different switches. -

-This is walk through of the options. -

- - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Option Description
Defaults for the options
are specified in brackets [ ]
Editors comment
-h, --help display this help and exit  
--help=short display options specific to this package This command shows the options special to motion. Recommended
--help=recursive display the short help of all the included packages  
-V, --version display version information and exit Gives no useful information
-q, --quiet, --silent do not print `checking...' messages Not very useful. Output to screen is only a few lines anyway.
--cache-file=FILE cache test results in FILE. [disabled] No function
-C, --config-cach alias for `--cache-file=config.cache' No function
-n, --no-create do not create output files Used for testing if other switches produce error - without writing anything to the disk
--srcdir=DIR find the sources in DIR. [configure dir or `..'] DIR is a directory path. Editor recommends having the current directory being the motion installation directory and not using this switch. Then it defaults to the same directory as where the configure script is which is the current directory.
Installation directories:    
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
The default /usr/local means that the executable binary "motion" is installed in /usr/local/bin, the manual page in /usr/local/man/man1, the document files in /usr/local/docs/motion-version, configuration file in /usr/local/etc, and some examples config files in /usr/local/examples/motion-versionEditor recommends keeping this default setting.
If you are experimenting with many parallel versions it may be interesting to set the PREFIX to e.g. /usr/local/motion and then add /usr/local/motion/bin to your search path (or simply cd /usr/local/motion/bin before execution).
This way you can change version just by changing the symbolic link in /usr/local/motion as suggested earlier in this guide.
If you are installing the software on a machine where you have no access to the /usr/local but have write access to a home directory, then you should change this to point to a directory within your home tree.
Example: --prefix=$HOME
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
If you set this it only defines an alternative installation directory for the executable binary.
Note: The executable binary will be placed in a directory "bin" below the directory specified by this option
Editor recommends leaving this as default (i.e. not setting it).
--bindir=DIR user executables [EPREFIX/bin] With this option you can control exactly in which directory the executable binary is installed. The previous option automatically adds the bin directory. Here you are in fill control.
--sbindir=DIR System admin executables [EPREFIX/sbin] Not used by motion. Ignore it.
--libexecdir=DIR program executables [EPREFIX/libexec] Not used by motion. Ignore it.
--datadir=DIR read-only architecture-independent data [PREFIX/share] Not used by motion. Ignore it.
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] This is where motion both installs the default configuration file and also where it later searches for it.
Motion searches for the configuration file "motion.conf" in the following order:

    1. Current directory from where motion was invoked
    2. $HOME/.motion
    3. The sysconfig directory set by this switch. If not defined the default is /usr/local/etc/

Editor recommends leaving this at default. Be careful if you run "make install" again. This will overwrite the motion.conf file that you have edited and experimented with for hours. Make sure to keep a copy in a safe place. Alternatively, copy the working file to the motion base install directory. Then make install will simply copy the same file back again.
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] Not used by motion. Ignore it.
--localstatedir=DIR modifiable single-machine data [PREFIX/var] Not used by motion. Ignore it.
--libdir=DIR object code libraries [EPREFIX/lib] Not used by motion. Ignore it.
--includedir=DIR C header files [PREFIX/include] Not used by motion. Ignore it.
--oldincludedir=DIR C header files for non-gcc [/usr/include] Not used by motion. Ignore it.
--infodir=DIR info documentation [PREFIX/info] Not used by motion. Ignore it.
--mandir=DIR man documentation [PREFIX/man] Editor recommends the default.
Optional Packages:    
--with-ffmpeg=DIR Specify the path for the directory prefix in which the library and headers are installed.
If not specified configure will search in /usr/ and /usr/local/
DIR is the directory PREFIX in which the ffmpeg shared libraries and their headers are installed.
If you install ffmpeg from sources and use the default directories or if ffmpeg is installed as a binary package (RPM or deb) you do not need to specify the directory prefix. Configure will find the libraries automatically. If you installed ffmpeg from sources and specified a different --prefix when building ffmpeg you must use the same value for the DIR ( --with-ffmpeg=DIR).
For more information on FFmpeg see the FFmpeg project home page.
FFmpeg is a package that enables streamed video mpeg signal from your web camera to a browser.
Editor recommends installing ffmpeg from source and in the directory /usr/local/ffmpeg and build ffmpeg with ./configure --enable-shared.
This places libraries in /usr/local/lib and headers in /usr/local/include.
--without-ffmpeg Do not compile with ffmpeg Use this if you do not want to compile with ffmpeg. If ffmpeg is not installed you do not need to specify that Motion must build without ffmpeg.
--with-mysql-lib=DIR Lib directory of MySQL Normally, configure will scan all possible default installation paths for MySQL libs. When its fail, use this command to tell configure where MySQL libs installation root directory is.
--with-mysql-include=DIR Include directory with headers for MySQL Normally, configure will scan all possible default installation paths for MySQL include. When its fail, use this command to tell configure where MySQL include installation directory is. This is the directory with the MySQL header files.
--without-mysql Do not compile with MySQL support Use this if you do not want to include MySQL support in the package.
This can also be useful if you get compilation errors related to MySQL and you actually do not need the feature anyway.
--with-pgsql=DIR Include PostgreSQL support. DIR is the PostgreSQL base install directory, defaults to /usr/local/pgsql.
Set DIR to "shared" to build as a dynamic library, or "shared,DIR" to build as a dynamic library and still specify DIR.
Default is that make searches in the normal installation directories of most distributions.
See section later about PostgreSQL about potential problem during compilation. There is an easy workaround for it.
--without-pgsql Do not compile with PostgreSQL support Use this if you do not want to include PostgreSQL support in the package.
This can also be useful if you get compilation errors related to PostgreSQL and you actually do not need the feature anyway.
--without-v4l Exclude using v4l (video4linux) subsystem. Makes Motion so it only supports network cameras. Can be used if you do not need V4L support and maybe lack some of the libraries for it.
--with-linuxthreads Use linuxthreads in BSD instead of native phtreads Only relevant for BSD. In Linux we always use this per default.
--without-bktr Exclude to use bktr subsystem , that usually useful for devices as network cameras ONLY used in *BSD
--with-jpeg-mmx=DIR Specify the prefix for the install path for jpeg-mmx for optimized jpeg handling (optional). If this is not specified motion will try to find the library /usr/lib/libjpeg-mmx.a /usr/local/lib/libjpeg-mmx.a. Considered experimental
--without-optimizecpu Exclude autodetecting platform and cpu type. This will disable the compilation of gcc optimizing code by platform and cpu. Use this if the optimization causes problems. Typically if you build on some non X386 compatible CPU.
Developers options    
--with-developer-flags Add additional warning flags for the compiler. This option is for developers only. It produces a flood of warnings that helps the developer to write more robust code. These warnings are normally harmless but can sometimes be a latent defect.
For more information about these flags, see CompileWithDeveloperFlags
- -
-
-

-

Make

-When you run make, all the C-source files are automatically compiled and linked. Just look out for error messages. -

-Make uses a file called "Makefile" which is generated by the "configure" script you just ran. If you have special needs you can manually edit this file. Next time you run configure a new Makefile will be generated and your changes are lost. -

-ALERT! Attention! -

-If you have run make before, you should run a make clean before running make again. This cleans out all the object files that were generated the previous time you ran make. If you do not run make clean first before you rebuild Motion you may not get the additional feature included. For example: If you built Motion without ffmpeg support and then add it later - and rebuild Motion without running make clean first - the ffmpeg feature does not get compiled into the Motion binary. -

-First time you build motion run ./configure, make, make install. If you need to build it again (to run with different configure options) run ./configure, make clean, make, make install. -

-

Make Install

-make install simply copies all the nice files that were generated during the compilation/linking that make did. -

-Makes the directories (if they do not already exist)(path shown are the defaults): /usr/local/bin, usr/local/man/man1, /usr/local/etc, /usr/local/share/doc/motion-3.2.X, and /usr/local/share/doc/examples/motion-3.2.X. -

-Copies the following files from the base motion directory (assuming the default PREFIX /usr/local was used when running configure - otherwise adjust to the actuals you chose)

    -
  • Executable binary "motion" to /usr/local/bin -
  • Manual page "motion.1" to /usr/local/man/man1 -
  • Document files "CHANGELOG, COPYING, CREDITS, INSTALL, and README to /usr/local/share/doc/motion-3.2.X -
  • Example configuration files "*.conf" to /usr/local/share/doc/examples/motion-3.2.X -
  • Configuration file "motion-dist.conf" to /usr/local/etc -
-Note that the any existing files are overwritten. The default config file motion-dist.conf is named like this so that you do not get your working motion.conf file overwritten when you upgrade Motion. -

-

Un-install

-From the motion base installation directory you simply run make uninstall -

-And delete the base installation directory in /usr/local and any link pointing to it. If you have forgotten where you installed it or someone else did it for you, simply search for the files and directories starting with motion. If the filenames and the directories match the names described in the "Make Install" section of this document, you can safely delete them. -

-

Additional Make Options

-The make command can be run with several options. make, make install and make uninstall has already been described above. -

-
make clean
deletes all the binary files (object files) and the motion binary generated by make. It also deletes temporary files and any jpg files that motion has saved in the motion source directory. It is very important to always run make clean before you run make if you change the configuration (like adding features such as ffmpeg) and rebuild motion. -
-

-
make distclean
deletes the files: config.status, config.log, config.cache, Makefile, and motion.spec. -
-

-
make updateguide
fetches a fresh new copy of this guide and place it in your motion source directory. Note that the pictures are not downloaded. -
-

-
make dist
performs make clean, make distclean and make updateguide in one single operation. -
-

-

-

Upgrading From Older Version

-If you are upgrading from motion 3.0.X or from an older version of 3.1.X you should note that many options have been removed from version 3.1.13 and forward and many new have arrived. You still have most of the old features. The options have been changed for two reasons. New more flexible features and to simplify getting started with Motion. With 3.2.1 the changes are significant. -You should also note these major differences.
    -
  • The use of thread files has completely changed. Read the section "The Config Files" carefully. -
  • The mask file format has changed. Read the section about "Mask File" -
  • Pre_capture feature introduced in 3.1.12 -
  • Advanced filename feature enables very flexible filename definitions (3.1.13) -
  • onffmpegclose options enables running external scripts when mpeg file is closed (3.1.13) -
  • despeckle feature improves motion detection and noise immunity (3.1.13) -
  • Minimum_motion_frames feature prevents short noise events from being saved (3.1.14) -
  • If you use the database features you need to note that from version 3.1.15 and forward the fields have been redefined. Removed are second, minute, hour, day, month and year. Instead these six have been replaced by a real timestamp field called time_stamp. The relatively new field 'type' has been renamed to 'file_type' to avoid reserved SQL words. A new field 'text_left' has been added which stores the text given by the config option text_left. And last a field called 'camera' has been added which stores the thread number. -
  • From 3.1.15 the ffmpeg feature now also supports mpeg4 and msmpeg4. The build process of Motion now use ffmpeg libraries as shared libraries. The --with-libavcodec has been replaced by a --with-ffmpeg which only needed to specify if you are installing ffmpeg from sources in a non-standard location. If you have installed ffmpeg from sources already you will need to rebuild by running (from within the ffmpeg source file root) ./configure --enable-shared followed by make and make install. If you had installed ffmpeg from a binary RPM or deb you probably don't have to do anything. -
  • Rotate feature was introduced in 3.1.15 -
  • Berkeley mpeg feature has been removed in 3.1.18 (use ffmpeg - it is much better) -
  • Incomplete prediction feature was removed in 3.1.18. (lack of interest in finishing it) -
  • Smart Mask feature introduced in 3.1.18 -
  • output_normal can now also have the value "first" which means only save first jpg from each event (3.1.18) -
  • ffmpeg-0.4.9 is now supported. Motion detection mpegs can no longer be saved as mpeg1 (ffmpeg does not support non-standard framerates in 0.4.9) (3.1.18) -
  • Motion now supports most (not all) mjpeg streaming cameras (3.1.18). -
  • output_normal can now have values "first" or "best". It is used when you need to present a link to an mpeg movie shown as a single jpeg image. "First" saves the first picture frame in the new event. "Best" saves the picture frame with most motion content (most changed pixels) when the event is over. "on" still saves all motion detection picture frames plus pre and post captured images. With "best" you can set jpeg_filename = "preview" and it gets the same filename as the mpeg file but with extension .jpg. Option "locate" can also take the value "preview" which makes it only draw a rectangel on the jpeg but not on the mpeg movie. (3.2.1) -
  • The xmlrpc remote control interface is replaced by a much nicer http remote control interface. (3.2.1) -
  • All the options that calls external programs have been made much more generic. New onxxxx options have been added. Execute, sms and mail have been replaced by the generic on_event_start. (3.2.1) -
  • New setup mode makes setting all the detection options much easier. -
  • netcam now also supports proxies (3.2.2) and ftp (3.2.4) -
  • text on the pictures can be set to double size (3.2.2) -
  • Tracking with Logitech Sphere/Orbit improved (3.2.4) -
  • SQL database feature is now fully configurable so you can control which fields you have in the database. -
  • Many new conversion specifiers have been added which can be used both in filenames, commands, text, and SQL database features (3.2.2-3.2.4) -
  • Stepper motor tracking feature extended to also include a Y axis (3.2.5) -
  • ffmpeg_filename has been renamed to movie_filename to prepare for alternative implementation to mpeg files made with ffmpeg (3.2.5) -
  • New feature: ffmpeg_deinterlace which can de-interlace using the ffmpeg libs (3.2.5) -
  • New feature: minimum_frame_time which enables Motion to run at frame rates below 2. minimum_gap feature was removed since this was useless and the new minimum_frame_time feature replaces it with much better function. (3.2.7) -
  • New feature: process_id_file which writes a PID file when started and removes it when stopped (3.2.7) -
  • V4L2 support with many new supported palettes : V4L2_PIX_FMT_SBGGR8, V4L2_PIX_FMT_SN9C10X, V4L2_PIX_FMT_JPEG, V4L2_PIX_FMT_UYVY (3.2.8) -
  • ffmpeg_video_codec allow swf (3.2.8) -
  • V4L2 fix support for : V4L2_PIX_FMT_MJPEG (3.2.9) -
  • ffmpeg_video_codec allow flv and ffv1(3.2.9) -
-

-

-The table below shows the new options in the left column, and obsolete options in the right column. If the there are options on both sides in a row it means that the options in the left column replaced the options in the right column. -

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Options Obsolete Options
text_left (3.1.13)
text_right (3.1.13)
text_changes (3.1.13)
drawtext_user (3.1.13)
drawtext_shots (3.1.13)
drawtext_changes (3.1.13)
jpeg_filename (3.1.13)
ffmpeg_filename (3.1.13)
snapshot_filename (3.1.13)
timelapse_filename (3.1.13)
predict_filename (3.1.13)
(predict_filename removed in 3.1.18)
oldlayout (3.1.13)
snapshots_overwrite (3.1.13)
snapshot_interval (3.1.13) snapshots (3.1.13)
  realmotion (3.1.13)
despeckle (3.1.13)  
pre_capture (3.1.12)  
ffmpeg_timelapse (v. 3.1.14) ffmpeg_timelaps (renamed v 3.1.14)
ffmpeg_timelapse_mode (3.1.14)  
sql_log_image (3.1.14)
sql_log_snapshot (3.1.14)
sql_log_mpeg (3.1.14)
sql_log_timelapse (3.1.14)
sql_log_prediction (3.1.14)
 
minimum_motion_frames (3.1.14)  
rotate (3.1.15)  
ffmpeg_variable_bitrate (3.1.15)
ffmpeg_video_codec (3.1.15)
 
  berkeley_single_directory (3.1.18)
mpeg_encode (3.1.18)
mpeg_encode_bin (3.1.18)
adjust_rate off (3.1.18)
jpg_cleanup (3.1.18)
  predict_filename (3.1.18)
predict_enable (3.1.18)
predict_threshold (3.1.18)
predict_description (3.1.18)
sql_log_prediction (3.1.18)
brightness (3.1.18)
contrast (3.1.18)
saturation (3.1.18)
hue (3.1.18)
 
smart_mask_speed (3.1.18)  
output_normal
valid values are now "on", "off", "first" (3.1.18) and "best" (3.2.1)
 
setup_mode (3.2.1) always_changes (3.2.1)
locate
valid values are now "on", "off", "preview" (3.2.1)
 
jpeg_filename
Besides normal path names the value "preview" has speciel meaning together with output_normal = "best" (3.2.1)
 
control_html_output (3.2.1)  
on_event_start (3.2.1)
execute (3.2.1)
sms (3.2.1)
mail (3.2.1)
on_event_end (3.2.1)
 
on_motion_detected (3.2.1)
 
on_picture_save (3.2.1)
onsave (3.2.1)
on_movie_start (3.2.1)
on_movie_end (3.2.1)
onmpeg (3.2.1)
onffmpegclose (introduced 3.1.13)(renamed to on_movie_end 3.2.1)
netcam_proxy (3.2.2)  
text_double (3.2.2)  
webcam_motion
Feature has been heavily improved so it is actually usefull now (3.2.2).
 
netcam_url
Now also supports fetching single frame jpeg pictures via ftp using ftp:// syntax (3.2.4)
 
track_step_angle_x (3.2.4)
track_step_angle_y (3.2.4)
Add better configuration of auto tracking with a Logitech Sphere/Orbit camera.
 
track_move_wait (3.2.4)
track_auto (3.2.4)
Adds better configuration of auto tracking feature
 
sql_query (3.2.4)
Adds full flexibility of defining fields when using the SQL database features.
 
track_maxy (3.2.5)
track_motory (3.2.5)
 
movie_filename (3.2.5) ffmpeg_filename (3.2.5)
ffmpeg_deinterlace (3.2.5)  
minimum_frame_time (3.2.7) minimum_gap (3.2.7)
process_id_file (3.2.7)  
ffmpeg_video_codec allow swf (3.2.8)  
ffmpeg_video_codec allow flv and ffv1 (3.2.9)  
  night_compensate (3.2.10)
low_cpu (3.2.10)
- -
-
-

-

Running Motion

-

-

Important Definitions

-Motion is invoked from the command line. It has no GUI. Everything is controlled from config files. From version 3.2 the command line is only used to define location of config file and a few special runtime modes (setup and non-daemon). -

-A few important definitions.

    -
  • A snapshot is a picture taken at regular intervals independently of any movement in the picture. -
  • A "motion" image/mpeg shows the pixels that have actually changed during the last frames. These pictures are not very useful for normal presentation to the public but they are quite useful for testing and tuning and making mask files as you can see exactly where motion sees something moving. Motion is shown in greytones. If labelling is enabled the largest area is marked as blue. Smart mask is shown in read. -
  • A "normal" image is the real image taken by the camera with text overlayed. -
-

- -

The Config Files

-

-If Motion was invoked with command line option -c pathname Motion will expect the config file to be as specified. When you specify the config file on the command line with -c you can call it anything. -

-If you do not specify -c or the filename you give Motion does not exist, Motion will search for the configuration file called 'motion.conf' in the following order: -

    -
  1. Current directory from where motion was invoked -
  2. Then in a directory called '.motion' in the current users home directory (shell environment variable $HOME). E.g. /home/goofy/.motion/motion.conf -
  3. The directory defined by the --sysconfdir=DIR when running .configure during installation of Motion
    (If this option was not defined the default is /usr/local/etc/) -
-If you have write access to /usr/local/etc then the editor recommends having only one motion.conf file in the default /usr/local/etc/ directory. -

-Motion has a configuration file in the distribution package called motion-dist.conf. When you run 'make install' this file gets copied to the /usr/local/etc directory. -

-The configuration file needs to be renamed from motion-dist.conf to motion.conf. The original file is called motion-dist.conf so that your perfectly working motion.conf file does not accidentally get overwritten when you re-install or upgrade to a newer version of Motion. -

-If you have more than one camera you should not try and invoke Motion more times. Motion is made to work with more than one camera in a very elegant way and the way to do it is to create a number of thread config files. Motion will then create an extra tread of itself for each camera. If you only have one camera you only need the motion.conf file. The minute you have two or more cameras you must have one thread config file per camera besides the motion.conf file. -

-So if you have for example two cameras you need motion.conf and two thread config files. Total of 3 config files. -

-An option that is common to all cameras can be placed in motion.conf. (You can also put all parameters in the thread files but that makes a lot of editing when you change a common thing). -

-An option that is unique to a camera must be defined in each thread file. -

-It is often seen that people copy the entire motion.conf into the thread config files and change a few options. This works but it not recommended because it is more difficult to maintain and overview. Keep all the common options in motion.conf and the few unique only in the thread config files -

-The first camera is defined in the first thread file called from motion.conf. The 2nd camera is defined in the 2nd thread file called from motion.conf etc. -

-Any option defined in motion.conf will be used for all cameras except for the cameras in which the same option is defined in a thread config file. -

-Motion reads its configuration parameters in the following sequence. If the same parameter exists more than one place the last one read wins.

    -
  1. Motion reads the configuration file motion.conf from the beginning of the file going down line by line. -
  2. If the option "thread" is defined in motion.conf, the thread configuration file(s) is/(are) read. -
  3. Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in a thread config file. -
  4. Motion reads the command line option again overruling any previously defined options. -
-So always call the thread config files in the end of the motion.conf file. If you define options in motion.conf AFTER the thread file calls, the same options in the thread files will never be used. So always put the thread file call at the end of motion.conf. -

-Nearly all config options can be unique for a specific camera and placed in a thread config file. There are a few options that must be in motion.conf and cannot be in a thread config file: control_authentication, control_html_output, control_localhost, control_port, daemon, and thread. -

-If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features. You do not have to remove them or comment them out. -

-If you run the http control command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the thread.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do. -

-

-

Command Line Options

-

-ALERT! In Motion 3.2.1 and forward most command line options have been removed and replaced them by an option to specify location to motion.conf and a few options related to setting up motion. There are now only few command line options left and they are basically all new. -

-SYNOPSIS -

-motion [ -hns ] [ -c config file path]
-
-

- -

- - - - - - - - - -
Option Description Editors comment
-n Run in non-daemon mode. Instead of running Motion in the background Motion runs in the terminal window writing messages when things happen. If you have problems getting Motion to start or work, run Motion in this mode to get more messages that can help you solve the problem.
-s Run in setup mode. Also forces non-daemon mode
-c config file path Full path and filename of config file. E.g. /home/kurt/motion.conf. Default is /usr/local/etc unless specified differently when building Motion. Many RPMs and debian packages will most likely use /etc or /etc/motion as default
-h Show help screen.  
-d level Debugging mode This mode is used for developers to enable debug messages. Normal users will not need to use this mode unless a developer request to get additional information in the attempt to resolve a bug. Mainly the netcam code has debugging features. The level defines how much debugging info you get. A high number displays all debugging.
-p process_id_file Full path of process ID file Full path and filename of process id file (PID file). This is optional. If none is given as command line option or in motion.conf (process_id_file) Motion will not create a PID file.
- -
-
-

-

-

Config File Options

-These are the options that can be used in the config file. -

-All number values are integer numbers (no decimals allowed). Boolean options can be on or off. -

-Some configuration options are only used if Motion is built on a system that has the matching software libraries installed (MySQL, PostgreSQL and FFMPEG). -

-MySQL

    -
  • mysql_db, mysql_host, mysql_user, mysql_password -
-

-PostgreSQL

    -
  • pgsql_db, pgsql_host, pgsql_user, pgsql_password, pgsql_port -
-

-FFMPEG (libavcodec)

    -
  • ffmpeg_cap_new, ffmpeg_cap_motion, ffmpeg_filename, ffmpeg_timelapse, ffmpeg_timelapse_mode, ffmpeg_bps, ffmpeg_variable_bitrate, ffmpeg_video_codec -
-

-

Options in Alphabetical Order.

-

-The table below lists all the Motion options in alphabetical order. Click on the option name to see a longer description of each. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Option Range/Values
Default
Description
auto_brightness Values: on, off
Default: off
Let motion regulate the brightness of a video device. Only recommended for cameras without auto brightness
brightness Values: 0 - 255
Default: 0 (disabled)
The brightness level for the video device.
contrast Values: 0 - 255
Default: 0 (disabled)
The contrast level for the video device.
control_authentication Values: Max 4096 characters
Default: Not defined
To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file.
control_html_output Values: on, off
Default: on
Enable HTML in the answer sent back to a browser connecting to the control_port. This option must be placed in motion.conf and not in a thread config file.
control_localhost Values: on, off
Default: on
Limits the http (html) control to the localhost. This option must be placed in motion.conf and not in a thread config file.
control_port Values: 0 - 65535
Default: 0 (disabled)
Sets the port number for the http (html using browser) based remote control. This option must be placed in motion.conf and not in a thread config file.
daemon Values: on, off
Default: off
Start in daemon (background) mode and release terminal. This option must be placed in motion.conf and not in a thread config file.
despeckle Values: EedDl
Default: Not defined
Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling.
ffmpeg_bps Values: 0 - 9999999
Default: 400000
Bitrate of mpegs produced by ffmpeg. Bitrate is bits per second. Default: 400000 (400kbps). Higher value mans better quality and larger files. Option requires that ffmpeg libraries are installed.
ffmpeg_cap_motion Values: on, off
Default: off
Use ffmpeg libraries to encode motion type mpeg movies where you only see the pixels that changes.
ffmpeg_cap_new Values: on, off
Default: off
Use ffmpeg libraries to encode mpeg movies in realtime.
ffmpeg_deinterlace Values: on, off
Default: off
Use ffmpeg to deinterlace video. Necessary if you use an analog camera and see horizontal combing on moving objects in video or pictures.
ffmpeg_filename (now called movie_filename) Values: Max 4095 characters
Default: %v-%Y%m%d%H%M%S
File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This option was renamed to movie_filename in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution.
ffmpeg_timelapse Values: 0 - 2147483647
Default: 0 (disabled)
Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used.
ffmpeg_timelapse_mode Values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual
Default: daily
The file rollover mode of the timelapse video.
ffmpeg_variable_bitrate Values: 0, 2 - 31
Default: 0 (disabled)
Enables and defines variable bitrate for the ffmpeg encoder. ffmpeg_bps is ignored if variable bitrate is enabled. Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, or the range 2 - 31 where 2 means best quality and 31 is worst.
ffmpeg_video_codec Values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf, flv, ffv1
Default: mpeg4
Codec to be used by ffmpeg for the video compression. Timelapse mpegs are always made in mpeg1 format independent from this option.
framerate Values: 2 - 100
Default: 100 (no limit)
Maximum number of frames to be captured from the camera per second.
frequency Values: 0 - 999999
Default: 0 (Not set)
The frequency to set the tuner to (kHz). Valid range: per tuner spec, default: 0 (Don't set it)
gap Values: 0 - 2147483647
Default: 60
Gap is the seconds of no motion detection that triggers the end of an event. An event is defined as a series of motion images taken within a short timeframe.
height Values: Device Dependent
Default: 288
The height of each frame in pixels.
hue Values: 0 - 255
Default: 0 (disabled)
The hue level for the video device.
input Values: 0 - 7, 8 = disabled
Default: 8 (disabled)
Input channel to use expressed as an integer number starting from 0. Should normally be set to 1 for video/TV cards, and 8 for USB cameras.
jpeg_filename Values: Max 4095 characters
Default: %v-%Y%m%d%H%M%S-%q
File path for motion triggered images (jpeg or ppm) relative to target_dir. Value 'preview' makes a jpeg filename with the same name body as the associated saved mpeg movie file.
lightswitch Values: 0 - 100
Default: 0 (disabled)
Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity.
locate Values: on, off, preview
Default: off
Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved mpeg movie.
low_cpu Values: 0 - 100
Default: 0 (disabled)
When this option is not zero motion will be in a low cpu mode while not detecting motion. In low cpu mode Motion reduces the framerate to the value given for this option. Value zero means disabled.
mask_file Values: Max 4095 characters
Default: Not defined
PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format.
max_mpeg_time Values: 0 (infinite) - 2147483647
Default: 3600
The maximum length of an mpeg movie in seconds. Set this to zero for unlimited length.
minimum_frame_time Values: 0 - 2147483647
Default: 0
Minimum time in seconds between the capturing picture frames from the camera. Default: 0 = disabled - the capture rate is given by the camera framerate.
minimum_gap Values: 0 - 2147483647
Default: 0 (no minimum)
The minimum time between two shots in seconds.
minimum_motion_frames Values: 1 - 1000s
Default: 1
Picture frames must contain motion at least the specified number of frames in a row before they are detected as true motion. At the default of 1, all motion is detected. Valid range is 1 to thousands, but it is recommended to keep it within 1-5.
motion_video_pipe Values: Max 4095 characters
Default: Not defined
The video4linux video loopback input device for motion images. If a particular pipe is to be used then use the device filename of this pipe, if a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. Default: not set
movie_filename Values: Max 4095 characters
Default: %v-%Y%m%d%H%M%S
File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This was previously called ffmpeg_filename.
mysql_db Values: Max 4095 characters
Default: Not defined
Name of the MySQL database.
mysql_host Values: Max 4095 characters
Default: localhost
IP address or domain name for the MySQL server. Use "localhost" if motion and MySQL runs on the same server.
mysql_password Values: Max 4095 characters
Default: Not defined
The MySQL password.
mysql_user Values: Max 4095 characters
Default: Not defined
The MySQL user name.
netcam_proxy Values: Max 4095 characters
Default: Not defined
URL to use for a netcam proxy server, if required. The syntax is http://myproxy:portnumber
netcam_url Values: Max 4095 characters
Default: Not defined
Specify an url to a downloadable jpeg file or raw mjpeg stream to use as input device. Such as an AXIS 2100 network camera.
netcam_userpass Values: Max 4095 characters
Default: Not defined
For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication.
night_compensate Values: on, off
Default: off
When this option is set the noise threshold will be lowered if the picture is dark. This will improve the sensitivity in dark places. However it might also increase the number of false alarms since most cameras also increase light sensitivity with their AGC (Automatic Gain Control) and this will increase noise.
noise_level Values: 1 - 255
Default: 32
The noise level is used as a threshold for distinguishing between noise and motion.
noise_tune Values: on, off
Default: on
Activates the automatic tuning of noise level.
norm Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour)
Default: 0 (PAL)
Select the norm of the video device. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL)
on_event_end Values: Max 4095 characters
Default: Not defined
Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option gap. You can use Conversion Specifiers and spaces as part of the command.
on_event_start Values: Max 4095 characters
Default: Not defined
Command to be executed when an event starts. An event starts at first motion detected after a period of no motion defined by gap. You can use ConversionSpecifiers and spaces as part of the command.
on_motion_detected Values: Max 4095 characters
Default: Not defined
Command to be executed when a motion frame is detected. You can use Conversion Specifiers and spaces as part of the command.
on_movie_end Values: Max 4095 characters
Default: Not defined
Command to be executed when an ffmpeg movie is closed at the end of an event. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
on_movie_start Values: Max 4095 characters
Default: Not defined
Command to be executed when an mpeg movie is created. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
on_picture_save Values: Max 4095 characters
Default: Not defined
Command to be executed when an image is saved. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
output_all Values: on, off
Default: off
Picture are saved continuously as if motion was detected all the time.
output_motion Values: on, off
Default: off
Output pictures with only the moving object. This feature generates the special motion type movies where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red.
output_normal Values: on, off, first, best
Default: on
Normal image is an image that is stored when motion is detected. It is the same image that was taken by the camera. I.e. not a motion image like defined by output_motion. Default is that normal images are stored.
pgsql_db Values: Max 4095 characters
Default: Not defined
Name of the PostgreSQL database.
pgsql_host Values: Max 4095 characters
Default: localhost
IP address or domain name for the PostgreSQL server. Use "localhost" if motion and PostgreSQL runs on the same server.
pgsql_password Values: Max 4095 characters
Default: Not defined
The PostgreSQL password.
pgsql_port Values: 0 - 65535
Default: 5432
The PostgreSQL server port number.
pgsql_user Values: Max 4095 characters
Default: Not defined
The PostgreSQL user name.
post_capture Values: 0 - 2147483647
Default: 0 (disabled)
Specifies the number of frames to be captured after motion has been detected.
ppm Values: on, off
Default: off
Output ppm images instead of jpeg. This uses less CPU time, but causes a LOT of hard disk I/O, and it is generally slower than jpeg.
pre_capture Values: 0 - 100s
Default: 0 (disabled)
Specifies the number of previous frames to be outputted at motion detection. Recommended range: 0 to 5, default=0. Do not use large values! Large values will cause Motion to skip video frames and cause unsmooth mpegs. To smooth mpegs use larger values of post_capture instead.
process_id_file Values: Max 4095 characters
Default: Not defined
File to store the process ID, also called pid file. Recommended value when used: /var/run/motion.pid
quality Values: 1 - 100
Default: 75
The quality for the jpeg images in percent.
quiet Values: on, off
Default: off
Be quiet, don't output beeps when detecting motion.
rotate Values: 0, 90, 180, 270
Default: 0 (not rotated)
Rotate image the given number of degrees. The rotation affects all saved images as well as mpeg movies.
roundrobin_frames Values: 1 - 2147483647
Default: 1
Specifies the number of frames to capture before switching inputs, this way also slow switching (e.g. every second) is possible.
roundrobin_skip Values: 1 - 2147483647
Default: 1
Specifies the number of frames to skip after a switch. (1 if you are feeling lucky, 2 if you want to be safe).
saturation Values: 0 - 255
Default: 0 (disabled)
The colour saturation level for the video device.
setup_mode Values: on, off
Default: off
Run Motion in setup mode.
smart_mask_speed Values: 0 - 10
Default: 0 (disabled)
Slugginess of the smart mask. Default is 0 = DISABLED. 1 is slow, 10 is fast.
snapshot_filename Values: Max 4095 characters
Default: %v-%Y%m%d%H%M%S-snapshot
File path for snapshots (jpeg or ppm) relative to target_dir.
snapshot_interval Values: 0 - 2147483647
Default: 0 (disabled)
Make automated snapshots every 'snapshot_interval' seconds.
sql_log_image Values: on, off
Default: on
Log to the database when creating motion triggered image file.
sql_log_mpeg Values: on, off
Default: off
Log to the database when creating motion triggered mpeg file.
sql_log_snapshot Values: on, off
Default: on
Log to the database when creating a snapshot image file.
sql_log_timelapse Values: on, off
Default: off
Log to the database when creating timelapse mpeg file
sql_query Values: Max 4095 characters
Default: insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
SQL query string that is sent to the database. The values for each field are given by using convertion specifiers
switchfilter Values: on, off
Default: off
Turns the switch filter on or off. The filter can distinguish between most switching noise and real motion. With this you can even set roundrobin_skip to 1 without generating much false detection.
target_dir Values: Max 4095 characters
Default: Not defined = current working directory
Target directory for picture and movie files.
text_changes Values: on, off
Default: off
Turns the text showing changed pixels on/off.
text_double Values: on, off
Default: off
Draw characters at twice normal size on images.
text_event Values: Max 4095 characters
Default: %Y%m%d%H%M%S
This option defines the value of the speciel event conversion specifier %C. You can use any conversion specifier in this option except %C. Date and time values are from the timestamp of the first image in the current event.
text_left Values: Max 4095 characters
Default: Not defined
User defined text overlayed on each in the lower left corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > \ , . : - + _ \n and conversion specifiers (codes starting by a %).
text_right Values: Max 4095 characters
Default: %Y-%m-%d\n%T
User defined text overlayed on each in the lower right corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > , . : - + _ \n and conversion specifiers (codes starting by a %). Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock
thread Values: Max 4095 characters
Default: Not defined
Specifies full path and filename for a thread config file. Each camera needs a thread config file containing the options that are unique to the camera. If you only have one camera you do not need thread config files. If you have two or more cameras you need one thread config file for each camera in addition to motion.conf. This option must be placed in motion.conf and not in a thread config file.
threshold Values: 1 - 2147483647
Default: 1500
Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling.
threshold_tune Values: on, off
Default: off
Activates the automatic tuning of threshold level.
timelapse_filename Values: Max 4095 characters
Default: %v-%Y%m%d-timelapse
File path for timelapse mpegs relative to target_dir (ffmpeg only).
track_auto Values: on, off
Default: off
Enable auto tracking
track_iomojo_id Values: 0 - 2147483647
Default: 0
Use this option if you have an iomojo smilecam connected to the serial port instead of a general stepper motor controller.
track_maxx Values: 0 - 2147483647
Default: 0
The maximum position for servo x.
track_maxy Values: 0 - 2147483647
Default: 0
The maximum position for servo y.
track_motorx Values: -1 - 2147483647
Default: -1
The motor number that is used for controlling the x-axis.
track_motory Values: -1 - 2147483647
Default: -1
The motor number that is used for controlling the y-axis.
track_move_wait Values: 0 - 2147483647
Default: 10
Delay during which tracking is disabled after auto tracking has moved the camera. Delay is defined as number of picture frames.
track_port Values: Max 4095 characters
Default: Not defined
This is the device name of the serial port to which the stepper motor interface is connected.
track_speed Values: 0 - 255
Default: 255
Speed to set the motor to.
track_step_angle_x Values: 0-90
Default: 10
Angle in degrees the camera moves per step on the X-axis with auto tracking. Currently only used with pwc type cameras.
track_step_angle_y Values: 0-40
Default: 10
Angle in degrees the camera moves per step on the Y-axis with auto tracking. Currently only used with pwc type cameras.
track_stepsize Values: 0 - 255
Default: 40
Number of steps to make.
track_type Values: 0 (none), 1 (stepper), 2 (iomojo), 3 (pwc), 4 (generic), 5 (uvcvideo)
Default: 0 (None)
Type of tracker.
tunerdevice Values: Max 4095 characters
Default: /dev/tuner0
The tuner device used for controlling the tuner in a tuner card. This option is only used when Motion is compiled for FreeBSD.
video_pipe Values: Max 4095 characters
Default: Not defined
The video4linux video loopback input device for normal images. If a particular pipe is to be used then use the device filename of this pipe. If a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe.
videodevice Values: Max 4095 characters
Default: /dev/video0 (FreeBSD: /dev/bktr0)
The video device to be used for capturing. Default for Linux is /dev/video0. for FreeBSD the default is /dev/bktr0.
webcam_limit Values: 0 - 2147483647
Default: 0 (unlimited)
Limit the number of frames to number frames. After 'webcam_limit' number of frames the connection will be closed by motion. The value 0 means unlimited.
webcam_localhost Values: on, off
Default: on
Limits the access to the webcam to the localhost.
webcam_maxrate Values: 1 - 100
Default: 1
Limit the framerate of the webcam in frames per second. Default is 1. Set the value to 100 for practically unlimited.
webcam_motion Values: on, off
Default: off
If set to 'on' Motion sends slows down the webcam stream to 1 picture per second when no motion is detected. When motion is detected the stream runs as defined by webcam_maxrate. When 'off' the webcam stream always runs as defined by webcam_maxrate.
webcam_port Values: 0 - 65535
Default: 0 (disabled)
TCP port on which motion will listen for incoming connects with its webcam server.
webcam_quality Values: 1 - 100
Default: 50
Quality setting in percent for the mjpeg picture frames transferred over the webcam connection. Keep it low to restrict needed bandwidth.
width Values: Device Dependent
Default: 352
The width in pixels of each frame. Valid range is camera dependent.
-

-

-

Signals (sent with e.g. kill command)

-A signal can be sent from the command line by typing e.g. kill -s SIGHUP pid, where the last parameter is the process ID which you get by typing ps -ef ¦ grep motion. The PID is the first on the list which is the parent process for the threads. -Motion responds to the following signals: -

- - - - -
Signal Description Editors comment
SIGHUP The config file will be reread. This is a very useful signal when you experiment with settings in the config file.
SIGTERM If needed motion will create an mpeg file of the last event and exit  
SIGUSR1 Motion will create an mpeg file of the current event.  
-

-

-

Error Logging

-Motion reports errors to the console when it runs in non-daemon mode. And it outputs even more information when run in setup mode. -

-Error logging has been implemented so that errors during daemon (background) mode are logged in the syslog. -

-The syslog is in most Linux systems the file /var/log/messages (e.g. RedHat/Fedora) or /var/log/syslog and /var/log/user.log (e.g. Debian). -

-

-

Motion Guide - Basic Features

-

-

Capture Device Options - The Basic Setup

-Before you can start using motion you need to know some basics about your camera. -Either you have a camera connected directly to your computer. In this case it is a video4linux type of camera. Or you connect to a network camera using a normal web URL. -

-

video4linux (V4L) devices

-You need to install your camera with the right driver. It is out of scope of this document to tell you how to do this and it depends on which type of camera. -

-Once installed the camera(s) will have the device names /dev/video0, /dev/video1, /dev/video2... -

-FreeBSD has a different naming of devices. When you build Motion for FreeBSD the default device name is /dev/bktr0. Under FreeBSD a TV card has a special device for controlling the tuner (e.g. /dev/tuner0). The option tunerdevice is only valid when Motion is built and running under FreeBSD. For Linux do not include this option in the config file (remove or comment out). -

-USB cameras take a lot of bandwidth. A USB camera connected to a USB 1.1 port or hub consumes all the bandwidth. Even with a small framesize and low framerate you should not expect to have more than one camera per USB 1.1 controller. If you need more than 1 USB camera add extra USB PCI cards to your computer. There exists cards that have 4 inputs each with their own controller and with full bandwidth. Many 4-input cards only have 1 controller. USB cameras do not have the feature of selecting input channels. To disable the input selection the option input must be set to the value 8 for USB cameras. -

-Composite video cards are normally made with a chip called BT878 (older cards have a BT848). They all use the Linux driver called 'bttv'. -

-There are cards with more then one video input but still only one BT878 chip. They have a video multiplexer which input is selected with the config option input. Input channel numbers start at 0 (which is why the value 8 and not 0 disables input selection). There are video capture cards available with 4 or 8 inputs but only one chip. They present themselves as one single video device and you select input using the 'input' option. If you define e.g. 4 thread config files with the same videodevice name but different input numbers Motion automatically goes into round robin mode. See the round robin section for more information. Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3. Other have TV=0, composite video 1= 1, composite video = 2, S-VHS = 3. For video capture cards input 1 is normally the composite video input. -

-Some capture cards are specially made for surveillance with for example 4 inputs. Others have a TV tuner, a composite input (phono socket) and perhaps also a S-VHS input. For all these cards the inputs are numbered. The numbering varies from card to card so the easiest is to experiment for 5 minutes with a program that can show the videostream. Use a program such as Camstream or xawtv to experiment with the values. -

-If you use the TV tuner input you also need to set the frequency of the TV channel using the option frequency. Otherwise set 'frequency' to 0. -

-Finally you need to set the TV norm. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default is 0 (PAL). If your camera is a PAL black and white you may get a better result with norm=3 (PAL no colour). -

-If the netcam_url option is defined all the video4linux options are ignored so make sure the netcam_url option is commented out if you do not need it. -

-These are the parameters used for video4linux devices -

-

-

auto_brightness

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Let motion regulate the brightness of a video device. Only recommended for cameras without auto brightness -

-Motion will try to adjust the brightness of the video device if the images captured are too dark or too light. This option will be most useful for video devices like web cams, which sometimes don't have such an option in hardware. -

-The auto_brightness feature will adjust the brightness of the device up or down until the value defined by the option brightness is reached (1 = dark, 255 = bright). If brightness is zero auto_brightness will try to adjust to the average brightness level 128. -

-You need to know if the camera supports auto brightness. Most cameras have auto everything. If your video device already does this for you this option might cause oscillations. If you do not know assume that it has and do not use the Motion auto brightness feature. At least not to start with. -

-

-

brightness

    -
  • Type: Integer -
  • Range / Valid values: 0 - 255 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-The brightness level for the video device. -

-Value 0 means that Motion does not set the brightness value but leaves it unchanged. -

-If this setting is used in conjunction with the auto_brightness feature then this setting is the average brightness level in the range 1 (dark) to 255 (bright) that the auto_brightness feature will try to achieve by adjusting the device brightness up and down. -

-

-

contrast

    -
  • Type: Boolean -
  • Range / Valid values: 0 - 255 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-The contrast level for the video device. -

-Disabled (Value 0) means that Motion does not set the contrast value. -

-

-

framerate

-

    -
  • Type: Integer -
  • Range / Valid values: 2 - 100 -
  • Default: 100 (no limit) -
  • Option Topic -
-

-Maximum number of frames to be captured from the camera per second. -

-The faster you fetch pictures from the camera the more CPU load you get and the more pictures get included when Motion is detected. -

-Motion will stop storing pictures if the framerate is set to less than 2. -

-Set this parameter to the maximum number of images per second that you want to store either as images or as mpeg films. -

-To set intervals longer than one second use the 'minimum_gap' option instead. -

-

-

frequency

-

    -
  • Type: Boolean -
  • Range / Valid values: 0 - 999999 -
  • Default: 0 (Not set) -
  • Option Topic -
-

-The frequency to set the tuner to (kHz). Valid range: per tuner spec, default: 0 (Don't set it) -

-This option is only relevant if you have a TV tuner card where you can select the tuner frequency. Your tuner card must support this feature. -

-

-

height

-

    -
  • Type: Integer -
  • Range / Valid values: Device Dependent -
  • Default: 288 -
  • Option Topic -
-

-The height of each frame in pixels. -

-The height of the image in pixels. Motion does not scale so should be set to the actual size of the v4l device. In case of a net camera motion sets the height to the height of the first image read. -

-Motion actually set the size of the image coming from the video4linux device. -

-Your camera or capture/TV card will not support any picture size. You must know which frame size (width and height) the camera supports. If you do not know start with width 320 and height 240 which most cameras and capture cards supports. -

-For some device drivers like pwc (driver for Philips USB cameras) setting the size to a non-standard value makes the driver create an image of the nearest smaller size and create a gray band around the image to fit the size given by motion. Note that it is the driver and not motion that generates the gray band. Motion will try to detect motion in the entire image including the gray band. -

-Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Thís is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16. -

-

-

hue

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 255 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-The hue level for the video device. -

-Normally only relevant for NTSC cameras. -

-

-

input

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 7, 8 = disabled -
  • Default: 8 (disabled) -
  • Option Topic -
-

-Input channel to use expressed as an integer number starting from 0. Should normally be set to 1 for video/TV cards, and 8 for USB cameras. -

-This parameter is really used only with video capture cards that has more than one input. -

-However if you set the input number to e.g. 1 for a USB camera (ov511 or pwc driver) motion writes an error message back. If you set it to 8 it does not give you any warning. -

-If you have a video capture card you can define the channel to tune to using this option. If you are using a USB device, network camera or a capture card without tuner you should set the value to the default 8. -

-Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3. Other have TV=0, composite video 1= 1, composite video = 2, S-VHS = 3. It is recommended to set the parameter to 8 for USB cameras as your first try. For video capture cards input 1 is normally the composite video input. -

-

-

minimum_frame_time

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 -
  • Option Topic -
-

-Minimum time in seconds between the capturing picture frames from the camera. Default: 0 = disabled - the capture rate is given by the camera framerate. -

-This option is used when you want to capture images at a rate lower than 2 per second. -

-When this is enabled the framerate option is used only to set the pace the Motion service the webcam port etc. Running Motion at framerate 2 is normally fine. -

-ALERT! This feature is introduced in Motion 3.2.7 -

- -

-

-

norm

-

    -
  • Type: Discrete Strings -
  • Range / Valid values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour) -
  • Default: 0 (PAL) -
  • Option Topic -
-

-Select the norm of the video device. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) -

-This value is only used for capture cards using the BTTV driver. -

-

-

rotate

-

    -
  • Type: Discrete Strings -
  • Range / Valid values: 0, 90, 180, 270 -
  • Default: 0 (not rotated) -
  • Option Topic -
-

-Rotate image the given number of degrees. The rotation affects all saved images as well as mpeg movies. -

-The rotation feature is used when the camera is hanging upside down (180 degrees) or if you choose a picture format in portrait instead of the normal landscape (90 or 270 degrees). -

-Note that the CPU load increases when using this feature with a value other than 0. Also note that Motion automatically swaps width and height if you rotate 90 or 270 degrees, so you don't have to touch these options. -

-

-

saturation

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 255 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-The colour saturation level for the video device. -

-

-

tunerdevice

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: /dev/tuner0 -
  • Option Topic -
-

-The tuner device used for controlling the tuner in a tuner card. This option is only used when Motion is compiled for FreeBSD. -

-Make sure to remove or comment out this option when running Motion under Linux. -

-

-

videodevice

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: /dev/video0 (FreeBSD: /dev/bktr0) -
  • Option Topic -
-

-The video device to be used for capturing. Default for Linux is /dev/video0. for FreeBSD the default is /dev/bktr0. -

-This is the video4linux device name. Ignore this for net cameras. -

-

-

width

-

    -
  • Type: Integer -
  • Range / Valid values: Device Dependent -
  • Default: 352 -
  • Option Topic -
-

-The width in pixels of each frame. Valid range is camera dependent. -

-Motion does not scale so should be set to the actual size of the v4l device. -

-In case of a net camera motion sets the height to the height of the first image read. -

-Motion actually set the size of the image coming from the video4linux device. -

-Your camera or capture/TV card will not support any picture size. You must know which frame size (width and height) the camera supports. If you do not know start with width 320 and height 240 which most cameras and capture cards supports. -

-For some device drivers like pwc (driver for Philips USB cameras) setting the size to a non-standard value makes the driver create an image of the nearest smaller size and create a gray band around the image to fit the size given by motion. Note that it is the driver and not motion that generates the gray band. Motion will try to detect motion in the entire image including the gray band. -

-Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Thís is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16. -

-

-

Network Cameras

-Motion can connect to a network camera through a normal TCP socket. All you need to give it is the URL. The URL given must return either one single jpeg picture or an mjpeg stream. For the time being Motion cannot connect to a video stream such a mpeg, mpeg4, divx. The URL must return one single jpeg image or an mjpeg stream! You can connect through a proxy server. -

-Also watch out that you do not use a URL that create an HTML page with an embedded jpg. What must be returned is the jpg picture itself or the raw mjpeg stream. -

-When the netcam_url is defined all the video4linux options above are ignored!! -

-If the connection to a network camera is lost - Motion will reuse the last good image for approx 30 seconds. AFter 30 seconds the image is replaced by a grey image with a text telling that the signal is lost and when the connection was lost. This text and its date format is not configurable and there are no plans to make it configurable in order to keep the number config options under control. -

-Note that Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Thís is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16. But if you intend to monitor a network camera which is saving jpeg images you may have to pay attention to the dimensions of the picture. -

-The network camera feature has been completely re-written in Motion 3.2.2. We believe the netcam feature is much more stable now that it was in previous versions. Motion tries to reconnect to the camera if the connection is lost. There is no official standard for mjpeg and we know that there are probably still some cameras that are not yet supported. If you run into a problem please file a Bug Report with as much information about the format as possible. A binary raw dump of the first 2-3 frames with headers and boundary strings is very useful. You can see how to make it on the special topic NetcamMjpegStreamDumps. When you have the file you can upload it to the same topic. -

-

-

netcam_proxy

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-URL to use for a netcam proxy server, if required. The syntax is http://myproxy:portnumber -

-Use this if you need to connect to a network camera through a proxy server. -

-Example of syntax: "http://myproxy.mydomain.com:1024 -

-If the proxy port number is 80 you can ommit the port number. Then the syntax is use "http://myproxy.mydomain.com" . -

-Leave this option undefined if you do not use a proxy server. -

-

-

netcam_url

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Specify an url to a downloadable jpeg file or raw mjpeg stream to use as input device. Such as an AXIS 2100 network camera. -

-Example of URL: http://www.gate.com/pe1rxq/jeroen.jpg. -

-Motion can connect to a network camera through a normal TCP socket. All you need to give it is the URL. The URL given must return either one single jpeg picture or an mjpeg stream. For the time being Motion cannot connect to a video stream such a mpeg, mpeg4, divx. The URL must return one single jpeg image or an mjpeg stream! -

-Also watch out that you do not use a URL that create an HTML page with an embedded jpg. What must be returned is the jpg picture itself or the raw mjpeg stream. -

-When the netcam_url is defined all the video4linux options are ignored!! -

-Motion can also fetch jpeg pictures via ftp. You then use the ftp:// syntax instead. -

-

-

netcam_userpass

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. -

-To use no authentication simply remove this option from the config file comment it out with "#" or ";" in front. -

-

-

- -

Round Robin feature

-This feature is automatically activated where multiple threads are sharing the same video device (for example /dev/video0). Each thread can then set different input channels to change camera with the input option or by tuning the tuner with frequency option. -

-ALERT! Round Robin is not relevant for Network cameras or standard USB web cameras. The Round Robin feature is used with video capture cards which have multiple inputs per video chip. -

-ALERT! Note that round robin is not the ideal way to run multiple cameras. When the capture card changes input it takes a little while before the decoder chip has syncronized to the new camera. You can improve this if you have expensive cameras with a syncronize input. Only one camera can be decoded at a time so if you have 4 cameras connected 3 of the camera threads will need to wait for their turn. The fact that cameras have to take turns and the fact that you have to skip a few frames after each turn dramatically lowers the possible framerate. You can get a high framerate by viewing each camera for a long time. But then you may miss the action on one of the inactive cameras. If you can affort it avoid Round Robin and buy the more expensive type of capture cards that has one decoder chip per input. If you only need 2 or 3 cameras you can also simply put 2 or 3 cheap TV cards in the computer. Linux has no problem working with multiple TV cards. -

    -
  • If multiple threads use the same video device, they each can capture roundrobin_frames number of frames before having to share the device with the other threads. -
  • When another thread wants to watch another input or frequency or size the first roundrobin_skip number of frames are skipped to allow the device to settle. -
  • The last option switch_filter is supposed to prevent the change of camera from being detected as Motion. Its function is not perfect and sometimes prevents detection of real motion. You should start with having the option disabled and then try with the option enabled to see if you can skip less frames without loosing the detection of the type of motion you normally want to detect. -
-

-These are the special Round Robin options -

-

-

roundrobin_frames

-

    -
  • Type: Integer -
  • Range / Valid values: 1 - 2147483647 -
  • Default: 1 -
  • Option Topic -
-

-Specifies the number of frames to capture before switching inputs, this way also slow switching (e.g. every second) is possible. -

-The Round Robin feature is automatically activated where multiple threads are sharing the same video device. Each thread can then set different input channels or frequencies to change camera. -

-If multiple threads use the same video device, they each can capture roundrobin_frames number of frames before having to share the device with the other threads. -

-

-

roundrobin_skip

-

    -
  • Type: Integer -
  • Range / Valid values: 1 - 2147483647 -
  • Default: 1 -
  • Option Topic -
-

-Specifies the number of frames to skip after a switch. (1 if you are feeling lucky, 2 if you want to be safe). -

-The Round Robin feature is automatically activated where multiple threads are sharing the same video device. Each thread can then set different input channels or frequencies to change camera. -

-When another thread wants to watch another input or frequency or size the first roundrobin_skip number of frames are skipped to allow the device to settle. -

-

-

switchfilter

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Turns the switch filter on or off. The filter can distinguish between most switching noise and real motion. With this you can even set roundrobin_skip to 1 without generating much false detection. -

-This is a round robin related feature used when you have a capture card with multiple inputs (controlled by the 'input' option) on the same videodevice. -

-ALERT! This feature was seriously broken until Motion 3.2.4 -

-

-

Motion Detection Settings

-These are the options that controls the detection of motion. Further details follows after. -

-

-

despeckle

-

    -
  • Type: String -
  • Range / Valid values: EedDl -
  • Default: Not defined -
  • Option Topic -
-

-Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling. -

-A way of tuning (by removing or enhancing) noise in the motion image. Options for the despeckle feature are any of 'e', 'E', 'd' or 'D'. This can be combined by a trailing 'l' (letter l) which enables the labeling feature. Default: Not Defined (Don't despeckle and label). -

-Wind blowing grass and trees around or poor light conditions can cause a lot of dots (or noise) to appear in the motion image (See the section on Tuning Motion). This feature removes (or enhances!) this noise and so improves the reliability of motion. -

-The 'e' option removes diamonds, 'E' removes squares and alternating eE will remove circles. Each e/E you add will shrink the noise by a pixel all the way around. So 'despeckle Ee' will remove circles of radius 2. However, this will also shrink the detection by 2 and will affect the threshold. So to remove noise and then restore the detected motion to its original size try 'despeckle EedD'. -

-After the despeckle feature is done you can let the labeling feature search for areas of connected pixels and "label" each area. The program will now trigger motion based on the number of changed pixels in the largest area. In other words, the largest labeled area has to be above the threshold to trigger a motion detected. -

-The value EedDl is a good starting point. The possible combinations are endless and it requires many experiments to find the best combination. Just remember that the labeling feature only works as intended if it runs after the despeckle feature. Ie. the letter 'l' must be the last letter and only one 'l'. -

-If you have very few problems with false detections leave this option either blank or at EedD which will remove most of the single pixel noise. -A very detailed technical explanation of the despeckle part can be found at the webpage of the author of this feature Ian McConnell's Webcam: Motion Web Page -

-

-

gap

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 60 -
  • Option Topic -
-

-Gap is the seconds of no motion detection that triggers the end of an event. An event is defined as a series of motion images taken within a short timeframe. -

-Recommended value is 60 seconds (Default). The value 0 is allowed (but not recommended) and disables events causing all Motion to be written to one single mpeg file and no pre_capture. You can force an event to end and a new to begin using the http control 'http://host:port/thread_number/action/makemovie'. Disabling events has bad side effects on noise_tune and smartmask. Both features can only work properly outside an event. When gap is set to 0, both features don't work properly anymore. -

-An event is defined as a series of motion images taken within a short timeframe. E.g. a person walking through the room is an event that may have caused 10 single jpg images to be stored. This option defines how long a pause between detected motions that is needed to be defined as a new event. -

-The gap timer starts after the last motion is detected and post_capture images have been saved and appended to open movie mpeg files. -

-Any motion detected before the gap timer times out resets the gap timer so it starts counting over again. -

-Detailed Description -

-The option 'gap' is important. It defines how long a period of no motion detected it takes before we say an event is over. An event is defined as a series of motion images taken within a short timeframe. E.g. a person walking through the room is an event that may have caused 10 single jpg images to be stored. Motion detected includes post_captured frames set by the 'post_capture' option. The 'gap' option defines how long a pause between detected motions that is needed to be defined as a new event. A good starting value is 60 seconds. -

-The way 'gap' works in more technical terms is:

    -
  • Gap is a timer that timeout 'gap' seconds after the last video frame with motion is detected. -
  • If 'post_capture' is activated then the gap timer starts counting after the last image of the post_capture buffer has been saved. -
  • The gap timer is reset and starts all over each time new motion is detected, so you will not miss any action by having a short 'gap' value. It will just create more events (e.g. more mpegs files) -
-

-The gap value impacts many functions in Motion.

    -
  • When the gap timer runs out the event number is increased by one next time motion is detected. When you use the %v conversion specifier in filenames or text features this means that the number in filename or text increased by one. -
  • The pre_capture feature only works at the beginning of an event. So if you have a very large 'gap' value pre_capture is not working very often. -
  • When you make mpegs using the ffmpeg features a new mpeg file is started at the beginning of an event when the first motion is detected. When 'gap' seconds has passed without motion (and post_captured frames saved) the mpeg files is completed and closed. -
  • Do not use large gap values to generate one large mpeg4 file. If Motion stops working this mpeg4 file never gets properly completed and closed and you will not be able to view it. -
  • Some of the tracking features sets the camera back to the center position when an event is over. -
-

-Note that 'gap' and 'minimum_gap' have nothing to do with each other. -

-

-

lightswitch

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 100 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity. -

-Experiment to see what works best for your application. -

-Note: From version 3.1.17 (snap release 2 and on) this option has changed from a boolean (on or off) to a number in percent between 0 and 100. Zero means the option is disabled. -

-The value defines the picture areas in percent that will trigger the lightswitch condition. When lightswitch is detected motion detection is disabled for 5 picture frames. This is to avoid false detection when light conditions change and when a camera changes sensitivity at low light. -

-

-

low_cpu

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 100 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-When this option is not zero motion will be in a low cpu mode while not detecting motion. In low cpu mode Motion reduces the framerate to the value given for this option. Value zero means disabled. -

-This is smart for running a server that also does other tasks such as running Apache, MySQL etc. Motion grabs this lower number of frames per second until it detects motion. Then it speeds up to normal speed and take pictures as set by the option "framerate". -

-

-

mask_file

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format. -

-Full path of the PGM (portable gray map) mask file (binary format). -

-If you have one or more areas of the camera image in which you do NOT want motion detected (e.g. a tree that moves in the wind or a corner of the picture where you can see cars/pedestrians passing by) you need a mask file. This file is a picture that you create in your favorite photo editing program. The areas that you want detected must be white. The error that you want ignored must be black. The pgm image must be the same size (number of pixels high and wide) as the pictures that are taken by the camera (video4linux device). -

-You can adjust sensitivity by using gray tones. -

-If you do not have a mask file disable this option by not having it in the config file or comment it out ("#"or ";" as first character in line). -If you are using the rotate option, note that the mask is applied after the rotation. -

-Detailed Description -

-The mask file must be a pgm format image file (portable gray map). Note that you must choose the BINARY format. -

-The feature is simple. Create an image of exact the same size as the ones you get from your video device (camera). Make a purely white picture and paint the areas that you want to mask out black. You can also make gray areas where you want to lower the sensitivity to motion. Normally you will stick to pure black and white. -

-One easy method for generating the mask file is as follows. -

-You can just take a motion captured picture, edit it with black and white for the mask and save it as a pgm file. -If you cannot save in this format save as a grayscale jpg and then you can convert it to pgm format with -

-djpeg -grayscale -pnm [inputfile] > mask.pgm -

-(assuming you have djpeg installed - part of the jpeg lib package). -

-Note that the mask file option masks off the detection of motion. The entire picture is still shown on the picture. This means that you cannot use the feature to mask off an area that you do not want people to see. -

-Below are an example of a webcam picture and a mask file to prevent the detection cars in the street. -

-Normal picture. Notice the street is visible through the hedge. -

-normal.jpg -

-Mask file (converted to png format so it can be shown by your web browser) -

- -
mask1.png
-

-

-

max_mpeg_time

-

    -
  • Type: Integer -
  • Range / Valid values: 0 (infinite) - 2147483647 -
  • Default: 3600 -
  • Option Topic -
-

-The maximum length of an mpeg movie in seconds. Set this to zero for unlimited length. -

-

-

- -

-

-

minimum_gap

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 (no minimum) -
  • Option Topic -
-

-The minimum time between two shots in seconds. -

-This is the minimum gap between the storing pictures while detecting motion. -

-The value zero means that pictures can be stored almost at the framerate of the camera. Normally you will set this to 0 -

-This option has nothing to do with the 'gap' option. -

-ALERT! From motion 3.2.7 this feature has been removed because it was in practical a useless feature. It prevented saving more than one picture per minimum_gap seconds but the capturing and motion detect was still run at full framerate loading the CPU heavily. From 3.2.7 a new feature called minimum_frame_time has been introduced which lower the capture rate. So it gives the same effect as minimum_gap did but additionally lower the CPU load significantly. -

-

-

minimum_motion_frames

-

    -
  • Type: Boolean -
  • Range / Valid values: 1 - 1000s -
  • Default: 1 -
  • Option Topic -
-

-Picture frames must contain motion at least the specified number of frames in a row before they are detected as true motion. At the default of 1, all motion is detected. Valid range is 1 to thousands, but it is recommended to keep it within 1-5. -

-Note that the picture frames are buffered by Motion and once motion is detected also the first frames containing motion are saved so you will not miss anything. -

-The feature is used when you get many false detections when the camera changes light sensitivity or light changes. -

-Experiment for best setting. Even though Motion accepts large values you should set this to a relatively low number (below 10). For each step larger than 1 Motion reserves space in RAM for the picture frame buffer. If you have a large value Motion will miss many frames from the camera while it is processing the all the pictures in the buffer. -

-

-

night_compensate

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-When this option is set the noise threshold will be lowered if the picture is dark. This will improve the sensitivity in dark places. However it might also increase the number of false alarms since most cameras also increase light sensitivity with their AGC (Automatic Gain Control) and this will increase noise. -

-It has normally been the advice not to use this with 'noise_tune' turned on. However the latest experience is that with the new improved noise_tune algorithm it actually works fine in combination with 'night_compensate'. -

-

-

noise_level

-

    -
  • Type: Integer -
  • Range / Valid values: 1 - 255 -
  • Default: 32 -
  • Option Topic -
-

-The noise level is used as a threshold for distinguishing between noise and motion. -

-This is different from the threshold parameter. This is changes at pixel level. The purpose is to eliminate the changes generated by electric noise in the camera. Especially in complete darkness you can see the noise as small grey dots that come randomly in the picture. This noise can create false motion detection. What this parameter means is that the intensity of a pixel must change more than +/- the noise threshold parameter to be counted. -

-

-

noise_tune

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: on -
  • Option Topic -
-

-Activates the automatic tuning of noise level. -

-This feature makes Motion continuously adjust the noise threshold for distinguishing between noise and motion. The 'noise_level' setting is ignored when activating this feature. This is a new feature and new algorithm. It may give different results depending on camera and light conditions. Report your experience with it on the Motion mailing list. If it does not work well, deactivate the 'noise_tune' option and use the manual setting of 'noise_level' instead. -

-

-

output_all

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Picture are saved continuously as if motion was detected all the time. -

-This feature is not meant to be the normal mode of operation. Especially not if you have the output_normal or output_motion features enabled since it will keep on saving pictures on the disk and you will soon run out of disk space. So be careful with this command. -

-If your frame rate is 10 pictures per second motion will save 10 new picture pr second until the disk is full. -

-It does all the normal actions that are done when motion is detected. It saves pictures on the harddisk, execute external scripts, etc as fast as the frame rate of the camera. So it is probably a good idea to run with a low framerate when using this feature and to not use activate all the features that saves files on the disk. -

-The idea of this feature is that you can turn the feature on and off for a short period of time to test or to generate continuous mpeg films when needed. -

-

-

post_capture

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Specifies the number of frames to be captured after motion has been detected. -

-The purpose of this is mainly to create smooth video clips each time motion is detected. Use it to you personal taste (and disk space).. -

-This option is the preferred way to create continuous movies. Post_capture does not consume extra RAM and it does not create pauses in the movie even with large values. -

-If you only store mpegs movies and do not have output_normal on, then the recommended post_capture value is what is equivalent to 1-5 seconds of movie. -

-

-

pre_capture

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 100s -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Specifies the number of previous frames to be outputted at motion detection. Recommended range: 0 to 5, default=0. Do not use large values! Large values will cause Motion to skip video frames and cause unsmooth mpegs. To smooth mpegs use larger values of post_capture instead. -

-Motion buffers the number of picture frames defined by 'pre_capture'. When motion is detected the pictures in the buffer are included in the video clip generated by ffmpeg. The effect is that it seems the program knew in advance that the event was going to take place and started the recording before it actually happened. This is a nice feature that give more complete video clips of an event. -

-If pre_capture is set to 0 the feature is disabled. Keep this value below 5. -

-The recommended value would be approx 0.5 second of video so the value should be defined so it fits the framerate and the desired pre-capture time. E.g. 0.5 second at 20 frames pr second would mean a value of 5. You should never use a value larger than 10. -

-You can in theory have up to 100s of pre-captured frames but naturally this makes motion leave a larger footprint in the memory of the computer. More important Motion is processing all the buffered images including saving jpegs, encoding mpegs, writing to databases and executing external programs after the first image is detected as Motion. -

-Motion will not grab another image until this is done. This means that even moderate values for pre_capture combined with high framerates will mean that you will miss quite many frames of Motion. It is therefore recommended to use relative small values for pre_capture. Depending on your chosen framerate and depending on the features enabled values from 1-5 are sensible. -

-If you wish to create smooth mpegs during events using large pre_capture values will do the opposite! It will create a long pause where a lot of action is missed. -

-To get a smooth mpeg use a large value for post_capture which does not cost any performance hit or RAM space. -

-

-

smart_mask_speed

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 10 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Slugginess of the smart mask. Default is 0 = DISABLED. 1 is slow, 10 is fast. -

-Smartmask is a dynamic, self-learning mask. Smartmask will disable sensitivity in areas with frequent motion (like trees in the wind). Sensitivity is turned on again after some time of no more motion in this area. The built mask is a bit larger at the borders than the actual motion was. This way smartmask works more reliable when sudden moves occur under windy conditions. -

-smart_mask_speed - tunes the slugginess of the mask. It accepts values from 0 (turned off) to 10 (fast). Fast means here that the mask is built quick, but it is also not staying very long with no more motion. Slow means that it takes a while until the mask is built but it also stays longer. A good start value for smart_mask_speed is 5. This setting is independent from the framerate. The attack and decay time is constant over all available framerates. -

-When smartmask is enabled and motion is also configured to either write motion-images or motion-mpegs, the current smartmask is copied as an overlay into the black/white motion-pictures/mpegs in red colour. Same thing happens to the webcam stream when Motion runs in setup_mode. That way you can easily adjust smart_mask_speed. -

-Detailed Description -

-The mask_file option provides a static mask to turn off sensitivity in certain areas. This is very usefull to mask a street with cars passing by all day long etc... -

-But imagine a scenario with large bushes and big trees where all the leaves are moving in the wind also triggering motion from time to time even with despeckle turned on. Of course you can also define a static mask here, but what if the bushes are growing during spring and summer? Well, you have to adapt the mask from time to time. What if the camera position moves slightly? What if someone grows new plants in your garden? You always have to setup a new static mask. -

-The answer to this problem is the smart mask feature introduced in Motion 3.1.18. A dynamic, self-learing mask. -

-Smart mask will disable sensitivity in areas with frequent motion (like trees in the wind). Sensitivity is turned on again after some time of no more motion in this area. The built mask is a bit larger at the borders than the actual motion. This way smartmask works more reliably when sudden moves occur under windy conditions. -

-

-

threshold

-

    -
  • Type: Integer -
  • Range / Valid values: 1 - 2147483647 -
  • Default: 1500 -
  • Option Topic -
-

-Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling. -

-The 'threshold' option is the most important detection setting. When motion runs it compares the current image frame with the previous and counts the number of changed pixels after having processed the image with noise filtering, masking, despeckle and labeling. If more pixels than defined by 'threshold' have changed we assume that we have detected motion. Set the threshold as low as possible so that you get the motion you want detected but large enough so that you do not get detections from noise and plants moving. Note that the larger your frames are, the more pixels you have. So for large picture frame sizes you need a higher threshold. -

-Use the -s (setup mode) command line option and/or the text_changes config file option to experiment to find the right threshold value. If you do not get small movements detected (see the mouse on the kitchen floor) lower the value. If motion detects too many birds or moving trees, increase the number. Practical values would be from a few hundred to 2000 indoors and 1000-10000 outdoors. -

-

-

threshold_tune

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Activates the automatic tuning of threshold level. -

-This feature makes Motion continuously adjust the threshold for declaring motion. -

-The threshold setting is ignored when activating this feature. It may give different results depending on your camera, light conditions, indoor/outdoor, the motion to be detected etc. If it does not work well, deactivate the 'threshold_tune' option and use the manual setting of threshold instead. -

-

-

Image File Output

-The following options controls how Motion generates images when detection motion. -

-

-

output_motion

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Output pictures with only the moving object. This feature generates the special motion type movies where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red. -

-Motion images shows the motion content of the pictures. This is good for tuning and testing but probably not very interesting for the general public. -

-Default is not to store motion images. Motion pictures are stored the same place and with the same filename as normal motion triggered pictures except they have an "m" appended at the end of the filename before the .jpg or .ppm. E.g. the name can be 01-20020424232936-00m.jpg. -

-

-

output_normal

-

    -
  • Type: Discrete Strings -
  • Range / Valid values: on, off, first, best -
  • Default: on -
  • Option Topic -
-

-Normal image is an image that is stored when motion is detected. It is the same image that was taken by the camera. I.e. not a motion image like defined by output_motion. Default is that normal images are stored. -

-If you set the value to 'first' Motion saves only the first motion detected picture per event. -

-If you set it to "best" Motion saves the picture with most changed pixels during the event. This is useful if you store mpegs on a webserver and want to present a jpeg to show the content of the mpeg on a webpage. "best" requires a little more CPU power and resources compared to "first". -

-Set to 'off' to don't write pictures ( jpeg or ppm ). -

-

-

ppm

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Output ppm images instead of jpeg. This uses less CPU time, but causes a LOT of hard disk I/O, and it is generally slower than jpeg. -

-The recommendation is to always use jpg except if you have a specific need to store high quality pictures without any quality loss. For web cameras you should always choose jpg. Note that the built in webcam server requires that this parameter is set to off. -

-

-

quality

-

    -
  • Type: Integer -
  • Range / Valid values: 1 - 100 -
  • Default: 75 -
  • Option Topic -
-

-The quality for the jpeg images in percent. -

-100 means hardly compressed. A small number means a much smaller file size but also a less nice quality image to look at. 50 is a good compromise for most. -

-

-

Tuning Motion

-

-Motion 3.2 introduces a new feature Setup Mode. This is a great new feature with really make tuning all the settings of Motion much more easy and transparent. In setup mode two things happen: -

    -
  1. With 'motion -s' Motion runs in console mode instead of daemon. It outputs a lot of useful information for each frame from the camera. Each message is prefixed by [number] where number is the camera number (thread number). -
  2. When you look at the mjpeg webcam stream you see a black image with numbers. What you see is the number of changed pixels, number of labeled areas and noise setting. When something moves you see the pixels detected as Motion in black and white. The largest labelled area (assuming despeckle is enabled and with the 'l' at the end) is blue. It is only the blue areas which is counted as Motion. If smartmask is enabled you see this as red areas. -
-

-Here is a suggestion how to initially setup Motion. -

    -
  • Disable despeckle (comment it out in motion.conf). -
  • Disable smartmask -
  • Enable both http control and webcam by setting port numbers. Example 8080 for control and 8081 for webcam. -
  • Start Motion in setup mode -
  • View the webcam stream. Either with Cambozola or with Firefox. http://localhost:8081/ Firefox often needs to reload the page before it works. Bug in Firefox. Internet Explorer cannot show the stream unless you make a webpage on your Apache with Cambozola applet. -
  • Open new browser window and connect to the http interface. http://localhost:8080/ . You can now control and change almost anything while Motion is running. You cannot resize the image. That was too hard to code. To disable a feature enter a space. -
  • Start by experimenting with noise level. Do this both during daylight and during darkness. You will be surprised to see how much noise a camera makes during night. Try using the automatic noise feature. It should work for most. -
  • Now try the despeckle feature. Enable it using the recommended default EedDl. If this is not enough experiment. Remember that the l must be the last letter. It is fun to play with. -
  • Set the threshold to what you want to trigger Motion. -
-

-In normal mode you can use the same setting with two browser windows and experiment with settings of the camera if needed. -

-From the web interface you can ask Motion to write all your changes back to the config files (motion.conf and thread config files). It will even tidy them up for you so they look nice. -

-There are two sets of options to adjust.

-

-


-

-Normal picture frame -

-outputnormal1.jpg -

-


-Motion type picture frame with despeckle. Note that the largest area is blue and only this is counted as Motion. -

-The Motion image shows how Motion maintains a "reference frame" which is not just the last picture frame but a matematical calculation of the past images. This enlarges real Motion and ensures that it is not easy to sneak in slowly. -

-outputmotion1.jpg -


-

-

-

Generating MPEG films with ffmpeg

-The ffmpeg option can generate mpeg films very fast and "on the fly". This means that the mpeg film is growing each time motion is detected. -

-Some people on the Motion mailing list have had trouble building the ffmpeg package because they did not have the NASM assembler package installed. So pay attention to this if you run into problems. -

-ffmpeg exists as binary packages for most distributions including RPMs and debian packages. -

-Ffmpeg is an interesting project. The releases have not been very consistent over time. The official releases are out of date now. So we are forced to take our chance and checkout a version from their CVS server and hope that we are lucky in getting a version that works. See ffmpeg project page. We encourage the maintaners of such an important project to introduce better release schedules in the near future for the benefit of opensource software. -

-In order to help people finding a version of ffmpeg that works we have started testing the Motion package with a selection of binaries and a CVS snapshot. The CVS source snapshot of ffmpeg which is certified with Motion is available on the Related projects file area on the Motion Sourceforge project -

-Motion works with the following versions of ffmpeg:

    -
  • ffmpeg-0.4.8. With this release Motion supports mpeg1, mpeg4 and msmpeg4. Lately newer distributions have problems building this 2003 release of ffmpeg so many of you no longer have this option. -
  • ffmpeg-0.4.9pre1. Is supported starting from Motion version 3.1.18. With this release Motion supports mpeg4 and msmpeg4 but not mpeg1. The reason is that the ffmpeg team has decided no longer to support non-standard framerates in their mpeg1 encoder library. Also ffmpeg-0.4.9pre1 gives people problems on newer distributions. -
  • ffmpeg from CVS. This may work. We cannot continuously monitor and try every time a new source file is checked into ffmpeg. You will have to try. -
  • ffmpeg RPMs. Currently each Motion release is tested with the current Livna ffmpeg rpm package for Fedora. See the Download Files page for direct links to the version which has been certified with the latest Motion release. -
  • ffmpeg debian binaries. Latest versions from the debian repository for Debian Sarge works fine with Motion. -
  • Certified ffmpeg CVS snapshot for latest Motion release is available from the Motion Sourceforge Related Projects file area -
-

-The timelapse feature always runs mpeg1 with both ffmpeg 0.4.8 and 0.4.9 and newer. Motion simply creates the timelapse film with a standard mpeg1 framerate. Note : maximum size for timelapse files is 2GB. -

-In principle Motion can be made to support many other formats. It requires additional coding in Motion. You are welcome to submit patches. All ffmpeg related code is in the source file ffmpeg.c. It is not trivial to do because the ffmpeg libraries not documented at all. All you have is a couple of code examples. -

-To build ffpmeg from source follow these steps: -

-Download the ffmpeg and untar it to /usr/local/ffmpeg. Then it should be a simple matter of entering the ffmpeg directory and run the commands -

-

-cd /usr/local/ffmpeg
-./configure --enable-shared
-make
-make install
-
-

-This creates the libavcodec.so and libavformat.so libraries under /usr/local/lib and header files under /usr/local/include/ffmpeg. -

-You probably need to do one more step. -

-Make sure you have 'root' privileges for the next steps. -

-Open the file /etc/ld.so.conf in your favorite text editor. -

-Add this line of text if it is not already there - otherwise go to the next step (ldconfig). -

-/usr/local/lib -Run the command ldconfig. -

-Motion should now be able to find the shared libraries for ffmpeg (libavcodec.so and libavformat.so) in /usr/local/lib. -

-You can also find a pre-compiled binary package (e.g. rpm or deb) and install this. Normally an rpm will place the libavcodec.so under /usr/lib. -There are various RPMs available from different repositories. Some need additional RPMs that are actually not needed by Motion but need to be installed to satisfy dependencies. The editor has tried different RPMs of ffmpeg-0.4.8 and they all seem to work. -

-Motion then need to be built by running ./configure, make and make install. -(Note that with earlier versions of motion you had to specify the location of libavcodec. Now configure searches for the shared library in /usr/lib and /usr/local/lib by default.) -

-Note that if you install ffmpeg from source and already have ffmpeg installed from an RPM, the Motion configure may very well find the binary library from the rpm instead of the sources. Make sure to uninstall any old ffmpeg RPMs before you install ffmpeg from sources. -

-These are the config file options related to ffmpeg. -

-

-

ffmpeg_bps

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 9999999 -
  • Default: 400000 -
  • Option Topic -
-

-Bitrate of mpegs produced by ffmpeg. Bitrate is bits per second. Default: 400000 (400kbps). Higher value mans better quality and larger files. Option requires that ffmpeg libraries are installed. -

-To use this feature you need to install the FFmpeg Streaming Multimedia System. -

-Experiment to get the desired quality. The better quality the bigger files. This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled). -

-

-

ffmpeg_cap_motion

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Use ffmpeg libraries to encode motion type mpeg movies where you only see the pixels that changes. -

-Works like ffmpeg_cap_new but outputs motion pixel type pictures instead. -

-This feature generates the special motion type movie where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red. The filename given is the same as the normal mpegs except they have an 'm' appended after the filename before the .mpg. E.g. 20040424181525m.mpg -

-To use this feature you need to install the FFmpeg Streaming Multimedia System -

-

-

ffmpeg_cap_new

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Use ffmpeg libraries to encode mpeg movies in realtime. -

-Generates a new film at the beginning of each new event and appends to the film for each motion detected within the same event. The current event ends when the time defined by the 'gap' option has passed with no motion detected. At the next detection of motion a new mpeg film is started. -

-To use this feature you need to install the FFmpeg Streaming Multimedia System -

-Must not be included in config file without having ffmpeg installed. -

-

-

ffmpeg_deinterlace

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Use ffmpeg to deinterlace video. Necessary if you use an analog camera and see horizontal combing on moving objects in video or pictures. -

-To use this feature you need to install the FFmpeg Streaming Multimedia System -

-Must not be included in config file without having ffmpeg installed. -

-

- -

-

-

ffmpeg_timelapse

-

    -
  • Type: Boolean -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used. -

-This feature uses ffmpegs libavcodec to encode a timelaps movie saving a picture frame at the interval in seconds set by this parameter. Setting this option to 0 disables it. -

-The feature gives your viewer the chance to watch the day pass by. It makes a nice effect to film flowers etc closeup during the day. Options like frame_rate, snapshot, gap etc have no impact on the ffmpeg timelapse function. -

-Note that the timelapse format is always mpeg1 independent of ffmpeg_video_codec. This is because mpeg1 allows the timelapse to stop and the file to be reopened and more film appended. -

-To use this feature you need to install the FFmpeg Streaming Multimedia System. -

-(renamed from ffmpeg_timelaps to ffmpeg_timelapse in 3.1.14) -

-

-

ffmpeg_timelapse_mode

-

    -
  • Type: Discrete Strings -
  • Range / Valid values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual -
  • Default: daily -
  • Option Topic -
-

-The file rollover mode of the timelapse video. -

-Note that it is important that you use the conversion specifiers in ffmpeg_filename that ensure that the new timelapse file indeed is a new file. If the filename does not change Motion will simply append the timelapse pictures to the existing file. -

-The value 'Manual' means that Motion does not automatically rollover to a new filename. You can do it manually using the http control interface by setting the option 'ffmpeg_timelapse' to 0 and then back to your chosen value. Value 'hourly' rolls over on the full hour. Value 'daily' which is the default rolls over at midnight. There are two weekly options because depending on where you come from a week may either start on Sunday or Monday. And 'monthly' naturally rolls over on the 1st of the month. -

-

-

ffmpeg_variable_bitrate

-

    -
  • Type: Integer -
  • Range / Valid values: 0, 2 - 31 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Enables and defines variable bitrate for the ffmpeg encoder. ffmpeg_bps is ignored if variable bitrate is enabled. Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, or the range 2 - 31 where 2 means best quality and 31 is worst. -

-Experiment for the value that gives you the desired compromise between size and quality. -

-

-

ffmpeg_video_codec

-

    -
  • Type: Discrete Strings -
  • Range / Valid values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf, flv, ffv1 -
  • Default: mpeg4 -
  • Option Topic -
-

-Codec to be used by ffmpeg for the video compression. Timelapse mpegs are always made in mpeg1 format independent from this option. -

-mpeg1 gives you files with extension .mpg. It is only supported by the old ffmpeg version 0.4.8. The ffmpeg team decided no longer to support non-standard framerates for mpeg1 from ffmpeg version 0.4.9pre1. -

-mpeg4 or msmpeg4 give you files with extension .avi -

-msmpeg4 is recommended for use with Windows Media Player because it requires with no installation of codec on the Windows client. -

-swf gives you a flash film with extension .swf -

-flv gives you a flash video with extension .flv -

-ffv1 , FF video codec 1 for Lossless Encoding ( experimental ) -

-This option does not affect the timelapse feature. Timelapse is always recorded in mpeg1 format because we need to be able to append to an existing file. mpeg4 does not easily allow this. -

-

-


-

-See also the section Advanced Filenames where the two additional options ffmpeg_filename and timelapse_filename are defined. -

-If you want to use this feature you can read about the FFmpeg Streaming Multimedia System -

-

-

Snapshots - The Traditional Periodic Web Camera

-Motion can also act like a traditional web camera. -

-

-

snapshot_interval

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Make automated snapshots every 'snapshot_interval' seconds. -

-The snapshots are stored in the target directory + the directory/filename specified by the snapshot_filename option. -

-This is the traditional web camera feature where a picture is taken at a regular interval independently of motion in the picture. -

-

-See the also snapshot_filename option in the section Advanced Filenames. -

-

-

Text Features

-Text features are highly flexible. You can taylor the text displayed on the images and films to your taste and you can add your own user defined text. -

-This is how the overlayed text is located. -

- - - - -
- - - - - - - - - -
-

  





 

-
-

 CHANGES





 

-
-



TEXT_LEFT

-
-

TEXT_RIGHT
YYYY-MM-DD
HH:MM:SS 

-
-
-

-You are allowed to put the text in quotation marks. This allows you to use leading spaces. By combining spaces and new lines '\n' you can place your text anywhere on the picture. Experiment to find your preferred look. When setting the text using http remote control the text must be URL encoded. The browser does this for you. If you need to set it with a command line tool, use a browser first and let it make the encoded URL for you. Then you can copy paste it to your script file or cron line or whatever you want to use. -

-Below are the options that controls the display of text. The 'locate' option is not a text feature but described here because it is related to information overlayed on the output images. -

-The text_event feature is special in that it defines the conversion specifier %C which can be used both for text display and for filenames. -

-

-

locate

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off, preview -
  • Default: off -
  • Option Topic -
-

-Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved mpeg movie. -

-The value 'preview' only works when 'output_normal' is set to either 'first' or 'best'. -

-

-

text_changes

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Turns the text showing changed pixels on/off. -

-By setting this option to 'on' the number of pixels that changed compared to the reference frame is displayed in the upper right corner of the pictures. This is good for calibration and test. Maybe not so interesting for a greater public. Set it to your personal taste. -

-

-

text_double

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
-

-Draw characters at twice normal size on images. -

-This option makes the text defined by text_left, text_right and text_changes twice the normal size. This may be useful when using large picture formats such as 640 x 480. -

- -

-

-

text_event

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: %Y%m%d%H%M%S -
  • Option Topic -
-

-This option defines the value of the speciel event conversion specifier %C. You can use any conversion specifier in this option except %C. Date and time values are from the timestamp of the first image in the current event. -

-The idea is that %C can be used filenames and text_left/right for creating a unique identifier for each event. -

-Option text_event defines the value %C which then can be used in filenames and text_right/text_left. The text_event/%C uses the time stamp for the first image detected in a new event. %C is an empty string when no event is in progress (gap period expired). Pre_captured and minimum_motion_frames images are time stamped before the event happens so %C in text_left/right does not have any effect on those images. -

-

-

text_left

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-User defined text overlayed on each in the lower left corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > \ , . : - + _ \n and conversion specifiers (codes starting by a %). -

-text_left is displayed in the lower left corner of the pictures. If the option is not defined no text is displayed at this position. -

-You can place the text in quotation marks to allow leading spaces. With a combination is spaces and newlines you can position the text anywhere on the picture. -

-Detailed Description -

-A conversion specifier is a code that starts by % (except newline which is \n). The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

    -
  • %Y = year -
  • %m = month as two digits -
  • %d = date -
  • %H = hour -
  • %M = minute -
  • %S = second -
  • %T = HH:MM:SS -
-

-These are unique to motion

    -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i = width of motion area -
  • %J = height of motion area -
  • %K = X coordinate of motion center -
  • %L = Y coordinate of motion center -
  • %C = value defined by text_event -
-

-With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features. -

-For a full list of conversion specifiers see the section Conversion Specifiers for Advanced Filename and Text Feature. -

-

-

text_right

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: %Y-%m-%d\n%T -
  • Option Topic -
-

-User defined text overlayed on each in the lower right corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > , . : - + _ \n and conversion specifiers (codes starting by a %). Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock -

-text_right is displayed in the lower right corner of the pictures. If the option is not defined no text is displayed at this position. -

-You can place the text in quotation marks to allow leading spaces. With a combination is spaces and newlines you can position the text anywhere on the picture. -

-A major difference from text_left is that if this option is undefined the default is %Y-%m-%d\n%T which displays the date in ISO format YYYY-MM-DD and below the time in 24 hour clock HH:MM:SS. -

-Detailed Description -

-A conversion specifier is a code that starts by % (except newline which is \n). The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

    -
  • %Y = year -
  • %m = month as two digits -
  • %d = date -
  • %H = hour -
  • %M = minute -
  • %S = second -
  • %T = HH:MM:SS -
-

-These are unique to motion

    -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i = width of motion area -
  • %J = height of motion area -
  • %K = X coordinate of motion center -
  • %L = Y coordinate of motion center -
  • %C = value defined by text_event -
-

-With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features. -

-For a full list of conversion specifiers see the section Conversion Specifiers for Advanced Filename and Text Feature. -

-

-

Advanced Filenames

-Motion has a very advanced and flexible automated filenaming feature. -

-By using conversion specifiers (codes that consist of a '%' followed by a letter) you can build up the filenames including sub directories for pictures and movies using any combination of letters, numbers and conversion specifiers which are codes that represents time, date, event number and frame numbers. -

-The option target_dir is the target directory for all snapshots, motion images and normal images. The default is the current working directory (current working directory of the terminal from which motion was started). You will normally always want to specify this parameter. -

-Note that the options snapshot_filename, jpeg_filename, ffmpeg_filename, and timelapse_filename all allow specifying directories by using '/' in the filename. These will all be relative to target_dir. This means in principle that you can specify target_dir as '/' and be 100% flexible. It also means that Motion can write files all over your harddisk if you make a mistake. It is recommended to specify the target_dir as deep or detailed as possible for this reason. And note that targer_dir does not allow conversion specifiers. -

-The conversion specifier %C which is defined by the option text_event is interesting in connection with filenames because it can be used to create files and directories for each event in a very flexible way. -

-The convertion specifier %t (thread/camera number) is also very useful. Here is an example of filename definitions in motion.conf: -

-

-target_dir /usr/local/webcam
-snapshot_filename cam%t/%v-%Y%m%d%H%M%S-snapshot
-jpeg_filename cam%t/%v-%Y%m%d%H%M%S-%q
-ffmpeg_filename cam%t/%v-%Y%m%d%H%M%S
-timelapse_filename cam%t/%Y%m%d%H-timelapse
-
-

-The smart thing is that this defines the filename of all your camera threads in motion.conf so you do not need to specify target dir and filenames in the thread config files. In the above example an mpegfile for camera thread 3 will be saved as a filename similar to /usr/local/webcam/cam3/28-20051128130840.avi -

-NOTE: Unless you use the minimum_gap option to limit the number of shots to less then one per second - you must use the frame modifier %q as part of the jpeg_filename. Otherwise the pictures saved within the same second will overwrite each other. The %q in jpeg_filename ensures that each jpeg (or ppm) picture saved gets a unique filename. -

-ALERT! Security Warning! Note that the flexibility of this feature also means you have to pay attention to the following.

    -
  • Anyone with access to the remote control port (http) can alter the values of these options and save files anywhere on your server with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside. -
  • Anyone with local access to the computer and edit rights to the motion.conf file can alter the values of these options and save files anywhere on your server with the same privileges as the user running Motion. Make sure the motion.conf file is maximum readonly to anyone else but the user running Motion. -
  • It is a good idea to run Motion as a harmless user. Not as root. -
-

-These are the advanced filename options in motion.conf -

-

-

ffmpeg_filename (now called movie_filename)

-

-ALERT! This option was renamed to movie_filename in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution. -

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: %v-%Y%m%d%H%M%S -
  • Option Topic -
-

-File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This option was renamed to movie_filename in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution. -

-Default value is equivalent to legacy 'oldlayout' option -For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H%M%S -

-File extension .mpg or .avi is automatically added so do not include this. -

-This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

    -
  • %Y = year -
  • %m = month as two digits -
  • %d = date -
  • %H = hour -
  • %M = minute -
  • %S = second -
  • %T = HH:MM:SS -
-

-These are unique to motion

    -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i = width of motion area -
  • %J = height of motion area -
  • %K = X coordinate of motion center -
  • %L = Y coordinate of motion center -
  • %C = value defined by text_event -
-

-If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S for 'oldlayout on' and %Y/%m/%d/%H%M%S for 'oldlayout off'. -

-

-

jpeg_filename

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: %v-%Y%m%d%H%M%S-%q -
  • Option Topic -
-

-File path for motion triggered images (jpeg or ppm) relative to target_dir. Value 'preview' makes a jpeg filename with the same name body as the associated saved mpeg movie file. -

-Default value is equivalent to legacy 'oldlayout' option. For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H/%M/%S-%q -

-This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

    -
  • %Y = year -
  • %m = month as two digits -
  • %d = date -
  • %H = hour -
  • %M = minute -
  • %S = second -
  • %T = HH:MM:SS -
-

-These are unique to motion

    -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i = width of motion area -
  • %J = height of motion area -
  • %K = X coordinate of motion center -
  • %L = Y coordinate of motion center -
  • %C = value defined by text_event -
-

-If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S-%q for 'oldlayout on' and %Y/%m/%d/%H/%M/%S-%q for 'oldlayout off'. -

-The value 'preview' only works when 'output_normal' is set to 'best'. It makes Motion name the best preview jpeg file (image with most changed pixels during the event) with the same body name as the mpeg movie created during the same event. The purpose is to create a good single image that represents the saved mpeg moview so you can decide if you want to see it and spend time downloading it from a web page. -

-

-

movie_filename

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: %v-%Y%m%d%H%M%S -
  • Option Topic -
-

-File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This was previously called ffmpeg_filename. -

-ALERT! This option was renamed from ffmpeg_filename to movie_filename in Motion 3.2.5. -

-Default value is equivalent to legacy 'oldlayout' option -For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H%M%S -

-File extension .mpg or .avi is automatically added so do not include this. -

-This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

    -
  • %Y = year -
  • %m = month as two digits -
  • %d = date -
  • %H = hour -
  • %M = minute -
  • %S = second -
  • %T = HH:MM:SS -
-

-These are unique to motion

    -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i = width of motion area -
  • %J = height of motion area -
  • %K = X coordinate of motion center -
  • %L = Y coordinate of motion center -
  • %C = value defined by text_event -
-

-If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S for 'oldlayout on' and %Y/%m/%d/%H%M%S for 'oldlayout off'. -

-

-

snapshot_filename

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: %v-%Y%m%d%H%M%S-snapshot -
  • Option Topic -
-

-File path for snapshots (jpeg or ppm) relative to target_dir. -

-Default value is equivalent to legacy 'oldlayout' option. For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H/%M/%S-snapshot -

-File extension .jpg or .ppm is automatically added so do not include this -A symbolic link called lastsnap.jpg (or lastsnap.ppm) created in the target_dir will always point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap' -

-This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

    -
  • %Y = year -
  • %m = month as two digits -
  • %d = date -
  • %H = hour -
  • %M = minute -
  • %S = second -
  • %T = HH:MM:SS -
-

-These are unique to motion

    -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i = width of motion area -
  • %J = height of motion area -
  • %K = X coordinate of motion center -
  • %L = Y coordinate of motion center -
  • %C = value defined by text_event -
-

-If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S-snapshot for 'oldlayout on' and %Y/%m/%d/%H/%M/%S-snapshot for 'oldlayout off'. -

-For the equivalent of the now obsolete option 'snap_overwrite' use the value 'lastsnap'. -

-

-

target_dir

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined = current working directory -
  • Option Topic -
-

-Target directory for picture and movie files. -

-This is the target directory for all snapshots, images files and movie files. The default is the current working directory (current working directory of the terminal from which motion was started). You will normally always want to specify this parameter as an absolute path. -

-Note that the options snapshot_filename, jpeg_filename, ffmpeg_filename, and timelapse_filename all allows specifying directories. These will all be relative to 'target_dir'. This means in principle that you can specify target_dir as '/' and be 100% flexible. It also means that Motion can write files all over your harddisk if you make a mistake. It is recommended to specify the target_dir as deep or detailed as possible for this reason. -

-

-

timelapse_filename

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: %v-%Y%m%d-timelapse -
  • Option Topic -
-

-File path for timelapse mpegs relative to target_dir (ffmpeg only). -

-Default value is equivalent to legacy 'oldlayout' option. -

-For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d-timelapse -

-File extension .mpg is automatically added so do not include this. -

-This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

    -
  • %Y = year -
  • %m = month as two digits -
  • %d = date -
  • %H = hour -
  • %M = minute -
  • %S = second -
  • %T = HH:MM:SS -
-

-These are unique to motion

    -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i = width of motion area -
  • %J = height of motion area -
  • %K = X coordinate of motion center -
  • %L = Y coordinate of motion center -
  • %C = value defined by text_event -
-

-If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d-timelapse for 'oldlayout on' and %Y/%m/%d-timelapse for 'oldlayout off'. -

-

-

Conversion Specifiers for Advanced Filename and Text Features

-The table below shows all the supported Conversion Specifiers you can use in the options text_event, text_left, text_right, sql_query, snapshot_filename, jpeg_filename, ffmpeg_filename, timelapse_filename, on_event_start, on_event_end, on_picture_save, on_movie_start, on_movie_end, and on_motion_detected. -

-In text_left and text_right you can additionally use '\n' for new line. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Conversion Specifier Description
%a The abbreviated weekday name according to the current locale.
%A The full weekday name according to the current locale.
%b The abbreviated month name according to the current locale.
%B The full month name according to the current locale.
%c The preferred date and time representation for the current locale.
%C Text defined by the text_event feature
%d The day of the month as a decimal number (range 01 to 31).
%D Number of pixels detected as Motion. If labelling is enabled the number is the number of pixels in the largest labelled motion area.
%E Modifier: use alternative format, see below.
%f File name - used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features.
%F Equivalent to %Y-%m-%d (the ISO 8601 date format).
%H The hour as a decimal number using a 24-hour clock (range 00 to 23).
%i Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
%I The hour as a decimal number using a 12-hour clock (range 01 to 12).
%j The day of the year as a decimal number (range 001 to 366).
%J Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
%k The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.)
%K X coordinate in pixels of the center point of motion. Origin is upper left corner.
%l The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.)
%L Y coordinate in pixels of the center point of motion. Origin is upper left corner and number is positive moving downwards (I may change this soon).
%m The month as a decimal number (range 01 to 12).
%M The minute as a decimal number (range 00 to 59).
%n Filetype as used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features.
%N Noise level.
%o Threshold. The number of detected pixels required to trigger motion. When threshold_tune is 'on' this can be used to show the current tuned value of threshold.
%p Either 'AM' or 'PM' according to the given time value, or the corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'.
%P Like %p but in lowercase: `am' or `pm' or a corresponding string for the current locale.
%q Picture frame number within current second. For jpeg filenames this should always be included in the filename if you save more then 1 picture per second to ensure unique filenames. It is not needed in filenames for mpegs.
%Q Number of detected labels found by the despeckle feature
%r The time in a.m. or p.m. notation.
%R The time in 24-hour notation (%H:%M).
%s The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC.
%S The second as a decimal number (range 00 to 61).
%t Thread number (camera number)
%T The time in 24-hour notation (%H:%M:%S).
%u The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w.
%U The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W.
%v Event number. An event is a series of motion detections happening with less than 'gap' seconds between them.
%V The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also %U and %W.
%w The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u.
%W The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01.
%x The preferred date representation for the current locale without the time.
%X The preferred time representation for the current locale without the date.
%y The year as a decimal number without a century (range 00 to 99).
%Y The year as a decimal number including the century.
%z The time-zone as hour offset from GMT.
%Z The time zone or name or abbreviation.
-

-

-

Webcam Server

-Motion has simple webcam server built in. The video stream is in mjpeg format. -

-Each thread can have its own webcam server. If you enable the webcam server (option webcam_port to a number different from 0) and you have more than one camera, you must make sure to include webcam_port in each thread config file and set webcam_port to different and unique port numbers or zero (disable). Otherwise each webcam server will use the setting from the motion.conf file and try to bind to the same port. If the webcam_port numbers are not different from each other Motion will disable the webcam feature. -

-Note: The webcam server feature requires that the option ppm is set to off. (I.e. saved images are jpeg images). -

-The webcam_maxrate and webcam_quality options are important to limit the load on your server and link. Don't set them too high unless you only use it on the localhost or on an internal LAN. The option webcam_quality is equivalent to the quality level for jpeg pictures. -

-The webcam_limit option prevents people from loading your Network connection by streaming for hours and hours. The options defines the number of picture frames sent as mjpeg Motion will allow without re-connecting (e.g. clicking refresh in the browser). -

-The option webcam_localhost is a security feature. When enabled you can only access the webserver on the same machine as Motion is running on. If you want to present a live webcam on your web site this feature must be disabled. -

-The webserver generates a stream in "multipart jpeg" format (mjpeg). You cannot watch the stream with most browsers. Only certain versions of Netscape works. Mozilla and Firefox brosers can view the mjpeg stream but you often have to refresh the page once to get the streaming going. Internet Explorer cannot show the mjpeg stream. For public viewing this is not very useful. There exists a java applet called Cambozola which enabled any Java capable browser to show the stream. To enable the feature to a broad audience you should use this applet or similar. -

-To use the webcam feature with Cambozola is actually very simple. -

-1. Create a html page in which you will want the streamed picture. -

-2. In the html page include this code -

-

-<applet code=com.charliemouse.cambozola.Viewer
-    archive=cambozola.jar width="320" height="240" style="border-width:1; border-color:gray; border-style:solid;">
-    <param name=url value="http://www.myurl.com:8081">
-</applet>
-
-

-Where the width and height is the image size of the video stream. -

-Replace www.myurl.com:8081 by the real url and port number of your choice. -

-3. In the same directory you place the cambozola.jar file. No need to build the java applet from source. Simply use the applet in the package. -

-4. Enable the feature in motion.conf. -

-You can also view the live webcam stream using MPlayer like this: -

-

mplayer -demuxer lavf http://www.myurl.com:8081/stream.mjpg
-

-Note that the stream.mjpg part is important, without it you will get a LAVF_check: no clue about this gibberish! error from libavformat. -

-These are the special webcam parameters. -

-

-

webcam_limit

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 (unlimited) -
  • Option Topic -
-

-Limit the number of frames to number frames. After 'webcam_limit' number of frames the connection will be closed by motion. The value 0 means unlimited. -

-Number can be defined by multiplying actual webcam rate by desired number of seconds. Actual webcam rate is the smallest of the numbers framerate and webcam_maxrate. -

-

-

webcam_localhost

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: on -
  • Option Topic -
-

-Limits the access to the webcam to the localhost. -

-By setting this to on, the webcam can only be accessed on the same machine on which Motion is running. -

-

-

webcam_maxrate

-

    -
  • Type: Integer -
  • Range / Valid values: 1 - 100 -
  • Default: 1 -
  • Option Topic -
-

-Limit the framerate of the webcam in frames per second. Default is 1. Set the value to 100 for practically unlimited. -

-Don't set 'webcam_maxrate' too high unless you only use it on the localhost or on an internal LAN. -

-

-

webcam_motion

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-If set to 'on' Motion sends slows down the webcam stream to 1 picture per second when no motion is detected. When motion is detected the stream runs as defined by webcam_maxrate. When 'off' the webcam stream always runs as defined by webcam_maxrate. -

-Use this option to save bandwidth when there is not anything important to see from the camera anyway. -

-Note that this feature was greatly improved from Motion version 3.2.2. Before 3.2.2 the option stopped the webcam stream except when Motion was detected. This made the feature not very useful because it made it difficult to connect to the webcam stream and most mjpeg viewers would timeout and give an error message. From 3.2.2 the feature has been greatly improved and actually quite recommendable. -

-

-

-

webcam_port

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 65535 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-TCP port on which motion will listen for incoming connects with its webcam server. -

-Note that each camera thread must have its own unique port number and it must also be different from the control_port number. -

-A good value to select is 8081 for camera 1, 8082 for camera 2, 8083 for camera 3 etc etc. -

-

-

webcam_quality

-

    -
  • Type: Integer -
  • Range / Valid values: 1 - 100 -
  • Default: 50 -
  • Option Topic -
-

-Quality setting in percent for the mjpeg picture frames transferred over the webcam connection. Keep it low to restrict needed bandwidth. -

-The mjpeg stream consists of a header followed by jpeg frames separated by content-length and boundary string. The quality level defines the size of the individual jpeg pictures in the mjpeg stream. If you set it too high you need quite a high bandwidth to view the stream. -

-

Remote Control with http

-

-Motion can be remote controlled via a simple http interface. http is the language a normal web browser talks when it requests a web page. The web server answers back with some simple http headers followed by a webpage coded in HTML. -

-Most Motion config options can be changed while Motion is running except options related to the size of the captured images and mask files which are loaded only when Motion starts. So only your fantasy sets the limit to what you can change combining cron and the remote control interface for Motion. -

-So the most obvious tool to use to remote control Motion is any web browser. All commands are sent using the http GET method which simply means that the information is sent via the URL and maybe a query string. You can use any browser (Firefox, Mozilla, Internet Explorer, Konquerer, Opera etc). You can also use the text based browser lynx to control Motion from a console. It navigates fine through the very simple and minimalistic http control interface of Motion. -

-The details about how to control Motion via the URL is described in detail in the Motion http API topic. -

-But it is probably simpler to connect to the control port with a browser, navigate to the function you want, and copy the URL from the browser URL entry line. If your control_port is 8080 and you browse from the same machine on which Motion runs simply look up http://localhost:8080/ and navigate around. Connecting from a remote machine is done by using a domain name (example http://mydomain.com:8080/) or the IP address of the machine (example http://192.168.1.4:8080/). The option control_localhost must be off to allow connection from a remote machine. -

-If you want to use a script or cron to automatically change Motion settings while Motion runs you use a program that can fetch a webpage. We simply just throw away the html page that Motion returns. Programs commonly available on Linux machines are wget and lwp-request. Here is an example of how to start and stop motion detection via cron. These two lines are added to /etc/crontab. -

-

-0 9 * * * root /usr/bin/lwp-request http://localhost:8080/0/detection/start > /dev/null
-0 18 * * * root /usr/bin/lwp-request http://localhost:8080/0/detection/pause > /dev/null
-
-

-If you want to use the http remote control from your own software (for example your own PHP front end) you can set the new motion.conf option html_output off. Then Motion answers back with very basic text only and no html around it. A bit like the xmlrpc interface did. -

-To remote control Motion from a web pages you can for example use PHP. In PHP it takes this simple code line to send a remote commend to Motion. Here we pause motion detection for camera 2 -

-readfile('http://localhost:8080/2/detection/pause'); -

-What happened to XMLRPC? -

-XMLRPC is replaced by a simpler http remote control interface. It is still being worked on but it is absolutely useable now and much nicer to work with than xmlrpc. Another advantage is that you do not need to install xmlrpc libraries. It is all written in standard C. -

-ALERT! Security Warning! Note that this feature also means you have to pay attention to the following.

    -
  • Anyone with access to the remote control port (http) can alter the values of any options and save files anywhere on your server with the same privileges as the user running Motion. They can execute any command on your computer with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside. -
  • If you limit control port to localhost you still need to take care of any user logging into the server with any kind of terminal session. -
  • It is a good idea to run Motion as a harmless user. Not as root!! -
-

-These are the config file options that control Motion. -

-These must be placed in motion.conf and not in a thread config file. -

-

-

control_authentication

-

    -
  • Type: String -
  • Range / Valid values: Max 4096 characters -
  • Default: Not defined -
  • Option Topic -
-

-To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file. -

-By setting this to on, the control using http (browser) can only be accessed using login and password ( following the Basic Authentication defined in HTTP RFC). -

-

-

- -

-

-

control_html_output

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: on -
  • Option Topic -
-

-Enable HTML in the answer sent back to a browser connecting to the control_port. This option must be placed in motion.conf and not in a thread config file. -

-The recommended value for most is "on" which means that you can navigate and control Motion with a normal browser. By setting this option to "off" the replies are in plain text which may be easier to parse for 3rd party programs that control Motion. -

-

-

control_localhost

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: on -
  • Option Topic -
-

-Limits the http (html) control to the localhost. This option must be placed in motion.conf and not in a thread config file. -

-By setting this to on, the control using http (browser) can only be accessed on the same machine on which Motion is running. -

-

-

control_port

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 65535 -
  • Default: 0 (disabled) -
  • Option Topic -
-

-Sets the port number for the http (html using browser) based remote control. This option must be placed in motion.conf and not in a thread config file. -

-This sets the TCP/IP port number to be used for control of motion using http (browser). Port numbers below 1024 normally requires that you have root privileges. Port 8080 is a fine choice of port to use for the purpose. -

-

-

--- KennethLavrsen - 12 Apr 2005 -

-

-

External Commands

-Motion can execute external commands based on the motion detection and related events. They are all described in this section. The option quiet is also included in this section. -

-A redesign of the external commands was due. They were not very easy to understand, not all were flexible enough and some were missing. So a new external command feature set was made for 3.2.1 and on. -

-This is how the new script commands look like: -

- - - - - - - -
Function Old Option New Option Argument Appended
Start of event (first motion) execute on_event_start None
End of event (no motion for gap seconds) New! on_event_end None
Picture saved (jpg or ppm) onsave on_picture_save Filename of picture
Movie starts (mpeg file opened) onmpeg on_movie_start Filename of movie
Movie ends (mpeg file closed) onffmpegclose on_movie_end Filename of movie
Motion detected (each single frame with Motion detected) New! on_motion_detected None
-

-Mail and sms has been removed because they were not configurable. If you want to send event-based mails or sms, just use one of those commands above and send the mail from that script. See What happened to mail and sms? -

-

-ALERT! Security Warning! Note that this feature also means you have to pay attention to the following.

    -
  • Anyone with access to the remote control port (http) can execute any command on your computer with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside. -
  • If you limit control port to localhost you still need to take care of any user logging into the server with any kind of GUI or terminal session. All it takes is a browser or single command line execution to change settings in Motion. -
  • It is a good idea to run Motion as a harmless user. Not as root!! -
-

-These are the options -

-

-

on_event_end

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option gap. You can use Conversion Specifiers and spaces as part of the command. -

-Full path name of the program/script. -

-This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script. -

-The command is run when an event is over. I.e. the number of seconds defined by the time 'gap' has passed since the last detection of motion and motion closes the mpeg file. -

-

-

on_event_start

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Command to be executed when an event starts. An event starts at first motion detected after a period of no motion defined by gap. You can use ConversionSpecifiers and spaces as part of the command. -

-Full path name of the program/script. -

-This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script. -

-The command is run when an event starts. I.e. the first motion is detected since the last event. -

-This option replaces the former options 'mail', 'sms' and 'execute'. -

-

-

on_motion_detected

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Command to be executed when a motion frame is detected. You can use Conversion Specifiers and spaces as part of the command. -

-Do not write "none" if you do not want to execute commands. Simply do not include the option in the file or comment it out by placing a "#" or ";" as the first character on the line before the execute command. -

-

-

on_movie_end

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Command to be executed when an ffmpeg movie is closed at the end of an event. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. -

-Full path name of the program/script. -

-This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script. -

-The command is run when an event is over. I.e. the number of seconds defined by the time 'gap' has passed since the last detection of motion and motion closes the mpeg file. -

-This option was previously called onffmpegclose. -

-Note that from Motion 3.2.4 the path name of the picture file is no longer appended to the command. Instead you can use the conversion specifier %f to insert the picture filename (full path) anywhere in the command. -

-Most common conversion specifiers -

    -
  • %Y = year, %m = month, %d = date -
  • %H = hour, %M = minute, %S = second -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i and %J = width and height of motion area -
  • %K and %L = X and Y coordinates of motion center -
  • %C = value defined by text_event -
  • %f = filename with full path -
  • %n = number indicating filetype -
-

-

-

on_movie_start

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Command to be executed when an mpeg movie is created. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. -

-Full path name of the program/script. -

-This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script. When you use ffmpeg the film is generated on the fly and on_movie_start then runs when the new mpeg file is created. Often you will want to use the on_movie_end option which runs when the mpeg file is closed and the event is over. -

-This option was previously called onmpeg. -

-Note that from Motion 3.2.4 the path name of the picture file is no longer appended to the command. Instead you can use the conversion specifier %f to insert the picture filename (full path) anywhere in the command. -

-Most common conversion specifiers -

    -
  • %Y = year, %m = month, %d = date -
  • %H = hour, %M = minute, %S = second -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i and %J = width and height of motion area -
  • %K and %L = X and Y coordinates of motion center -
  • %C = value defined by text_event -
  • %f = filename with full path -
  • %n = number indicating filetype -
-

-

-

on_picture_save

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Command to be executed when an image is saved. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. -

-Full path name of the program/script. -

-This can be any type of program or script. Remember to set the execution bit in the file access control list (chmod) and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/usr/bin/perl) as the first line of the script. -

-Note that from Motion 3.2.4 the path name of the picture file is no longer appended to the command. Instead you can use the conversion specifier %f to insert the picture filename (full path) anywhere in the command. -

-Most common conversion specifiers -

    -
  • %Y = year, %m = month, %d = date -
  • %H = hour, %M = minute, %S = second -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i and %J = width and height of motion area -
  • %K and %L = X and Y coordinates of motion center -
  • %C = value defined by text_event -
  • %f = filename with full path -
  • %n = number indicating filetype -
-

-

-

quiet

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Be quiet, don't output beeps when detecting motion. -

-Only works in non-daemon mode. -

-

-

- -

What happened to mail and sms?

-The 6 new on_xxxxx options replace the former execute, mail and sms options. -

-They are quite generic and flexible. These small bash scripts gives to the same functionality as mail and sms BUT you have all the flexibility you want to extend the messages, change the 'from' email address etc. -

-

Sending email at start of event

-Script written by JoergWeber -
-#!/bin/sh
-
-# Motion sample script to send an e-mail at start of an event.
-# Replaces the former 'mail' option.
-# Just define this script as 'on_event_start'-script in motion.conf like that:
-# on_event_start send_mail "%Y-%m-%d %T"
-
-#change to suit your needs:
-#location of 'mail' binary
-MAIL="/usr/bin/mail"
-#Destination e-mail address
-TO="root@localhost"
-#Subject of the e-mail
-SUBJECT="Motion detected"
-
-#Don't change anything below this line
-echo -e "This is an automated message generated by motion.\n\nMotion detected: $1\n\n" | $MAIL -s "$SUBJECT" $TO
-
-

-

Sending SMS at start of event

-Script written by JoergWeber -

-If you uncomment the line #/usr/local/bin/send_mail $1 you can combine both sending email and sms. -

-#!/bin/sh
-
-# Motion sample script to send an sms at start of an event.
-# Replaces the former 'sms' option.
-# Just define this script as 'on_event_start'-script in motion.conf like that:
-# on_event_start send_sms "%Y-%m-%d %T"
-#
-# If you want to send an e-mail message here as well, just uncomment the last
-# line of this script.
-
-#change to suit your needs:
-#location of 'sms-client' binary
-SMS_CLIENT="/usr/bin/sms_client"
-#Destination sms number
-TO="12345"
-
-#Don't change anything below this line
-$SMS_CLIENT $TO "Motion detected $1"
-
-#/usr/local/bin/send_mail $1
-
-
-

-

-

Motion Guide - Special Features

-

-

Tracking Control

-This is still at the experimental stage. Read more about it motion tracking page. -

-

Tracking Feature with Logitech Quickcam Sphere/Orbit

-Motion supports controlling the pan and tilt feature of a Logitech Quickcam Sphere/Orbit. -

-Motion can move the camera to a fixed position given in degrees pan (left-right) and tilt (down-up). Movement can be set with absolute coordinates or relative to current position. There is also an auto tracking feature for the Logitech Quickcam Sphere/Orbit but it is not very mature. It is fun to play with but not very useful yet. See this topic of how KennethLavrsen controls his Sphere: LogitechSphereControl. -

-For a detailed description of http remote control see the section Remote Control with http. -

-List of tracking options -

-

track_auto

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Enable auto tracking -

-Requires a tracking camera type supported by Motion. -

-

-

track_iomojo_id

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 -
  • Option Topic -
-

-Use this option if you have an iomojo smilecam connected to the serial port instead of a general stepper motor controller. -

-Only used for iomojo camera. -

-

-

track_maxx

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 -
  • Option Topic -
-

-The maximum position for servo x. -

-Only used for stepper motor tracking. -

-

-

track_maxy

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 0 -
  • Option Topic -
-

-The maximum position for servo y. -

-Only used for stepper motor tracking. -

- -

-

-

track_motorx

-

    -
  • Type: Integer -
  • Range / Valid values: -1 - 2147483647 -
  • Default: -1 -
  • Option Topic -
-

-The motor number that is used for controlling the x-axis. -

-Only used for stepper motor tracking. -

-

-

track_motory

-

    -
  • Type: Integer -
  • Range / Valid values: -1 - 2147483647 -
  • Default: -1 -
  • Option Topic -
-

-The motor number that is used for controlling the y-axis. -

-Only used for stepper motor tracking. -

- -

-

-

track_move_wait

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 2147483647 -
  • Default: 10 -
  • Option Topic -
-

-Delay during which tracking is disabled after auto tracking has moved the camera. Delay is defined as number of picture frames. -

-The actual delay is depending on the chosen framerate. If you want the camera to move maximum once every 2 seconds and the framerate is 10 then you need to set the track_move_wait value to 2 * 10 = 20. -

-

-

track_port

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-This is the device name of the serial port to which the stepper motor interface is connected. -

-Only used for stepper motor tracking. -

-

-

track_speed

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 255 -
  • Default: 255 -
  • Option Topic -
-

-Speed to set the motor to. -

-Only used for stepper motor tracking. -

-

-

track_step_angle_x

-

    -
  • Type: Integer -
  • Range / Valid values: 0-90 -
  • Default: 10 -
  • Option Topic -
-

-Angle in degrees the camera moves per step on the X-axis with auto tracking. Currently only used with pwc type cameras. -

-Requires a tracking camera type pwc. -

-

-

track_step_angle_y

-

    -
  • Type: Integer -
  • Range / Valid values: 0-40 -
  • Default: 10 -
  • Option Topic -
-

-Angle in degrees the camera moves per step on the Y-axis with auto tracking. Currently only used with pwc type cameras. -

-Requires a tracking camera type pwc. -

- -

-

-

track_stepsize

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 255 -
  • Default: 40 -
  • Option Topic -
-

-Number of steps to make. -

-Only used for stepper motor tracking. -

-

-

track_type

-

    -
  • Type: Discrete Strings -
  • Range / Valid values: 0 (none), 1 (stepper), 2 (iomojo), 3 (pwc), 4 (generic), 5 (uvcvideo) -
  • Default: 0 (None) -
  • Option Topic -
-

-Type of tracker. -

-Motion has special tracking options which use either a serial stepper motor controller, an iomojo smile cam or a Philips WebCam driver compatible pan/tilt camera such as the Logitech Quickcam Sphere or Orbit. -

-To disable tracking, set this to 0 and the other track options are ignored. -

-Value 1 is for the special Motion Tracking project using a stepper motor and a home made controller. -

-Value 2 is for the iomojo smilecam -

-Value 3 is for pwc type USB tracking cameras such as the Logitech Quickcam Sphere/Orbit which is driven by the pwc (Philips WebCam) driver. To use this camera your version of pwc must be at least 8.12. -

-Value 4 is the generic track type. Currently it has no other function than enabling some of the internal Motion features related to tracking. Eventually more functionality will be implemented for this type. -

-Value 5 is for uvcvideo type USB tracking cameras such as the Logitech Quickcam Sphere/Orbit MP (new Model) which is driven by the uvcvideo driver. This option was added in Motion 3.2.8. -

-

-

Using Databases

-Motion can be compiled with both MySQL and PostgreSQL database support. When enabled Motion adds a record to a table in the database as specified by the sql_query. The query contains the fields that are used and the value are given by using conversion specifiers for dynamic data like filename, time, number of detected pixels etc. Motion does not place any binary images in the database and it cannot remove old records. -

-Motion only adds records to the database when files are created. The database contains records of saved files which means to get a record in the database the feature that enables for example motion detection, timelapse, snapshots etc must be enabled. The sql_log options defines which types of files are logged in the database. -

-The following sql_log options are common to both MySQL and PostgreSQL. -

-

-

sql_log_image

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: on -
  • Option Topic -
-

-Log to the database when creating motion triggered image file. -

-Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature. -

-

-

sql_log_mpeg

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Log to the database when creating motion triggered mpeg file. -

-Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature. -

-

-

sql_log_snapshot

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: on -
  • Option Topic -
-

-Log to the database when creating a snapshot image file. -

-Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature. -

-

-

sql_log_timelapse

-

    -
  • Type: Boolean -
  • Range / Valid values: on, off -
  • Default: off -
  • Option Topic -
-

-Log to the database when creating timelapse mpeg file -

-Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature. -

-

-

sql_query

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') -
  • Option Topic -
-

-SQL query string that is sent to the database. The values for each field are given by using convertion specifiers -

-Most common conversion specifiers -

    -
  • %Y = year, %m = month, %d = date -
  • %H = hour, %M = minute, %S = second -
  • %v = event -
  • %q = frame number -
  • %t = thread (camera) number -
  • %D = changed pixels -
  • %N = noise level -
  • %i and %J = width and height of motion area -
  • %K and %L = X and Y coordinates of motion center -
  • %C = value defined by text_event -
  • %f = filename with full path -
  • %n = number indicating filetype -
-

-

-See the "MySQL" section for detailed information about the database itself. -

-

MySQL

-You can use the MySQL database to register each file that is stored by motion. -

-You need to generate a new database with a name of your own choice. You must enter this name in the config file (mysql_db option). The default value for the option sql_query requires that you create a new database in MySQL with a new table called "security" with the following fields: -

-insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') -

    -
  • camera (int) - camera (thread) number -
  • filename (char60) - filename (full path) -
  • frame (int) - the number of the picture frame -
  • file_type (int) - file type as a number - see table below. -
  • time_stamp (timestamp) - timestamp for the picture in native database format -
  • text_event (timestamp) - The text from the text_event option which by default is compatible with timestamps in SQL. -
-

-Note from version 3.2.4 the introduction of sql_query completely redefines the way you setup the SQL feature. It is now 100% flexible and can easily be made compatible with your existing Motion database from earlier versions of Motion. -

-These are the file type descriptions and the file type numbers stored in the database. -

- - - - - - -
Normal image 1
Snapshot image 2
Motion image (showing only pixels defined as motion) 4
Normal mpeg image 8
Motion mpeg (showing only pixels defined as motion) 16
Timelapse mpeg 32
-

-You can create the table using the following SQL statement. -

-CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), text_event timestamp(14)); -

-If you choose to use text_event for a non-timestamp value you can instead define something like. -

-CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), text_event char(40)); -

-

-Remember to update grant table to give access to the mysql username you choose for motion. -

-It would be too much to go into detail about how to setup and use MySQL. After all this is a guide about Motion. However here are some hints and links. -

-Setting Up a MySQL Based Website - A beginners guide from Linux Planet. -

-Webmonkey PHP/!MySQL tutorial - Entertaining and easy to read. -

-The phpMyAdmin homepage. The best and simplest tool to use MySQL (editors opinion). Requires Apache/PHP. -

-The options for MySQL -

-

-

mysql_db

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Name of the MySQL database. -

-MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature. -

-If you compiled motion with MySQL support you will need to set the mysql options if you want motion to log events to the database. -

-

-

mysql_host

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: localhost -
  • Option Topic -
-

-IP address or domain name for the MySQL server. Use "localhost" if motion and MySQL runs on the same server. -

-MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature. -

-

-

mysql_password

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-The MySQL password. -

-MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature. -

-

-

mysql_user

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-The MySQL user name. -

-MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature. -

-

-

-

PostgreSQL

-Same/similar as for MySQL above. -

-The options for PostgreSQL -

-

-

pgsql_db

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-Name of the PostgreSQL database. -

-PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature. -

-If you compiled motion with PostgreSQL support you will need to set all the pgsql_ options if you want motion to log events to the database. -

-

-

pgsql_host

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: localhost -
  • Option Topic -
-

-IP address or domain name for the PostgreSQL server. Use "localhost" if motion and PostgreSQL runs on the same server. -

-PostgreSQL CONFIG FILE OPTION. Motion must be built with pgsql_db libraries to use this feature. -

-

-

pgsql_password

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-The PostgreSQL password. -

-PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature. -

-

-

pgsql_port

-

    -
  • Type: Integer -
  • Range / Valid values: 0 - 65535 -
  • Default: 5432 -
  • Option Topic -
-

-The PostgreSQL server port number. -

-PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature. -

-

-

pgsql_user

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-The PostgreSQL user name. -

-PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature. -

-

-

Video4Linux Loopback Device

-You can use this driver for looking at motion in realtime. The video4linux driver is written by the same author that first created Motion. You can find the source and a brief description at the video4linux loopback device web page. -

-The video4linux device is a Kernel module which installs itself as a video pipe. It has an input and an output. The module simply takes anything that comes on its input and send it out at the output. The purpose of this is to create a standard video4linux type video device that other programs can then use. You may now ask: "What do I need that for?". -

-Only one program can access a video device at a time. When motion is using a camera - no other program can access the same camera. But motion is made to be able to feed a video signal to the video loopback device. This way an additional program such as Camstream, Xawtv, a video stream server etc can watch the signal from a camera that motion uses already. What you see is not the live camera stream but the exact same picture that motion uses for detecting motion and the same pictures that are saved/streamed. You can also choose to see the "motion" type images where you see the pixels that are changing - live. Originally the video4linux pipe was used as an interface between Motion and a Webcam server. Since version 2.9 Motion has had its own webserver so this usage is no longer very relevant. -

-When you install the video loopback device it will create an input - for example /dev/video5 and an output - for example /dev/video6. You can then tell motion to "pipe" the video signal to the /dev/video5 and look at the pictures live using e.g. Camstream on /dev/video6. Camstream is "fooled" to think it is looking at a real camera. -

-Installing -

-Installing the video loopback device is not difficult. At least not when you have this document available. -

-First you must prepare your system for more video devices. You will need two extra devices for each video pipe that you want. -

-For example if you have 4 cameras they will probably run at /dev/video0, /dev/video1, /dev/video2, and /dev/video3. So you will need additional 8 video devices. This is easy to do. -

-

-mknod /dev/video4 c 81 4
-mknod /dev/video5 c 81 5
-mknod /dev/video6 c 81 6
-mknod /dev/video7 c 81 7
-mknod /dev/video8 c 81 8
-mknod /dev/video9 c 81 9
-mknod /dev/video10 c 81 10
-mknod /dev/video11 c 81 11
-
-

-Note that the video device number is the same as the last parameter given on each line. -

-You may need to set the ownership and permissions (chown and chmod) to be the same as the video devices that were already there. -

-Now you need to install the video loopback device. -

-Download the latest video4linux loopback device . Place the file in a place of your own choice. -

-Untar and uncompress the file to the place you want the program installed. Editor recommends /usr/local/vloopback. -

-cd /usr/local -

-tar -xvzf /path/to/vloopback-1.1-rc1.tar.gz -

-You now have a directory called vloopback-1.1-rc1. You can rename it to vloopback (mv vloopback-1.1-rc1 vloopback). I recommend creating a symbolic link to the current version. This way you can more easily experiment with different versions simply by changing the link. -

-ln -s vloopback-1.1-rc1 vloopback -

-Now change to the new directory -

-cd vloopback -

-Build the code -

-make -

-There is a good chance that the make will not work and give you a long list of errors. To run make the following must be available on you machine.

    -
  • The kernel source files must be installed. -
  • The source files must be available at /usr/src/linux.
    E.g. the new Red Hat 7.3 does not have a link to the sources called linux. Instead there is a link called linux-2.4. This is easy to fix. Just create a link to the real source tree. Do not rename! Add a link using this command (replacing the kernel version number with the one you have on your machine)
    ln -s /usr/src/linux-2.4.18-4 /usr/src/linux -
  • Alternatively you can change the vloopback makefile so that the "LINUXSRC=/usr/src/linux" line is changed to the actual path. I recommend the link solution since this may solve other similar problems that you can get when installing other software. -
-

-When compiling on a newer Linux distribution you may get a warning about a header file malloc.h. To remove this warning simply change the header reference as suggested by the warning. -

-In vloopback.c you replace the line -

-#include <linux/malloc.h> -

-with the line -

-#include <linux/slab.h> -

-Install the code you built as a Kernel module. There are two options: pipes should be set to the number of video loopbacks that you want. Probably one for each camera. The dev_offset defines which video device number will be the first. If dev_offset is not defined the vloopback module will install itself from the first available video device. If you want the cameras to be assigned to the lower video device numbers you must either load vloopback after loading the video device modules OR use the dev_offset option when loading vloopback. Vloopback then installs itself in the sequence input 0, output 0, input 1, output 1, input 2, output 2 etc. Here is shown the command for our example of 4 cameras and 4 loopback devices and the first loopback device offset to /dev/video4. -

-/sbin/insmod /usr/local/vloopback/vloopback.o pipes=4 dev_offset=4 -

-When you run the command you may get a warning about tainting the Kernel. Just ignore this. -You can choose to copy the vloopback.o file into a directory in the /lib/modules tree where the insmod/modprobe programs are already looking for modules. Then the command gets simpler (/sbin/insmod vloopback pipes=.....). -

-If you want the loopback device to load during boot, you can place the call in one of the bootup scripts such as /etc/rc.d/rc.local. Vloopback should be loaded before you start motion. -

-To activate the vloopback device in motion set the 'video_pipe' option in the motion.conf file. You can also view the special motion pictures where you see the changed pixels by setting the option 'motion_video_pipe' in motion.conf. When setting the video_pipe and/or motion_video_pipe options either specify the input device as e.g. /dev/video4. You can also set the parameter to '-' which means that motion will find the first vacant video loopback device input. If you have more than one camera you may want to control which loopback device each thread uses. Then you need to define the specific device name in motion.conf for the first camera and in each thread config file for the other cameras. If you set the video_pipe parameter to '-' in the motion.conf file and not setting it in the thread config files, motion automatically assign video devices in the same sequence as the threads are loaded. You can combine both video_pipe and motion_video_pipe but then naturally you will need twice as many pipes. -

-De-activating should be done with this command -

-/sbin/modprobe -r vloopback -

-Description of the motion.conf options related to video loopback device. -

-

-

motion_video_pipe

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-The video4linux video loopback input device for motion images. If a particular pipe is to be used then use the device filename of this pipe, if a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. Default: not set -

-Using this you can view the results in real time. E.g. by using the program camstream. The difference between this option and the video-pipe option is that this option shows the motion version of the images instead of the normal images. -

-Disable this option by not having it in the config file (or comment it out with "#" or ";"). -

-

-

video_pipe

-

    -
  • Type: String -
  • Range / Valid values: Max 4095 characters -
  • Default: Not defined -
  • Option Topic -
-

-The video4linux video loopback input device for normal images. If a particular pipe is to be used then use the device filename of this pipe. If a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. -

-Using this you can view the results in real time. E.g. by using the program camstream. -

-Disable this option by not having it in the config file (or comment it out with "#" or ";"). -

-

-

-

--- KennethLavrsen - 13 Apr 2005 \ No newline at end of file diff --git a/picture.c b/picture.c index 196f220..8c36793 100644 --- a/picture.c +++ b/picture.c @@ -880,15 +880,15 @@ void overlay_largest_label(struct context *cnt, unsigned char *out) * Returns the dest_image_size if successful. Otherwise 0. */ int put_picture_memory(struct context *cnt, unsigned char* dest_image, int image_size, - unsigned char *image, int quality) + unsigned char *image, int width, int height, int quality) { switch (cnt->imgs.type) { case VIDEO_PALETTE_YUV420P: return put_jpeg_yuv420p_memory(dest_image, image_size, image, - cnt->imgs.width, cnt->imgs.height, quality, cnt, &(cnt->current_image->timestamp_tm), &(cnt->current_image->location)); + width, height, quality, cnt, &(cnt->current_image->timestamp_tm), &(cnt->current_image->location)); case VIDEO_PALETTE_GREY: return put_jpeg_grey_memory(dest_image, image_size, image, - cnt->imgs.width, cnt->imgs.height, quality); + width, height, quality); default: MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO, "%s: Unknow image type %d", cnt->imgs.type); @@ -916,6 +916,24 @@ void put_picture_fd(struct context *cnt, FILE *picture, unsigned char *image, in } } +void put_sized_picture_fd(struct context *cnt, FILE *picture, unsigned char *image, int width, int height, int quality) +{ + if (cnt->imgs.picture_type == IMAGE_TYPE_PPM) { + put_ppm_bgr24_file(picture, image, width, height); + } else { + switch (cnt->imgs.type) { + case VIDEO_PALETTE_YUV420P: + put_jpeg_yuv420p_file(picture, image, width, height, quality, cnt, &(cnt->current_image->timestamp_tm), &(cnt->current_image->location)); + break; + case VIDEO_PALETTE_GREY: + put_jpeg_grey_file(picture, image, width, height, quality); + break; + default: + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO, "%s: Unknow image type %d", + cnt->imgs.type); + } + } +} void put_picture(struct context *cnt, char *file, unsigned char *image, int ftype) { @@ -943,6 +961,58 @@ void put_picture(struct context *cnt, char *file, unsigned char *image, int ftyp event(cnt, EVENT_FILECREATE, NULL, file, (void *)(unsigned long)ftype, NULL); } +void put_sized_picture(struct context *cnt, char *file, unsigned char *image, int width, int height, int ftype) +{ + FILE *picture; + + picture = myfopen(file, "w", BUFSIZE_1MEG); + if (!picture) { + /* Report to syslog - suggest solution if the problem is access rights to target dir. */ + if (errno == EACCES) { + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, + "%s: Can't write picture to file %s - check access rights to target directory\n" + "Thread is going to finish due to this fatal error", file); + cnt->finish = 1; + cnt->restart = 0; + return; + } else { + /* If target dir is temporarily unavailable we may survive. */ + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Can't write picture to file %s", file); + return; + } + } + + put_sized_picture_fd(cnt, picture, image, width, height, cnt->conf.quality); + myfclose(picture); + event(cnt, EVENT_FILECREATE, NULL, file, (void *)(unsigned long)ftype, NULL); +} + +void put_encoded_picture(struct context *cnt, char *file, unsigned char *image, int size, int ftype) +{ + FILE *picture; + + picture = myfopen(file, "w", BUFSIZE_1MEG); + if (!picture) { + /* Report to syslog - suggest solution if the problem is access rights to target dir. */ + if (errno == EACCES) { + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, + "%s: Can't write picture to file %s - check access rights to target directory\n" + "Thread is going to finish due to this fatal error", file); + cnt->finish = 1; + cnt->restart = 0; + return; + } else { + /* If target dir is temporarily unavailable we may survive. */ + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Can't write picture to file %s", file); + return; + } + } + + fwrite(image, size, 1, picture); + myfclose(picture); + event(cnt, EVENT_FILECREATE, NULL, file, (void *)(unsigned long)ftype, NULL); +} + /** * get_pgm * Get the pgm file used as fixed mask @@ -1056,6 +1126,25 @@ void put_fixed_mask(struct context *cnt, const char *file) "re-run motion to enable mask feature", cnt->conf.mask_file); } +/** + * put_image + * save an image to a file, picking appropriate buffer and format based on app configuration. + */ +void put_image(struct context *cnt, char* fullfilename, struct image_data * imgdat, int ftype) +{ + if (imgdat->secondary_image && cnt->conf.output_secondary_pictures) { + if (cnt->imgs.secondary_type == SECONDARY_TYPE_RAW) { + put_sized_picture(cnt, fullfilename, imgdat->secondary_image, cnt->imgs.secondary_width, cnt->imgs.secondary_height, ftype); + } + else if (cnt->imgs.secondary_type == SECONDARY_TYPE_JPEG) { + put_encoded_picture(cnt, fullfilename, imgdat->secondary_image, imgdat->secondary_size, ftype); + } + } + else { + put_picture(cnt, fullfilename, imgdat->image, ftype); + } +} + /** * preview_save * save preview_shot @@ -1098,7 +1187,7 @@ void preview_save(struct context *cnt) previewname[basename_len] = '\0'; strcat(previewname, imageext(cnt)); - put_picture(cnt, previewname, cnt->imgs.preview_image.image , FTYPE_IMAGE); + put_image(cnt, previewname, &cnt->imgs.preview_image, FTYPE_IMAGE); } else { /* * Save best preview-shot also when no movies are recorded or imagepath @@ -1117,7 +1206,7 @@ void preview_save(struct context *cnt) mystrftime(cnt, filename, sizeof(filename), imagepath, &cnt->imgs.preview_image.timestamp_tm, NULL, 0); snprintf(previewname, PATH_MAX, "%s/%s.%s", cnt->conf.filepath, filename, imageext(cnt)); - put_picture(cnt, previewname, cnt->imgs.preview_image.image, FTYPE_IMAGE); + put_image(cnt, previewname, &cnt->imgs.preview_image, FTYPE_IMAGE); } /* Restore global context values. */ diff --git a/picture.h b/picture.h index 6f00e1d..3aa2a3f 100644 --- a/picture.h +++ b/picture.h @@ -17,8 +17,11 @@ void overlay_fixed_mask(struct context *, unsigned char *); void put_fixed_mask(struct context *, const char *); void overlay_largest_label(struct context *, unsigned char *); void put_picture_fd(struct context *, FILE *, unsigned char *, int); -int put_picture_memory(struct context *, unsigned char*, int, unsigned char *, int); +int put_picture_memory(struct context *, unsigned char*, int, unsigned char *, int, int, int); void put_picture(struct context *, char *, unsigned char *, int); +void put_sized_picture(struct context *cnt, char *file, unsigned char *image, int width, int height, int quality); +void put_encoded_picture(struct context *cnt, char *file, unsigned char *image, int size, int ftype); +void put_image(struct context *cnt, char* fullfilename, struct image_data * imgdat, int ftype); unsigned char *get_pgm(FILE *, int, int); void preview_save(struct context *); diff --git a/pmcr_metrics.h b/pmcr_metrics.h new file mode 100644 index 0000000..019c0b6 --- /dev/null +++ b/pmcr_metrics.h @@ -0,0 +1,73 @@ +/* + * pmcr_metrics.h + * + * Created on: 24 Jun 2013 + * Author: ntuckett + */ + +#ifndef PMCR_METRICS_H_ +#define PMCR_METRICS_H_ + +#if defined(ARM_PMCR_METRICS) + +#define SCP_CR_CYCLE_COUNT 0xff +#define SCP_CR_RETURN_PRED_WRONG 0x26 +#define SCP_CR_RETURN_PRED_RIGHT 0x25 +#define SCP_CR_RETURN_COUNT 0x24 +#define SCP_CR_CALL_COUNT 0x23 +#define SCP_CR_WRITE_BUFFER_DRAIN 0x12 +#define SCP_CR_LOAD_STALL 0x11 +#define SCP_CR_EXTERNAL_DATA_ACCESS 0x10 +#define SCP_CR_MAIN_TLB_MISS 0x0F +#define SCP_CR_PC_SOFT_CHANGE 0x0D +#define SCP_CR_DATA_CACHE_WRITEBACK 0x0C +#define SCP_CR_DATA_CACHE_MISS 0x0B +#define SCP_CR_DATA_CACHE_ACCESS 0x0A +#define SCP_CR_DATA_CACHE_ACCESS_C 0x09 // for only cacheable locations +#define SCP_CR_INSTRUCTION_COUNT 0x07 +#define SCP_CR_BRANCH_MISPREDICTION 0x06 +#define SCP_CR_BRANCH_COUNT 0x05 +#define SCP_CR_DATA_MICRO_TLB_MISS 0x04 +#define SCP_CR_INSTR_MICRO_TLB_MISS 0x03 +#define SCP_CR_DATA_STALL 0x02 +#define SCP_CR_INSTRUCTION_STALL 0x01 +#define SCP_CR_INSTR_CACHE_MISS 0x00 + +__attribute__((always_inline)) inline void scp_pmcr_reset_and_start_counters() +{ + asm volatile ("mcr p15, 0, %0, c15, c12, 0\n" : : "r" (7)); +} + +__attribute__((always_inline)) inline void scp_pmcr_configure_reset_and_start_counters(unsigned int cr0, unsigned int cr1) +{ + asm volatile ("mcr p15, 0, %0, c15, c12, 0\n" : : "r" (7 | (cr0 << 12) | (cr1 << 20))); +} + +__attribute__((always_inline)) inline void scp_pmcr_stop_counters() +{ + asm volatile ("mcr p15, 0, %0, c15, c12, 0\n" : : "r" (0)); +} + +__attribute__((always_inline)) inline unsigned int scp_ccr_read(void) +{ + unsigned int cc; + asm volatile ("mrc p15, 0, %0, c15, c12, 1" : "=r" (cc)); + return cc; +} + +__attribute__((always_inline)) inline unsigned int scp_cr0_read(void) +{ + unsigned int cr; + asm volatile ("mrc p15, 0, %0, c15, c12, 2" : "=r" (cr)); + return cr; +} + +__attribute__((always_inline)) inline unsigned int scp_cr1_read(void) +{ + unsigned int cr; + asm volatile ("mrc p15, 0, %0, c15, c12, 3" : "=r" (cr)); + return cr; +} + +#endif /* ARM_PMCR_METRICS */ +#endif /* PMCR_METRICS_H_ */ diff --git a/pwc-ioctl.h-10.0.10 b/pwc-ioctl.h-10.0.10 deleted file mode 100644 index 48a3861..0000000 --- a/pwc-ioctl.h-10.0.10 +++ /dev/null @@ -1,334 +0,0 @@ -#ifndef PWC_IOCTL_H -#define PWC_IOCTL_H - -/* (C) 2001-2004 Nemosoft Unv. - (C) 2004-2006 Luc Saillard (luc@saillard.org) - - NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx - driver and thus may have bugs that are not present in the original version. - Please send bug reports and support requests to . - The decompression routines have been implemented by reverse-engineering the - Nemosoft binary pwcx module. Caveat emptor. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* This is pwc-ioctl.h belonging to PWC 10.0.10 - It contains structures and defines to communicate from user space - directly to the driver. - */ - -/* - Changes - 2001/08/03 Alvarado Added ioctl constants to access methods for - changing white balance and red/blue gains - 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE - 2003/12/13 Nemosft Unv. Some modifications to make interfacing to - PWCX easier - 2006/01/01 Luc Saillard Add raw format definition - */ - -/* These are private ioctl() commands, specific for the Philips webcams. - They contain functions not found in other webcams, and settings not - specified in the Video4Linux API. - - The #define names are built up like follows: - VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam - G optional: Get - S optional: Set - ... the function - */ - -#if (!defined(BSD)) -#include -#include - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 10) -/* Compatibility for older kernel */ -typedef __u16 __le16; -#endif - -#endif /* ( !BSD ) */ - - /* Enumeration of image sizes */ -#define PSZ_SQCIF 0x00 -#define PSZ_QSIF 0x01 -#define PSZ_QCIF 0x02 -#define PSZ_SIF 0x03 -#define PSZ_CIF 0x04 -#define PSZ_VGA 0x05 -#define PSZ_MAX 6 - - -/* The frame rate is encoded in the video_window.flags parameter using - the upper 16 bits, since some flags are defined nowadays. The following - defines provide a mask and shift to filter out this value. - This value can also be passing using the private flag when using v4l2 and - VIDIOC_S_FMT ioctl. - - In 'Snapshot' mode the camera freezes its automatic exposure and colour - balance controls. - */ -#define PWC_FPS_SHIFT 16 -#define PWC_FPS_MASK 0x00FF0000 -#define PWC_FPS_FRMASK 0x003F0000 -#define PWC_FPS_SNAPSHOT 0x00400000 -#define PWC_QLT_MASK 0x03000000 -#define PWC_QLT_SHIFT 24 - - -/* structure for transferring x & y coordinates */ -struct pwc_coord -{ - int x, y; /* guess what */ - int size; /* size, or offset */ -}; - - -/* Used with VIDIOCPWCPROBE */ -struct pwc_probe -{ - char name[32]; - int type; -}; - -struct pwc_serial -{ - char serial[30]; /* String with serial number. Contains terminating 0 */ -}; - -/* pwc_whitebalance.mode values */ -#define PWC_WB_INDOOR 0 -#define PWC_WB_OUTDOOR 1 -#define PWC_WB_FL 2 -#define PWC_WB_MANUAL 3 -#define PWC_WB_AUTO 4 - -/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). - Set mode to one of the PWC_WB_* values above. - *red and *blue are the respective gains of these colour components inside - the camera; range 0..65535 - When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; - otherwise undefined. - 'read_red' and 'read_blue' are read-only. -*/ -struct pwc_whitebalance -{ - int mode; - int manual_red, manual_blue; /* R/W */ - int read_red, read_blue; /* R/O */ -}; - -/* - 'control_speed' and 'control_delay' are used in automatic whitebalance mode, - and tell the camera how fast it should react to changes in lighting, and - with how much delay. Valid values are 0..65535. -*/ -struct pwc_wb_speed -{ - int control_speed; - int control_delay; - -}; - -/* Used with VIDIOCPWC[SG]LED */ -struct pwc_leds -{ - int led_on; /* Led on-time; range = 0..25000 */ - int led_off; /* Led off-time; range = 0..25000 */ -}; - -/* Image size (used with GREALSIZE) */ -struct pwc_imagesize -{ - int width; - int height; -}; - -/* Defines and structures for Motorized Pan & Tilt */ -#define PWC_MPT_PAN 0x01 -#define PWC_MPT_TILT 0x02 -#define PWC_MPT_TIMEOUT 0x04 /* for status */ - -/* Set angles; when absolute != 0, the angle is absolute and the - driver calculates the relative offset for you. This can only - be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns - absolute angles. - */ -struct pwc_mpt_angles -{ - int absolute; /* write-only */ - int pan; /* degrees * 100 */ - int tilt; /* degress * 100 */ -}; - -/* Range of angles of the camera, both horizontally and vertically. - */ -struct pwc_mpt_range -{ - int pan_min, pan_max; /* degrees * 100 */ - int tilt_min, tilt_max; -}; - -struct pwc_mpt_status -{ - int status; - int time_pan; - int time_tilt; -}; - - -/* This is used for out-of-kernel decompression. With it, you can get - all the necessary information to initialize and use the decompressor - routines in standalone applications. - */ -struct pwc_video_command -{ - int type; /* camera type (645, 675, 730, etc.) */ - int release; /* release number */ - - int size; /* one of PSZ_* */ - int alternate; - int command_len; /* length of USB video command */ - unsigned char command_buf[13]; /* Actual USB video command */ - int bandlength; /* >0 = compressed */ - int frame_size; /* Size of one (un)compressed frame */ -}; - -/* Flags for PWCX subroutines. Not all modules honour all flags. */ -#define PWCX_FLAG_PLANAR 0x0001 -#define PWCX_FLAG_BAYER 0x0008 - - -/* IOCTL definitions */ - - /* Restore user settings */ -#define VIDIOCPWCRUSER _IO('v', 192) - /* Save user settings */ -#define VIDIOCPWCSUSER _IO('v', 193) - /* Restore factory settings */ -#define VIDIOCPWCFACTORY _IO('v', 194) - - /* You can manipulate the compression factor. A compression preference of 0 - means use uncompressed modes when available; 1 is low compression, 2 is - medium and 3 is high compression preferred. Of course, the higher the - compression, the lower the bandwidth used but more chance of artefacts - in the image. The driver automatically chooses a higher compression when - the preferred mode is not available. - */ - /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL _IOW('v', 195, int) - /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL _IOR('v', 195, int) - - -/* Retrieve serial number of camera */ -#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial) - - /* This is a probe function; since so many devices are supported, it - becomes difficult to include all the names in programs that want to - check for the enhanced Philips stuff. So in stead, try this PROBE; - it returns a structure with the original name, and the corresponding - Philips type. - To use, fill the structure with zeroes, call PROBE and if that succeeds, - compare the name with that returned from VIDIOCGCAP; they should be the - same. If so, you can be assured it is a Philips (OEM) cam and the type - is valid. - */ -#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe) - - /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ -#define VIDIOCPWCSAGC _IOW('v', 200, int) - /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC _IOR('v', 200, int) - /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) - - /* Color compensation (Auto White Balance) */ -#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance) -#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance) - - /* Auto WB speed */ -#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed) -#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed) - - /* LEDs on/off/blink; int range 0..65535 */ -#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) -#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) - - /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ -#define VIDIOCPWCSCONTOUR _IOW('v', 206, int) -#define VIDIOCPWCGCONTOUR _IOR('v', 206, int) - - /* Backlight compensation; 0 = off, otherwise on */ -#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int) -#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int) - - /* Flickerless mode; = 0 off, otherwise on */ -#define VIDIOCPWCSFLICKER _IOW('v', 208, int) -#define VIDIOCPWCGFLICKER _IOR('v', 208, int) - - /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ -#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) -#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) - - /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ -#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) - - /* Motorized pan & tilt functions */ -#define VIDIOCPWCMPTRESET _IOW('v', 211, int) -#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) -#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status) - - /* Get the USB set-video command; needed for initializing libpwcx */ -#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command) -struct pwc_table_init_buffer { - int len; - char *buffer; -}; -#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer) - -/* - * This is private command used when communicating with v4l2. - * In the future all private ioctl will be remove/replace to - * use interface offer by v4l2. - */ - -#if (defined(MOTION_V4L2)) && (!defined(BSD)) - -#define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0) -#define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1) -#define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2) -#define V4L2_CID_PRIVATE_COLOUR_MODE (V4L2_CID_PRIVATE_BASE + 3) -#define V4L2_CID_PRIVATE_AUTOCONTOUR (V4L2_CID_PRIVATE_BASE + 4) -#define V4L2_CID_PRIVATE_CONTOUR (V4L2_CID_PRIVATE_BASE + 5) -#define V4L2_CID_PRIVATE_BACKLIGHT (V4L2_CID_PRIVATE_BASE + 6) -#define V4L2_CID_PRIVATE_FLICKERLESS (V4L2_CID_PRIVATE_BASE + 7) -#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8) - -struct pwc_raw_frame { - __le16 type; /* type of the webcam */ - __le16 vbandlength; /* Size of 4lines compressed (used by the decompressor) */ - __u8 cmd[4]; /* the four byte of the command (in case of nala, - only the first 3 bytes is filled) */ - __u8 rawframe[0]; /* frame_size = H/4*vbandlength */ -} __attribute__ ((packed)); - -#endif /* MOTION_V4L2 && (! BSD ) */ - -#endif diff --git a/pwc-ioctl.h-10.0.5 b/pwc-ioctl.h-10.0.5 deleted file mode 100644 index 65805ea..0000000 --- a/pwc-ioctl.h-10.0.5 +++ /dev/null @@ -1,292 +0,0 @@ -#ifndef PWC_IOCTL_H -#define PWC_IOCTL_H - -/* (C) 2001-2004 Nemosoft Unv. - (C) 2004 Luc Saillard (luc@saillard.org) - - NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx - driver and thus may have bugs that are not present in the original version. - Please send bug reports and support requests to . - The decompression routines have been implemented by reverse-engineering the - Nemosoft binary pwcx module. Caveat emptor. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* This is pwc-ioctl.h belonging to PWC 8.12.1 - It contains structures and defines to communicate from user space - directly to the driver. - */ - -/* - Changes - 2001/08/03 Alvarado Added ioctl constants to access methods for - changing white balance and red/blue gains - 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE - 2003/12/13 Nemosft Unv. Some modifications to make interfacing to - PWCX easier - */ - -/* These are private ioctl() commands, specific for the Philips webcams. - They contain functions not found in other webcams, and settings not - specified in the Video4Linux API. - - The #define names are built up like follows: - VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam - G optional: Get - S optional: Set - ... the function - */ - - - /* Enumeration of image sizes */ -#define PSZ_SQCIF 0x00 -#define PSZ_QSIF 0x01 -#define PSZ_QCIF 0x02 -#define PSZ_SIF 0x03 -#define PSZ_CIF 0x04 -#define PSZ_VGA 0x05 -#define PSZ_MAX 6 - - -/* The frame rate is encoded in the video_window.flags parameter using - the upper 16 bits, since some flags are defined nowadays. The following - defines provide a mask and shift to filter out this value. - - In 'Snapshot' mode the camera freezes its automatic exposure and colour - balance controls. - */ -#define PWC_FPS_SHIFT 16 -#define PWC_FPS_MASK 0x00FF0000 -#define PWC_FPS_FRMASK 0x003F0000 -#define PWC_FPS_SNAPSHOT 0x00400000 - - -/* structure for transfering x & y coordinates */ -struct pwc_coord -{ - int x, y; /* guess what */ - int size; /* size, or offset */ -}; - - -/* Used with VIDIOCPWCPROBE */ -struct pwc_probe -{ - char name[32]; - int type; -}; - -struct pwc_serial -{ - char serial[30]; /* String with serial number. Contains terminating 0 */ -}; - -/* pwc_whitebalance.mode values */ -#define PWC_WB_INDOOR 0 -#define PWC_WB_OUTDOOR 1 -#define PWC_WB_FL 2 -#define PWC_WB_MANUAL 3 -#define PWC_WB_AUTO 4 - -/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). - Set mode to one of the PWC_WB_* values above. - *red and *blue are the respective gains of these colour components inside - the camera; range 0..65535 - When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; - otherwise undefined. - 'read_red' and 'read_blue' are read-only. -*/ -struct pwc_whitebalance -{ - int mode; - int manual_red, manual_blue; /* R/W */ - int read_red, read_blue; /* R/O */ -}; - -/* - 'control_speed' and 'control_delay' are used in automatic whitebalance mode, - and tell the camera how fast it should react to changes in lighting, and - with how much delay. Valid values are 0..65535. -*/ -struct pwc_wb_speed -{ - int control_speed; - int control_delay; - -}; - -/* Used with VIDIOCPWC[SG]LED */ -struct pwc_leds -{ - int led_on; /* Led on-time; range = 0..25000 */ - int led_off; /* Led off-time; range = 0..25000 */ -}; - -/* Image size (used with GREALSIZE) */ -struct pwc_imagesize -{ - int width; - int height; -}; - -/* Defines and structures for Motorized Pan & Tilt */ -#define PWC_MPT_PAN 0x01 -#define PWC_MPT_TILT 0x02 -#define PWC_MPT_TIMEOUT 0x04 /* for status */ - -/* Set angles; when absolute != 0, the angle is absolute and the - driver calculates the relative offset for you. This can only - be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns - absolute angles. - */ -struct pwc_mpt_angles -{ - int absolute; /* write-only */ - int pan; /* degrees * 100 */ - int tilt; /* degress * 100 */ -}; - -/* Range of angles of the camera, both horizontally and vertically. - */ -struct pwc_mpt_range -{ - int pan_min, pan_max; /* degrees * 100 */ - int tilt_min, tilt_max; -}; - -struct pwc_mpt_status -{ - int status; - int time_pan; - int time_tilt; -}; - - -/* This is used for out-of-kernel decompression. With it, you can get - all the necessary information to initialize and use the decompressor - routines in standalone applications. - */ -struct pwc_video_command -{ - int type; /* camera type (645, 675, 730, etc.) */ - int release; /* release number */ - - int size; /* one of PSZ_* */ - int alternate; - int command_len; /* length of USB video command */ - unsigned char command_buf[13]; /* Actual USB video command */ - int bandlength; /* >0 = compressed */ - int frame_size; /* Size of one (un)compressed frame */ -}; - -/* Flags for PWCX subroutines. Not all modules honour all flags. */ -#define PWCX_FLAG_PLANAR 0x0001 -#define PWCX_FLAG_BAYER 0x0008 - - -/* IOCTL definitions */ - - /* Restore user settings */ -#define VIDIOCPWCRUSER _IO('v', 192) - /* Save user settings */ -#define VIDIOCPWCSUSER _IO('v', 193) - /* Restore factory settings */ -#define VIDIOCPWCFACTORY _IO('v', 194) - - /* You can manipulate the compression factor. A compression preference of 0 - means use uncompressed modes when available; 1 is low compression, 2 is - medium and 3 is high compression preferred. Of course, the higher the - compression, the lower the bandwidth used but more chance of artefacts - in the image. The driver automatically chooses a higher compression when - the preferred mode is not available. - */ - /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL _IOW('v', 195, int) - /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL _IOR('v', 195, int) - - -/* Retrieve serial number of camera */ -#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial) - - /* This is a probe function; since so many devices are supported, it - becomes difficult to include all the names in programs that want to - check for the enhanced Philips stuff. So in stead, try this PROBE; - it returns a structure with the original name, and the corresponding - Philips type. - To use, fill the structure with zeroes, call PROBE and if that succeeds, - compare the name with that returned from VIDIOCGCAP; they should be the - same. If so, you can be assured it is a Philips (OEM) cam and the type - is valid. - */ -#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe) - - /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ -#define VIDIOCPWCSAGC _IOW('v', 200, int) - /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC _IOR('v', 200, int) - /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) - - /* Color compensation (Auto White Balance) */ -#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance) -#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance) - - /* Auto WB speed */ -#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed) -#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed) - - /* LEDs on/off/blink; int range 0..65535 */ -#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) -#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) - - /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ -#define VIDIOCPWCSCONTOUR _IOW('v', 206, int) -#define VIDIOCPWCGCONTOUR _IOR('v', 206, int) - - /* Backlight compensation; 0 = off, otherwise on */ -#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int) -#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int) - - /* Flickerless mode; = 0 off, otherwise on */ -#define VIDIOCPWCSFLICKER _IOW('v', 208, int) -#define VIDIOCPWCGFLICKER _IOR('v', 208, int) - - /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ -#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) -#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) - - /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ -#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) - - /* Motorized pan & tilt functions */ -#define VIDIOCPWCMPTRESET _IOW('v', 211, int) -#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) -#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status) - - /* Get the USB set-video command; needed for initializing libpwcx */ -#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command) -struct pwc_table_init_buffer { - int len; - char *buffer; - -}; -#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer) - -#endif diff --git a/pwc-ioctl.h-pwc8.0 b/pwc-ioctl.h-pwc8.0 deleted file mode 100644 index 0161986..0000000 --- a/pwc-ioctl.h-pwc8.0 +++ /dev/null @@ -1,229 +0,0 @@ -#ifndef PWC_IOCTL_H -#define PWC_IOCTL_H - -/* (C) 2001-2003 Nemosoft Unv. webcam@smcc.demon.nl - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* This is pwc-ioctl.h belonging to PWC 8.10 */ - -/* - Changes - 2001/08/03 Alvarado Added ioctl constants to access methods for - changing white balance and red/blue gains - 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE - */ - -/* These are private ioctl() commands, specific for the Philips webcams. - They contain functions not found in other webcams, and settings not - specified in the Video4Linux API. - - The #define names are built up like follows: - VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam - G optional: Get - S optional: Set - ... the function - */ - - - - -/* The frame rate is encoded in the video_window.flags parameter using - the upper 16 bits, since some flags are defined nowadays. The following - defines provide a mask and shift to filter out this value. - - In 'Snapshot' mode the camera freezes its automatic exposure and colour - balance controls. - */ -#define PWC_FPS_SHIFT 16 -#define PWC_FPS_MASK 0x00FF0000 -#define PWC_FPS_FRMASK 0x003F0000 -#define PWC_FPS_SNAPSHOT 0x00400000 - - - -struct pwc_probe -{ - char name[32]; - int type; -}; - - -/* pwc_whitebalance.mode values */ -#define PWC_WB_INDOOR 0 -#define PWC_WB_OUTDOOR 1 -#define PWC_WB_FL 2 -#define PWC_WB_MANUAL 3 -#define PWC_WB_AUTO 4 - -/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). - Set mode to one of the PWC_WB_* values above. - *red and *blue are the respective gains of these colour components inside - the camera; range 0..65535 - When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; - otherwise undefined. - 'read_red' and 'read_blue' are read-only. -*/ - -struct pwc_whitebalance -{ - int mode; - int manual_red, manual_blue; /* R/W */ - int read_red, read_blue; /* R/O */ -}; - -/* - 'control_speed' and 'control_delay' are used in automatic whitebalance mode, - and tell the camera how fast it should react to changes in lighting, and - with how much delay. Valid values are 0..65535. -*/ -struct pwc_wb_speed -{ - int control_speed; - int control_delay; - -}; - -/* Used with VIDIOCPWC[SG]LED */ -struct pwc_leds -{ - int led_on; /* Led on-time; range = 0..25000 */ - int led_off; /* Led off-time; range = 0..25000 */ -}; - -/* Image size (used with GREALSIZE) */ -struct pwc_imagesize -{ - int width; - int height; -}; - -/* Defines and structures for Motorized Pan & Tilt */ -#define PWC_MPT_PAN 0x01 -#define PWC_MPT_TILT 0x02 -#define PWC_MPT_TIMEOUT 0x04 /* for status */ - -/* Set angles; when absolute = 1, the angle is absolute and the - driver calculates the relative offset for you. This can only - be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns - absolute angles. - */ -struct pwc_mpt_angles -{ - int absolute; /* write-only */ - int pan; /* degrees * 100 */ - int tilt; /* degress * 100 */ - int zoom; /* N/A, set to -1 */ -}; - -/* Range of angles of the camera, both horizontally and vertically. - The zoom is not used, maybe in the future... - - */ -struct pwc_mpt_range -{ - int pan_min, pan_max; /* degrees * 100 */ - int tilt_min, tilt_max; - int zoom_min, zoom_max; /* -1, -1 */ -}; - -struct pwc_mpt_status -{ - int status; - int time_pan; - int time_tilt; -}; - - - /* Restore user settings */ -#define VIDIOCPWCRUSER _IO('v', 192) - /* Save user settings */ -#define VIDIOCPWCSUSER _IO('v', 193) - /* Restore factory settings */ -#define VIDIOCPWCFACTORY _IO('v', 194) - - /* You can manipulate the compression factor. A compression preference of 0 - means use uncompressed modes when available; 1 is low compression, 2 is - medium and 3 is high compression preferred. Of course, the higher the - compression, the lower the bandwidth used but more chance of artefacts - in the image. The driver automatically chooses a higher compression when - the preferred mode is not available. - */ - /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL _IOW('v', 195, int) - /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL _IOR('v', 195, int) - - - /* This is a probe function; since so many devices are supported, it - becomes difficult to include all the names in programs that want to - check for the enhanced Philips stuff. So in stead, try this PROBE; - it returns a structure with the original name, and the corresponding - Philips type. - To use, fill the structure with zeroes, call PROBE and if that succeeds, - compare the name with that returned from VIDIOCGCAP; they should be the - same. If so, you can be assured it is a Philips (OEM) cam and the type - is valid. - */ -#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe) - - /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ -#define VIDIOCPWCSAGC _IOW('v', 200, int) - /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC _IOR('v', 200, int) - /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) - - /* Color compensation (Auto White Balance) */ -#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance) -#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance) - - /* Auto WB speed */ -#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed) -#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed) - - /* LEDs on/off/blink; int range 0..65535 */ -#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) -#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) - - /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ -#define VIDIOCPWCSCONTOUR _IOW('v', 206, int) -#define VIDIOCPWCGCONTOUR _IOR('v', 206, int) - - /* Backlight compensation; 0 = off, otherwise on */ -#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int) -#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int) - - /* Flickerless mode; = 0 off, otherwise on */ -#define VIDIOCPWCSFLICKER _IOW('v', 208, int) -#define VIDIOCPWCGFLICKER _IOR('v', 208, int) - - /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ -#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) -#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) - - /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ -#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) - - /* Motorized pan & tilt functions */ -#define VIDIOCPWCMPTRESET _IOW('v', 211, int) -#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) -#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status) - -#endif diff --git a/pwc-ioctl.h-pwc9.0.1 b/pwc-ioctl.h-pwc9.0.1 deleted file mode 100644 index 2535a3c..0000000 --- a/pwc-ioctl.h-pwc9.0.1 +++ /dev/null @@ -1,279 +0,0 @@ -#ifndef PWC_IOCTL_H -#define PWC_IOCTL_H - -/* (C) 2001-2004 Nemosoft Unv. webcam@smcc.demon.nl - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* This is pwc-ioctl.h belonging to PWC 8.12.1 - It contains structures and defines to communicate from user space - directly to the driver. - */ - -/* - Changes - 2001/08/03 Alvarado Added ioctl constants to access methods for - changing white balance and red/blue gains - 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE - 2003/12/13 Nemosft Unv. Some modifications to make interfacing to - PWCX easier - */ - -/* These are private ioctl() commands, specific for the Philips webcams. - They contain functions not found in other webcams, and settings not - specified in the Video4Linux API. - - The #define names are built up like follows: - VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam - G optional: Get - S optional: Set - ... the function - */ - - - /* Enumeration of image sizes */ -#define PSZ_SQCIF 0x00 -#define PSZ_QSIF 0x01 -#define PSZ_QCIF 0x02 -#define PSZ_SIF 0x03 -#define PSZ_CIF 0x04 -#define PSZ_VGA 0x05 -#define PSZ_MAX 6 - - -/* The frame rate is encoded in the video_window.flags parameter using - the upper 16 bits, since some flags are defined nowadays. The following - defines provide a mask and shift to filter out this value. - - In 'Snapshot' mode the camera freezes its automatic exposure and colour - balance controls. - */ -#define PWC_FPS_SHIFT 16 -#define PWC_FPS_MASK 0x00FF0000 -#define PWC_FPS_FRMASK 0x003F0000 -#define PWC_FPS_SNAPSHOT 0x00400000 - - -/* structure for transfering x & y coordinates */ -struct pwc_coord -{ - int x, y; /* guess what */ - int size; /* size, or offset */ -}; - - -/* Used with VIDIOCPWCPROBE */ -struct pwc_probe -{ - char name[32]; - int type; -}; - -struct pwc_serial -{ - char serial[30]; /* String with serial number. Contains terminating 0 */ -}; - -/* pwc_whitebalance.mode values */ -#define PWC_WB_INDOOR 0 -#define PWC_WB_OUTDOOR 1 -#define PWC_WB_FL 2 -#define PWC_WB_MANUAL 3 -#define PWC_WB_AUTO 4 - -/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). - Set mode to one of the PWC_WB_* values above. - *red and *blue are the respective gains of these colour components inside - the camera; range 0..65535 - When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; - otherwise undefined. - 'read_red' and 'read_blue' are read-only. -*/ -struct pwc_whitebalance -{ - int mode; - int manual_red, manual_blue; /* R/W */ - int read_red, read_blue; /* R/O */ -}; - -/* - 'control_speed' and 'control_delay' are used in automatic whitebalance mode, - and tell the camera how fast it should react to changes in lighting, and - with how much delay. Valid values are 0..65535. -*/ -struct pwc_wb_speed -{ - int control_speed; - int control_delay; - -}; - -/* Used with VIDIOCPWC[SG]LED */ -struct pwc_leds -{ - int led_on; /* Led on-time; range = 0..25000 */ - int led_off; /* Led off-time; range = 0..25000 */ -}; - -/* Image size (used with GREALSIZE) */ -struct pwc_imagesize -{ - int width; - int height; -}; - -/* Defines and structures for Motorized Pan & Tilt */ -#define PWC_MPT_PAN 0x01 -#define PWC_MPT_TILT 0x02 -#define PWC_MPT_TIMEOUT 0x04 /* for status */ - -/* Set angles; when absolute != 0, the angle is absolute and the - driver calculates the relative offset for you. This can only - be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns - absolute angles. - */ -struct pwc_mpt_angles -{ - int absolute; /* write-only */ - int pan; /* degrees * 100 */ - int tilt; /* degress * 100 */ -}; - -/* Range of angles of the camera, both horizontally and vertically. - */ -struct pwc_mpt_range -{ - int pan_min, pan_max; /* degrees * 100 */ - int tilt_min, tilt_max; -}; - -struct pwc_mpt_status -{ - int status; - int time_pan; - int time_tilt; -}; - - -/* This is used for out-of-kernel decompression. With it, you can get - all the necessary information to initialize and use the decompressor - routines in standalone applications. - */ -struct pwc_video_command -{ - int type; /* camera type (645, 675, 730, etc.) */ - int release; /* release number */ - - int size; /* one of PSZ_* */ - int alternate; - int command_len; /* length of USB video command */ - unsigned char command_buf[13]; /* Actual USB video command */ - int bandlength; /* >0 = compressed */ - int frame_size; /* Size of one (un)compressed frame */ -}; - -/* Flags for PWCX subroutines. Not all modules honour all flags. */ -#define PWCX_FLAG_PLANAR 0x0001 -#define PWCX_FLAG_BAYER 0x0008 - - -/* IOCTL definitions */ - - /* Restore user settings */ -#define VIDIOCPWCRUSER _IO('v', 192) - /* Save user settings */ -#define VIDIOCPWCSUSER _IO('v', 193) - /* Restore factory settings */ -#define VIDIOCPWCFACTORY _IO('v', 194) - - /* You can manipulate the compression factor. A compression preference of 0 - means use uncompressed modes when available; 1 is low compression, 2 is - medium and 3 is high compression preferred. Of course, the higher the - compression, the lower the bandwidth used but more chance of artefacts - in the image. The driver automatically chooses a higher compression when - the preferred mode is not available. - */ - /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL _IOW('v', 195, int) - /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL _IOR('v', 195, int) - - -/* Retrieve serial number of camera */ -#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial) - - /* This is a probe function; since so many devices are supported, it - becomes difficult to include all the names in programs that want to - check for the enhanced Philips stuff. So in stead, try this PROBE; - it returns a structure with the original name, and the corresponding - Philips type. - To use, fill the structure with zeroes, call PROBE and if that succeeds, - compare the name with that returned from VIDIOCGCAP; they should be the - same. If so, you can be assured it is a Philips (OEM) cam and the type - is valid. - */ -#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe) - - /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ -#define VIDIOCPWCSAGC _IOW('v', 200, int) - /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC _IOR('v', 200, int) - /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) - - /* Color compensation (Auto White Balance) */ -#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance) -#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance) - - /* Auto WB speed */ -#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed) -#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed) - - /* LEDs on/off/blink; int range 0..65535 */ -#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) -#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) - - /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ -#define VIDIOCPWCSCONTOUR _IOW('v', 206, int) -#define VIDIOCPWCGCONTOUR _IOR('v', 206, int) - - /* Backlight compensation; 0 = off, otherwise on */ -#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int) -#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int) - - /* Flickerless mode; = 0 off, otherwise on */ -#define VIDIOCPWCSFLICKER _IOW('v', 208, int) -#define VIDIOCPWCGFLICKER _IOR('v', 208, int) - - /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ -#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) -#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) - - /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ -#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) - - /* Motorized pan & tilt functions */ -#define VIDIOCPWCMPTRESET _IOW('v', 211, int) -#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) -#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status) - - /* Get the USB set-video command; needed for initializing libpwcx */ -#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command) - -#endif diff --git a/raspicam/RaspiCLI.c b/raspicam/RaspiCLI.c new file mode 100644 index 0000000..13b861f --- /dev/null +++ b/raspicam/RaspiCLI.c @@ -0,0 +1,155 @@ +/* +Copyright (c) 2013, Broadcom Europe Ltd +Copyright (c) 2013, James Hughes +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * \file RaspiCLI.c + * Code for handling command line parameters + * + * \date 4th March 2013 + * \Author: James Hughes + * + * Description + * + * Some functions/structures for command line parameter parsing + * + */ +#include +#include +#include +#include + +#include "interface/vcos/vcos.h" + +#include "RaspiCLI.h" + + +/** + * Convert a string from command line to a comand_id from the list + * + * @param commands Array of command to check + * @param num_command Number of commands in the array + * @param arg String to search for in the list + * @param num_parameters Returns the number of parameters used by the command + * + * @return command ID if found, -1 if not found + * + */ +int raspicli_get_command_id(const COMMAND_LIST *commands, const int num_commands, const char *arg, int *num_parameters) +{ + int command_id = -1; + int j; + + vcos_assert(commands); + vcos_assert(num_parameters); + vcos_assert(arg); + + if (!commands || !num_parameters || !arg) + return -1; + + for (j = 0; j < num_commands; j++) + { + if (!strcmp(arg, commands[j].command) || + !strcmp(arg, commands[j].abbrev)) + { + // match + command_id = commands[j].id; + *num_parameters = commands[j].num_parameters; + break; + } + } + + return command_id; +} + + +/** + * Display the list of commands in help format + * + * @param commands Array of command to check + * @param num_command Number of commands in the arry + * + * + */ +void raspicli_display_help(const COMMAND_LIST *commands, const int num_commands) +{ + int i; + + vcos_assert(commands); + + if (!commands) + return; + + for (i = 0; i < num_commands; i++) + { + fprintf(stderr, "-%s, -%s\t: %s\n", commands[i].abbrev, + commands[i].command, commands[i].help); + } +} + + +/** + * Function to take a string, a mapping, and return the int equivalent + * @param str Incoming string to match + * @param map Mapping data + * @param num_refs The number of items in the mapping data + * @return The integer match for the string, or -1 if no match + */ +int raspicli_map_xref(const char *str, const XREF_T *map, int num_refs) +{ + int i; + + for (i=0;i +#include + +#include "interface/vcos/vcos.h" + +#include "interface/vmcs_host/vc_vchi_gencmd.h" +#include "interface/mmal/mmal.h" +#include "interface/mmal/mmal_logging.h" +#include "interface/mmal/util/mmal_util.h" +#include "interface/mmal/util/mmal_util_params.h" +#include "interface/mmal/util/mmal_default_components.h" +#include "RaspiCamControl.h" +#include "RaspiCLI.h" + +/// Structure to cross reference exposure strings against the MMAL parameter equivalent +static XREF_T exposure_map[] = +{ + {"auto", MMAL_PARAM_EXPOSUREMODE_AUTO}, + {"night", MMAL_PARAM_EXPOSUREMODE_NIGHT}, + {"nightpreview", MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW}, + {"backlight", MMAL_PARAM_EXPOSUREMODE_BACKLIGHT}, + {"spotlight", MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT}, + {"sports", MMAL_PARAM_EXPOSUREMODE_SPORTS}, + {"snow", MMAL_PARAM_EXPOSUREMODE_SNOW}, + {"beach", MMAL_PARAM_EXPOSUREMODE_BEACH}, + {"verylong", MMAL_PARAM_EXPOSUREMODE_VERYLONG}, + {"fixedfps", MMAL_PARAM_EXPOSUREMODE_FIXEDFPS}, + {"antishake", MMAL_PARAM_EXPOSUREMODE_ANTISHAKE}, + {"fireworks", MMAL_PARAM_EXPOSUREMODE_FIREWORKS} +}; + +static const int exposure_map_size = sizeof(exposure_map) / sizeof(exposure_map[0]); + +/// Structure to cross reference awb strings against the MMAL parameter equivalent +static XREF_T awb_map[] = +{ + {"off", MMAL_PARAM_AWBMODE_OFF}, + {"auto", MMAL_PARAM_AWBMODE_AUTO}, + {"sun", MMAL_PARAM_AWBMODE_SUNLIGHT}, + {"cloud", MMAL_PARAM_AWBMODE_CLOUDY}, + {"shade", MMAL_PARAM_AWBMODE_SHADE}, + {"tungsten", MMAL_PARAM_AWBMODE_TUNGSTEN}, + {"fluorescent", MMAL_PARAM_AWBMODE_FLUORESCENT}, + {"incandescent", MMAL_PARAM_AWBMODE_INCANDESCENT}, + {"flash", MMAL_PARAM_AWBMODE_FLASH}, + {"horizon", MMAL_PARAM_AWBMODE_HORIZON} +}; + +static const int awb_map_size = sizeof(awb_map) / sizeof(awb_map[0]); + +/// Structure to cross reference image effect against the MMAL parameter equivalent +static XREF_T imagefx_map[] = +{ + {"none", MMAL_PARAM_IMAGEFX_NONE}, + {"negative", MMAL_PARAM_IMAGEFX_NEGATIVE}, + {"solarise", MMAL_PARAM_IMAGEFX_SOLARIZE}, + {"sketch", MMAL_PARAM_IMAGEFX_SKETCH}, + {"denoise", MMAL_PARAM_IMAGEFX_DENOISE}, + {"emboss", MMAL_PARAM_IMAGEFX_EMBOSS}, + {"oilpaint", MMAL_PARAM_IMAGEFX_OILPAINT}, + {"hatch", MMAL_PARAM_IMAGEFX_HATCH}, + {"gpen", MMAL_PARAM_IMAGEFX_GPEN}, + {"pastel", MMAL_PARAM_IMAGEFX_PASTEL}, + {"watercolour", MMAL_PARAM_IMAGEFX_WATERCOLOUR}, + {"film", MMAL_PARAM_IMAGEFX_FILM}, + {"blur", MMAL_PARAM_IMAGEFX_BLUR}, + {"saturation", MMAL_PARAM_IMAGEFX_SATURATION}, + {"colourswap", MMAL_PARAM_IMAGEFX_COLOURSWAP}, + {"washedout", MMAL_PARAM_IMAGEFX_WASHEDOUT}, + {"posterise", MMAL_PARAM_IMAGEFX_POSTERISE}, + {"colourpoint", MMAL_PARAM_IMAGEFX_COLOURPOINT}, + {"colourbalance", MMAL_PARAM_IMAGEFX_COLOURBALANCE}, + {"cartoon", MMAL_PARAM_IMAGEFX_CARTOON} + }; + +static const int imagefx_map_size = sizeof(imagefx_map) / sizeof(imagefx_map[0]); + +static XREF_T metering_mode_map[] = +{ + {"average", MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE}, + {"spot", MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT}, + {"backlit", MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT}, + {"matrix", MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX} +}; + +static const int metering_mode_map_size = sizeof(metering_mode_map)/sizeof(metering_mode_map[0]); + + +#define CommandSharpness 0 +#define CommandContrast 1 +#define CommandBrightness 2 +#define CommandSaturation 3 +#define CommandISO 4 +#define CommandVideoStab 5 +#define CommandEVComp 6 +#define CommandExposure 7 +#define CommandAWB 8 +#define CommandImageFX 9 +#define CommandColourFX 10 +#define CommandMeterMode 11 +#define CommandRotation 12 +#define CommandHFlip 13 +#define CommandVFlip 14 +#define CommandROI 15 +#define CommandShutterSpeed 16 + +static COMMAND_LIST cmdline_commands[] = +{ + {CommandSharpness, "-sharpness", "sh", "Set image sharpness (-100 to 100)", 1}, + {CommandContrast, "-contrast", "co", "Set image contrast (-100 to 100)", 1}, + {CommandBrightness, "-brightness","br", "Set image brightness (0 to 100)", 1}, + {CommandSaturation, "-saturation","sa", "Set image saturation (-100 to 100)", 1}, + {CommandISO, "-ISO", "ISO","Set capture ISO", 1}, + {CommandVideoStab, "-vstab", "vs", "Turn on video stablisation", 0}, + {CommandEVComp, "-ev", "ev", "Set EV compensation", 1}, + {CommandExposure, "-exposure", "ex", "Set exposure mode (see Notes)", 1}, + {CommandAWB, "-awb", "awb","Set AWB mode (see Notes)", 1}, + {CommandImageFX, "-imxfx", "ifx","Set image effect (see Notes)", 1}, + {CommandColourFX, "-colfx", "cfx","Set colour effect (U:V)", 1}, + {CommandMeterMode, "-metering", "mm", "Set metering mode (see Notes)", 1}, + {CommandRotation, "-rotation", "rot","Set image rotation (0-359)", 1}, + {CommandHFlip, "-hflip", "hf", "Set horizontal flip", 0}, + {CommandVFlip, "-vflip", "vf", "Set vertical flip", 0}, + {CommandROI, "-roi", "roi","Set region of interest (x,y,w,d as normalised coordinates [0.0-1.0])", 1}, + {CommandShutterSpeed,"-shutter", "ss", "Set shutter speed in microseconds", 1} +}; + +static int cmdline_commands_size = sizeof(cmdline_commands) / sizeof(cmdline_commands[0]); + + +#define parameter_reset -99999 + +/** + * Update the passed in parameter according to the rest of the parameters + * passed in. + * + * + * @return 0 if reached end of cycle for this parameter, !0 otherwise + */ +static int update_cycle_parameter(int *option, int min, int max, int increment) +{ + vcos_assert(option); + if (!option) + return 0; + + if (*option == parameter_reset) + *option = min - increment; + + *option += increment; + + if (*option > max) + { + *option = parameter_reset; + return 0; + } + else + return 1; +} + + +/** + * Test/Demo code to cycle through a bunch of camera settings + * This code is pretty hacky so please don't complain!! + * It only does stuff that should have a visual impact (hence demo!) + * This will override any user supplied parameters + * + * Each call of this function will move on to the next setting + * + * @param camera Pointer to the camera to change settings on. + * @return 0 if reached end of complete sequence, !0 otherwise + */ + +int raspicamcontrol_cycle_test(MMAL_COMPONENT_T *camera) +{ + static int parameter = 0; + static int parameter_option = parameter_reset; // which value the parameter currently has + + vcos_assert(camera); + + // We are going to cycle through all the relevant entries in the parameter block + // and send options to the camera. + if (parameter == 0) + { + // sharpness + if (update_cycle_parameter(¶meter_option, -100, 100, 10)) + raspicamcontrol_set_sharpness(camera, parameter_option); + else + { + raspicamcontrol_set_sharpness(camera, 0); + parameter++; + } + } + else + if (parameter == 1) + { + // contrast + if (update_cycle_parameter(¶meter_option, -100, 100, 10)) + raspicamcontrol_set_contrast(camera, parameter_option); + else + { + raspicamcontrol_set_contrast(camera, 0); + parameter++; + } + } + else + if (parameter == 2) + { + // brightness + if (update_cycle_parameter(¶meter_option, 0, 100, 10)) + raspicamcontrol_set_brightness(camera, parameter_option); + else + { + raspicamcontrol_set_brightness(camera, 50); + parameter++; + } + } + else + if (parameter == 3) + { + // contrast + if (update_cycle_parameter(¶meter_option, -100, 100, 10)) + raspicamcontrol_set_saturation(camera, parameter_option); + else + { + parameter++; + raspicamcontrol_set_saturation(camera, 0); + } + } + else + if (parameter == 4) + { + // EV + if (update_cycle_parameter(¶meter_option, -10, 10, 4)) + raspicamcontrol_set_exposure_compensation(camera, parameter_option); + else + { + raspicamcontrol_set_exposure_compensation(camera, 0); + parameter++; + } + } + else + if (parameter == 5) + { + // MMAL_PARAM_EXPOSUREMODE_T + if (update_cycle_parameter(¶meter_option, 0, exposure_map_size, 1)) + raspicamcontrol_set_exposure_mode(camera, exposure_map[parameter_option].mmal_mode); + else + { + raspicamcontrol_set_exposure_mode(camera, MMAL_PARAM_EXPOSUREMODE_AUTO); + parameter++; + } + } + else + if (parameter == 6) + { + // MMAL_PARAM_AWB_T + if (update_cycle_parameter(¶meter_option, 0, awb_map_size, 1)) + raspicamcontrol_set_awb_mode(camera, awb_map[parameter_option].mmal_mode); + else + { + raspicamcontrol_set_awb_mode(camera, MMAL_PARAM_AWBMODE_AUTO); + parameter++; + } + } + if (parameter == 7) + { + // MMAL_PARAM_IMAGEFX_T + if (update_cycle_parameter(¶meter_option, 0, imagefx_map_size, 1)) + raspicamcontrol_set_imageFX(camera, imagefx_map[parameter_option].mmal_mode); + else + { + raspicamcontrol_set_imageFX(camera, MMAL_PARAM_IMAGEFX_NONE); + parameter++; + } + } + if (parameter == 8) + { + MMAL_PARAM_COLOURFX_T colfx = {0,0,0}; + switch (parameter_option) + { + case parameter_reset : + parameter_option = 1; + colfx.u = 128; + colfx.v = 128; + break; + case 1 : + parameter_option = 2; + colfx.u = 100; + colfx.v = 200; + break; + case 2 : + parameter_option = parameter_reset; + colfx.enable = 0; + parameter++; + break; + } + raspicamcontrol_set_colourFX(camera, &colfx); + } + + // Orientation + if (parameter == 9) + { + switch (parameter_option) + { + case parameter_reset: + raspicamcontrol_set_rotation(camera, 90); + parameter_option = 1; + break; + + case 1 : + raspicamcontrol_set_rotation(camera, 180); + parameter_option = 2; + break; + + case 2 : + raspicamcontrol_set_rotation(camera, 270); + parameter_option = 3; + break; + + case 3 : + { + raspicamcontrol_set_rotation(camera, 0); + raspicamcontrol_set_flips(camera, 1,0); + parameter_option = 4; + break; + } + case 4 : + { + raspicamcontrol_set_flips(camera, 0,1); + parameter_option = 5; + break; + } + case 5 : + { + raspicamcontrol_set_flips(camera, 1, 1); + parameter_option = 6; + break; + } + case 6 : + { + raspicamcontrol_set_flips(camera, 0, 0); + parameter_option = parameter_reset; + parameter++; + break; + } + } + } + + if (parameter == 10) + { + parameter = 1; + return 0; + } + + return 1; +} + + + +/** + * Convert string to the MMAL parameter for exposure mode + * @param str Incoming string to match + * @return MMAL parameter matching the string, or the AUTO option if no match found + */ +static MMAL_PARAM_EXPOSUREMODE_T exposure_mode_from_string(const char *str) +{ + int i = raspicli_map_xref(str, exposure_map, exposure_map_size); + + if( i != -1) + return (MMAL_PARAM_EXPOSUREMODE_T)i; + + vcos_log_error("Unknown exposure mode: %s", str); + return MMAL_PARAM_EXPOSUREMODE_AUTO; +} + +/** + * Convert string to the MMAL parameter for AWB mode + * @param str Incoming string to match + * @return MMAL parameter matching the string, or the AUTO option if no match found + */ +static MMAL_PARAM_AWBMODE_T awb_mode_from_string(const char *str) +{ + int i = raspicli_map_xref(str, awb_map, awb_map_size); + + if( i != -1) + return (MMAL_PARAM_AWBMODE_T)i; + + vcos_log_error("Unknown awb mode: %s", str); + return MMAL_PARAM_AWBMODE_AUTO; +} + +/** + * Convert string to the MMAL parameter for image effects mode + * @param str Incoming string to match + * @return MMAL parameter matching the strong, or the AUTO option if no match found + */ +MMAL_PARAM_IMAGEFX_T imagefx_mode_from_string(const char *str) +{ + int i = raspicli_map_xref(str, imagefx_map, imagefx_map_size); + + if( i != -1) + return (MMAL_PARAM_IMAGEFX_T)i; + + vcos_log_error("Unknown image fx: %s", str); + return MMAL_PARAM_IMAGEFX_NONE; +} + +/** + * Convert string to the MMAL parameter for exposure metering mode + * @param str Incoming string to match + * @return MMAL parameter matching the string, or the AUTO option if no match found + */ +static MMAL_PARAM_EXPOSUREMETERINGMODE_T metering_mode_from_string(const char *str) +{ + int i = raspicli_map_xref(str, metering_mode_map, metering_mode_map_size); + + if( i != -1) + return (MMAL_PARAM_EXPOSUREMETERINGMODE_T)i; + + vcos_log_error("Unknown metering mode: %s", str); + return MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE; +} + +/** + * Parse a possible command pair - command and parameter + * @param arg1 Command + * @param arg2 Parameter (could be NULL) + * @return How many parameters were used, 0,1,2 + */ +int raspicamcontrol_parse_cmdline(RASPICAM_CAMERA_PARAMETERS *params, const char *arg1, const char *arg2) +{ + int command_id, used = 0, num_parameters; + + if (!arg1) + return 0; + + command_id = raspicli_get_command_id(cmdline_commands, cmdline_commands_size, arg1, &num_parameters); + + // If invalid command, or we are missing a parameter, drop out + if (command_id==-1 || (command_id != -1 && num_parameters > 0 && arg2 == NULL)) + return 0; + + switch (command_id) + { + case CommandSharpness : // sharpness - needs single number parameter + sscanf(arg2, "%d", ¶ms->sharpness); + used = 2; + break; + + case CommandContrast : // contrast - needs single number parameter + sscanf(arg2, "%d", ¶ms->contrast); + used = 2; + break; + + case CommandBrightness : // brightness - needs single number parameter + sscanf(arg2, "%d", ¶ms->brightness); + used = 2; + break; + + case CommandSaturation : // saturation - needs single number parameter + sscanf(arg2, "%d", ¶ms->saturation); + used = 2; + break; + + case CommandISO : // ISO - needs single number parameter + sscanf(arg2, "%d", ¶ms->ISO); + used = 2; + break; + + case CommandVideoStab : // video stabilisation - if here, its on + params->videoStabilisation = 1; + used = 1; + break; + + case CommandEVComp : // EV - needs single number parameter + sscanf(arg2, "%d", ¶ms->exposureCompensation); + used = 2; + break; + + case CommandExposure : // exposure mode - needs string + params->exposureMode = exposure_mode_from_string(arg2); + used = 2; + break; + + case CommandAWB : // AWB mode - needs single number parameter + params->awbMode = awb_mode_from_string(arg2); + used = 2; + break; + + case CommandImageFX : // Image FX - needs string + params->imageEffect = imagefx_mode_from_string(arg2); + used = 2; + break; + + case CommandColourFX : // Colour FX - needs string "u:v" + sscanf(arg2, "%d:%d", ¶ms->colourEffects.u, ¶ms->colourEffects.u); + params->colourEffects.enable = 1; + used = 2; + break; + + case CommandMeterMode: + params->exposureMeterMode = metering_mode_from_string(arg2); + used = 2; + break; + + case CommandRotation : // Rotation - degree + sscanf(arg2, "%d", ¶ms->rotation); + used = 2; + break; + + case CommandHFlip : + params->hflip = 1; + used = 1; + break; + + case CommandVFlip : + params->vflip = 1; + used = 1; + break; + + case CommandROI : + { + double x,y,w,h; + int args; + + args = sscanf(arg2, "%lf,%lf,%lf,%lf", &x,&y,&w,&h); + + if (args != 4 || x > 1.0 || y > 1.0 || w > 1.0 || h > 1.0) + { + return 0; + } + + // Make sure we stay within bounds + if (x + w > 1.0) + w = 1 - x; + + if (y + h > 1.0) + h = 1 - y; + + params->roi.x = x; + params->roi.y = y; + params->roi.w = w; + params->roi.h = h; + + used = 2; + break; + } + + case CommandShutterSpeed : // Shutter speed needs single number parameter + sscanf(arg2, "%d", ¶ms->shutter_speed); + used = 2; + break; + + + } + + return used; +} + +/** + * Display help for command line options + */ +void raspicamcontrol_display_help() +{ + int i; + + fprintf(stderr, "\nImage parameter commands\n\n"); + + raspicli_display_help(cmdline_commands, cmdline_commands_size); + + fprintf(stderr, "\n\nNotes\n\nExposure mode options :\n%s", exposure_map[0].mode ); + + for (i=1;iexposureMode, exposure_map, exposure_map_size); + const char *awb_mode = raspicli_unmap_xref(params->awbMode, awb_map, awb_map_size); + const char *image_effect = raspicli_unmap_xref(params->imageEffect, imagefx_map, imagefx_map_size); + const char *metering_mode = raspicli_unmap_xref(params->exposureMeterMode, metering_mode_map, metering_mode_map_size); + + fprintf(stderr, "Sharpness %d, Contrast %d, Brightness %d\n", params->sharpness, params->contrast, params->brightness); + fprintf(stderr, "Saturation %d, ISO %d, Video Stabilisation %s, Exposure compensation %d\n", params->saturation, params->ISO, params->videoStabilisation ? "Yes": "No", params->exposureCompensation); + fprintf(stderr, "Exposure Mode '%s', AWB Mode '%s', Image Effect '%s'\n", exp_mode, awb_mode, image_effect); + fprintf(stderr, "Metering Mode '%s', Colour Effect Enabled %s with U = %d, V = %d\n", metering_mode, params->colourEffects.enable ? "Yes":"No", params->colourEffects.u, params->colourEffects.v); + fprintf(stderr, "Rotation %d, hflip %s, vflip %s\n", params->rotation, params->hflip ? "Yes":"No",params->vflip ? "Yes":"No"); + fprintf(stderr, "ROI x %lf, y %f, w %f h %f\n", params->roi.x, params->roi.y, params->roi.w, params->roi.h); +} + +/** + * Convert a MMAL status return value to a simple boolean of success + * ALso displays a fault if code is not success + * + * @param status The error code to convert + * @return 0 if status is sucess, 1 otherwise + */ +int mmal_status_to_int(MMAL_STATUS_T status) +{ + if (status == MMAL_SUCCESS) + return 0; + else + { + switch (status) + { + case MMAL_ENOMEM : vcos_log_error("Out of memory"); break; + case MMAL_ENOSPC : vcos_log_error("Out of resources (other than memory)"); break; + case MMAL_EINVAL: vcos_log_error("Argument is invalid"); break; + case MMAL_ENOSYS : vcos_log_error("Function not implemented"); break; + case MMAL_ENOENT : vcos_log_error("No such file or directory"); break; + case MMAL_ENXIO : vcos_log_error("No such device or address"); break; + case MMAL_EIO : vcos_log_error("I/O error"); break; + case MMAL_ESPIPE : vcos_log_error("Illegal seek"); break; + case MMAL_ECORRUPT : vcos_log_error("Data is corrupt \attention FIXME: not POSIX"); break; + case MMAL_ENOTREADY :vcos_log_error("Component is not ready \attention FIXME: not POSIX"); break; + case MMAL_ECONFIG : vcos_log_error("Component is not configured \attention FIXME: not POSIX"); break; + case MMAL_EISCONN : vcos_log_error("Port is already connected "); break; + case MMAL_ENOTCONN : vcos_log_error("Port is disconnected"); break; + case MMAL_EAGAIN : vcos_log_error("Resource temporarily unavailable. Try again later"); break; + case MMAL_EFAULT : vcos_log_error("Bad address"); break; + default : vcos_log_error("Unknown status error"); break; + } + + return 1; + } +} + +/** + * Give the supplied parameter block a set of default values + * @params Pointer to parameter block + */ +void raspicamcontrol_set_defaults(RASPICAM_CAMERA_PARAMETERS *params) +{ + vcos_assert(params); + + params->sharpness = 0; + params->contrast = 0; + params->brightness = 50; + params->saturation = 0; + params->ISO = 0; // 0 = auto + params->videoStabilisation = 0; + params->exposureCompensation = 0; + params->exposureMode = MMAL_PARAM_EXPOSUREMODE_AUTO; + params->exposureMeterMode = MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE; + params->awbMode = MMAL_PARAM_AWBMODE_AUTO; + params->imageEffect = MMAL_PARAM_IMAGEFX_NONE; + params->colourEffects.enable = 0; + params->colourEffects.u = 128; + params->colourEffects.v = 128; + params->rotation = 0; + params->hflip = params->vflip = 0; + params->roi.x = params->roi.y = 0.0; + params->roi.w = params->roi.h = 1.0; + params->shutter_speed = 0; // 0 = auto +} + +/** + * Get all the current camera parameters from specified camera component + * @param camera Pointer to camera component + * @param params Pointer to parameter block to accept settings + * @return 0 if successful, non-zero if unsuccessful + */ +int raspicamcontrol_get_all_parameters(MMAL_COMPONENT_T *camera, RASPICAM_CAMERA_PARAMETERS *params) +{ + vcos_assert(camera); + vcos_assert(params); + + if (!camera || !params) + return 1; + +/* TODO : Write these get functions + params->sharpness = raspicamcontrol_get_sharpness(camera); + params->contrast = raspicamcontrol_get_contrast(camera); + params->brightness = raspicamcontrol_get_brightness(camera); + params->saturation = raspicamcontrol_get_saturation(camera); + params->ISO = raspicamcontrol_get_ISO(camera); + params->videoStabilisation = raspicamcontrol_get_video_stabilisation(camera); + params->exposureCompensation = raspicamcontrol_get_exposure_compensation(camera); + params->exposureMode = raspicamcontrol_get_exposure_mode(camera); + params->awbMode = raspicamcontrol_get_awb_mode(camera); + params->imageEffect = raspicamcontrol_get_image_effect(camera); + params->colourEffects = raspicamcontrol_get_colour_effect(camera); + params->thumbnailConfig = raspicamcontrol_get_thumbnail_config(camera); +*/ + return 0; +} + +/** + * Set the specified camera to all the specified settings + * @param camera Pointer to camera component + * @param params Pointer to parameter block containing parameters + * @return 0 if successful, none-zero if unsuccessful. + */ +int raspicamcontrol_set_all_parameters(MMAL_COMPONENT_T *camera, const RASPICAM_CAMERA_PARAMETERS *params) +{ + int result; + + result = raspicamcontrol_set_saturation(camera, params->saturation); + result += raspicamcontrol_set_sharpness(camera, params->sharpness); + result += raspicamcontrol_set_contrast(camera, params->contrast); + result += raspicamcontrol_set_brightness(camera, params->brightness); + result += raspicamcontrol_set_ISO(camera, params->ISO); + result += raspicamcontrol_set_video_stabilisation(camera, params->videoStabilisation); + result += raspicamcontrol_set_exposure_compensation(camera, params->exposureCompensation); + result += raspicamcontrol_set_exposure_mode(camera, params->exposureMode); + result += raspicamcontrol_set_metering_mode(camera, params->exposureMeterMode); + result += raspicamcontrol_set_awb_mode(camera, params->awbMode); + result += raspicamcontrol_set_imageFX(camera, params->imageEffect); + result += raspicamcontrol_set_colourFX(camera, ¶ms->colourEffects); + //result += raspicamcontrol_set_thumbnail_parameters(camera, ¶ms->thumbnailConfig); TODO Not working for some reason + result += raspicamcontrol_set_rotation(camera, params->rotation); + result += raspicamcontrol_set_flips(camera, params->hflip, params->vflip); + result += raspicamcontrol_set_ROI(camera, params->roi); + result += raspicamcontrol_set_shutter_speed(camera, params->shutter_speed); + + return result; +} + +/** + * Adjust the saturation level for images + * @param camera Pointer to camera component + * @param saturation Value to adjust, -100 to 100 + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_saturation(MMAL_COMPONENT_T *camera, int saturation) +{ + int ret = 0; + + if (!camera) + return 1; + + if (saturation >= -100 && saturation <= 100) + { + MMAL_RATIONAL_T value = {saturation, 100}; + ret = mmal_status_to_int(mmal_port_parameter_set_rational(camera->control, MMAL_PARAMETER_SATURATION, value)); + } + else + { + vcos_log_error("Invalid saturation value"); + ret = 1; + } + + return ret; +} + +/** + * Set the sharpness of the image + * @param camera Pointer to camera component + * @param sharpness Sharpness adjustment -100 to 100 + */ +int raspicamcontrol_set_sharpness(MMAL_COMPONENT_T *camera, int sharpness) +{ + int ret = 0; + + if (!camera) + return 1; + + if (sharpness >= -100 && sharpness <= 100) + { + MMAL_RATIONAL_T value = {sharpness, 100}; + ret = mmal_status_to_int(mmal_port_parameter_set_rational(camera->control, MMAL_PARAMETER_SHARPNESS, value)); + } + else + { + vcos_log_error("Invalid sharpness value"); + ret = 1; + } + + return ret; +} + +/** + * Set the contrast adjustment for the image + * @param camera Pointer to camera component + * @param contrast Contrast adjustment -100 to 100 + * @return + */ +int raspicamcontrol_set_contrast(MMAL_COMPONENT_T *camera, int contrast) +{ + int ret = 0; + + if (!camera) + return 1; + + if (contrast >= -100 && contrast <= 100) + { + MMAL_RATIONAL_T value = {contrast, 100}; + ret = mmal_status_to_int(mmal_port_parameter_set_rational(camera->control, MMAL_PARAMETER_CONTRAST, value)); + } + else + { + vcos_log_error("Invalid contrast value"); + ret = 1; + } + + return ret; +} + +/** + * Adjust the brightness level for images + * @param camera Pointer to camera component + * @param brightness Value to adjust, 0 to 100 + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_brightness(MMAL_COMPONENT_T *camera, int brightness) +{ + int ret = 0; + + if (!camera) + return 1; + + if (brightness >= 0 && brightness <= 100) + { + MMAL_RATIONAL_T value = {brightness, 100}; + ret = mmal_status_to_int(mmal_port_parameter_set_rational(camera->control, MMAL_PARAMETER_BRIGHTNESS, value)); + } + else + { + vcos_log_error("Invalid brightness value"); + ret = 1; + } + + return ret; +} + +/** + * Adjust the ISO used for images + * @param camera Pointer to camera component + * @param ISO Value to set TODO : + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_ISO(MMAL_COMPONENT_T *camera, int ISO) +{ + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set_uint32(camera->control, MMAL_PARAMETER_ISO, ISO)); +} + +/** + * Adjust the metering mode for images + * @param camera Pointer to camera component + * @param saturation Value from following + * - MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE, + * - MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT, + * - MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT, + * - MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_metering_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_EXPOSUREMETERINGMODE_T m_mode ) +{ + MMAL_PARAMETER_EXPOSUREMETERINGMODE_T meter_mode = {{MMAL_PARAMETER_EXP_METERING_MODE,sizeof(meter_mode)}, + m_mode}; + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set(camera->control, &meter_mode.hdr)); +} + + +/** + * Set the video stabilisation flag. Only used in video mode + * @param camera Pointer to camera component + * @param saturation Flag 0 off 1 on + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_video_stabilisation(MMAL_COMPONENT_T *camera, int vstabilisation) +{ + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set_boolean(camera->control, MMAL_PARAMETER_VIDEO_STABILISATION, vstabilisation)); +} + +/** + * Adjust the exposure compensation for images (EV) + * @param camera Pointer to camera component + * @param exp_comp Value to adjust, -10 to +10 + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_exposure_compensation(MMAL_COMPONENT_T *camera, int exp_comp) +{ + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set_int32(camera->control, MMAL_PARAMETER_EXPOSURE_COMP , exp_comp)); +} + + +/** + * Set exposure mode for images + * @param camera Pointer to camera component + * @param mode Exposure mode to set from + * - MMAL_PARAM_EXPOSUREMODE_OFF, + * - MMAL_PARAM_EXPOSUREMODE_AUTO, + * - MMAL_PARAM_EXPOSUREMODE_NIGHT, + * - MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW, + * - MMAL_PARAM_EXPOSUREMODE_BACKLIGHT, + * - MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT, + * - MMAL_PARAM_EXPOSUREMODE_SPORTS, + * - MMAL_PARAM_EXPOSUREMODE_SNOW, + * - MMAL_PARAM_EXPOSUREMODE_BEACH, + * - MMAL_PARAM_EXPOSUREMODE_VERYLONG, + * - MMAL_PARAM_EXPOSUREMODE_FIXEDFPS, + * - MMAL_PARAM_EXPOSUREMODE_ANTISHAKE, + * - MMAL_PARAM_EXPOSUREMODE_FIREWORKS, + * + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_exposure_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_EXPOSUREMODE_T mode) +{ + MMAL_PARAMETER_EXPOSUREMODE_T exp_mode = {{MMAL_PARAMETER_EXPOSURE_MODE,sizeof(exp_mode)}, mode}; + + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set(camera->control, &exp_mode.hdr)); +} + + +/** + * Set the aWB (auto white balance) mode for images + * @param camera Pointer to camera component + * @param awb_mode Value to set from + * - MMAL_PARAM_AWBMODE_OFF, + * - MMAL_PARAM_AWBMODE_AUTO, + * - MMAL_PARAM_AWBMODE_SUNLIGHT, + * - MMAL_PARAM_AWBMODE_CLOUDY, + * - MMAL_PARAM_AWBMODE_SHADE, + * - MMAL_PARAM_AWBMODE_TUNGSTEN, + * - MMAL_PARAM_AWBMODE_FLUORESCENT, + * - MMAL_PARAM_AWBMODE_INCANDESCENT, + * - MMAL_PARAM_AWBMODE_FLASH, + * - MMAL_PARAM_AWBMODE_HORIZON, + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_awb_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_AWBMODE_T awb_mode) +{ + MMAL_PARAMETER_AWBMODE_T param = {{MMAL_PARAMETER_AWB_MODE,sizeof(param)}, awb_mode}; + + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set(camera->control, ¶m.hdr)); +} + +/** + * Set the image effect for the images + * @param camera Pointer to camera component + * @param imageFX Value from + * - MMAL_PARAM_IMAGEFX_NONE, + * - MMAL_PARAM_IMAGEFX_NEGATIVE, + * - MMAL_PARAM_IMAGEFX_SOLARIZE, + * - MMAL_PARAM_IMAGEFX_POSTERIZE, + * - MMAL_PARAM_IMAGEFX_WHITEBOARD, + * - MMAL_PARAM_IMAGEFX_BLACKBOARD, + * - MMAL_PARAM_IMAGEFX_SKETCH, + * - MMAL_PARAM_IMAGEFX_DENOISE, + * - MMAL_PARAM_IMAGEFX_EMBOSS, + * - MMAL_PARAM_IMAGEFX_OILPAINT, + * - MMAL_PARAM_IMAGEFX_HATCH, + * - MMAL_PARAM_IMAGEFX_GPEN, + * - MMAL_PARAM_IMAGEFX_PASTEL, + * - MMAL_PARAM_IMAGEFX_WATERCOLOUR, + * - MMAL_PARAM_IMAGEFX_FILM, + * - MMAL_PARAM_IMAGEFX_BLUR, + * - MMAL_PARAM_IMAGEFX_SATURATION, + * - MMAL_PARAM_IMAGEFX_COLOURSWAP, + * - MMAL_PARAM_IMAGEFX_WASHEDOUT, + * - MMAL_PARAM_IMAGEFX_POSTERISE, + * - MMAL_PARAM_IMAGEFX_COLOURPOINT, + * - MMAL_PARAM_IMAGEFX_COLOURBALANCE, + * - MMAL_PARAM_IMAGEFX_CARTOON, + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_imageFX(MMAL_COMPONENT_T *camera, MMAL_PARAM_IMAGEFX_T imageFX) +{ + MMAL_PARAMETER_IMAGEFX_T imgFX = {{MMAL_PARAMETER_IMAGE_EFFECT,sizeof(imgFX)}, imageFX}; + + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set(camera->control, &imgFX.hdr)); +} + +/* TODO :what to do with the image effects parameters? + MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {{MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS,sizeof(imfx_param)}, + imageFX, 0, {0}}; +mmal_port_parameter_set(camera->control, &imfx_param.hdr); + */ + +/** + * Set the colour effect for images (Set UV component) + * @param camera Pointer to camera component + * @param colourFX Contains enable state and U and V numbers to set (e.g. 128,128 = Black and white) + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_colourFX(MMAL_COMPONENT_T *camera, const MMAL_PARAM_COLOURFX_T *colourFX) +{ + MMAL_PARAMETER_COLOURFX_T colfx = {{MMAL_PARAMETER_COLOUR_EFFECT,sizeof(colfx)}, 0, 0, 0}; + + if (!camera) + return 1; + + colfx.enable = colourFX->enable; + colfx.u = colourFX->u; + colfx.v = colourFX->v; + + return mmal_status_to_int(mmal_port_parameter_set(camera->control, &colfx.hdr)); + +} + + +/** + * Set the rotation of the image + * @param camera Pointer to camera component + * @param rotation Degree of rotation (any number, but will be converted to 0,90,180 or 270 only) + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_rotation(MMAL_COMPONENT_T *camera, int rotation) +{ + int ret; + int my_rotation = ((rotation % 360 ) / 90) * 90; + + ret = mmal_port_parameter_set_int32(camera->output[0], MMAL_PARAMETER_ROTATION, my_rotation); + mmal_port_parameter_set_int32(camera->output[1], MMAL_PARAMETER_ROTATION, my_rotation); + mmal_port_parameter_set_int32(camera->output[2], MMAL_PARAMETER_ROTATION, my_rotation); + + return ret; +} + +/** + * Set the flips state of the image + * @param camera Pointer to camera component + * @param hflip If true, horizontally flip the image + * @param vflip If true, vertically flip the image + * + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_flips(MMAL_COMPONENT_T *camera, int hflip, int vflip) +{ + MMAL_PARAMETER_MIRROR_T mirror = {{MMAL_PARAMETER_MIRROR, sizeof(MMAL_PARAMETER_MIRROR_T)}, MMAL_PARAM_MIRROR_NONE}; + + if (hflip && vflip) + mirror.value = MMAL_PARAM_MIRROR_BOTH; + else + if (hflip) + mirror.value = MMAL_PARAM_MIRROR_HORIZONTAL; + else + if (vflip) + mirror.value = MMAL_PARAM_MIRROR_VERTICAL; + + mmal_port_parameter_set(camera->output[0], &mirror.hdr); + mmal_port_parameter_set(camera->output[1], &mirror.hdr); + return mmal_port_parameter_set(camera->output[2], &mirror.hdr); +} + +/** + * Set the ROI of the sensor to use for captures/preview + * @param camera Pointer to camera component + * @param rect Normalised coordinates of ROI rectangle + * + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_ROI(MMAL_COMPONENT_T *camera, PARAM_FLOAT_RECT_T rect) +{ + MMAL_PARAMETER_INPUT_CROP_T crop = {{MMAL_PARAMETER_INPUT_CROP, sizeof(MMAL_PARAMETER_INPUT_CROP_T)}}; + + crop.rect.x = (65536 * rect.x); + crop.rect.y = (65536 * rect.y); + crop.rect.width = (65536 * rect.w); + crop.rect.height = (65536 * rect.h); + + return mmal_port_parameter_set(camera->control, &crop.hdr); +} + +/** + * Adjust the exposure time used for images + * @param camera Pointer to camera component + * @param shutter speed in microseconds + * @return 0 if successful, non-zero if any parameters out of range + */ +int raspicamcontrol_set_shutter_speed(MMAL_COMPONENT_T *camera, int speed) +{ + if (!camera) + return 1; + + return mmal_status_to_int(mmal_port_parameter_set_uint32(camera->control, MMAL_PARAMETER_SHUTTER_SPEED, speed)); +} + + + +/** + * Asked GPU how much memory it has allocated + * + * @return amount of memory in MB + */ +static int raspicamcontrol_get_mem_gpu(void) +{ + char response[80] = ""; + int gpu_mem = 0; + if (vc_gencmd(response, sizeof response, "get_mem gpu") == 0) + vc_gencmd_number_property(response, "gpu", &gpu_mem); + return gpu_mem; +} + +/** + * Ask GPU about its camera abilities + * @param supported None-zero if software supports the camera + * @param detected None-zero if a camera has been detected + */ +static void raspicamcontrol_get_camera(int *supported, int *detected) +{ + char response[80] = ""; + if (vc_gencmd(response, sizeof response, "get_camera") == 0) + { + if (supported) + vc_gencmd_number_property(response, "supported", supported); + if (detected) + vc_gencmd_number_property(response, "detected", detected); + } +} + +/** + * Check to see if camera is supported, and we have allocated enough meooryAsk GPU about its camera abilities + * @param supported None-zero if software supports the camera + * @param detected None-zero if a camera has been detected + */ +void raspicamcontrol_check_configuration(int min_gpu_mem) +{ + int gpu_mem = raspicamcontrol_get_mem_gpu(); + int supported = 0, detected = 0; + raspicamcontrol_get_camera(&supported, &detected); + if (!supported) + vcos_log_error("Camera is not enabled in this build. Try running \"sudo raspi-config\" and ensure that \"camera\" has been enabled\n"); + else if (gpu_mem < min_gpu_mem) + vcos_log_error("Only %dM of gpu_mem is configured. Try running \"sudo raspi-config\" and ensure that \"memory_split\" has a value of %d or greater\n", gpu_mem, min_gpu_mem); + else if (!detected) + vcos_log_error("Camera is not detected. Please check carefully the camera module is installed correctly\n"); + else + vcos_log_error("Failed to run camera app. Please check for firmware updates\n"); +} + diff --git a/raspicam/RaspiCamControl.h b/raspicam/RaspiCamControl.h new file mode 100644 index 0000000..78e15de --- /dev/null +++ b/raspicam/RaspiCamControl.h @@ -0,0 +1,184 @@ +/* +Copyright (c) 2013, Broadcom Europe Ltd +Copyright (c) 2013, James Hughes +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef RASPICAMCONTROL_H_ +#define RASPICAMCONTROL_H_ + +/* Various parameters + * + * Exposure Mode + * MMAL_PARAM_EXPOSUREMODE_OFF, + MMAL_PARAM_EXPOSUREMODE_AUTO, + MMAL_PARAM_EXPOSUREMODE_NIGHT, + MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW, + MMAL_PARAM_EXPOSUREMODE_BACKLIGHT, + MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT, + MMAL_PARAM_EXPOSUREMODE_SPORTS, + MMAL_PARAM_EXPOSUREMODE_SNOW, + MMAL_PARAM_EXPOSUREMODE_BEACH, + MMAL_PARAM_EXPOSUREMODE_VERYLONG, + MMAL_PARAM_EXPOSUREMODE_FIXEDFPS, + MMAL_PARAM_EXPOSUREMODE_ANTISHAKE, + MMAL_PARAM_EXPOSUREMODE_FIREWORKS, + * + * AWB Mode + * MMAL_PARAM_AWBMODE_OFF, + MMAL_PARAM_AWBMODE_AUTO, + MMAL_PARAM_AWBMODE_SUNLIGHT, + MMAL_PARAM_AWBMODE_CLOUDY, + MMAL_PARAM_AWBMODE_SHADE, + MMAL_PARAM_AWBMODE_TUNGSTEN, + MMAL_PARAM_AWBMODE_FLUORESCENT, + MMAL_PARAM_AWBMODE_INCANDESCENT, + MMAL_PARAM_AWBMODE_FLASH, + MMAL_PARAM_AWBMODE_HORIZON, + * + * Image FX + MMAL_PARAM_IMAGEFX_NONE, + MMAL_PARAM_IMAGEFX_NEGATIVE, + MMAL_PARAM_IMAGEFX_SOLARIZE, + MMAL_PARAM_IMAGEFX_POSTERIZE, + MMAL_PARAM_IMAGEFX_WHITEBOARD, + MMAL_PARAM_IMAGEFX_BLACKBOARD, + MMAL_PARAM_IMAGEFX_SKETCH, + MMAL_PARAM_IMAGEFX_DENOISE, + MMAL_PARAM_IMAGEFX_EMBOSS, + MMAL_PARAM_IMAGEFX_OILPAINT, + MMAL_PARAM_IMAGEFX_HATCH, + MMAL_PARAM_IMAGEFX_GPEN, + MMAL_PARAM_IMAGEFX_PASTEL, + MMAL_PARAM_IMAGEFX_WATERCOLOUR, + MMAL_PARAM_IMAGEFX_FILM, + MMAL_PARAM_IMAGEFX_BLUR, + MMAL_PARAM_IMAGEFX_SATURATION, + MMAL_PARAM_IMAGEFX_COLOURSWAP, + MMAL_PARAM_IMAGEFX_WASHEDOUT, + MMAL_PARAM_IMAGEFX_POSTERISE, + MMAL_PARAM_IMAGEFX_COLOURPOINT, + MMAL_PARAM_IMAGEFX_COLOURBALANCE, + MMAL_PARAM_IMAGEFX_CARTOON, + + */ + + + +// There isn't actually a MMAL structure for the following, so make one +typedef struct +{ + int enable; /// Turn colourFX on or off + int u,v; /// U and V to use +} MMAL_PARAM_COLOURFX_T; + +typedef struct +{ + int enable; + int width,height; + int quality; +} MMAL_PARAM_THUMBNAIL_CONFIG_T; + +typedef struct +{ + double x; + double y; + double w; + double h; +} PARAM_FLOAT_RECT_T; + +/// struct contain camera settings +typedef struct RASPICAM_CAMERA_PARAMETERS +{ + int sharpness; /// -100 to 100 + int contrast; /// -100 to 100 + int brightness; /// 0 to 100 + int saturation; /// -100 to 100 + int ISO; /// TODO : what range? + int videoStabilisation; /// 0 or 1 (false or true) + int exposureCompensation; /// -10 to +10 ? + MMAL_PARAM_EXPOSUREMODE_T exposureMode; + MMAL_PARAM_EXPOSUREMETERINGMODE_T exposureMeterMode; + MMAL_PARAM_AWBMODE_T awbMode; + MMAL_PARAM_IMAGEFX_T imageEffect; + MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imageEffectsParameters; + MMAL_PARAM_COLOURFX_T colourEffects; + int rotation; /// 0-359 + int hflip; /// 0 or 1 + int vflip; /// 0 or 1 + PARAM_FLOAT_RECT_T roi; /// region of interest to use on the sensor. Normalised [0,1] values in the rect + int shutter_speed; /// 0 = auto, otherwise the shutter speed in ms +} RASPICAM_CAMERA_PARAMETERS; + + +void raspicamcontrol_check_configuration(int min_gpu_mem); + +int raspicamcontrol_parse_cmdline(RASPICAM_CAMERA_PARAMETERS *params, const char *arg1, const char *arg2); +void raspicamcontrol_display_help(); +int raspicamcontrol_cycle_test(MMAL_COMPONENT_T *camera); + +int raspicamcontrol_set_all_parameters(MMAL_COMPONENT_T *camera, const RASPICAM_CAMERA_PARAMETERS *params); +int raspicamcontrol_get_all_parameters(MMAL_COMPONENT_T *camera, RASPICAM_CAMERA_PARAMETERS *params); +void raspicamcontrol_dump_parameters(const RASPICAM_CAMERA_PARAMETERS *params); + +void raspicamcontrol_set_defaults(RASPICAM_CAMERA_PARAMETERS *params); + +void raspicamcontrol_check_configuration(int min_gpu_mem); + +// Individual setting functions +int raspicamcontrol_set_saturation(MMAL_COMPONENT_T *camera, int saturation); +int raspicamcontrol_set_sharpness(MMAL_COMPONENT_T *camera, int sharpness); +int raspicamcontrol_set_contrast(MMAL_COMPONENT_T *camera, int contrast); +int raspicamcontrol_set_brightness(MMAL_COMPONENT_T *camera, int brightness); +int raspicamcontrol_set_ISO(MMAL_COMPONENT_T *camera, int ISO); +int raspicamcontrol_set_metering_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_EXPOSUREMETERINGMODE_T mode); +int raspicamcontrol_set_video_stabilisation(MMAL_COMPONENT_T *camera, int vstabilisation); +int raspicamcontrol_set_exposure_compensation(MMAL_COMPONENT_T *camera, int exp_comp); +int raspicamcontrol_set_exposure_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_EXPOSUREMODE_T mode); +int raspicamcontrol_set_awb_mode(MMAL_COMPONENT_T *camera, MMAL_PARAM_AWBMODE_T awb_mode); +int raspicamcontrol_set_imageFX(MMAL_COMPONENT_T *camera, MMAL_PARAM_IMAGEFX_T imageFX); +int raspicamcontrol_set_colourFX(MMAL_COMPONENT_T *camera, const MMAL_PARAM_COLOURFX_T *colourFX); +int raspicamcontrol_set_rotation(MMAL_COMPONENT_T *camera, int rotation); +int raspicamcontrol_set_flips(MMAL_COMPONENT_T *camera, int hflip, int vflip); +int raspicamcontrol_set_ROI(MMAL_COMPONENT_T *camera, PARAM_FLOAT_RECT_T rect); +int raspicamcontrol_set_shutter_speed(MMAL_COMPONENT_T *camera, int speed_ms); + +//Individual getting functions +int raspicamcontrol_get_saturation(MMAL_COMPONENT_T *camera); +int raspicamcontrol_get_sharpness(MMAL_COMPONENT_T *camera); +int raspicamcontrol_get_contrast(MMAL_COMPONENT_T *camera); +int raspicamcontrol_get_brightness(MMAL_COMPONENT_T *camera); +int raspicamcontrol_get_ISO(MMAL_COMPONENT_T *camera); +MMAL_PARAM_EXPOSUREMETERINGMODE_T raspicamcontrol_get_metering_mode(MMAL_COMPONENT_T *camera); +int raspicamcontrol_get_video_stabilisation(MMAL_COMPONENT_T *camera); +int raspicamcontrol_get_exposure_compensation(MMAL_COMPONENT_T *camera); +MMAL_PARAM_THUMBNAIL_CONFIG_T raspicamcontrol_get_thumbnail_parameters(MMAL_COMPONENT_T *camera); +MMAL_PARAM_EXPOSUREMODE_T raspicamcontrol_get_exposure_mode(MMAL_COMPONENT_T *camera); +MMAL_PARAM_AWBMODE_T raspicamcontrol_get_awb_mode(MMAL_COMPONENT_T *camera); +MMAL_PARAM_IMAGEFX_T raspicamcontrol_get_imageFX(MMAL_COMPONENT_T *camera); +MMAL_PARAM_COLOURFX_T raspicamcontrol_get_colourFX(MMAL_COMPONENT_T *camera); + + +#endif /* RASPICAMCONTROL_H_ */ diff --git a/stream.c b/stream.c index 8f8d6a5..768e132 100644 --- a/stream.c +++ b/stream.c @@ -1080,35 +1080,12 @@ void stream_stop(struct context *cnt) " & active motion-stream sockets"); } -/* - * stream_put - * Is the starting point of the stream loop. It is called from - * the motion_loop with the argument 'image' pointing to the latest frame. - * If config option 'stream_motion' is 'on' this function is called once - * per second (frame 0) and when Motion is detected excl pre_capture. - * If config option 'stream_motion' is 'off' this function is called once - * per captured picture frame. - * It is always run in setup mode for each picture frame captured and with - * the special setup image. - * The function does two things: - * It looks for possible waiting new clients and adds them. - * It sends latest picture frame to all connected clients. - * Note: Clients that have disconnected are handled in the stream_flush() - * function. - */ -void stream_put(struct context *cnt, unsigned char *image) +void stream_put_pre(struct context *cnt) { struct timeval timeout; - struct stream_buffer *tmpbuffer; fd_set fdread; int sl = cnt->stream.socket; int sc; - /* Tthe following string has an extra 16 chars at end for length. */ - const char jpeghead[] = "--BoundaryString\r\n" - "Content-type: image/jpeg\r\n" - "Content-Length: "; - int headlength = sizeof(jpeghead) - 1; /* Don't include terminator. */ - char len[20]; /* Will be used for sprintf, must be >= 16 */ /* * Timeout struct used to timeout the time we wait for a client @@ -1144,6 +1121,47 @@ void stream_put(struct context *cnt, unsigned char *image) /* Call flush to send any previous partial-sends which are waiting. */ stream_flush(&cnt->stream, &cnt->stream_count, cnt->conf.stream_limit); +} + +void stream_put_post(struct context *cnt) +{ + /* + * Now we call flush again. This time (assuming some clients were + * ready for the new frame) the new data will be written out. + */ + stream_flush(&cnt->stream, &cnt->stream_count, cnt->conf.stream_limit); + + /* Unlock the mutex */ + if (cnt->conf.stream_auth_method != 0) + pthread_mutex_unlock(&stream_auth_mutex); +} + +/* + * stream_put + * Is the starting point of the stream loop. It is called from + * the motion_loop with the argument 'image' pointing to the latest frame. + * If config option 'stream_motion' is 'on' this function is called once + * per second (frame 0) and when Motion is detected excl pre_capture. + * If config option 'stream_motion' is 'off' this function is called once + * per captured picture frame. + * It is always run in setup mode for each picture frame captured and with + * the special setup image. + * The function does two things: + * It looks for possible waiting new clients and adds them. + * It sends latest picture frame to all connected clients. + * Note: Clients that have disconnected are handled in the stream_flush() + * function. + */ +void stream_put(struct context *cnt, unsigned char *image, int width, int height, int size) +{ + struct stream_buffer *tmpbuffer; + const char jpeghead[] = "--BoundaryString\r\n" + "Content-type: image/jpeg\r\n" + "Content-Length: "; + int headlength = sizeof(jpeghead) - 1; /* Don't include terminator. */ + char len[20]; /* Will be used for sprintf, must be >= 16 */ + + stream_put_pre(cnt); /* Check if any clients have available buffers. */ if (stream_check_write(&cnt->stream)) { @@ -1153,7 +1171,7 @@ void stream_put(struct context *cnt, unsigned char *image) * than necessary, but it is difficult to estimate the * minimum size actually required. */ - tmpbuffer = stream_tmpbuffer(cnt->imgs.size); + tmpbuffer = stream_tmpbuffer(size); /* Check if allocation was ok. */ if (tmpbuffer) { @@ -1178,8 +1196,8 @@ void stream_put(struct context *cnt, unsigned char *image) wptr += headlength; /* Create a jpeg image and place into tmpbuffer. */ - tmpbuffer->size = put_picture_memory(cnt, wptr, cnt->imgs.size, image, - cnt->conf.stream_quality); + tmpbuffer->size = put_picture_memory(cnt, wptr, size, image, + width, height, cnt->conf.stream_quality); /* Fill in the image length into the header. */ imgsize = sprintf(len, "%9ld\r\n\r\n", tmpbuffer->size); @@ -1205,15 +1223,76 @@ void stream_put(struct context *cnt, unsigned char *image) } } - /* - * Now we call flush again. This time (assuming some clients were - * ready for the new frame) the new data will be written out. - */ - stream_flush(&cnt->stream, &cnt->stream_count, cnt->conf.stream_limit); + stream_put_post(cnt); +} - /* Unlock the mutex */ - if (cnt->conf.stream_auth_method != 0) - pthread_mutex_unlock(&stream_auth_mutex); +void stream_put_encoded(struct context *cnt, unsigned char *jpeg_image, int width, int height, int size) +{ + struct stream_buffer *tmpbuffer; + const char jpeghead[] = "--BoundaryString\r\n" + "Content-type: image/jpeg\r\n" + "Content-Length: "; + int headlength = sizeof(jpeghead) - 1; /* Don't include terminator. */ + char len[20]; /* Will be used for sprintf, must be >= 16 */ - return; + stream_put_pre(cnt); + + /* Check if any clients have available buffers. */ + if (stream_check_write(&cnt->stream)) { + /* + * Yes - create a new tmpbuffer for current image. + */ + tmpbuffer = stream_tmpbuffer(size + headlength + 2); + + /* Check if allocation was ok. */ + if (tmpbuffer) { + int imgsize; + + /* + * We need a pointer that points to the picture buffer + * just after the mjpeg header. We create a working pointer wptr + * to be used in the call to put_picture_memory which we can change + * and leave tmpbuffer->ptr intact. + */ + unsigned char *wptr = tmpbuffer->ptr; + + /* + * For web protocol, our image needs to be preceded + * with a little HTTP, so we put that into the buffer + * first. + */ + memcpy(wptr, jpeghead, headlength); + + /* Update our working pointer to point past header. */ + wptr += headlength; + + /* Create a jpeg image and place into tmpbuffer. */ + memcpy(wptr, jpeg_image, size); + tmpbuffer->size = size; + + /* Fill in the image length into the header. */ + imgsize = sprintf(len, "%9ld\r\n\r\n", tmpbuffer->size); + memcpy(wptr - imgsize, len, imgsize); + + /* Append a CRLF for good measure. */ + memcpy(wptr + tmpbuffer->size, "\r\n", 2); + + /* + * Now adjust tmpbuffer->size to reflect the + * header at the beginning and the extra CRLF + * at the end. + */ + tmpbuffer->size += headlength + 2; + + /* + * And finally put this buffer to all clients with + * no outstanding data from previous frames. + */ + stream_add_write(&cnt->stream, tmpbuffer, cnt->conf.stream_maxrate); + } else { + MOTION_LOG(ERR, TYPE_STREAM, SHOW_ERRNO, "%s: Error creating tmpbuffer"); + } + } + + stream_put_post(cnt); } diff --git a/stream.h b/stream.h index 33d31ad..34f1063 100644 --- a/stream.h +++ b/stream.h @@ -39,7 +39,8 @@ struct stream { }; int stream_init(struct context *); -void stream_put(struct context *, unsigned char *); +void stream_put(struct context *, unsigned char *, int, int, int); +void stream_put_encoded(struct context *cnt, unsigned char *, int, int, int); void stream_stop(struct context *); #endif /* _INCLUDE_STREAM_H_ */ diff --git a/track.h b/track.h index 0e44ae6..2b12687 100644 --- a/track.h +++ b/track.h @@ -9,7 +9,7 @@ #ifndef _INCLUDE_TRACK_H #define _INCLUDE_TRACK_H -#include "alg.h" +#include "coord.h" #include struct trackoptions { diff --git a/utils.c b/utils.c new file mode 100644 index 0000000..00c8a64 --- /dev/null +++ b/utils.c @@ -0,0 +1,41 @@ +/* + * utils.c + * + * Created on: 16 Jun 2013 + * Author: ntuckett + */ + +#include + +struct timespec timespec_diff(struct timespec start, struct timespec end) +{ + struct timespec temp; + if ((end.tv_nsec-start.tv_nsec)<0) { + temp.tv_sec = end.tv_sec-start.tv_sec-1; + temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec; + } else { + temp.tv_sec = end.tv_sec-start.tv_sec; + temp.tv_nsec = end.tv_nsec-start.tv_nsec; + } + return temp; +} + +int get_elapsed_time_ms() +{ + static int base_set = 0; + static struct timespec base_tspec; + struct timespec tspec; + + if (base_set == 0) + { + base_set = 1; + clock_gettime(CLOCK_REALTIME, &base_tspec); + } + + clock_gettime(CLOCK_REALTIME, &tspec); + struct timespec diff = timespec_diff(base_tspec, tspec); + + return (diff.tv_nsec / 1000000) + (diff.tv_sec * 1000); +} + + diff --git a/utils.h b/utils.h new file mode 100644 index 0000000..1616653 --- /dev/null +++ b/utils.h @@ -0,0 +1,13 @@ +/* + * utils.h + * + * Created on: 16 Jun 2013 + * Author: ntuckett + */ + +#ifndef UTILS_H_ +#define UTILS_H_ + +extern int get_elapsed_time_ms(); + +#endif /* UTILS_H_ */ diff --git a/version.sh b/version.sh deleted file mode 100755 index 68dc73e..0000000 --- a/version.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -SNV_VERSION=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2` -test $SNV_VERSION || SNV_VERSION=`cd "$1" && grep revision .svn/entries 2>/dev/null | cut -d '"' -f2` -test $SNV_VERSION || SNV_VERSION=UNKNOWN -echo -n "trunkREV$SNV_VERSION" diff --git a/video.h b/video.h index 12f2928..bec789a 100644 --- a/video.h +++ b/video.h @@ -87,7 +87,7 @@ struct video_dev { /* video functions, video_common.c */ int vid_start(struct context *cnt); -int vid_next(struct context *cnt, unsigned char *map); +int vid_next(struct context *cnt, unsigned char *map, struct image_data* imgdat); void vid_close(struct context *cnt); void vid_cleanup(void); void vid_init(void); diff --git a/video_common.c b/video_common.c index 9f8d6a0..40c07e9 100644 --- a/video_common.c +++ b/video_common.c @@ -550,6 +550,12 @@ void vid_close(struct context *cnt) struct video_dev *prev = NULL; #endif /* WITHOUT_V4L */ + if (cnt->video_source.video_source_cleanup_fn) { + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "%s: calling video source cleanup"); + cnt->video_source.video_source_cleanup_fn(cnt); + return; + } + else /* Cleanup the netcam part */ if (cnt->netcam) { MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "%s: calling netcam_cleanup"); @@ -858,6 +864,13 @@ int vid_start(struct context *cnt) struct config *conf = &cnt->conf; int dev = -1; + if (cnt->video_source.video_source_start_fn) { + dev = cnt->video_source.video_source_start_fn(cnt); + if (dev < 0) { + cnt->video_source.video_source_cleanup_fn(cnt); + } + } + else if (conf->netcam_url) { dev = netcam_start(cnt); if (dev < 0) { @@ -884,6 +897,7 @@ int vid_start(struct context *cnt) * Parameters: * cnt Pointer to the context for this thread * map Pointer to the buffer in which the function puts the new image + * map2 Pointer to the secondary buffer in which the function puts the new image (optional, can be NULL) * * Global variable * viddevs The viddevs struct is "global" within the context of video.c @@ -896,11 +910,15 @@ int vid_start(struct context *cnt) * with bit 0 set Non fatal V4L error (copy grey image and discard this image) * with bit 1 set Non fatal Netcam error */ -int vid_next(struct context *cnt, unsigned char *map) +int vid_next(struct context *cnt, unsigned char *map, struct image_data* imgdat) { int ret = -2; struct config *conf = &cnt->conf; + if (cnt->video_source.video_source_next_fn) { + return cnt->video_source.video_source_next_fn(cnt, imgdat); + } + else if (conf->netcam_url) { if (cnt->video_dev == -1) return NETCAM_GENERAL_ERROR; diff --git a/videosourceplugin.c b/videosourceplugin.c new file mode 100644 index 0000000..5a0fbae --- /dev/null +++ b/videosourceplugin.c @@ -0,0 +1,27 @@ +/* + * videosourceplugin.c + * + * Created on: 16 Jun 2013 + * Author: ntuckett + */ +#include "motion.h" + +void video_source_plugins_init(struct context *cnt) { + cnt->imgs.secondary_width = 0; + cnt->imgs.secondary_height = 0; + cnt->imgs.secondary_size = 0; + + struct config *conf = &cnt->conf; + + if (conf->filecam_path) { + filecam_select_as_plugin(cnt); + return; + } +#ifdef HAVE_MMAL + if (conf->mmalcam_name) { + mmalcam_select_as_plugin(cnt); + return; + } +#endif +} + diff --git a/videosourceplugin.h b/videosourceplugin.h new file mode 100644 index 0000000..9b848d9 --- /dev/null +++ b/videosourceplugin.h @@ -0,0 +1,28 @@ +/* + * sourceplugin.h + * + * Created on: 16 Jun 2013 + * Author: ntuckett + */ + +#ifndef VIDEOSOURCEPLUGIN_H_ +#define VIDEOSOURCEPLUGIN_H_ + +struct context; +struct image_data; + +typedef int (*video_source_start_ptr)(struct context *); +typedef int (*video_source_next_ptr)(struct context *, struct image_data* imgdat); +typedef void (*video_source_cleanup_ptr)(struct context *); + +typedef struct video_source_plugin *video_source_plugin_ptr; + +typedef struct video_source_plugin { + video_source_start_ptr video_source_start_fn; + video_source_next_ptr video_source_next_fn; + video_source_cleanup_ptr video_source_cleanup_fn; +} video_source_plugin; + +extern void video_source_plugins_init(struct context *cnt); + +#endif /* VIDEOSOURCEPLUGIN_H_ */