diff --git a/CODE_STANDARD b/CODE_STANDARD index 9104669..dd1be5a 100644 --- a/CODE_STANDARD +++ b/CODE_STANDARD @@ -118,6 +118,7 @@ if ((picture=fopen(cnt->conf.mask_file, "r"))) { 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); @@ -129,6 +130,40 @@ else 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. diff --git a/conf.h b/conf.h index 334e963..2296a71 100644 --- a/conf.h +++ b/conf.h @@ -1,126 +1,126 @@ /* - ** - ** conf.h - function prototypes for the config handling routines - ** - ** Originally written for the dproxy package by Matthew Pratt. - ** - ** Copyright 2000 Jeroen Vreeken (pe1rxq@chello.nl) - ** - ** This software is licensed under the terms of the GNU General - ** Public License (GPL). Please see the file COPYING for details. - ** - ** -*/ + * + * conf.h - function prototypes for the config handling routines + * + * Originally written for the dproxy package by Matthew Pratt. + * + * Copyright 2000 Jeroen Vreeken (pe1rxq@chello.nl) + * + * This software is licensed under the terms of the GNU General + * Public License (GPL). Please see the file COPYING for details. + * + * + */ #ifndef _INCLUDE_CONF_H #define _INCLUDE_CONF_H /* - more parameters may be added later. + more parameters may be added later. */ struct config { - int setup_mode; - int width; - int height; - int quality; - int rotate_deg; - int max_changes; - int threshold_tune; - const char *output_pictures; - int motion_img; - int emulate_motion; - int event_gap; - int max_movie_time; - int snapshot_interval; - const char *locate_motion; - int input; - int norm; - int frame_limit; - int quiet; - const char *picture_type; - int noise; - int noise_tune; - int minimum_frame_time; - int lightswitch; - int autobright; - int brightness; - int contrast; - int saturation; - int hue; - int roundrobin_frames; - int roundrobin_skip; - int pre_capture; - int post_capture; - int switchfilter; - int ffmpeg_output; - int ffmpeg_output_debug; - int ffmpeg_bps; - int ffmpeg_vbr; - int ffmpeg_deinterlace; - const char *ffmpeg_video_codec; - int stream_port; - int stream_quality; - int stream_motion; - int stream_maxrate; - int stream_localhost; - int stream_limit; - int webcontrol_port; - int webcontrol_localhost; - int webcontrol_html_output; - const char *webcontrol_authentication; - unsigned long frequency; - int tuner_number; - int timelapse; - const char *timelapse_mode; + int setup_mode; + int width; + int height; + int quality; + int rotate_deg; + int max_changes; + int threshold_tune; + const char *output_pictures; + int motion_img; + int emulate_motion; + int event_gap; + int max_movie_time; + int snapshot_interval; + const char *locate_motion; + int input; + int norm; + int frame_limit; + int quiet; + const char *picture_type; + int noise; + int noise_tune; + int minimum_frame_time; + int lightswitch; + int autobright; + int brightness; + int contrast; + int saturation; + int hue; + int roundrobin_frames; + int roundrobin_skip; + int pre_capture; + int post_capture; + int switchfilter; + int ffmpeg_output; + int ffmpeg_output_debug; + int ffmpeg_bps; + int ffmpeg_vbr; + int ffmpeg_deinterlace; + const char *ffmpeg_video_codec; + int stream_port; + int stream_quality; + int stream_motion; + int stream_maxrate; + int stream_localhost; + int stream_limit; + int webcontrol_port; + int webcontrol_localhost; + int webcontrol_html_output; + const char *webcontrol_authentication; + unsigned long frequency; + int tuner_number; + int timelapse; + const char *timelapse_mode; #if (defined(BSD)) - const char *tuner_device; + const char *tuner_device; #endif - const char *video_device; - short unsigned int v4l2_palette; - const char *vidpipe; - const char *filepath; - const char *imagepath; - const char *moviepath; - const char *snappath; - const char *timepath; - char *on_event_start; - char *on_event_end; - const char *mask_file; - int smart_mask_speed; - int sql_log_image; - int sql_log_snapshot; - int sql_log_movie; - int sql_log_timelapse; - const char *sql_query; - const char *database_type; - const char *database_dbname; - const char *database_host; - const char *database_user; - const char *database_password; - int database_port; - char *on_picture_save; - char *on_area_detected; - char *on_motion_detected; - char *on_movie_start; - char *on_movie_end; - char *on_camera_lost; - const char *motionvidpipe; - const char *netcam_url; - const char *netcam_userpass; - const char *netcam_keepalive; - const char *netcam_proxy; - unsigned int netcam_broken; - int text_changes; - const char *text_left; - const char *text_right; - const char *text_event; - int text_double; - const char *despeckle_filter; - const char *area_detect; - int minimum_motion_frames; - char *pid_file; - int argc; - char **argv; + const char *video_device; + short unsigned int v4l2_palette; + const char *vidpipe; + const char *filepath; + const char *imagepath; + const char *moviepath; + const char *snappath; + const char *timepath; + char *on_event_start; + char *on_event_end; + const char *mask_file; + int smart_mask_speed; + int sql_log_image; + int sql_log_snapshot; + int sql_log_movie; + int sql_log_timelapse; + const char *sql_query; + const char *database_type; + const char *database_dbname; + const char *database_host; + const char *database_user; + const char *database_password; + int database_port; + char *on_picture_save; + char *on_area_detected; + char *on_motion_detected; + char *on_movie_start; + char *on_movie_end; + char *on_camera_lost; + const char *motionvidpipe; + const char *netcam_url; + const char *netcam_userpass; + const char *netcam_keepalive; + const char *netcam_proxy; + unsigned int netcam_broken; + int text_changes; + const char *text_left; + const char *text_right; + const char *text_event; + int text_double; + const char *despeckle_filter; + const char *area_detect; + int minimum_motion_frames; + char *pid_file; + int argc; + char **argv; }; /** @@ -133,12 +133,12 @@ typedef const char *(* conf_print_func)(struct context **, char **, int, unsigne * description for parameters in the config file */ typedef struct { - const char *param_name; /* name for this parameter */ - const char *param_help; /* short explanation for parameter */ - unsigned short int main_thread; /* belong only to main thread when value>0 */ - int conf_value; /* pointer to a field in struct context */ - conf_copy_func copy; /* a function to set the value in 'config' */ - conf_print_func print; /* a function to output the value to a file */ + const char *param_name; /* name for this parameter */ + const char *param_help; /* short explanation for parameter */ + unsigned short int main_thread; /* belong only to main thread when value>0 */ + int conf_value; /* pointer to a field in struct context */ + conf_copy_func copy; /* a function to set the value in 'config' */ + conf_print_func print; /* a function to output the value to a file */ } config_param; diff --git a/configure b/configure index 2188d13..23c7e4e 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-r375. +# Generated by GNU Autoconf 2.61 for motion trunk-r380. # # 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-r375' -PACKAGE_STRING='motion trunk-r375' +PACKAGE_VERSION='trunk-r380' +PACKAGE_STRING='motion trunk-r380' PACKAGE_BUGREPORT='' ac_unique_file="motion.c" @@ -1177,7 +1177,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-r375 to adapt to many kinds of systems. +\`configure' configures motion trunk-r380 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1238,7 +1238,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of motion trunk-r375:";; + short | recursive ) echo "Configuration of motion trunk-r380:";; esac cat <<\_ACEOF @@ -1374,7 +1374,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -motion configure trunk-r375 +motion configure trunk-r380 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1388,7 +1388,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-r375, which was +It was created by motion $as_me trunk-r380, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -8666,7 +8666,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-r375, which was +This file was extended by motion $as_me trunk-r380, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8715,7 +8715,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -motion config.status trunk-r375 +motion config.status trunk-r380 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/ffmpeg.h b/ffmpeg.h index d8f843c..0b3fae0 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -36,19 +36,19 @@ struct ffmpeg { #ifdef HAVE_FFMPEG - AVFormatContext *oc; - AVStream *video_st; - AVCodecContext *c; + AVFormatContext *oc; + AVStream *video_st; + AVCodecContext *c; - AVFrame *picture; /* contains default image pointers */ - uint8_t *video_outbuf; - int video_outbuf_size; + AVFrame *picture; /* contains default image pointers */ + uint8_t *video_outbuf; + int video_outbuf_size; - void *udata; /* U & V planes for greyscale images */ - int vbr; /* variable bitrate setting */ - char codec[20]; /* codec name */ + void *udata; /* U & V planes for greyscale images */ + int vbr; /* variable bitrate setting */ + char codec[20]; /* codec name */ #else - int dummy; + int dummy; #endif }; @@ -61,28 +61,28 @@ void ffmpeg_init(void); * timelapse video, use TIMELAPSE_CODEC as codec name. */ struct ffmpeg *ffmpeg_open( - char *ffmpeg_video_codec, - char *filename, - unsigned char *y, /* YUV420 Y plane */ - unsigned char *u, /* YUV420 U plane */ - unsigned char *v, /* YUV420 V plane */ - int width, - int height, - int rate, /* framerate, fps */ - int bps, /* bitrate; bits per second */ - int vbr /* variable bitrate */ - ); + char *ffmpeg_video_codec, + char *filename, + unsigned char *y, /* YUV420 Y plane */ + unsigned char *u, /* YUV420 U plane */ + unsigned char *v, /* YUV420 V plane */ + int width, + int height, + int rate, /* framerate, fps */ + int bps, /* bitrate; bits per second */ + int vbr /* variable bitrate */ + ); /* Puts the image pointed to by the picture member of struct ffmpeg. */ int ffmpeg_put_image(struct ffmpeg *); /* Puts the image defined by u, y and v (YUV420 format). */ int ffmpeg_put_other_image( - struct ffmpeg *ffmpeg, - unsigned char *y, - unsigned char *u, - unsigned char *v - ); + struct ffmpeg *ffmpeg, + unsigned char *y, + unsigned char *u, + unsigned char *v + ); /* Closes the mpeg file. */ void ffmpeg_close(struct ffmpeg *); diff --git a/logger.c b/logger.c index 3cd8bab..a417a60 100644 --- a/logger.c +++ b/logger.c @@ -3,6 +3,7 @@ * * Logger for motion * + * Copyright 2005, William M. Brack * Copyright 2008 by Angel Carpintero (ack@telefonica.net) * This software is distributed under the GNU Public License Version 2 * See also the file 'COPYING'. @@ -15,79 +16,79 @@ /** * motion_log * - * This routine is used for printing all informational, debug or error - * messages produced by any of the other motion functions. It always - * produces a message of the form "[n] {message}", and (if the param - * 'errno_flag' is set) follows the message with the associated error - * message from the library. + * This routine is used for printing all informational, debug or error + * messages produced by any of the other motion functions. It always + * produces a message of the form "[n] {message}", and (if the param + * 'errno_flag' is set) follows the message with the associated error + * message from the library. * * Parameters: * - * level logging level for the 'syslog' function - * (-1 implies no syslog message should be produced) - * errno_flag if set, the log message should be followed by the - * error message. - * fmt the format string for producing the message - * ap variable-length argument list + * level logging level for the 'syslog' function + * (-1 implies no syslog message should be produced) + * errno_flag if set, the log message should be followed by the + * error message. + * fmt the format string for producing the message + * ap variable-length argument list * * Returns: - * Nothing + * Nothing */ void motion_log(int level, int errno_flag, const char *fmt, ...) { - int errno_save, n; - char buf[1024]; + int errno_save, n; + char buf[1024]; #if (!defined(BSD)) - char msg_buf[100]; + char msg_buf[100]; #endif - va_list ap; - int threadnr; + va_list ap; + int threadnr; - /* If pthread_getspecific fails (e.g., because the thread's TLS doesn't - * contain anything for thread number, it returns NULL which casts to zero, - * which is nice because that's what we want in that case. - */ - threadnr = (unsigned long)pthread_getspecific(tls_key_threadnr); + /* If pthread_getspecific fails (e.g., because the thread's TLS doesn't + * contain anything for thread number, it returns NULL which casts to zero, + * which is nice because that's what we want in that case. + */ + threadnr = (unsigned long)pthread_getspecific(tls_key_threadnr); - /* - * First we save the current 'error' value. This is required because - * the subsequent calls to vsnprintf could conceivably change it! - */ - errno_save = errno; + /* + * First we save the current 'error' value. This is required because + * the subsequent calls to vsnprintf could conceivably change it! + */ + errno_save = errno; - /* Prefix the message with the thread number */ - n = snprintf(buf, sizeof(buf), "[%d] ", threadnr); + /* Prefix the message with the thread number */ + n = snprintf(buf, sizeof(buf), "[%d] ", threadnr); - /* Next add the user's message */ - va_start(ap, fmt); - n += vsnprintf(buf + n, sizeof(buf) - n, fmt, ap); + /* Next add the user's message */ + va_start(ap, fmt); + n += vsnprintf(buf + n, sizeof(buf) - n, fmt, ap); - /* If errno_flag is set, add on the library error message */ - if (errno_flag) { - strcat(buf, ": "); - n += 2; - /* - * this is bad - apparently gcc/libc wants to use the non-standard GNU - * version of strerror_r, which doesn't actually put the message into - * my buffer :-(. I have put in a 'hack' to get around this. - */ + /* If errno_flag is set, add on the library error message */ + if (errno_flag) { + strcat(buf, ": "); + n += 2; + /* + * this is bad - apparently gcc/libc wants to use the non-standard GNU + * version of strerror_r, which doesn't actually put the message into + * my buffer :-(. I have put in a 'hack' to get around this. + */ #if (defined(BSD)) - strerror_r(errno_save, buf + n, sizeof(buf) - n); /* 2 for the ': ' */ + strerror_r(errno_save, buf + n, sizeof(buf) - n); /* 2 for the ': ' */ #else - strcat(buf, strerror_r(errno_save, msg_buf, sizeof(msg_buf))); + strcat(buf, strerror_r(errno_save, msg_buf, sizeof(msg_buf))); #endif - } - /* If 'level' is not negative, send the message to the syslog */ - if (level >= 0) - syslog(level, buf); + } + /* If 'level' is not negative, send the message to the syslog */ + if (level >= 0) + syslog(level, buf); - /* For printing to stderr we need to add a newline */ - strcat(buf, "\n"); - fputs(buf, stderr); - fflush(stderr); + /* For printing to stderr we need to add a newline */ + strcat(buf, "\n"); + fputs(buf, stderr); + fflush(stderr); - /* Clean up the argument list routine */ - va_end(ap); + /* Clean up the argument list routine */ + va_end(ap); } diff --git a/logger.h b/logger.h index 9adea55..5fe2134 100644 --- a/logger.h +++ b/logger.h @@ -3,6 +3,7 @@ * * Include file for logger.h * + * Copyright 2005, William M. Brack * Copyright 2008 by Angel Carpintero (ack@telefonica.net) * This software is distributed under the GNU Public License Version 2 * See also the file 'COPYING'. @@ -14,6 +15,17 @@ #include "motion.h" #include + + +/* Debug levels */ +#define CAMERA_WARNINGS 3 /* warnings only */ +#define TRACK_DEBUG 4 /* track debug */ +#define CAMERA_INFO 5 /* info debug */ +#define CAMERA_VIDEO 6 /* debug video not verbose */ +#define CAMERA_DEBUG 7 /* debug but not verbose */ +#define CAMERA_VERBOSE 8 /* verbose level */ +#define CAMERA_ALL 9 /* everything */ + void motion_log(int, int, const char *, ...); #endif diff --git a/motion.h b/motion.h index 289b68a..664b522 100644 --- a/motion.h +++ b/motion.h @@ -1,6 +1,6 @@ -/* motion.h +/* motion.h * - * Include file for motion.c + * Include file for motion.c * Copyright 2000 by Jeroen Vreeken (pe1rxq@amsat.org) * This software is distributed under the GNU public license version 2 * See also the file 'COPYING'. @@ -101,16 +101,6 @@ #endif -/* Debug levels FIXME */ -#define CAMERA_WARNINGS 3 /* warnings only */ -#define TRACK_DEBUG 4 /* track debug */ -#define CAMERA_INFO 5 /* info debug */ -#define CAMERA_VIDEO 6 /* debug video not verbose */ -#define CAMERA_DEBUG 7 /* debug but not verbose */ -#define CAMERA_VERBOSE 8 /* verbose level */ -#define CAMERA_ALL 9 /* everything */ - - /* Default picture settings */ #define DEF_WIDTH 352 #define DEF_HEIGHT 288 @@ -131,13 +121,13 @@ #define THRESHOLD_TUNE_LENGTH 256 #define MISSING_FRAMES_TIMEOUT 30 /* When failing to get picture frame from camera - * we reuse the previous frame until - * MISSING_FRAMES_TIMEOUT seconds has passed - * and then we show a grey image instead + we reuse the previous frame until + MISSING_FRAMES_TIMEOUT seconds has passed + and then we show a grey image instead */ -#define WATCHDOG_TMO 30 /* 10 sec max motion_loop interval */ -#define WATCHDOG_OFF -127 /* Turn off watchdog, used when we wants to quit a thread */ +#define WATCHDOG_TMO 30 /* 30 sec max motion_loop interval */ +#define WATCHDOG_OFF -127 /* Turn off watchdog, used when we wants to quit a thread */ #define CONNECTION_KO "Lost connection" #define CONNECTION_OK "Connection OK" @@ -175,11 +165,11 @@ #define FTYPE_IMAGE_ANY (FTYPE_IMAGE | FTYPE_IMAGE_SNAPSHOT | FTYPE_IMAGE_MOTION) /* What types of images files do we want to have */ -#define NEWIMG_OFF 0 -#define NEWIMG_ON 1 -#define NEWIMG_FIRST 2 -#define NEWIMG_BEST 4 -#define NEWIMG_CENTER 8 +#define NEWIMG_OFF 0 +#define NEWIMG_ON 1 +#define NEWIMG_FIRST 2 +#define NEWIMG_BEST 4 +#define NEWIMG_CENTER 8 #define LOCATE_OFF 0 #define LOCATE_ON 1 @@ -188,11 +178,11 @@ #define LOCATE_CENTER 4 #define LOCATE_REDCROSS 5 -#define LOCATE_NORMAL 0 -#define LOCATE_BOTH 1 +#define LOCATE_NORMAL 0 +#define LOCATE_BOTH 1 -#define UPDATE_REF_FRAME 1 -#define RESET_REF_FRAME 2 +#define UPDATE_REF_FRAME 1 +#define RESET_REF_FRAME 2 /* Forward declaration, used in track.h */ struct images; @@ -215,21 +205,21 @@ struct images; #define IMAGE_POSTCAP 32 struct image_data { - unsigned char *image; - int diffs; - time_t timestamp; /* Timestamp when image was captured */ - struct tm timestamp_tm; - int shot; /* Sub second timestamp count */ + unsigned char *image; + int diffs; + time_t timestamp; /* Timestamp when image was captured */ + struct tm timestamp_tm; + int shot; /* Sub second timestamp count */ - /* movement center to img center distance - * Note Dist is calculated distX*distX + distY*distY */ - unsigned long cent_dist; + /* movement center to img center distance + * Note Dist is calculated distX*distX + distY*distY */ + unsigned long cent_dist; - unsigned int flags; /* Se IMAGE_* defines */ + unsigned int flags; /* Se IMAGE_* defines */ - struct coord location; /* coordinates for center and size of last motion detection*/ + struct coord location; /* coordinates for center and size of last motion detection*/ - int total_labels; + int total_labels; }; /* DIFFERENCES BETWEEN imgs.width, conf.width AND rotate_data.cap_width @@ -262,143 +252,143 @@ int draw_text (unsigned char *image, int startx, int starty, int width, const ch int initialize_chars(void); struct images { - struct image_data *image_ring; /* The base address of the image ring buffer */ - int image_ring_size; - int image_ring_in; /* Index in image ring buffer we last added a image into */ - int image_ring_out; /* Index in image ring buffer we want to process next time */ - - unsigned char *ref; /* The reference frame */ - unsigned char *out; /* Picture buffer for motion images */ - int *ref_dyn; /* Dynamic objects to be excluded from reference frame */ - unsigned char *image_virgin; /* Last picture frame with no text or locate overlay */ - struct image_data preview_image; /* Picture buffer for best image when enables */ - unsigned char *mask; /* Buffer for the mask file */ - unsigned char *smartmask; - unsigned char *smartmask_final; - unsigned char *common_buffer; - int *smartmask_buffer; - int *labels; - int *labelsize; - int width; - int height; - int type; - int picture_type; /* Output picture type IMAGE_JPEG, IMAGE_PPM */ - int size; - int motionsize; - int labelgroup_max; - int labels_above; - int labelsize_max; - int largest_label; + struct image_data *image_ring; /* The base address of the image ring buffer */ + int image_ring_size; + int image_ring_in; /* Index in image ring buffer we last added a image into */ + int image_ring_out; /* Index in image ring buffer we want to process next time */ + + unsigned char *ref; /* The reference frame */ + unsigned char *out; /* Picture buffer for motion images */ + int *ref_dyn; /* Dynamic objects to be excluded from reference frame */ + unsigned char *image_virgin; /* Last picture frame with no text or locate overlay */ + struct image_data preview_image; /* Picture buffer for best image when enables */ + unsigned char *mask; /* Buffer for the mask file */ + unsigned char *smartmask; + unsigned char *smartmask_final; + unsigned char *common_buffer; + int *smartmask_buffer; + int *labels; + int *labelsize; + int width; + int height; + int type; + int picture_type; /* Output picture type IMAGE_JPEG, IMAGE_PPM */ + int size; + int motionsize; + int labelgroup_max; + int labels_above; + int labelsize_max; + int largest_label; }; /* Contains data for image rotation, see rotate.c. */ struct rotdata { - /* Temporary buffer for 90 and 270 degrees rotation. */ - unsigned char *temp_buf; - /* Degrees to rotate; copied from conf.rotate_deg. This is the value - * that is actually used. The value of conf.rotate_deg cannot be used - * because it can be changed by motion-control, and changing rotation - * while Motion is running just causes problems. - */ - int degrees; - /* Capture width and height - different from output width and height if - * rotating 90 or 270 degrees. */ - int cap_width; - int cap_height; + /* Temporary buffer for 90 and 270 degrees rotation. */ + unsigned char *temp_buf; + /* Degrees to rotate; copied from conf.rotate_deg. This is the value + * that is actually used. The value of conf.rotate_deg cannot be used + * because it can be changed by motion-control, and changing rotation + * while Motion is running just causes problems. + */ + int degrees; + /* Capture width and height - different from output width and height if + * rotating 90 or 270 degrees. */ + int cap_width; + int cap_height; }; /* - these used to be global variables but now each thread will have its - own context + these used to be global variables but now each thread will have its + own context */ struct context { - char conf_filename[PATH_MAX]; - int threadnr; - unsigned short int daemon; - char pid_file[PATH_MAX]; - - struct config conf; - struct images imgs; - struct trackoptions track; - struct netcam_context *netcam; - struct image_data *current_image; /* Pointer to a structure where the image, diffs etc is stored */ - unsigned short int new_img; - - int locate_motion; - struct rotdata rotate_data; /* rotation data is thread-specific */ - - int noise; - int threshold; - int diffs_last[THRESHOLD_TUNE_LENGTH]; - int smartmask_speed; - - /* Commands to the motion thread */ - volatile unsigned short int snapshot; /* Make a snapshot */ - volatile unsigned short int makemovie; /* End a movie */ - volatile unsigned short int finish; /* End the thread */ - volatile unsigned short int restart; /* Restart the thread when it ends */ - /* Is the motion thread running */ - volatile unsigned short int running; - volatile int watchdog; - - pthread_t thread_id; - - int event_nr; - int prev_event; - int lightswitch_framecounter; - char text_event_string[PATH_MAX]; /* The text for conv. spec. %C - + char conf_filename[PATH_MAX]; + int threadnr; + unsigned short int daemon; + char pid_file[PATH_MAX]; + + struct config conf; + struct images imgs; + struct trackoptions track; + struct netcam_context *netcam; + struct image_data *current_image; /* Pointer to a structure where the image, diffs etc is stored */ + unsigned short int new_img; + + int locate_motion; + struct rotdata rotate_data; /* rotation data is thread-specific */ + + int noise; + int threshold; + int diffs_last[THRESHOLD_TUNE_LENGTH]; + int smartmask_speed; + + /* Commands to the motion thread */ + volatile unsigned short int snapshot; /* Make a snapshot */ + volatile unsigned short int makemovie; /* End a movie */ + volatile unsigned short int finish; /* End the thread */ + volatile unsigned short int restart; /* Restart the thread when it ends */ + /* Is the motion thread running */ + volatile unsigned short int running; + volatile int watchdog; + + pthread_t thread_id; + + int event_nr; + int prev_event; + int lightswitch_framecounter; + char text_event_string[PATH_MAX]; /* The text for conv. spec. %C - we assume PATH_MAX normally 4096 characters is fine */ - int postcap; /* downcounter, frames left to to send post event */ + int postcap; /* downcounter, frames left to to send post event */ - short int shots; - unsigned short int detecting_motion; - struct tm *currenttime_tm; - struct tm *eventtime_tm; + short int shots; + unsigned short int detecting_motion; + struct tm *currenttime_tm; + struct tm *eventtime_tm; - time_t currenttime; - time_t lasttime; - time_t eventtime; - time_t connectionlosttime; /* timestamp from connection lost */ + time_t currenttime; + time_t lasttime; + time_t eventtime; + time_t connectionlosttime; /* timestamp from connection lost */ - int lastrate; - unsigned short int startup_frames; - unsigned short int moved; - unsigned short int pause; - int missing_frame_counter; /* counts failed attempts to fetch picture frame from camera */ - unsigned short int lost_connection; + int lastrate; + unsigned short int startup_frames; + unsigned short int moved; + unsigned short int pause; + int missing_frame_counter; /* counts failed attempts to fetch picture frame from camera */ + unsigned short int lost_connection; #if (defined(BSD)) - int tuner_dev; + int tuner_dev; #endif - int video_dev; - int pipe; - int mpipe; + int video_dev; + int pipe; + int mpipe; - struct stream stream; - int stream_count; - + struct stream stream; + int stream_count; + #if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) - int sql_mask; + int sql_mask; #endif #ifdef HAVE_MYSQL - MYSQL *database; + MYSQL *database; #endif #ifdef HAVE_PGSQL - PGconn *database_pg; + PGconn *database_pg; #endif #ifdef HAVE_FFMPEG - struct ffmpeg *ffmpeg_output; - struct ffmpeg *ffmpeg_output_debug; - struct ffmpeg *ffmpeg_timelapse; - struct ffmpeg *ffmpeg_smartmask; - char newfilename[PATH_MAX]; - char motionfilename[PATH_MAX]; - char timelapsefilename[PATH_MAX]; - short int movie_fps; - short int movie_last_shot; + struct ffmpeg *ffmpeg_output; + struct ffmpeg *ffmpeg_output_debug; + struct ffmpeg *ffmpeg_timelapse; + struct ffmpeg *ffmpeg_smartmask; + char newfilename[PATH_MAX]; + char motionfilename[PATH_MAX]; + char timelapsefilename[PATH_MAX]; + short int movie_fps; + short int movie_last_shot; #endif }; diff --git a/netcam.h b/netcam.h index 88ea7e5..e9d62e1 100644 --- a/netcam.h +++ b/netcam.h @@ -1,16 +1,16 @@ /* - * netcam.h + * netcam.h * - * Include file for handling network cameras. + * Include file for handling network cameras. * - * This code was inspired by the original netcam.c module - * written by Jeroen Vreeken and enhanced by several Motion - * project contributors, particularly Angel Carpintero and - * Christopher Price. - * - * Copyright 2005, William M. Brack - * This software is distributed under the GNU Public license - * Version 2. See also the file 'COPYING'. + * This code was inspired by the original netcam.c module + * written by Jeroen Vreeken and enhanced by several Motion + * project contributors, particularly Angel Carpintero and + * Christopher Price. + * + * Copyright 2005, William M. Brack + * This software is distributed under the GNU Public license + * Version 2. See also the file 'COPYING'. */ #ifndef _INCLUDE_NETCAM_H #define _INCLUDE_NETCAM_H @@ -75,11 +75,11 @@ typedef struct netcam_context *netcam_context_ptr; * when attempting to connect to the netcam. */ struct url_t { - char *service; - char *userpass; - char *host; - int port; - char *path; + char *service; + char *userpass; + char *host; + int port; + char *path; }; /* @@ -88,18 +88,18 @@ struct url_t { * which are each described using a struct netcam_image_buff */ typedef struct netcam_image_buff { - char *ptr; - int content_length; - size_t size; /* total allocated size */ - size_t used; /* bytes already used */ - struct timeval image_time; /* time this image was received */ + char *ptr; + int content_length; + size_t size; /* total allocated size */ + size_t used; /* bytes already used */ + struct timeval image_time; /* time this image was received */ } netcam_buff; typedef netcam_buff *netcam_buff_ptr; typedef struct file_context { - char *path; /* the path within the URL */ - int control_file_desc; /* file descriptor for the control socket */ - time_t last_st_mtime; /* time this image was modified */ + char *path; /* the path within the URL */ + int control_file_desc; /* file descriptor for the control socket */ + time_t last_st_mtime; /* time this image was modified */ } tfile_context; #define NCS_UNSUPPORTED 0 /* streaming is not supported */ @@ -111,150 +111,150 @@ typedef struct file_context { * for an individual netcam. */ typedef struct netcam_context { - struct context *cnt; /* pointer to parent motion - context structure */ - - int finish; /* flag to break the camera- - handling thread out of it's - infinite loop in emergency */ - - int threadnr; /* motion's thread number for - the camera-handling thread - (if required). Used for - error reporting */ - - pthread_t thread_id; /* thread i.d. for a camera- - handling thread (if required). - Not currently used, but may be - useful in the future */ - - pthread_mutex_t mutex; /* mutex used with conditional waits */ - - pthread_cond_t exiting; /* pthread condition structure to let - the camera-handler acknowledge that - it's finished */ - - pthread_cond_t cap_cond; /* pthread condition structure to - initiate next capture request (used - only with non-streaming cameras */ - - pthread_cond_t pic_ready; /* pthread condition structure used - for synchronisation between the - camera handler and the motion main - loop, showing new frame is ready */ - - int start_capture; /* besides our signalling condition, - we also keep a flag to assure the - camera-handler will always start - a new cycle as soon as possible, - even if it's not currently waiting - on the condition. */ - - char *connect_host; /* the host to connect to (may be - either the camera host, or - possibly a proxy) */ - - int connect_port; /* usually will be 80, but can be - specified as something else by - the user */ - - int connect_http_10; /* set to TRUE if HTTP 1.0 connection - (netcam_keepalive off) */ - - int connect_http_11; /* set to TRUE if HTTP 1.1 connection - (netcam_keepalive on) */ - - int connect_keepalive; /* set to TRUE if connection maintained after - a request, otherwise FALSE to close down - the socket each time (netcam_keealive force) */ - - int keepalive_thisconn; /* set to TRUE if cam has sent 'Keep-Alive' in this connection */ - - int keepalive_timeup; /* set to TRUE if it is time to close netcam's socket, - and then re-open it with Keep-Alive set again. - Even Keep-Alive netcams need a close/open sometimes. */ - - char *connect_request; /* contains the complete string - required for connection to the - camera */ - - int sock; /* fd for the camera's socket. - Note that this value is also - present within the struct - rbuf *response. */ - - struct timeval timeout; /* The current timeout setting for - the socket. */ - - struct rbuf *response; /* this structure (defined in the - netcam_wget module) contains - the context for an HTTP - connection. Note that this - structure includes a large - buffer for the HTTP data */ - - struct ftp_context *ftp; /* this structure contains the - context for FTP connection */ - - struct file_context *file; /* this structure contains the - context for FILE connection */ - - int (*get_image)(netcam_context_ptr); - /* Function to fetch the image from - the netcam. It is initialised in - netcam_setup depending upon whether - the picture source is from an http - server or from an ftp server */ - - - struct netcam_caps { /* netcam capabilities: */ - unsigned char streaming; /* See the NCS_* defines */ - unsigned char content_length; /* 0 - unsupported */ - } caps; - - char *boundary; /* 'boundary' string when used to - separate mjpeg images */ - - size_t boundary_length; /* string length of the boundary - string */ - - /* Three separate buffers are used - for handling the data. Their - definitions follow: */ - - netcam_buff_ptr latest; /* This buffer contains the latest - frame received from the camera */ - - netcam_buff_ptr receiving; /* This buffer is used for receiving - data from the camera */ - - netcam_buff_ptr jpegbuf; /* This buffer is used for jpeg - decompression */ - - int imgcnt; /* count for # of received jpegs */ - int imgcnt_last; /* remember last count to check if a new - image arrived */ - - int error_count; /* simple count of number of errors since - last good frame was received */ - - unsigned int width; /* info for decompression */ - unsigned int height; - - int JFIF_marker; /* Debug to know if JFIF was present or not */ - unsigned int netcam_broken; /* For network cameras with buggy firmwares */ - - struct timeval last_image; /* time the most recent image was - received */ + struct context *cnt; /* pointer to parent motion + context structure */ + + int finish; /* flag to break the camera- + handling thread out of it's + infinite loop in emergency */ + + int threadnr; /* motion's thread number for + the camera-handling thread + (if required). Used for + error reporting */ + + pthread_t thread_id; /* thread i.d. for a camera- + handling thread (if required). + Not currently used, but may be + useful in the future */ + + pthread_mutex_t mutex; /* mutex used with conditional waits */ + + pthread_cond_t exiting; /* pthread condition structure to let + the camera-handler acknowledge that + it's finished */ + + pthread_cond_t cap_cond; /* pthread condition structure to + initiate next capture request (used + only with non-streaming cameras */ + + pthread_cond_t pic_ready; /* pthread condition structure used + for synchronisation between the + camera handler and the motion main + loop, showing new frame is ready */ + + int start_capture; /* besides our signalling condition, + we also keep a flag to assure the + camera-handler will always start + a new cycle as soon as possible, + even if it's not currently waiting + on the condition. */ + + char *connect_host; /* the host to connect to (may be + either the camera host, or + possibly a proxy) */ + + int connect_port; /* usually will be 80, but can be + specified as something else by + the user */ + + int connect_http_10; /* set to TRUE if HTTP 1.0 connection + (netcam_keepalive off) */ + + int connect_http_11; /* set to TRUE if HTTP 1.1 connection + (netcam_keepalive on) */ + + int connect_keepalive; /* set to TRUE if connection maintained after + a request, otherwise FALSE to close down + the socket each time (netcam_keealive force) */ + + int keepalive_thisconn; /* set to TRUE if cam has sent 'Keep-Alive' in this connection */ + + int keepalive_timeup; /* set to TRUE if it is time to close netcam's socket, + and then re-open it with Keep-Alive set again. + Even Keep-Alive netcams need a close/open sometimes. */ + + char *connect_request; /* contains the complete string + required for connection to the + camera */ + + int sock; /* fd for the camera's socket. + Note that this value is also + present within the struct + rbuf *response. */ + + struct timeval timeout; /* The current timeout setting for + the socket. */ + + struct rbuf *response; /* this structure (defined in the + netcam_wget module) contains + the context for an HTTP + connection. Note that this + structure includes a large + buffer for the HTTP data */ + + struct ftp_context *ftp; /* this structure contains the + context for FTP connection */ + + struct file_context *file; /* this structure contains the + context for FILE connection */ + + int (*get_image)(netcam_context_ptr); + /* Function to fetch the image from + the netcam. It is initialised in + netcam_setup depending upon whether + the picture source is from an http + server or from an ftp server */ + + + struct netcam_caps { /* netcam capabilities: */ + unsigned char streaming; /* See the NCS_* defines */ + unsigned char content_length; /* 0 - unsupported */ + } caps; + + char *boundary; /* 'boundary' string when used to + separate mjpeg images */ + + size_t boundary_length; /* string length of the boundary + string */ + + /* Three separate buffers are used + for handling the data. Their + definitions follow: */ + + netcam_buff_ptr latest; /* This buffer contains the latest + frame received from the camera */ + + netcam_buff_ptr receiving; /* This buffer is used for receiving + data from the camera */ + + netcam_buff_ptr jpegbuf; /* This buffer is used for jpeg + decompression */ + + int imgcnt; /* count for # of received jpegs */ + int imgcnt_last; /* remember last count to check if a new + image arrived */ + + int error_count; /* simple count of number of errors since + last good frame was received */ + + unsigned int width; /* info for decompression */ + unsigned int height; + + int JFIF_marker; /* Debug to know if JFIF was present or not */ + unsigned int netcam_broken; /* For network cameras with buggy firmwares */ + + struct timeval last_image; /* time the most recent image was + received */ - float av_frame_time; /* "running average" of time between - successive frames (microseconds) */ + float av_frame_time; /* "running average" of time between + successive frames (microseconds) */ - struct jpeg_error_mgr jerr; - jmp_buf setjmp_buffer; + struct jpeg_error_mgr jerr; + jmp_buf setjmp_buffer; - int jpeg_error; /* flag to show error or warning - occurred during decompression*/ + int jpeg_error; /* flag to show error or warning + occurred during decompression*/ } netcam_context; #define MJPG_MH_MAGIC "MJPG" @@ -265,18 +265,18 @@ typedef struct netcam_context { * Little-endian data is read from the network. */ typedef struct { - char mh_magic[MJPG_MH_MAGIC_SIZE]; /* must contain the string MJP - not null-terminated. */ - unsigned int mh_framesize; /* Total size of the current - frame in bytes (~45kb on WVC200) */ - unsigned short mh_framewidth; /* Frame width in pixels */ - unsigned short mh_frameheight; /* Frame height in pixels */ - unsigned int mh_frameoffset; /* Offset of this chunk relative - to the beginning of frame. */ - unsigned short mh_chunksize; /* The size of the chunk data - following this header. */ - char mh_reserved[30]; /* Unknown data, seems to be - constant between all headers */ + char mh_magic[MJPG_MH_MAGIC_SIZE]; /* must contain the string MJP + not null-terminated. */ + unsigned int mh_framesize; /* Total size of the current + frame in bytes (~45kb on WVC200) */ + unsigned short mh_framewidth; /* Frame width in pixels */ + unsigned short mh_frameheight; /* Frame height in pixels */ + unsigned int mh_frameoffset; /* Offset of this chunk relative + to the beginning of frame. */ + unsigned short mh_chunksize; /* The size of the chunk data + following this header. */ + char mh_reserved[30]; /* Unknown data, seems to be + constant between all headers */ } mjpg_header; /* diff --git a/netcam_ftp.h b/netcam_ftp.h index 13a7d2c..e06dfad 100644 --- a/netcam_ftp.h +++ b/netcam_ftp.h @@ -15,21 +15,21 @@ #define FTP_BUF_SIZE 1024 typedef struct ftp_context { - char *path; /* the path within the URL */ - char *user; /* user string */ - char *passwd; /* passwd string */ - struct sockaddr_in ftp_address; /* the socket addr structure */ - int passive; /* flag show passive/active mode used */ - int control_file_desc; /* file descriptor for the control socket */ - int data_file_desc; /* file descriptor for the data socket */ - int state; /* WRITE / READ / CLOSED */ - int returnValue; /* the protocol return value */ + char *path; /* the path within the URL */ + char *user; /* user string */ + char *passwd; /* passwd string */ + struct sockaddr_in ftp_address; /* the socket addr structure */ + int passive; /* flag show passive/active mode used */ + int control_file_desc; /* file descriptor for the control socket */ + int data_file_desc; /* file descriptor for the data socket */ + int state; /* WRITE / READ / CLOSED */ + int returnValue; /* the protocol return value */ - /* buffer for data received from the control connection */ - char control_buffer[FTP_BUF_SIZE + 1]; - int control_buffer_index; - int control_buffer_used; - int control_buffer_answer; + /* buffer for data received from the control connection */ + char control_buffer[FTP_BUF_SIZE + 1]; + int control_buffer_index; + int control_buffer_used; + int control_buffer_answer; } ftp_context, *ftp_context_pointer; /* The public interface */ diff --git a/netcam_wget.h b/netcam_wget.h index f8ed998..9a091bf 100644 --- a/netcam_wget.h +++ b/netcam_wget.h @@ -1,6 +1,6 @@ /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 - Free Software Foundation, Inc. + Free Software Foundation, Inc. Additional Copyright (C) 2004-2005 Christopher Price, Angel Carpintero, and other contributing authors. @@ -31,11 +31,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Retrieval stream */ struct rbuf { - char buffer[4096]; /* the input buffer */ - char *buffer_pos; /* current position in the buffer */ - size_t buffer_left; /* number of bytes left in the buffer: - buffer_left = buffer_end - buffer_pos */ - int ret; /* used by RBUF_READCHAR macro */ + char buffer[4096]; /* the input buffer */ + char *buffer_pos; /* current position in the buffer */ + size_t buffer_left; /* number of bytes left in the buffer: + buffer_left = buffer_end - buffer_pos */ + int ret; /* used by RBUF_READCHAR macro */ }; /* Read a character from RBUF. If there is anything in the buffer, @@ -50,12 +50,12 @@ struct rbuf should return the character or EOF, and in case of error store it to rbuf->err or something. */ -#define RBUF_READCHAR(netcam, store) \ -((netcam)->response->buffer_left ? (--(netcam)->response->buffer_left, \ -*((char *) (store)) = *(netcam)->response->buffer_pos++, 1) \ -: ((netcam)->response->buffer_pos = (netcam)->response->buffer, \ -((((netcam)->response->ret = rbuf_read_bufferful (netcam)) <= 0) \ -? (netcam)->response->ret : ((netcam)->response->buffer_left = (netcam->response)->ret - 1, \ +#define RBUF_READCHAR(netcam, store) \ +((netcam)->response->buffer_left ? (--(netcam)->response->buffer_left, \ +*((char *) (store)) = *(netcam)->response->buffer_pos++, 1) \ +: ((netcam)->response->buffer_pos = (netcam)->response->buffer, \ +((((netcam)->response->ret = rbuf_read_bufferful (netcam)) <= 0) \ +? (netcam)->response->ret : ((netcam)->response->buffer_left = (netcam->response)->ret - 1, \ *((char *) (store)) = *(netcam)->response->buffer_pos++,1)))) /* Function declarations */ @@ -76,8 +76,16 @@ void base64_encode(const char *, char *, int); char *strdupdelim(const char *, const char *); int http_process_type(const char *, void *); -enum { HG_OK, HG_ERROR, HG_EOF}; -enum header_get_flags{ HG_NONE = 0,HG_NO_CONTINUATIONS = 0x2 }; +enum { + HG_OK, + HG_ERROR, + HG_EOF +}; + +enum header_get_flags{ + HG_NONE = 0, + HG_NO_CONTINUATIONS = 0x2 +}; int header_get (netcam_context_ptr, char **, enum header_get_flags); int header_process (const char *, const char *, diff --git a/picture.h b/picture.h index 7e38876..6f00e1d 100644 --- a/picture.h +++ b/picture.h @@ -1,5 +1,5 @@ /* - * picture.h + * picture.h * * Copyright 2002 by Jeroen Vreeken (pe1rxq@amsat.org) * Portions of this file are Copyright by Lionnel Maugis @@ -18,7 +18,7 @@ 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); -void put_picture(struct context *, char *, unsigned char *, int ); +void put_picture(struct context *, char *, unsigned char *, int); unsigned char *get_pgm(FILE *, int, int); void preview_save(struct context *); diff --git a/pwc-ioctl.h b/pwc-ioctl.h index c3e8b11..48a3861 100644 --- a/pwc-ioctl.h +++ b/pwc-ioctl.h @@ -45,11 +45,11 @@ specified in the Video4Linux API. The #define names are built up like follows: - VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam + VIDIOC VIDeo IOCtl prefix + PWC Philps WebCam G optional: Get S optional: Set - ... the function + ... the function */ #if (!defined(BSD)) @@ -64,13 +64,13 @@ typedef __u16 __le16; #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 +#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 @@ -82,40 +82,40 @@ typedef __u16 __le16; 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 +#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 */ + int x, y; /* guess what */ + int size; /* size, or offset */ }; /* Used with VIDIOCPWCPROBE */ struct pwc_probe { - char name[32]; - int type; + char name[32]; + int type; }; struct pwc_serial { - char serial[30]; /* String with serial number. Contains terminating 0 */ + 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 +#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. @@ -127,9 +127,9 @@ struct pwc_serial */ struct pwc_whitebalance { - int mode; - int manual_red, manual_blue; /* R/W */ - int read_red, read_blue; /* R/O */ + int mode; + int manual_red, manual_blue; /* R/W */ + int read_red, read_blue; /* R/O */ }; /* @@ -139,29 +139,29 @@ struct pwc_whitebalance */ struct pwc_wb_speed { - int control_speed; - int control_delay; + 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 */ + 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; + 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 */ +#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 @@ -170,24 +170,24 @@ struct pwc_imagesize */ struct pwc_mpt_angles { - int absolute; /* write-only */ - int pan; /* degrees * 100 */ - int tilt; /* degress * 100 */ + 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; + int pan_min, pan_max; /* degrees * 100 */ + int tilt_min, tilt_max; }; struct pwc_mpt_status { - int status; - int time_pan; - int time_tilt; + int status; + int time_pan; + int time_tilt; }; @@ -197,30 +197,30 @@ struct pwc_mpt_status */ 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 */ + 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 +#define PWCX_FLAG_PLANAR 0x0001 +#define PWCX_FLAG_BAYER 0x0008 /* IOCTL definitions */ /* Restore user settings */ -#define VIDIOCPWCRUSER _IO('v', 192) +#define VIDIOCPWCRUSER _IO('v', 192) /* Save user settings */ -#define VIDIOCPWCSUSER _IO('v', 193) +#define VIDIOCPWCSUSER _IO('v', 193) /* Restore factory settings */ -#define VIDIOCPWCFACTORY _IO('v', 194) +#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 @@ -230,13 +230,13 @@ struct pwc_video_command the preferred mode is not available. */ /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL _IOW('v', 195, int) +#define VIDIOCPWCSCQUAL _IOW('v', 195, int) /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL _IOR('v', 195, int) +#define VIDIOCPWCGCQUAL _IOR('v', 195, int) /* Retrieve serial number of camera */ -#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial) +#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 @@ -248,61 +248,60 @@ struct pwc_video_command 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) +#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) +#define VIDIOCPWCSAGC _IOW('v', 200, int) /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC _IOR('v', 200, int) +#define VIDIOCPWCGAGC _IOR('v', 200, int) /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer) /* * This is private command used when communicating with v4l2. @@ -323,13 +322,13 @@ struct pwc_table_init_buffer { #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 */ + __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 /* MOTION_V4L2 && (! BSD ) */ #endif diff --git a/pwc-ioctl.h-10.0.10 b/pwc-ioctl.h-10.0.10 index 63754ab..48a3861 100644 --- a/pwc-ioctl.h-10.0.10 +++ b/pwc-ioctl.h-10.0.10 @@ -45,13 +45,14 @@ specified in the Video4Linux API. The #define names are built up like follows: - VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam + VIDIOC VIDeo IOCtl prefix + PWC Philps WebCam G optional: Get S optional: Set - ... the function + ... the function */ +#if (!defined(BSD)) #include #include @@ -60,14 +61,16 @@ 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 +#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 @@ -79,40 +82,40 @@ typedef __u16 __le16; 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 +#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 */ + int x, y; /* guess what */ + int size; /* size, or offset */ }; /* Used with VIDIOCPWCPROBE */ struct pwc_probe { - char name[32]; - int type; + char name[32]; + int type; }; struct pwc_serial { - char serial[30]; /* String with serial number. Contains terminating 0 */ + 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 +#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. @@ -124,9 +127,9 @@ struct pwc_serial */ struct pwc_whitebalance { - int mode; - int manual_red, manual_blue; /* R/W */ - int read_red, read_blue; /* R/O */ + int mode; + int manual_red, manual_blue; /* R/W */ + int read_red, read_blue; /* R/O */ }; /* @@ -136,29 +139,29 @@ struct pwc_whitebalance */ struct pwc_wb_speed { - int control_speed; - int control_delay; + 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 */ + 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; + 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 */ +#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 @@ -167,24 +170,24 @@ struct pwc_imagesize */ struct pwc_mpt_angles { - int absolute; /* write-only */ - int pan; /* degrees * 100 */ - int tilt; /* degress * 100 */ + 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; + int pan_min, pan_max; /* degrees * 100 */ + int tilt_min, tilt_max; }; struct pwc_mpt_status { - int status; - int time_pan; - int time_tilt; + int status; + int time_pan; + int time_tilt; }; @@ -194,30 +197,30 @@ struct pwc_mpt_status */ 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 */ + 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 +#define PWCX_FLAG_PLANAR 0x0001 +#define PWCX_FLAG_BAYER 0x0008 /* IOCTL definitions */ /* Restore user settings */ -#define VIDIOCPWCRUSER _IO('v', 192) +#define VIDIOCPWCRUSER _IO('v', 192) /* Save user settings */ -#define VIDIOCPWCSUSER _IO('v', 193) +#define VIDIOCPWCSUSER _IO('v', 193) /* Restore factory settings */ -#define VIDIOCPWCFACTORY _IO('v', 194) +#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 @@ -227,13 +230,13 @@ struct pwc_video_command the preferred mode is not available. */ /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL _IOW('v', 195, int) +#define VIDIOCPWCSCQUAL _IOW('v', 195, int) /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL _IOR('v', 195, int) +#define VIDIOCPWCGCQUAL _IOR('v', 195, int) /* Retrieve serial number of camera */ -#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial) +#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 @@ -245,61 +248,60 @@ struct pwc_video_command 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) +#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) +#define VIDIOCPWCSAGC _IOW('v', 200, int) /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC _IOR('v', 200, int) +#define VIDIOCPWCGAGC _IOR('v', 200, int) /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#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) +#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer) /* * This is private command used when communicating with v4l2. @@ -307,6 +309,8 @@ struct pwc_table_init_buffer { * 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) @@ -318,12 +322,13 @@ struct pwc_table_init_buffer { #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 */ + __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/rotate.h b/rotate.h index 6557cfe..d1a3091 100644 --- a/rotate.h +++ b/rotate.h @@ -1,12 +1,12 @@ /* - * rotate.h + * rotate.h * - * Include file for handling image rotation. + * Include file for handling image rotation. * - * Copyright 2004-2005, Per Jonsson (per@pjd.nu) + * Copyright 2004-2005, Per Jonsson (per@pjd.nu) * - * This software is distributed under the GNU Public license - * Version 2. See also the file 'COPYING'. + * This software is distributed under the GNU Public license + * Version 2. See also the file 'COPYING'. */ #ifndef _INCLUDE_ROTATE_H #define _INCLUDE_ROTATE_H diff --git a/stream.h b/stream.h index 4a48714..33d31ad 100644 --- a/stream.h +++ b/stream.h @@ -22,20 +22,20 @@ #define _INCLUDE_STREAM_H_ struct stream_buffer { - unsigned char *ptr; - int ref; - long size; + unsigned char *ptr; + int ref; + long size; }; struct stream { - int socket; - FILE *fwrite; - struct stream_buffer *tmpbuffer; - long filepos; - int nr; - unsigned long int last; - struct stream *prev; - struct stream *next; + int socket; + FILE *fwrite; + struct stream_buffer *tmpbuffer; + long filepos; + int nr; + unsigned long int last; + struct stream *prev; + struct stream *next; }; int stream_init(struct context *); diff --git a/track.h b/track.h index 0fb7d7e..c6c529e 100644 --- a/track.h +++ b/track.h @@ -1,9 +1,9 @@ -/* track.h +/* track.h * - * Experimental motion tracking. + * Experimental motion tracking. * - * Copyright 2000, Jeroen Vreeken - * This program is published under the GNU Public license + * Copyright 2000, Jeroen Vreeken + * This program is published under the GNU Public license */ #ifndef _INCLUDE_TRACK_H @@ -13,31 +13,31 @@ #include struct trackoptions { - int dev; - /* Config options: */ - unsigned short int type; - char *port; - unsigned short int motorx; - unsigned short int motory; - int maxx; - int maxy; - int minx; - int miny; - unsigned short int stepsize; - unsigned short int speed; - unsigned short int homex; - unsigned short int homey; - unsigned short int iomojo_id; - unsigned short int active; - unsigned short int motorx_reverse; - unsigned short int motory_reverse; - unsigned short int minmaxfound; - unsigned short int step_angle_x; - unsigned short int step_angle_y; - unsigned short int move_wait; - /* UVC */ - int pan_angle; // degrees - int tilt_angle; // degrees + int dev; + /* Config options: */ + unsigned short int type; + char *port; + unsigned short int motorx; + unsigned short int motory; + int maxx; + int maxy; + int minx; + int miny; + unsigned short int stepsize; + unsigned short int speed; + unsigned short int homex; + unsigned short int homey; + unsigned short int iomojo_id; + unsigned short int active; + unsigned short int motorx_reverse; + unsigned short int motory_reverse; + unsigned short int minmaxfound; + unsigned short int step_angle_x; + unsigned short int step_angle_y; + unsigned short int move_wait; + /* UVC */ + int pan_angle; // degrees + int tilt_angle; // degrees }; extern struct trackoptions track_template; @@ -140,7 +140,7 @@ unsigned short int track_move(struct context *, int, struct coord *, struct imag * Some defines for the Iomojo Smilecam: */ -#define IOMOJO_BAUDRATE B19200 +#define IOMOJO_BAUDRATE B19200 #define IOMOJO_CHECKPOWER_CMD 0xff #define IOMOJO_CHECKPOWER_RET 'Q' @@ -169,9 +169,9 @@ unsigned short int track_move(struct context *, int, struct coord *, struct imag */ #ifdef MOTION_V4L2 -#define V4L2_CID_PAN_RELATIVE (V4L2_CID_PRIVATE_BASE+7) -#define V4L2_CID_TILT_RELATIVE (V4L2_CID_PRIVATE_BASE+8) -#define V4L2_CID_PANTILT_RESET (V4L2_CID_PRIVATE_BASE+9) +#define V4L2_CID_PAN_RELATIVE (V4L2_CID_PRIVATE_BASE+7) +#define V4L2_CID_TILT_RELATIVE (V4L2_CID_PRIVATE_BASE+8) +#define V4L2_CID_PANTILT_RESET (V4L2_CID_PRIVATE_BASE+9) #define INCPANTILT 64 // 1 degree #endif /* MOTION_V4L2 */ diff --git a/video_freebsd.h b/video_freebsd.h index b548fbb..0a348b7 100644 --- a/video_freebsd.h +++ b/video_freebsd.h @@ -1,9 +1,10 @@ -/* video_freebsd.h +/* + * video_freebsd.h * - * Include file for video_freebsd.c - * Copyright 2004 by Angel Carpintero (ack@telefonica.net) - * This software is distributed under the GNU public license version 2 - * See also the file 'COPYING'. + * Include file for video_freebsd.c + * Copyright 2004 by Angel Carpintero (ack@telefonica.net) + * This software is distributed under the GNU public license version 2 + * See also the file 'COPYING'. * */ @@ -37,30 +38,30 @@ */ /* video4linux error codes */ -#define V4L_GENERAL_ERROR 0x01 /* binary 000001 */ -#define V4L_BTTVLOST_ERROR 0x05 /* binary 000101 */ +#define V4L_GENERAL_ERROR 0x01 /* binary 000001 */ +#define V4L_BTTVLOST_ERROR 0x05 /* binary 000101 */ #define V4L_FATAL_ERROR -1 -#define NORM_DEFAULT 0x00800 // METEOR_FMT_AUTOMODE -#define NORM_PAL 0x00200 // METEOR_FMT_PAL -#define NORM_NTSC 0x00100 // METEOR_FMT_NTSC -#define NORM_SECAM 0x00400 // METEOR_FMT_SECAM -#define NORM_PAL_NC 0x00200 // METEOR_FMT_PAL /* Greyscale howto ?! FIXME */ +#define NORM_DEFAULT 0x00800 // METEOR_FMT_AUTOMODE +#define NORM_PAL 0x00200 // METEOR_FMT_PAL +#define NORM_NTSC 0x00100 // METEOR_FMT_NTSC +#define NORM_SECAM 0x00400 // METEOR_FMT_SECAM +#define NORM_PAL_NC 0x00200 // METEOR_FMT_PAL /* Greyscale howto ?! FIXME */ -#define NORM_DEFAULT_NEW BT848_IFORM_F_AUTO -#define NORM_PAL_NEW BT848_IFORM_F_PALBDGHI -#define NORM_NTSC_NEW BT848_IFORM_F_NTSCM -#define NORM_SECAM_NEW BT848_IFORM_F_SECAM -#define NORM_PAL_NC_NEW BT848_IFORM_F_AUTO /* FIXME */ +#define NORM_DEFAULT_NEW BT848_IFORM_F_AUTO +#define NORM_PAL_NEW BT848_IFORM_F_PALBDGHI +#define NORM_NTSC_NEW BT848_IFORM_F_NTSCM +#define NORM_SECAM_NEW BT848_IFORM_F_SECAM +#define NORM_PAL_NC_NEW BT848_IFORM_F_AUTO /* FIXME */ -#define PAL 0 -#define NTSC 1 -#define SECAM 2 -#define PAL_NC 3 +#define PAL 0 +#define NTSC 1 +#define SECAM 2 +#define PAL_NC 3 -#define PAL_HEIGHT 576 -#define SECAM_HEIGHT 576 -#define NTSC_HEIGHT 480 +#define PAL_HEIGHT 576 +#define SECAM_HEIGHT 576 +#define NTSC_HEIGHT 480 #define BSD_VIDFMT_NONE 0 #define BSD_VIDFMT_YV12 1 @@ -73,50 +74,50 @@ #define BSD_VIDFMT_LAST 8 -#define IN_DEFAULT 0 -#define IN_COMPOSITE 0 -#define IN_TV 1 -#define IN_COMPOSITE2 2 -#define IN_SVIDEO 3 +#define IN_DEFAULT 0 +#define IN_COMPOSITE 0 +#define IN_TV 1 +#define IN_COMPOSITE2 2 +#define IN_SVIDEO 3 -#define CAPTURE_SINGLE 0 -#define CAPTURE_CONTINOUS 1 +#define CAPTURE_SINGLE 0 +#define CAPTURE_CONTINOUS 1 -#define VIDEO_DEVICE "/dev/bktr0" -#define TUNER_DEVICE "/dev/tuner0" +#define VIDEO_DEVICE "/dev/bktr0" +#define TUNER_DEVICE "/dev/tuner0" struct video_dev { - struct video_dev *next; - int usage_count; - int fd_bktr; - int fd_tuner; - const char *video_device; - const char *tuner_device; - unsigned short input; - unsigned short norm; - int width; - int height; - int contrast; - int saturation; - int hue; - int brightness; - int channel; - int channelset; - unsigned long freq; - - pthread_mutex_t mutex; - pthread_mutexattr_t attr; - int owner; - int frames; - - /* Device type specific stuff: */ -#ifndef WITHOUT_V4L - int capture_method; - int v4l_fmt; - unsigned char *v4l_buffers[2]; - int v4l_curbuffer; - int v4l_maxbuffer; - int v4l_bufsize; + struct video_dev *next; + int usage_count; + int fd_bktr; + int fd_tuner; + const char *video_device; + const char *tuner_device; + unsigned short input; + unsigned short norm; + int width; + int height; + int contrast; + int saturation; + int hue; + int brightness; + int channel; + int channelset; + unsigned long freq; + + pthread_mutex_t mutex; + pthread_mutexattr_t attr; + int owner; + int frames; + + /* Device type specific stuff: */ +#ifndef WITHOUT_V4L + int capture_method; + int v4l_fmt; + unsigned char *v4l_buffers[2]; + int v4l_curbuffer; + int v4l_maxbuffer; + int v4l_bufsize; #endif };