From b1128b102fa3c084bce8f073f5df1dbba4ef074a Mon Sep 17 00:00:00 2001 From: AngelCarpintero Date: Thu, 17 Jul 2008 11:27:29 +0000 Subject: [PATCH] Apply code standard --- alg.h | 36 +++---- event.h | 10 +- ffmpeg.h | 52 ++++----- motion.h | 294 +++++++++++++++++++++++++-------------------------- netcam.h | 258 ++++++++++++++++++++++---------------------- netcam_ftp.h | 28 ++--- picture.h | 2 +- rotate.h | 10 +- video.h | 100 +++++++++--------- 9 files changed, 395 insertions(+), 395 deletions(-) diff --git a/alg.h b/alg.h index 7b7f2faf..1dbef97e 100644 --- a/alg.h +++ b/alg.h @@ -1,9 +1,9 @@ -/* alg.h +/* alg.h * - * Detect changes in a video stream. - * Copyright 2001 by Jeroen Vreeken (pe1rxq@amsat.org) - * This software is distributed under the GNU public license version 2 - * See also the file 'COPYING'. + * Detect changes in a video stream. + * Copyright 2001 by Jeroen Vreeken (pe1rxq@amsat.org) + * This software is distributed under the GNU public license version 2 + * See also the file 'COPYING'. * */ @@ -13,22 +13,22 @@ #include "motion.h" struct coord { - int x; - int y; - int width; - int height; - int minx; - int maxx; - int miny; - int maxy; + int x; + int y; + int width; + int height; + int minx; + int maxx; + int miny; + int maxy; }; struct segment { - struct coord coord; - int width; - int height; - int open; - int count; + struct coord coord; + int width; + int height; + int open; + int count; }; void alg_locate_center_size(struct images *, int width, int height, struct coord *); diff --git a/event.h b/event.h index b03febaf..293d4f7a 100644 --- a/event.h +++ b/event.h @@ -1,11 +1,11 @@ /* - * event.h + * event.h * - * Include file for event.c + * Include file for event.c * - * Copyright Jeroen Vreeken, 2002 - * This software is distributed under the GNU Public License Version 2 - * see also the file 'COPYING'. + * Copyright Jeroen Vreeken, 2002 + * This software is distributed under the GNU Public License Version 2 + * see also the file 'COPYING'. * */ #ifndef _INCLUDE_EVENT_H_ diff --git a/ffmpeg.h b/ffmpeg.h index fa0a1de1..b968c8b9 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. */ void ffmpeg_put_image(struct ffmpeg *); /* Puts the image defined by u, y and v (YUV420 format). */ void 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/motion.h b/motion.h index 55ddf110..c20b13d9 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'. @@ -135,8 +135,8 @@ * 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 /* 10 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" @@ -144,46 +144,46 @@ #define DEF_MAXSTREAMS 10 /* Maximum number of webcam clients per camera */ #define DEF_MAXWEBQUEUE 10 /* Maximum number of webcam client in queue */ -#define DEF_TIMESTAMP "%Y-%m-%d\\n%T" -#define DEF_EVENTSTAMP "%Y%m%d%H%M%S" +#define DEF_TIMESTAMP "%Y-%m-%d\\n%T" +#define DEF_EVENTSTAMP "%Y%m%d%H%M%S" -#define DEF_SNAPPATH "%v-%Y%m%d%H%M%S-snapshot" -#define DEF_JPEGPATH "%v-%Y%m%d%H%M%S-%q" -#define DEF_MPEGPATH "%v-%Y%m%d%H%M%S" -#define DEF_TIMEPATH "%Y%m%d-timelapse" +#define DEF_SNAPPATH "%v-%Y%m%d%H%M%S-snapshot" +#define DEF_JPEGPATH "%v-%Y%m%d%H%M%S-%q" +#define DEF_MPEGPATH "%v-%Y%m%d%H%M%S" +#define DEF_TIMEPATH "%Y%m%d-timelapse" -#define DEF_TIMELAPSE_MODE "daily" +#define DEF_TIMELAPSE_MODE "daily" /* Do not break this line into two or more. Must be ONE line */ #define DEF_SQL_QUERY "sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')" /* Filetype defines */ -#define FTYPE_IMAGE 1 -#define FTYPE_IMAGE_SNAPSHOT 2 -#define FTYPE_IMAGE_MOTION 4 -#define FTYPE_MPEG 8 -#define FTYPE_MPEG_MOTION 16 -#define FTYPE_MPEG_TIMELAPSE 32 +#define FTYPE_IMAGE 1 +#define FTYPE_IMAGE_SNAPSHOT 2 +#define FTYPE_IMAGE_MOTION 4 +#define FTYPE_MPEG 8 +#define FTYPE_MPEG_MOTION 16 +#define FTYPE_MPEG_TIMELAPSE 32 #define FTYPE_MPEG_ANY (FTYPE_MPEG | FTYPE_MPEG_MOTION | FTYPE_MPEG_TIMELAPSE) #define FTYPE_IMAGE_ANY (FTYPE_IMAGE | FTYPE_IMAGE_SNAPSHOT | FTYPE_IMAGE_MOTION) /* What types of jpeg 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 -#define LOCATE_PREVIEW 2 +#define LOCATE_OFF 0 +#define LOCATE_ON 1 +#define LOCATE_PREVIEW 2 -#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; @@ -198,29 +198,29 @@ struct images; * so we only have to send it out when/if we want. */ /* A image can have detected motion in it, but dosn't trigger an event, if we use minimum_motion_frames */ -#define IMAGE_MOTION 1 -#define IMAGE_TRIGGER 2 -#define IMAGE_SAVE 4 -#define IMAGE_SAVED 8 -#define IMAGE_PRECAP 16 -#define IMAGE_POSTCAP 32 +#define IMAGE_MOTION 1 +#define IMAGE_TRIGGER 2 +#define IMAGE_SAVE 4 +#define IMAGE_SAVED 8 +#define IMAGE_PRECAP 16 +#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 @@ -253,140 +253,140 @@ 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 */ + 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 size; - int motionsize; - int labelgroup_max; - int labels_above; - int labelsize_max; - int largest_label; + 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 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]; + 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; + 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; - struct rotdata rotate_data; /* rotation data is thread-specific */ + int locate; + struct rotdata rotate_data; /* rotation data is thread-specific */ - int noise; - int threshold; - int diffs_last[THRESHOLD_TUNE_LENGTH]; - int smartmask_speed; + 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; + /* 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; + 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 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 */ - 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 webcam webcam; - int stream_count; - + struct webcam webcam; + 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_new; - struct ffmpeg *ffmpeg_motion; - struct ffmpeg *ffmpeg_timelapse; - struct ffmpeg *ffmpeg_smartmask; - char newfilename[PATH_MAX]; - char motionfilename[PATH_MAX]; - char timelapsefilename[PATH_MAX]; + struct ffmpeg *ffmpeg_new; + struct ffmpeg *ffmpeg_motion; + struct ffmpeg *ffmpeg_timelapse; + struct ffmpeg *ffmpeg_smartmask; + char newfilename[PATH_MAX]; + char motionfilename[PATH_MAX]; + char timelapsefilename[PATH_MAX]; #endif }; diff --git a/netcam.h b/netcam.h index 3545c4ab..e847ed0a 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; /* @@ -107,148 +107,148 @@ typedef struct file_context { * for an individual netcam. */ typedef struct netcam_context { - struct context *cnt; /* pointer to parent motion - context structure */ + 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 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 */ + 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_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_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 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 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. */ + 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 */ + 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 */ + int connect_http_10; /* set to TRUE if HTTP 1.0 connection */ - int connect_http_11; /* set to TRUE if HTTP 1.1 connection */ + int connect_http_11; /* set to TRUE if HTTP 1.1 connection */ - int connect_keepalive; /* set to TRUE if connection maintained + int connect_keepalive; /* set to TRUE if connection maintained after a request, otherwise FALSE to close down the socket each time */ - int keepalive_thisconn; /* set to TRUE if cam has sent 'Keep-Alive' in this connection */ + int keepalive_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. */ + 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 */ + 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. */ + 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 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 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 ftp_context *ftp; /* this structure contains the + context for FTP connection */ - struct file_context *file; /* this structure contains the - context for FILE 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 */ + 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; /* 1 - supported */ - unsigned char content_length; /* 0 - unsupported */ - } caps; + struct netcam_caps { /* netcam capabilities: */ + unsigned char streaming; /* 1 - supported */ + unsigned char content_length; /* 0 - unsupported */ + } caps; - char *boundary; /* 'boundary' string when used to - separate mjpeg images */ + char *boundary; /* 'boundary' string when used to + separate mjpeg images */ - size_t boundary_length; /* string length of the boundary - string */ + 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 */ + /* 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 receiving; /* This buffer is used for receiving + data from the camera */ - netcam_buff_ptr jpegbuf; /* This buffer is used for jpeg - decompression */ + 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 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 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 */ + 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 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; diff --git a/netcam_ftp.h b/netcam_ftp.h index 13a7d2c8..e06dfad9 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/picture.h b/picture.h index 7e388761..3d8ac38a 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 diff --git a/rotate.h b/rotate.h index 6557cfeb..d1a30916 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/video.h b/video.h index 37f85879..becd55ba 100644 --- a/video.h +++ b/video.h @@ -1,6 +1,6 @@ -/* video.h +/* video.h * - * Include file for video.c + * Include file for video.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'. @@ -16,56 +16,56 @@ #endif /* video4linux stuff */ -#define NORM_DEFAULT 0 -#define NORM_PAL 0 -#define NORM_NTSC 1 -#define NORM_SECAM 2 -#define NORM_PAL_NC 3 -#define IN_DEFAULT 8 -#define IN_TV 0 -#define IN_COMPOSITE 1 -#define IN_COMPOSITE2 2 -#define IN_SVIDEO 3 +#define NORM_DEFAULT 0 +#define NORM_PAL 0 +#define NORM_NTSC 1 +#define NORM_SECAM 2 +#define NORM_PAL_NC 3 +#define IN_DEFAULT 8 +#define IN_TV 0 +#define IN_COMPOSITE 1 +#define IN_COMPOSITE2 2 +#define IN_SVIDEO 3 /* video4linux error codes */ -#define V4L_GENERAL_ERROR 0x01 /* binary 000001 */ -#define V4L_BTTVLOST_ERROR 0x05 /* binary 000101 */ -#define V4L_FATAL_ERROR -1 +#define V4L_GENERAL_ERROR 0x01 /* binary 000001 */ +#define V4L_BTTVLOST_ERROR 0x05 /* binary 000101 */ +#define V4L_FATAL_ERROR -1 -#define VIDEO_DEVICE "/dev/video0" +#define VIDEO_DEVICE "/dev/video0" struct video_dev { - struct video_dev *next; - int usage_count; - int fd; - const char *video_device; - int input; - int width; - int height; - int brightness; - int contrast; - int saturation; - int hue; - unsigned long freq; - int tuner_number; + struct video_dev *next; + int usage_count; + int fd; + const char *video_device; + int input; + int width; + int height; + int brightness; + int contrast; + int saturation; + int hue; + unsigned long freq; + int tuner_number; - pthread_mutex_t mutex; - pthread_mutexattr_t attr; - int owner; - int frames; + pthread_mutex_t mutex; + pthread_mutexattr_t attr; + int owner; + int frames; - /* Device type specific stuff: */ + /* Device type specific stuff: */ #ifndef WITHOUT_V4L - /* v4l */ - int v4l2; - void *v4l2_private; + /* v4l */ + int v4l2; + void *v4l2_private; - int size_map; - int v4l_fmt; - unsigned char *v4l_buffers[2]; - int v4l_curbuffer; - int v4l_maxbuffer; - int v4l_bufsize; + int size_map; + int v4l_fmt; + unsigned char *v4l_buffers[2]; + int v4l_curbuffer; + int v4l_maxbuffer; + int v4l_bufsize; #endif }; @@ -91,20 +91,20 @@ void mjpegtoyuv420p(unsigned char *map, unsigned char *cap_map, int width, int h int vid_startpipe(const char *dev_name, int width, int height, int); int vid_putpipe(int dev, unsigned char *image, int); unsigned char *v4l_start(struct context *cnt, struct video_dev *viddev, int width, int height, - int input, int norm, unsigned long freq, int tuner_number); -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 input, int norm, unsigned long freq, int tuner_number); +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 v4l_next(struct video_dev *viddev, unsigned char *map, int width, int height); /* video2.c */ unsigned char *v4l2_start(struct context *cnt, struct video_dev *viddev, int width, int height, - int input, int norm, unsigned long freq, int tuner_number); -void v4l2_set_input(struct context *cnt, struct video_dev *viddev, unsigned char *map, int width, int height, - struct config *conf); + int input, int norm, unsigned long freq, int tuner_number); +void v4l2_set_input(struct context *cnt, struct video_dev *viddev, unsigned char *map, int width, + int height, struct config *conf); int v4l2_next(struct context *cnt, struct video_dev *viddev, unsigned char *map, int width, int height); void v4l2_close(struct video_dev *viddev); void v4l2_cleanup(struct video_dev *viddev); #endif -#endif /* _INCLUDE_VIDEO_H */ +#endif /* _INCLUDE_VIDEO_H */