diff --git a/CHANGELOG b/CHANGELOG index 9601790..4cdbd61 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,8 +2,6 @@ SVN trunk Summary of Changes Features * Insert Blanking frames http://www.lavrsen.dk/twiki/bin/view/Motion/FeatureRequest2007x12x16x132522 (Dag Erlandsson) - * Added to configure.in --with-pwcbsd to allow compile motion in freebsd with webcam support instead of bktr - (Angel Carpintero) Bugfixes @@ -34,6 +32,8 @@ Features * 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). diff --git a/CREDITS b/CREDITS index 01556e0..a0d4581 100644 --- a/CREDITS +++ b/CREDITS @@ -394,6 +394,7 @@ Angel Carpintero * Fix broken PostgreSQL detection for custom location, http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2008x02x25x025134 * Fixed stepper when is used track_auto on. + * Added to configure.in --with-pwcbsd to allow compile motion in freebsd with webcam support instead of bktr. Jared D * Change bayer2rgb24() to fix a problem with sn9c102 driver diff --git a/README.FreeBSD b/README.FreeBSD index ccf6137..2980532 100644 --- a/README.FreeBSD +++ b/README.FreeBSD @@ -63,6 +63,9 @@ Packages needed (dependencies for 6.x): - pwcbsd-1.4.1_1 ( with mmap support ) - v4l_compat-1.0.20060801 + run : ./configure --with-pwcbsd ; gmake ; gmake install + + * TODO * -------- diff --git a/configure b/configure index fd628a8..e48eca3 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for motion trunk-r335. +# Generated by GNU Autoconf 2.61 for motion trunk-r338. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='motion' PACKAGE_TARNAME='motion' -PACKAGE_VERSION='trunk-r335' -PACKAGE_STRING='motion trunk-r335' +PACKAGE_VERSION='trunk-r338' +PACKAGE_STRING='motion trunk-r338' PACKAGE_BUGREPORT='' ac_unique_file="motion.c" @@ -1178,7 +1178,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures motion trunk-r335 to adapt to many kinds of systems. +\`configure' configures motion trunk-r338 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1239,7 +1239,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of motion trunk-r335:";; + short | recursive ) echo "Configuration of motion trunk-r338:";; esac cat <<\_ACEOF @@ -1375,7 +1375,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -motion configure trunk-r335 +motion configure trunk-r338 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1389,7 +1389,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by motion $as_me trunk-r335, which was +It was created by motion $as_me trunk-r338, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -7538,7 +7538,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by motion $as_me trunk-r335, which was +This file was extended by motion $as_me trunk-r338, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7587,7 +7587,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -motion config.status trunk-r335 +motion config.status trunk-r338 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/video.c b/video.c index 40c58f8..20b1a01 100644 --- a/video.c +++ b/video.c @@ -33,7 +33,7 @@ static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev) if (cnt->conf.contrast && cnt->conf.contrast != viddev->contrast) { - if (ioctl(dev, VIDIOCGPICT, &vid_pic)==-1) + if (ioctl(dev, VIDIOCGPICT, &vid_pic) == -1) motion_log(LOG_ERR, 1, "ioctl (VIDIOCGPICT)"); make_change = 1; @@ -56,7 +56,7 @@ static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev) if (cnt->conf.hue && cnt->conf.hue != viddev->hue) { if (!make_change) { - if (ioctl(dev, VIDIOCGPICT, &vid_pic)==-1) + if (ioctl(dev, VIDIOCGPICT, &vid_pic) == -1) motion_log(LOG_ERR, 1, "ioctl (VIDIOCGPICT)"); } @@ -70,7 +70,7 @@ static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev) if (vid_do_autobright(cnt, viddev)) { /* If we already read the VIDIOGPICT - we should not do it again */ if (!make_change) { - if (ioctl(dev, VIDIOCGPICT, &vid_pic)==-1) + if (ioctl(dev, VIDIOCGPICT, &vid_pic) == -1) motion_log(LOG_ERR, 1, "ioctl (VIDIOCGPICT)"); } @@ -81,7 +81,7 @@ static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev) } else { if (cnt->conf.brightness && cnt->conf.brightness != viddev->brightness) { if (!make_change) { - if (ioctl(dev, VIDIOCGPICT, &vid_pic)==-1) + if (ioctl(dev, VIDIOCGPICT, &vid_pic) == -1) motion_log(LOG_ERR, 1, "ioctl (VIDIOCGPICT)"); } @@ -92,7 +92,7 @@ static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev) } if (make_change) { - if (ioctl(dev, VIDIOCSPICT, &vid_pic)==-1) + if (ioctl(dev, VIDIOCSPICT, &vid_pic) == -1) motion_log(LOG_ERR, 1, "ioctl (VIDIOCSPICT)"); } } @@ -121,7 +121,7 @@ unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, int widt } if (vid_caps.type & VID_TYPE_MONOCHROME) - viddev->v4l_fmt=VIDEO_PALETTE_GREY; + viddev->v4l_fmt = VIDEO_PALETTE_GREY; if (input != IN_DEFAULT) { memset(&vid_chnl, 0, sizeof(struct video_channel)); @@ -142,15 +142,15 @@ unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, int widt if (freq) { memset(&vid_tuner, 0, sizeof(struct video_tuner)); vid_tuner.tuner = tuner_number; - if (ioctl (dev, VIDIOCGTUNER, &vid_tuner)==-1) { + if (ioctl (dev, VIDIOCGTUNER, &vid_tuner) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCGTUNER)"); } else { if (vid_tuner.flags & VIDEO_TUNER_LOW) { - freq=freq*16; /* steps of 1/16 KHz */ + freq = freq*16; /* steps of 1/16 KHz */ } else { - freq=(freq*10)/625; + freq = (freq*10)/625; } - if (ioctl(dev, VIDIOCSFREQ, &freq)==-1) { + if (ioctl(dev, VIDIOCSFREQ, &freq) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCSFREQ)"); return (NULL); } @@ -165,46 +165,46 @@ unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, int widt motion_log(LOG_ERR, 0, "Motion only supports mmap."); return NULL; } else { - map=mmap(0, vid_buf.size, PROT_READ|PROT_WRITE, MAP_SHARED, dev, 0); - viddev->size_map=vid_buf.size; - if (vid_buf.frames>1) { - viddev->v4l_maxbuffer=2; - viddev->v4l_buffers[0]=map; - viddev->v4l_buffers[1]=(unsigned char *)map + vid_buf.offsets[1]; + map = mmap(0, vid_buf.size, PROT_READ|PROT_WRITE, MAP_SHARED, dev, 0); + viddev->size_map = vid_buf.size; + if (vid_buf.frames > 1) { + viddev->v4l_maxbuffer = 2; + viddev->v4l_buffers[0] = map; + viddev->v4l_buffers[1] = (unsigned char *)map + vid_buf.offsets[1]; } else { - viddev->v4l_buffers[0]=map; - viddev->v4l_maxbuffer=1; + viddev->v4l_buffers[0] = map; + viddev->v4l_maxbuffer = 1; } if (MAP_FAILED == map) { motion_log(LOG_ERR,1,"MAP_FAILED"); return (NULL); } - viddev->v4l_curbuffer=0; - vid_mmap.format=viddev->v4l_fmt; - vid_mmap.frame=viddev->v4l_curbuffer; - vid_mmap.width=width; - vid_mmap.height=height; + viddev->v4l_curbuffer = 0; + vid_mmap.format = viddev->v4l_fmt; + vid_mmap.frame = viddev->v4l_curbuffer; + vid_mmap.width = width; + vid_mmap.height = height; if (ioctl(dev, VIDIOCMCAPTURE, &vid_mmap) == -1) { motion_log(LOG_DEBUG, 1, "Failed with YUV420P, trying YUV422 palette"); - viddev->v4l_fmt=VIDEO_PALETTE_YUV422; - vid_mmap.format=viddev->v4l_fmt; + viddev->v4l_fmt = VIDEO_PALETTE_YUV422; + vid_mmap.format = viddev->v4l_fmt; /* Try again... */ if (ioctl(dev, VIDIOCMCAPTURE, &vid_mmap) == -1) { motion_log(LOG_DEBUG, 1, "Failed with YUV422, trying YUYV palette"); - viddev->v4l_fmt=VIDEO_PALETTE_YUYV; - vid_mmap.format=viddev->v4l_fmt; + viddev->v4l_fmt = VIDEO_PALETTE_YUYV; + vid_mmap.format = viddev->v4l_fmt; if (ioctl(dev, VIDIOCMCAPTURE, &vid_mmap) == -1) { motion_log(LOG_DEBUG, 1, "Failed with YUYV, trying RGB24 palette"); - viddev->v4l_fmt=VIDEO_PALETTE_RGB24; - vid_mmap.format=viddev->v4l_fmt; + viddev->v4l_fmt = VIDEO_PALETTE_RGB24; + vid_mmap.format = viddev->v4l_fmt; /* Try again... */ if (ioctl(dev, VIDIOCMCAPTURE, &vid_mmap) == -1) { motion_log(LOG_DEBUG, 1, "Failed with RGB24, trying GREYSCALE palette"); - viddev->v4l_fmt=VIDEO_PALETTE_GREY; - vid_mmap.format=viddev->v4l_fmt; + viddev->v4l_fmt = VIDEO_PALETTE_GREY; + vid_mmap.format = viddev->v4l_fmt; /* Try one last time... */ if (ioctl(dev, VIDIOCMCAPTURE, &vid_mmap) == -1) { motion_log(LOG_ERR, 1, "Failed with all supported palettes " @@ -219,23 +219,23 @@ unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, int widt switch (viddev->v4l_fmt) { case VIDEO_PALETTE_YUV420P: - viddev->v4l_bufsize=(width*height*3)/2; + viddev->v4l_bufsize = (width*height*3)/2; motion_log(LOG_DEBUG, 0, "Using VIDEO_PALETTE_YUV420P palette"); break; case VIDEO_PALETTE_YUV422: - viddev->v4l_bufsize=(width*height*2); + viddev->v4l_bufsize = (width*height*2); motion_log(LOG_DEBUG, 0, "Using VIDEO_PALETTE_YUV422 palette"); break; case VIDEO_PALETTE_YUYV: - viddev->v4l_bufsize=(width*height*2); + viddev->v4l_bufsize = (width*height*2); motion_log(LOG_DEBUG, 0, "Using VIDEO_PALETTE_YUYV palette"); break; case VIDEO_PALETTE_RGB24: - viddev->v4l_bufsize=(width*height*3); + viddev->v4l_bufsize = (width*height*3); motion_log(LOG_DEBUG, 0, "Using VIDEO_PALETTE_RGB24 palette"); break; case VIDEO_PALETTE_GREY: - viddev->v4l_bufsize=width*height; + viddev->v4l_bufsize = width*height; motion_log(LOG_DEBUG, 0, "Using VIDEO_PALETTE_GREY palette"); break; } @@ -296,7 +296,7 @@ int v4l_next(struct video_dev *viddev, unsigned char *map, int width, int height return V4L_FATAL_ERROR; } - vid_mmap.frame=frame; + vid_mmap.frame = frame; if (ioctl(dev, VIDIOCSYNC, &vid_mmap.frame) == -1) { motion_log(LOG_ERR, 1, "sync error in proc %d", getpid()); @@ -323,28 +323,28 @@ int v4l_next(struct video_dev *viddev, unsigned char *map, int width, int height void v4l_set_input(struct context *cnt, struct video_dev *viddev, unsigned char *map, int width, int height, int input, int norm, int skip, unsigned long freq, int tuner_number) { - int dev=viddev->fd; + int dev = viddev->fd; int i; struct video_channel vid_chnl; struct video_tuner vid_tuner; unsigned long frequnits = freq; - if (input != viddev->input || width != viddev->width || height!=viddev->height || - freq!=viddev->freq || tuner_number!=viddev->tuner_number) { + if (input != viddev->input || width != viddev->width || height != viddev->height || + freq != viddev->freq || tuner_number != viddev->tuner_number) { if (freq) { memset(&vid_tuner, 0, sizeof(struct video_tuner)); vid_tuner.tuner = tuner_number; - if (ioctl (dev, VIDIOCGTUNER, &vid_tuner)==-1) { + if (ioctl (dev, VIDIOCGTUNER, &vid_tuner) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCGTUNER)"); } else { if (vid_tuner.flags & VIDEO_TUNER_LOW) { - frequnits=freq*16; /* steps of 1/16 KHz */ + frequnits = freq*16; /* steps of 1/16 KHz */ } else { - frequnits=(freq*10)/625; + frequnits = (freq*10)/625; } - if (ioctl(dev, VIDIOCSFREQ, &frequnits)==-1) { + if (ioctl(dev, VIDIOCSFREQ, &frequnits) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCSFREQ)"); return; } @@ -365,13 +365,13 @@ void v4l_set_input(struct context *cnt, struct video_dev *viddev, unsigned char } } v4l_picture_controls(cnt, viddev); - viddev->input=input; - viddev->width=width; - viddev->height=height; - viddev->freq=freq; - viddev->tuner_number=tuner_number; + viddev->input = input; + viddev->width = width; + viddev->height = height; + viddev->freq =freq; + viddev->tuner_number = tuner_number; /* skip a few frames if needed */ - for (i=0; i1) { - buffer[strlen(buffer)-1]=0; + if (strlen(buffer) > 1) { + buffer[strlen(buffer)-1] = 0; loop=strtok(buffer, "\t"); input=strtok(NULL, "\t"); istatus=strtok(NULL, "\t"); output=strtok(NULL, "\t"); ostatus=strtok(NULL, "\t"); - if (istatus[0]=='-') { + if (istatus[0] == '-') { snprintf(pipepath, 255, "/dev/%s", input); - pipe_fd=open(pipepath, O_RDWR); - if (pipe_fd>=0) { + pipe_fd = open(pipepath, O_RDWR); + if (pipe_fd >= 0) { motion_log(-1, 0, "\tInput: /dev/%s", input); motion_log(-1, 0, "\tOutput: /dev/%s", output); break; @@ -450,14 +450,14 @@ static int v4l_open_vidpipe(void) } else { DIR *dir; struct dirent *dirp; - const char prefix[]="/sys/class/video4linux/"; + const char prefix[] = "/sys/class/video4linux/"; char *ptr, *io; int fd; - int low=9999; + int low = 9999; int tfd; int tnum; - if ((dir=opendir(prefix))== NULL) { + if ((dir=opendir(prefix)) == NULL) { motion_log(LOG_ERR, 1, "Failed to open '%s'", prefix); return -1; } @@ -466,8 +466,8 @@ static int v4l_open_vidpipe(void) strncpy(buffer, prefix, 255); strncat(buffer, dirp->d_name, 255); strncat(buffer, "/name", 255); - if ((fd=open(buffer, O_RDONLY)) >= 0) { - if ((read(fd, buffer, sizeof(buffer)-1))<0) { + if ((fd = open(buffer, O_RDONLY)) >= 0) { + if ((read(fd, buffer, sizeof(buffer)-1)) < 0) { close(fd); continue; } @@ -483,7 +483,7 @@ static int v4l_open_vidpipe(void) close(fd); continue; } - if ((ptr=strtok(buffer, " "))==NULL) { + if ((ptr=strtok(buffer, " ")) == NULL) { close(fd); continue; } @@ -491,9 +491,9 @@ static int v4l_open_vidpipe(void) if (tnum < low) { strcpy(buffer, "/dev/"); strcat(buffer, dirp->d_name); - if ((tfd=open(buffer, O_RDWR))>=0) { + if ((tfd=open(buffer, O_RDWR)) >= 0) { strcpy(pipepath, buffer); - if (pipe_fd>=0) { + if (pipe_fd >= 0) { close(pipe_fd); } pipe_fd = tfd; @@ -511,36 +511,36 @@ static int v4l_open_vidpipe(void) return pipe_fd; } -static int v4l_startpipe(char *dev_name, int width, int height, int type) +static int v4l_startpipe(const char *dev_name, int width, int height, int type) { int dev; struct video_picture vid_pic; struct video_window vid_win; if (!strcmp(dev_name, "-")) { - dev=v4l_open_vidpipe(); + dev = v4l_open_vidpipe(); } else { - dev=open(dev_name, O_RDWR); + dev = open(dev_name, O_RDWR); } if (dev < 0) return(-1); - if (ioctl(dev, VIDIOCGPICT, &vid_pic)== -1) { + if (ioctl(dev, VIDIOCGPICT, &vid_pic) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCGPICT)"); return(-1); } vid_pic.palette=type; - if (ioctl(dev, VIDIOCSPICT, &vid_pic)== -1) { + if (ioctl(dev, VIDIOCSPICT, &vid_pic) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCSPICT)"); return(-1); } - if (ioctl(dev, VIDIOCGWIN, &vid_win)== -1) { + if (ioctl(dev, VIDIOCGWIN, &vid_win) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCGWIN)"); return(-1); } - vid_win.height=height; - vid_win.width=width; - if (ioctl(dev, VIDIOCSWIN, &vid_win)== -1) { + vid_win.height = height; + vid_win.width = width; + if (ioctl(dev, VIDIOCSWIN, &vid_win) == -1) { motion_log(LOG_ERR, 1, "ioctl (VIDIOCSWIN)"); return(-1); } @@ -555,7 +555,7 @@ static int v4l_putpipe (int dev, unsigned char *image, int size) int vid_startpipe(const char *dev_name, int width, int height, int type) { - return v4l_startpipe( (char *)dev_name, width, height, type); + return v4l_startpipe( dev_name, width, height, type); } int vid_putpipe (int dev, unsigned char *image, int size)