From bb288e45460f62c07352fd66199d4db3535eb5e7 Mon Sep 17 00:00:00 2001 From: Mr-DaveDev Date: Mon, 26 Oct 2020 19:56:42 -0600 Subject: [PATCH] Improve function braces on new line --- src/conf.c | 9 ++- src/ffmpeg.c | 122 +++++++++++++++++++++++------------- src/jpegutils.c | 12 ++-- src/logger.c | 3 +- src/motion.c | 128 +++++++++++++++++++++++++------------- src/netcam.c | 13 ++-- src/netcam_ftp.c | 2 +- src/netcam_http.c | 1 - src/netcam_rtsp.c | 111 ++++++++++++++++++++++----------- src/picture.c | 6 +- src/rotate.c | 12 ++-- src/translate.c | 9 ++- src/video_bktr.c | 39 ++++++++---- src/video_common.c | 9 ++- src/video_loopback.c | 6 +- src/video_v4l2.c | 93 ++++++++++++++++++---------- src/webu.c | 144 ++++++++++++++++++++++++++++--------------- src/webu_html.c | 93 ++++++++++++++++++---------- src/webu_stream.c | 27 +++++--- src/webu_text.c | 111 ++++++++++++++++++++++----------- 20 files changed, 630 insertions(+), 320 deletions(-) diff --git a/src/conf.c b/src/conf.c index ef07f76f..c5cc1ece 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2990,7 +2990,8 @@ static struct context **copy_html_output(struct context **cnt, const char *str, return cnt; } -struct context **copy_uri(struct context **cnt, const char *str, int val) { +struct context **copy_uri(struct context **cnt, const char *str, int val) +{ const char *regex_str = "(http|https)://(((.*):(.*))@)?([^/:]|[-_.a-z0-9]+)(:([0-9]+))?($|(/[^*]*))"; @@ -3034,7 +3035,8 @@ struct context **copy_uri(struct context **cnt, const char *str, int val) { * when the motion program is terminated normally instead of relying on the * OS to clean up. */ -char *mystrcpy(char *to, const char *from){ +char *mystrcpy(char *to, const char *from) +{ /* * Free the memory used by the to string, if such memory exists, * and return a pointer to a freshly malloc()'d string with the @@ -3369,7 +3371,8 @@ static void usage() printf("\n"); } -static void config_parms_intl(){ +static void config_parms_intl() +{ /* This function prints out the configuration parms side by side * with the translations. It is currently disabled but put into * the code so that they can be found by xgettext. If enabled, then diff --git a/src/ffmpeg.c b/src/ffmpeg.c index faa4f10d..70e7df12 100644 --- a/src/ffmpeg.c +++ b/src/ffmpeg.c @@ -70,7 +70,8 @@ #endif /*********************************************/ -AVFrame *my_frame_alloc(void){ +AVFrame *my_frame_alloc(void) +{ AVFrame *pic; #if ( MYFFVER >= 55000) pic = av_frame_alloc(); @@ -80,7 +81,8 @@ AVFrame *my_frame_alloc(void){ return pic; } /*********************************************/ -void my_frame_free(AVFrame *frame){ +void my_frame_free(AVFrame *frame) +{ #if ( MYFFVER >= 55000) av_frame_free(&frame); #else @@ -88,7 +90,8 @@ void my_frame_free(AVFrame *frame){ #endif } /*********************************************/ -int my_image_get_buffer_size(enum MyPixelFormat pix_fmt, int width, int height){ +int my_image_get_buffer_size(enum MyPixelFormat pix_fmt, int width, int height) +{ int retcd = 0; #if ( MYFFVER >= 57000) int align = 1; @@ -99,7 +102,8 @@ int my_image_get_buffer_size(enum MyPixelFormat pix_fmt, int width, int height){ return retcd; } /*********************************************/ -int my_image_copy_to_buffer(AVFrame *frame, uint8_t *buffer_ptr, enum MyPixelFormat pix_fmt,int width, int height,int dest_size){ +int my_image_copy_to_buffer(AVFrame *frame, uint8_t *buffer_ptr, enum MyPixelFormat pix_fmt,int width, int height,int dest_size) +{ int retcd = 0; #if ( MYFFVER >= 57000) int align = 1; @@ -112,7 +116,8 @@ int my_image_copy_to_buffer(AVFrame *frame, uint8_t *buffer_ptr, enum MyPixelFor return retcd; } /*********************************************/ -int my_image_fill_arrays(AVFrame *frame,uint8_t *buffer_ptr,enum MyPixelFormat pix_fmt,int width,int height){ +int my_image_fill_arrays(AVFrame *frame,uint8_t *buffer_ptr,enum MyPixelFormat pix_fmt,int width,int height) +{ int retcd = 0; #if ( MYFFVER >= 57000) int align = 1; @@ -136,7 +141,8 @@ int my_image_fill_arrays(AVFrame *frame,uint8_t *buffer_ptr,enum MyPixelFormat p return retcd; } /*********************************************/ -void my_packet_unref(AVPacket pkt){ +void my_packet_unref(AVPacket pkt) +{ #if ( MYFFVER >= 57000) av_packet_unref(&pkt); #else @@ -144,7 +150,8 @@ void my_packet_unref(AVPacket pkt){ #endif } /*********************************************/ -void my_avcodec_close(AVCodecContext *codec_context){ +void my_avcodec_close(AVCodecContext *codec_context) +{ #if ( MYFFVER >= 57041) avcodec_free_context(&codec_context); #else @@ -152,7 +159,8 @@ void my_avcodec_close(AVCodecContext *codec_context){ #endif } /*********************************************/ -int my_copy_packet(AVPacket *dest_pkt, AVPacket *src_pkt){ +int my_copy_packet(AVPacket *dest_pkt, AVPacket *src_pkt) +{ #if ( MYFFVER >= 55000) return av_packet_ref(dest_pkt, src_pkt); #else @@ -173,7 +181,8 @@ int my_copy_packet(AVPacket *dest_pkt, AVPacket *src_pkt){ **************************************************************************** ****************************************************************************/ /*********************************************/ -static void ffmpeg_free_nal(struct ffmpeg *ffmpeg){ +static void ffmpeg_free_nal(struct ffmpeg *ffmpeg) +{ if (ffmpeg->nal_info) { free(ffmpeg->nal_info); ffmpeg->nal_info = NULL; @@ -181,7 +190,8 @@ static void ffmpeg_free_nal(struct ffmpeg *ffmpeg){ } } -static int ffmpeg_encode_nal(struct ffmpeg *ffmpeg){ +static int ffmpeg_encode_nal(struct ffmpeg *ffmpeg) +{ // h264_v4l2m2m has NAL units separated from the first frame, which makes // some players very unhappy. if ((ffmpeg->pkt.pts == 0) && (!(ffmpeg->pkt.flags & AV_PKT_FLAG_KEY))) { @@ -203,7 +213,8 @@ static int ffmpeg_encode_nal(struct ffmpeg *ffmpeg){ return 0; } -static int ffmpeg_timelapse_exists(const char *fname){ +static int ffmpeg_timelapse_exists(const char *fname) +{ FILE *file; file = fopen(fname, "r"); if (file) @@ -214,7 +225,8 @@ static int ffmpeg_timelapse_exists(const char *fname){ return 0; } -static int ffmpeg_timelapse_append(struct ffmpeg *ffmpeg, AVPacket pkt){ +static int ffmpeg_timelapse_append(struct ffmpeg *ffmpeg, AVPacket pkt) +{ FILE *file; file = fopen(ffmpeg->filename, "a"); @@ -231,7 +243,8 @@ static int ffmpeg_timelapse_append(struct ffmpeg *ffmpeg, AVPacket pkt){ /* TODO Determine if this is even needed for old versions. Per * documentation for version 58, 'av_lockmgr_register This function does nothing' */ -static int ffmpeg_lockmgr_cb(void **arg, enum AVLockOp op){ +static int ffmpeg_lockmgr_cb(void **arg, enum AVLockOp op) +{ pthread_mutex_t *mutex = *arg; int err; @@ -267,7 +280,8 @@ static int ffmpeg_lockmgr_cb(void **arg, enum AVLockOp op){ } #endif -static void ffmpeg_free_context(struct ffmpeg *ffmpeg){ +static void ffmpeg_free_context(struct ffmpeg *ffmpeg) +{ if (ffmpeg->picture != NULL){ my_frame_free(ffmpeg->picture); @@ -286,7 +300,8 @@ static void ffmpeg_free_context(struct ffmpeg *ffmpeg){ } -static int ffmpeg_get_oformat(struct ffmpeg *ffmpeg){ +static int ffmpeg_get_oformat(struct ffmpeg *ffmpeg) +{ size_t codec_name_len = strcspn(ffmpeg->codec_name, ":"); char *codec_name = malloc(codec_name_len + 1); @@ -422,7 +437,8 @@ static int ffmpeg_get_oformat(struct ffmpeg *ffmpeg){ return 0; } -static int ffmpeg_encode_video(struct ffmpeg *ffmpeg){ +static int ffmpeg_encode_video(struct ffmpeg *ffmpeg) +{ #if ( MYFFVER >= 57041) //ffmpeg version 3.1 and after int retcd = 0; @@ -535,7 +551,8 @@ static int ffmpeg_encode_video(struct ffmpeg *ffmpeg){ #endif } -static int ffmpeg_set_pts(struct ffmpeg *ffmpeg, const struct timeval *tv1){ +static int ffmpeg_set_pts(struct ffmpeg *ffmpeg, const struct timeval *tv1) +{ int64_t pts_interval; @@ -574,7 +591,8 @@ static int ffmpeg_set_pts(struct ffmpeg *ffmpeg, const struct timeval *tv1){ return 0; } -static int ffmpeg_set_pktpts(struct ffmpeg *ffmpeg, const struct timeval *tv1){ +static int ffmpeg_set_pktpts(struct ffmpeg *ffmpeg, const struct timeval *tv1) +{ int64_t pts_interval; @@ -613,7 +631,8 @@ static int ffmpeg_set_pktpts(struct ffmpeg *ffmpeg, const struct timeval *tv1){ return 0; } -static int ffmpeg_set_quality(struct ffmpeg *ffmpeg){ +static int ffmpeg_set_quality(struct ffmpeg *ffmpeg) +{ ffmpeg->opts = 0; if (ffmpeg->quality > 100) ffmpeg->quality = 100; @@ -664,7 +683,8 @@ struct blacklist_t const char *reason; }; -static const char *ffmpeg_codec_is_blacklisted(const char *codec_name){ +static const char *ffmpeg_codec_is_blacklisted(const char *codec_name) +{ static struct blacklist_t blacklisted_codec[] = { @@ -694,7 +714,8 @@ static const char *ffmpeg_codec_is_blacklisted(const char *codec_name){ return NULL; } -static int ffmpeg_set_codec_preferred(struct ffmpeg *ffmpeg){ +static int ffmpeg_set_codec_preferred(struct ffmpeg *ffmpeg) +{ size_t codec_name_len = strcspn(ffmpeg->codec_name, ":"); ffmpeg->codec = NULL; @@ -741,7 +762,8 @@ static int ffmpeg_set_codec_preferred(struct ffmpeg *ffmpeg){ } -static int ffmpeg_set_codec(struct ffmpeg *ffmpeg){ +static int ffmpeg_set_codec(struct ffmpeg *ffmpeg) +{ int retcd; char errstr[128]; @@ -868,7 +890,8 @@ static int ffmpeg_set_codec(struct ffmpeg *ffmpeg){ return 0; } -static int ffmpeg_set_stream(struct ffmpeg *ffmpeg){ +static int ffmpeg_set_stream(struct ffmpeg *ffmpeg) +{ #if ( MYFFVER >= 57041) int retcd; @@ -947,8 +970,8 @@ static int ffmpeg_alloc_video_buffer(AVFrame *frame, int align) return 0; } - -static int ffmpeg_set_picture(struct ffmpeg *ffmpeg){ +static int ffmpeg_set_picture(struct ffmpeg *ffmpeg) +{ int retcd; char errstr[128]; @@ -986,7 +1009,8 @@ static int ffmpeg_set_picture(struct ffmpeg *ffmpeg){ } -static int ffmpeg_set_outputfile(struct ffmpeg *ffmpeg){ +static int ffmpeg_set_outputfile(struct ffmpeg *ffmpeg) +{ int retcd; char errstr[128]; @@ -1048,7 +1072,8 @@ static int ffmpeg_set_outputfile(struct ffmpeg *ffmpeg){ } -static int ffmpeg_flush_codec(struct ffmpeg *ffmpeg){ +static int ffmpeg_flush_codec(struct ffmpeg *ffmpeg) +{ #if ( MYFFVER >= 57041) //ffmpeg version 3.1 and after @@ -1112,7 +1137,8 @@ static int ffmpeg_flush_codec(struct ffmpeg *ffmpeg){ } -static int ffmpeg_put_frame(struct ffmpeg *ffmpeg, const struct timeval *tv1){ +static int ffmpeg_put_frame(struct ffmpeg *ffmpeg, const struct timeval *tv1) +{ int retcd; av_init_packet(&ffmpeg->pkt); @@ -1150,7 +1176,8 @@ static int ffmpeg_put_frame(struct ffmpeg *ffmpeg, const struct timeval *tv1){ } -static void ffmpeg_passthru_reset(struct ffmpeg *ffmpeg){ +static void ffmpeg_passthru_reset(struct ffmpeg *ffmpeg) +{ /* Reset the written flag at start of each event */ int indx; @@ -1162,7 +1189,8 @@ static void ffmpeg_passthru_reset(struct ffmpeg *ffmpeg){ } -static void ffmpeg_passthru_write(struct ffmpeg *ffmpeg, int indx){ +static void ffmpeg_passthru_write(struct ffmpeg *ffmpeg, int indx) +{ /* Write the packet in the buffer at indx to file */ char errstr[128]; int retcd; @@ -1201,7 +1229,8 @@ static void ffmpeg_passthru_write(struct ffmpeg *ffmpeg, int indx){ } -static int ffmpeg_passthru_put(struct ffmpeg *ffmpeg, struct image_data *img_data){ +static int ffmpeg_passthru_put(struct ffmpeg *ffmpeg, struct image_data *img_data) +{ int idnbr_image, idnbr_lastwritten, idnbr_stop, idnbr_firstkey; int indx, indx_lastwritten, indx_firstkey; @@ -1271,7 +1300,8 @@ static int ffmpeg_passthru_put(struct ffmpeg *ffmpeg, struct image_data *img_dat return 0; } -static int ffmpeg_passthru_codec(struct ffmpeg *ffmpeg){ +static int ffmpeg_passthru_codec(struct ffmpeg *ffmpeg) +{ int retcd; AVStream *stream_in; @@ -1355,7 +1385,8 @@ static int ffmpeg_passthru_codec(struct ffmpeg *ffmpeg){ } -void ffmpeg_avcodec_log(void *ignoreme ATTRIBUTE_UNUSED, int errno_flag ATTRIBUTE_UNUSED, const char *fmt, va_list vl){ +void ffmpeg_avcodec_log(void *ignoreme ATTRIBUTE_UNUSED, int errno_flag ATTRIBUTE_UNUSED, const char *fmt, va_list vl) +{ char buf[1024]; char *end; @@ -1379,7 +1410,8 @@ void ffmpeg_avcodec_log(void *ignoreme ATTRIBUTE_UNUSED, int errno_flag ATTRIBUT } } -static void ffmpeg_put_pix_nv21(struct ffmpeg *ffmpeg, struct image_data *img_data){ +static void ffmpeg_put_pix_nv21(struct ffmpeg *ffmpeg, struct image_data *img_data) +{ unsigned char *image,*imagecr, *imagecb; int cr_len, x, y; @@ -1405,7 +1437,8 @@ static void ffmpeg_put_pix_nv21(struct ffmpeg *ffmpeg, struct image_data *img_da } -static void ffmpeg_put_pix_yuv420(struct ffmpeg *ffmpeg, struct image_data *img_data){ +static void ffmpeg_put_pix_yuv420(struct ffmpeg *ffmpeg, struct image_data *img_data) +{ unsigned char *image; if (ffmpeg->high_resolution){ @@ -1428,7 +1461,8 @@ static void ffmpeg_put_pix_yuv420(struct ffmpeg *ffmpeg, struct image_data *img_ **************************************************************************** ****************************************************************************/ -void ffmpeg_global_init(void){ +void ffmpeg_global_init(void) +{ #ifdef HAVE_FFMPEG MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO ,_("ffmpeg libavcodec version %d.%d.%d" @@ -1461,7 +1495,8 @@ void ffmpeg_global_init(void){ #endif /* HAVE_FFMPEG */ } -void ffmpeg_global_deinit(void) { +void ffmpeg_global_deinit(void) +{ #ifdef HAVE_FFMPEG avformat_network_deinit(); #if ( MYFFVER < 58000) @@ -1477,7 +1512,8 @@ void ffmpeg_global_deinit(void) { #endif /* HAVE_FFMPEG */ } -int ffmpeg_open(struct ffmpeg *ffmpeg){ +int ffmpeg_open(struct ffmpeg *ffmpeg) +{ #ifdef HAVE_FFMPEG int retcd; @@ -1543,7 +1579,8 @@ int ffmpeg_open(struct ffmpeg *ffmpeg){ } -void ffmpeg_close(struct ffmpeg *ffmpeg){ +void ffmpeg_close(struct ffmpeg *ffmpeg) +{ #ifdef HAVE_FFMPEG if (ffmpeg != NULL) { @@ -1570,8 +1607,8 @@ void ffmpeg_close(struct ffmpeg *ffmpeg){ #endif // HAVE_FFMPEG } - -int ffmpeg_put_image(struct ffmpeg *ffmpeg, struct image_data *img_data, const struct timeval *tv1){ +int ffmpeg_put_image(struct ffmpeg *ffmpeg, struct image_data *img_data, const struct timeval *tv1) +{ #ifdef HAVE_FFMPEG int retcd = 0; int cnt = 0; @@ -1631,7 +1668,8 @@ int ffmpeg_put_image(struct ffmpeg *ffmpeg, struct image_data *img_data, const s #endif // HAVE_FFMPEG } -void ffmpeg_reset_movie_start_time(struct ffmpeg *ffmpeg, const struct timeval *tv1){ +void ffmpeg_reset_movie_start_time(struct ffmpeg *ffmpeg, const struct timeval *tv1) +{ #ifdef HAVE_FFMPEG int64_t one_frame_interval = av_rescale_q(1,(AVRational){1, ffmpeg->fps},ffmpeg->video_st->time_base); if (one_frame_interval <= 0) diff --git a/src/jpegutils.c b/src/jpegutils.c index 263a889f..14fd1b65 100644 --- a/src/jpegutils.c +++ b/src/jpegutils.c @@ -96,8 +96,9 @@ struct jpgutl_error_mgr { }; /* These huffman tables are required by the old jpeg libs included with 14.04 */ -static void add_huff_table(j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val){ -/* Define a Huffman table */ +static void add_huff_table(j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) +{ + /* Define a Huffman table */ int nsymbols, len; if (*htblptr == NULL) @@ -122,9 +123,10 @@ static void add_huff_table(j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UI memcpy((*htblptr)->huffval, val, nsymbols * sizeof(UINT8)); } -static void std_huff_tables (j_decompress_ptr dinfo){ -/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ -/* IMPORTANT: these are only valid for 8-bit data precision! */ +static void std_huff_tables (j_decompress_ptr dinfo) +{ + /* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ + /* IMPORTANT: these are only valid for 8-bit data precision! */ static const UINT8 bits_dc_luminance[17] = { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/src/logger.c b/src/logger.c index 896c7722..d5431852 100644 --- a/src/logger.c +++ b/src/logger.c @@ -167,7 +167,8 @@ static char *str_time(void) * Returns: * Nothing */ -void motion_log(int level, unsigned int type, int errno_flag,int fncname, const char *fmt, ...){ +void motion_log(int level, unsigned int type, int errno_flag,int fncname, const char *fmt, ...) +{ int errno_save, n; char buf[1024]; char usrfmt[1024]; diff --git a/src/motion.c b/src/motion.c index 405d392e..ff709169 100644 --- a/src/motion.c +++ b/src/motion.c @@ -406,7 +406,8 @@ static void sigchild_handler(int signo ATTRIBUTE_UNUSED) * setup_signals * Attaches handlers to a number of signals that Motion need to catch. */ -static void setup_signals(void){ +static void setup_signals(void) +{ /* * Setup signals and do some initialization. 1 in the call to * 'motion_startup' means that Motion will become a daemon if so has been @@ -737,7 +738,8 @@ static void process_image_ring(struct context *cnt, unsigned int max_images) cnt->current_image = saved_current_image; } -static int init_camera_type(struct context *cnt){ +static int init_camera_type(struct context *cnt) +{ cnt->camera_type = CAMERA_TYPE_UNKNOWN; @@ -782,7 +784,8 @@ static int init_camera_type(struct context *cnt){ } -static void init_mask_privacy(struct context *cnt){ +static void init_mask_privacy(struct context *cnt) +{ int indxrow, indxcol; int start_cr, offset_cb, start_cb; @@ -888,7 +891,8 @@ static void init_mask_privacy(struct context *cnt){ } -static void init_text_scale(struct context *cnt){ +static void init_text_scale(struct context *cnt) +{ /* Consider that web interface may change conf values at any moment. * The below can put two sections in the image so make sure that after @@ -917,7 +921,8 @@ static void init_text_scale(struct context *cnt){ } -static void mot_stream_init(struct context *cnt){ +static void mot_stream_init(struct context *cnt) +{ /* The image buffers are allocated in event_stream_put if needed*/ pthread_mutex_init(&cnt->mutex_stream, NULL); @@ -942,7 +947,8 @@ static void mot_stream_init(struct context *cnt){ } -static void mot_stream_deinit(struct context *cnt){ +static void mot_stream_deinit(struct context *cnt) +{ /* Need to check whether buffers were allocated since init * function defers the allocations to event_stream_put @@ -977,7 +983,8 @@ static void mot_stream_deinit(struct context *cnt){ } /* TODO: dbse functions are to be moved to separate module in future change*/ -static void dbse_global_deinit(void){ +static void dbse_global_deinit(void) +{ MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, _("Closing MYSQL")); #if defined(HAVE_MYSQL) || defined(HAVE_MARIADB) mysql_library_end(); @@ -985,7 +992,8 @@ static void dbse_global_deinit(void){ } -static void dbse_global_init(void){ +static void dbse_global_init(void) +{ MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("Initializing database")); /* Initialize all the database items */ @@ -1037,7 +1045,8 @@ static void dbse_global_init(void){ } -static int dbse_init_mysql(struct context *cnt){ +static int dbse_init_mysql(struct context *cnt) +{ #if defined(HAVE_MYSQL) || defined(HAVE_MARIADB) int dbport; @@ -1073,7 +1082,8 @@ static int dbse_init_mysql(struct context *cnt){ } -static int dbse_init_sqlite3(struct context *cnt){ +static int dbse_init_sqlite3(struct context *cnt) +{ #ifdef HAVE_SQLITE3 if (cnt_list[0]->database_sqlite3 != 0) { MOTION_LOG(NTC, TYPE_DB, NO_ERRNO,_("SQLite3 using shared handle")); @@ -1104,7 +1114,8 @@ static int dbse_init_sqlite3(struct context *cnt){ } -static int dbse_init_pgsql(struct context *cnt){ +static int dbse_init_pgsql(struct context *cnt) +{ #ifdef HAVE_PGSQL if ((!strcmp(cnt->conf.database_type, "postgresql")) && (cnt->conf.database_dbname)) { char connstring[255]; @@ -1137,7 +1148,8 @@ static int dbse_init_pgsql(struct context *cnt){ return 0; } -static int dbse_init(struct context *cnt){ +static int dbse_init(struct context *cnt) +{ int retcd = 0; if (cnt->conf.database_type) { @@ -1163,7 +1175,8 @@ static int dbse_init(struct context *cnt){ return retcd; } -static void dbse_deinit(struct context *cnt){ +static void dbse_deinit(struct context *cnt) +{ if (cnt->conf.database_type) { #if defined(HAVE_MYSQL) || defined(HAVE_MARIADB) if ( (!strcmp(cnt->conf.database_type, "mysql")) && (cnt->conf.database_dbname)) { @@ -1190,7 +1203,8 @@ static void dbse_deinit(struct context *cnt){ } } -static void dbse_sqlmask_update(struct context *cnt){ +static void dbse_sqlmask_update(struct context *cnt) +{ /* * Set the sql mask file according to the SQL config options * We update it for every frame in case the config was updated @@ -1595,7 +1609,8 @@ static int motion_init(struct context *cnt) * * Returns: nothing */ -static void motion_cleanup(struct context *cnt) { +static void motion_cleanup(struct context *cnt) +{ event(cnt, EVENT_TIMELAPSEEND, NULL, NULL, NULL, NULL); event(cnt, EVENT_ENDMOTION, NULL, NULL, NULL, NULL); @@ -1695,7 +1710,8 @@ static void motion_cleanup(struct context *cnt) { } -static void mlp_mask_privacy(struct context *cnt){ +static void mlp_mask_privacy(struct context *cnt) +{ if (cnt->imgs.mask_privacy == NULL) return; @@ -1771,7 +1787,8 @@ static void mlp_mask_privacy(struct context *cnt){ } } -static void mlp_areadetect(struct context *cnt){ +static void mlp_areadetect(struct context *cnt) +{ int i, j, z = 0; /* * Simple hack to recognize motion in a specific area @@ -1800,7 +1817,8 @@ static void mlp_areadetect(struct context *cnt){ } -static void mlp_prepare(struct context *cnt){ +static void mlp_prepare(struct context *cnt) +{ int frame_buffer_size; struct timeval tv1; @@ -1887,7 +1905,8 @@ static void mlp_prepare(struct context *cnt){ } -static void mlp_resetimages(struct context *cnt){ +static void mlp_resetimages(struct context *cnt) +{ struct image_data *old_image; @@ -1941,7 +1960,8 @@ static void mlp_resetimages(struct context *cnt){ } -static int mlp_retry(struct context *cnt){ +static int mlp_retry(struct context *cnt) +{ /* * If a camera is not available we keep on retrying every 10 seconds @@ -2002,7 +2022,8 @@ static int mlp_retry(struct context *cnt){ return 0; } -static int mlp_capture(struct context *cnt){ +static int mlp_capture(struct context *cnt) +{ const char *tmpin; char tmpout[80]; @@ -2161,7 +2182,8 @@ static int mlp_capture(struct context *cnt){ } -static void mlp_detection(struct context *cnt){ +static void mlp_detection(struct context *cnt) +{ /***** MOTION LOOP - MOTION DETECTION SECTION *****/ @@ -2279,7 +2301,8 @@ static void mlp_detection(struct context *cnt){ } -static void mlp_tuning(struct context *cnt){ +static void mlp_tuning(struct context *cnt) +{ /***** MOTION LOOP - TUNING SECTION *****/ @@ -2353,7 +2376,8 @@ static void mlp_tuning(struct context *cnt){ } -static void mlp_overlay(struct context *cnt){ +static void mlp_overlay(struct context *cnt) +{ char tmp[PATH_MAX]; @@ -2427,7 +2451,8 @@ static void mlp_overlay(struct context *cnt){ } -static void mlp_actions(struct context *cnt){ +static void mlp_actions(struct context *cnt) +{ int indx; @@ -2595,7 +2620,8 @@ static void mlp_actions(struct context *cnt){ } -static void mlp_setupmode(struct context *cnt){ +static void mlp_setupmode(struct context *cnt) +{ /***** MOTION LOOP - SETUP MODE CONSOLE OUTPUT SECTION *****/ /* If CAMERA_VERBOSE enabled output some numbers to console */ @@ -2631,7 +2657,8 @@ static void mlp_setupmode(struct context *cnt){ } -static void mlp_snapshot(struct context *cnt){ +static void mlp_snapshot(struct context *cnt) +{ /***** MOTION LOOP - SNAPSHOT FEATURE SECTION *****/ /* * Did we get triggered to make a snapshot from control http? Then shoot a snap @@ -2654,7 +2681,8 @@ static void mlp_snapshot(struct context *cnt){ } -static void mlp_timelapse(struct context *cnt){ +static void mlp_timelapse(struct context *cnt) +{ struct tm timestamp_tm; @@ -2730,7 +2758,8 @@ static void mlp_timelapse(struct context *cnt){ } -static void mlp_loopback(struct context *cnt){ +static void mlp_loopback(struct context *cnt) +{ /* * Feed last image and motion image to video device pipes and the stream clients * In setup mode we send the special setup mode image to both stream and vloopback pipe @@ -2758,7 +2787,8 @@ static void mlp_loopback(struct context *cnt){ } -static void mlp_parmsupdate(struct context *cnt){ +static void mlp_parmsupdate(struct context *cnt) +{ /***** MOTION LOOP - ONCE PER SECOND PARAMETER UPDATE SECTION *****/ /* Check for some config parameter changes but only every second */ @@ -2831,7 +2861,8 @@ static void mlp_parmsupdate(struct context *cnt){ } -static void mlp_frametiming(struct context *cnt){ +static void mlp_frametiming(struct context *cnt) +{ int indx; struct timeval tv2; @@ -3042,7 +3073,8 @@ static void become_daemon(void) sigaction(SIGTSTP, &sig_ign_action, NULL); } -static void cntlist_create(int argc, char *argv[]){ +static void cntlist_create(int argc, char *argv[]) +{ /* * cnt_list is an array of pointers to the context structures cnt for each thread. * First we reserve room for a pointer to thread 0's context structure @@ -3074,7 +3106,8 @@ static void cntlist_create(int argc, char *argv[]){ cnt_list = conf_load(cnt_list); } -static void motion_shutdown(void){ +static void motion_shutdown(void) +{ int i = -1; motion_remove_pid(); @@ -3090,7 +3123,8 @@ static void motion_shutdown(void){ vid_mutex_destroy(); } -static void motion_camera_ids(void){ +static void motion_camera_ids(void) +{ /* Set the camera id's on the context. They must be unique */ int indx, indx2, invalid_ids; @@ -3128,7 +3162,8 @@ static void motion_camera_ids(void){ } } -static void motion_ntc(void){ +static void motion_ntc(void) +{ #ifdef HAVE_V4L2 MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : available")); @@ -3309,7 +3344,8 @@ static void motion_startup(int daemonize, int argc, char *argv[]) * * Returns: nothing */ -static void motion_start_thread(struct context *cnt){ +static void motion_start_thread(struct context *cnt) +{ int i; char service[6]; pthread_attr_t thread_attr; @@ -3398,7 +3434,8 @@ static void motion_start_thread(struct context *cnt){ } -static void motion_restart(int argc, char **argv){ +static void motion_restart(int argc, char **argv) +{ /* * Handle the restart situation. Currently the approach is to * cleanup everything, and then initialize everything again @@ -3415,7 +3452,8 @@ static void motion_restart(int argc, char **argv){ restart = 0; } -static void motion_watchdog(int indx){ +static void motion_watchdog(int indx) +{ /* Notes: * To test scenarios, just double lock a mutex in a spawned thread. @@ -3518,7 +3556,8 @@ static void motion_watchdog(int indx){ } } -static int motion_check_threadcount(void){ +static int motion_check_threadcount(void) +{ /* Return 1 if we should break out of loop */ /* It has been observed that this is not counting every @@ -3720,7 +3759,6 @@ void *myrealloc(void *ptr, size_t size, const char *desc) return dummy; } - /** * create_path * @@ -4086,7 +4124,8 @@ size_t mystrftime(const struct context *cnt, char *s, size_t max, const char *us /* This is a temporary location for these util functions. All the generic utility * functions will be collected here and ultimately moved into a new common "util" module */ -void util_threadname_set(const char *abbr, int threadnbr, const char *threadname){ +void util_threadname_set(const char *abbr, int threadnbr, const char *threadname) +{ /* When the abbreviation is sent in as null, that means we are being * provided a fully filled out thread name (usually obtained from a * previously called get_threadname so we set it without additional @@ -4114,7 +4153,8 @@ void util_threadname_set(const char *abbr, int threadnbr, const char *threadname } -void util_threadname_get(char *threadname){ +void util_threadname_get(char *threadname) +{ #if ((!defined(BSD) && HAVE_PTHREAD_GETNAME_NP) || defined(__APPLE__)) char currname[16]; @@ -4125,7 +4165,9 @@ void util_threadname_get(char *threadname){ #endif } -int util_check_passthrough(struct context *cnt){ + +int util_check_passthrough(struct context *cnt) +{ #if ( MYFFVER < 55000) if (cnt->movie_passthrough) MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO diff --git a/src/netcam.c b/src/netcam.c index 5345a52b..f4abf5e4 100644 --- a/src/netcam.c +++ b/src/netcam.c @@ -69,7 +69,8 @@ static char *netcam_url_match(regmatch_t m, const char *input) return match; } -static void netcam_url_invalid(struct url_t *parse_url){ +static void netcam_url_invalid(struct url_t *parse_url) +{ MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Invalid URL. Can not parse values.")); @@ -84,6 +85,7 @@ static void netcam_url_invalid(struct url_t *parse_url){ sprintf(parse_url->userpass, "%s","INVALID"); } + /** * netcam_url_parse * @@ -424,7 +426,8 @@ static void *netcam_handler_loop(void *arg) * Returns: Nothing. * */ -void netcam_cleanup(netcam_context_ptr netcam, int init_retry_flag){ +void netcam_cleanup(netcam_context_ptr netcam, int init_retry_flag) +{ struct timespec waittime; if (!netcam) return; @@ -550,7 +553,8 @@ void netcam_cleanup(netcam_context_ptr netcam, int init_retry_flag){ * * Returns: Error code */ -int netcam_next(struct context *cnt, struct image_data *img_data){ +int netcam_next(struct context *cnt, struct image_data *img_data) +{ netcam_context_ptr netcam; @@ -611,7 +615,8 @@ int netcam_next(struct context *cnt, struct image_data *img_data){ * -1 on any failure * -2 image dimensions are not modulo 8 */ -int netcam_start(struct context *cnt){ +int netcam_start(struct context *cnt) +{ netcam_context_ptr netcam; /* Local pointer to our context. */ pthread_attr_t handler_attribute; /* Attributes of our handler thread. */ diff --git a/src/netcam_ftp.c b/src/netcam_ftp.c index 67b44aad..fa1fe915 100644 --- a/src/netcam_ftp.c +++ b/src/netcam_ftp.c @@ -783,6 +783,7 @@ int ftp_get_socket(ftp_context_pointer ctxt) return ctxt->data_file_desc; } + /** * ftp_send_type * @@ -864,7 +865,6 @@ int ftp_read(ftp_context_pointer ctxt, void *dest, int len) return len; } - /** * ftp_close * diff --git a/src/netcam_http.c b/src/netcam_http.c index 6b9b465f..6bab3343 100644 --- a/src/netcam_http.c +++ b/src/netcam_http.c @@ -1498,7 +1498,6 @@ static int netcam_mjpg_buffer_refill(netcam_context_ptr netcam) return retval; } - /** * netcam_read_mjpg_jpeg * diff --git a/src/netcam_rtsp.c b/src/netcam_rtsp.c index e4d161bb..52da1917 100644 --- a/src/netcam_rtsp.c +++ b/src/netcam_rtsp.c @@ -33,7 +33,8 @@ #include "ffmpeg.h" -static int netcam_rtsp_check_pixfmt(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_check_pixfmt(struct rtsp_context *rtsp_data) +{ /* Determine if the format is YUV420P */ int retcd; @@ -45,7 +46,8 @@ static int netcam_rtsp_check_pixfmt(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_pktarray_free(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_pktarray_free(struct rtsp_context *rtsp_data) +{ int indx; pthread_mutex_lock(&rtsp_data->mutex_pktarray); @@ -64,7 +66,8 @@ static void netcam_rtsp_pktarray_free(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_null_context(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_null_context(struct rtsp_context *rtsp_data) +{ rtsp_data->swsctx = NULL; rtsp_data->swsframe_in = NULL; @@ -76,7 +79,8 @@ static void netcam_rtsp_null_context(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_close_context(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_close_context(struct rtsp_context *rtsp_data) +{ if (rtsp_data->swsctx != NULL) sws_freeContext(rtsp_data->swsctx); if (rtsp_data->swsframe_in != NULL) my_frame_free(rtsp_data->swsframe_in); @@ -93,7 +97,8 @@ static void netcam_rtsp_close_context(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_pktarray_resize(struct context *cnt, int is_highres){ +static void netcam_rtsp_pktarray_resize(struct context *cnt, int is_highres) +{ /* This is called from netcam_rtsp_next and is on the motion loop thread * The rtsp_data->mutex is locked around the call to this function. */ @@ -160,7 +165,8 @@ static void netcam_rtsp_pktarray_resize(struct context *cnt, int is_highres){ } -static void netcam_rtsp_pktarray_add(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_pktarray_add(struct rtsp_context *rtsp_data) +{ int indx_next; int retcd; @@ -212,7 +218,8 @@ static void netcam_rtsp_pktarray_add(struct rtsp_context *rtsp_data){ } -static int netcam_decode_sw(struct rtsp_context *rtsp_data){ +static int netcam_decode_sw(struct rtsp_context *rtsp_data) +{ #if ( MYFFVER >= 57041) int retcd; @@ -265,7 +272,8 @@ static int netcam_decode_sw(struct rtsp_context *rtsp_data){ #endif } -static int netcam_decode_vaapi(struct rtsp_context *rtsp_data){ +static int netcam_decode_vaapi(struct rtsp_context *rtsp_data) +{ #if ( MYFFVER >= 57083) @@ -320,7 +328,8 @@ static int netcam_decode_vaapi(struct rtsp_context *rtsp_data){ * 0 invalid but continue * 1 valid data */ -static int netcam_rtsp_decode_video(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_decode_video(struct rtsp_context *rtsp_data) +{ #if ( MYFFVER >= 57041) @@ -374,7 +383,8 @@ static int netcam_rtsp_decode_video(struct rtsp_context *rtsp_data){ } -static int netcam_rtsp_decode_packet(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_decode_packet(struct rtsp_context *rtsp_data) +{ int frame_size; int retcd; @@ -408,7 +418,8 @@ static int netcam_rtsp_decode_packet(struct rtsp_context *rtsp_data){ return frame_size; } -static void netcam_hwdecoders(struct rtsp_context *rtsp_data){ +static void netcam_hwdecoders(struct rtsp_context *rtsp_data) +{ #if ( MYFFVER >= 57083) @@ -449,7 +460,8 @@ static void netcam_hwdecoders(struct rtsp_context *rtsp_data){ #endif } -static enum AVPixelFormat netcam_getfmt_vaapi(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts) { +static enum AVPixelFormat netcam_getfmt_vaapi(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts) +{ #if ( MYFFVER >= 57083) const enum AVPixelFormat *p; (void)avctx; @@ -467,7 +479,8 @@ static enum AVPixelFormat netcam_getfmt_vaapi(AVCodecContext *avctx, const enum #endif } -static void netcam_rtsp_decoder_error(struct rtsp_context *rtsp_data, int retcd, const char* fnc_nm){ +static void netcam_rtsp_decoder_error(struct rtsp_context *rtsp_data, int retcd, const char* fnc_nm) +{ char errstr[128]; int indx; @@ -512,7 +525,8 @@ static void netcam_rtsp_decoder_error(struct rtsp_context *rtsp_data, int retcd, } -static int netcam_init_vaapi(struct rtsp_context *rtsp_data){ +static int netcam_init_vaapi(struct rtsp_context *rtsp_data) +{ #if ( MYFFVER >= 57083) @@ -564,7 +578,8 @@ static int netcam_init_vaapi(struct rtsp_context *rtsp_data){ #endif } -static int netcam_init_swdecoder(struct rtsp_context *rtsp_data) { +static int netcam_init_swdecoder(struct rtsp_context *rtsp_data) +{ #if ( MYFFVER >= 57041) @@ -623,7 +638,8 @@ static int netcam_init_swdecoder(struct rtsp_context *rtsp_data) { #endif } -static int netcam_rtsp_open_codec(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_open_codec(struct rtsp_context *rtsp_data) +{ #if ( MYFFVER >= 57041) int retcd; @@ -691,7 +707,8 @@ static int netcam_rtsp_open_codec(struct rtsp_context *rtsp_data){ } -static struct rtsp_context *rtsp_new_context(void){ +static struct rtsp_context *rtsp_new_context(void) +{ struct rtsp_context *ret; /* Note that mymalloc will exit on any problem. */ @@ -702,7 +719,8 @@ static struct rtsp_context *rtsp_new_context(void){ return ret; } -static int netcam_rtsp_interrupt(void *ctx){ +static int netcam_rtsp_interrupt(void *ctx) +{ struct rtsp_context *rtsp_data = ctx; if (rtsp_data->finish){ @@ -749,7 +767,8 @@ static int netcam_rtsp_interrupt(void *ctx){ return FALSE; } -static int netcam_rtsp_open_sws(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_open_sws(struct rtsp_context *rtsp_data) +{ if (rtsp_data->finish) return -1; /* This just speeds up the shutdown time */ @@ -811,7 +830,8 @@ static int netcam_rtsp_open_sws(struct rtsp_context *rtsp_data){ } -static int netcam_rtsp_resize(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_resize(struct rtsp_context *rtsp_data) +{ int retcd; char errstr[128]; @@ -899,7 +919,8 @@ static int netcam_rtsp_resize(struct rtsp_context *rtsp_data){ } -static int netcam_rtsp_read_image(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_read_image(struct rtsp_context *rtsp_data) +{ int size_decoded; int retcd, errcnt, haveimage; @@ -1039,7 +1060,8 @@ static int netcam_rtsp_read_image(struct rtsp_context *rtsp_data){ return 0; } -static int netcam_rtsp_ntc(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_ntc(struct rtsp_context *rtsp_data) +{ if ((rtsp_data->finish) || (!rtsp_data->first_image) || @@ -1084,7 +1106,8 @@ static int netcam_rtsp_ntc(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_set_options(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_set_options(struct rtsp_context *rtsp_data) +{ int indx; char *tmpval; @@ -1158,7 +1181,8 @@ static void netcam_rtsp_set_options(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_set_path (struct context *cnt, struct rtsp_context *rtsp_data ) { +static void netcam_rtsp_set_path (struct context *cnt, struct rtsp_context *rtsp_data ) +{ char *userpass = NULL; struct url_t url; @@ -1218,7 +1242,8 @@ static void netcam_rtsp_set_path (struct context *cnt, struct rtsp_context *rtsp } -static void netcam_rtsp_set_parms (struct context *cnt, struct rtsp_context *rtsp_data ) { +static void netcam_rtsp_set_parms (struct context *cnt, struct rtsp_context *rtsp_data ) +{ /* Set the parameters to be used with our camera */ char *tmpval; @@ -1312,7 +1337,8 @@ static void netcam_rtsp_set_parms (struct context *cnt, struct rtsp_context *rts } -static int netcam_rtsp_set_dimensions (struct context *cnt) { +static int netcam_rtsp_set_dimensions (struct context *cnt) +{ cnt->imgs.width = 0; cnt->imgs.height = 0; @@ -1347,7 +1373,8 @@ static int netcam_rtsp_set_dimensions (struct context *cnt) { return 0; } -static int netcam_rtsp_copy_stream(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_copy_stream(struct rtsp_context *rtsp_data) +{ /* Make a static copy of the stream information for use in passthrough processing */ #if ( MYFFVER >= 57041) AVStream *transfer_stream, *stream_in; @@ -1395,7 +1422,8 @@ static int netcam_rtsp_copy_stream(struct rtsp_context *rtsp_data){ } -static int netcam_rtsp_open_context(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_open_context(struct rtsp_context *rtsp_data) +{ int retcd; char errstr[128]; @@ -1525,7 +1553,8 @@ static int netcam_rtsp_open_context(struct rtsp_context *rtsp_data){ } -static int netcam_rtsp_connect(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_connect(struct rtsp_context *rtsp_data) +{ if (netcam_rtsp_open_context(rtsp_data) < 0) return -1; @@ -1574,7 +1603,8 @@ static int netcam_rtsp_connect(struct rtsp_context *rtsp_data){ return 0; } -static void netcam_rtsp_shutdown(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_shutdown(struct rtsp_context *rtsp_data) +{ if (rtsp_data) { netcam_rtsp_close_context(rtsp_data); @@ -1605,7 +1635,8 @@ static void netcam_rtsp_shutdown(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_handler_wait(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_handler_wait(struct rtsp_context *rtsp_data) +{ long usec_maxrate, usec_delay; @@ -1626,7 +1657,8 @@ static void netcam_rtsp_handler_wait(struct rtsp_context *rtsp_data){ } -static void netcam_rtsp_handler_reconnect(struct rtsp_context *rtsp_data){ +static void netcam_rtsp_handler_reconnect(struct rtsp_context *rtsp_data) +{ int retcd; @@ -1662,7 +1694,8 @@ static void netcam_rtsp_handler_reconnect(struct rtsp_context *rtsp_data){ } -static void *netcam_rtsp_handler(void *arg){ +static void *netcam_rtsp_handler(void *arg) +{ struct rtsp_context *rtsp_data = arg; @@ -1713,7 +1746,8 @@ static void *netcam_rtsp_handler(void *arg){ pthread_exit(NULL); } -static int netcam_rtsp_start_handler(struct rtsp_context *rtsp_data){ +static int netcam_rtsp_start_handler(struct rtsp_context *rtsp_data) +{ int retcd, wait_counter; pthread_attr_t handler_attribute; @@ -1767,7 +1801,8 @@ static int netcam_rtsp_start_handler(struct rtsp_context *rtsp_data){ #endif /* End HAVE_FFMPEG */ -int netcam_rtsp_setup(struct context *cnt){ +int netcam_rtsp_setup(struct context *cnt) +{ #ifdef HAVE_FFMPEG int retcd; @@ -1846,7 +1881,8 @@ int netcam_rtsp_setup(struct context *cnt){ #endif /* End #ifdef HAVE_FFMPEG */ } -int netcam_rtsp_next(struct context *cnt, struct image_data *img_data){ +int netcam_rtsp_next(struct context *cnt, struct image_data *img_data) +{ #ifdef HAVE_FFMPEG /* This is called from the motion loop thread */ @@ -1890,7 +1926,8 @@ int netcam_rtsp_next(struct context *cnt, struct image_data *img_data){ #endif /* End #ifdef HAVE_FFMPEG */ } -void netcam_rtsp_cleanup(struct context *cnt, int init_retry_flag){ +void netcam_rtsp_cleanup(struct context *cnt, int init_retry_flag) +{ #ifdef HAVE_FFMPEG /* * If the init_retry_flag is not set this function was diff --git a/src/picture.c b/src/picture.c index ac7d7cac..f2e0cf9d 100644 --- a/src/picture.c +++ b/src/picture.c @@ -772,7 +772,8 @@ int put_picture_memory(struct context *cnt, unsigned char* dest_image, int image return 0; } -static void put_picture_fd(struct context *cnt, FILE *picture, unsigned char *image, int quality, int ftype){ +static void put_picture_fd(struct context *cnt, FILE *picture, unsigned char *image, int quality, int ftype) +{ int width, height; int passthrough; int dummy = 1; @@ -969,7 +970,8 @@ void put_fixed_mask(struct context *cnt, const char *file) "re-run motion to enable mask feature"), cnt->conf.mask_file); } -void pic_scale_img(int width_src, int height_src, unsigned char *img_src, unsigned char *img_dst){ +void pic_scale_img(int width_src, int height_src, unsigned char *img_src, unsigned char *img_dst) +{ int i = 0, x, y; for (y = 0; y < height_src; y+=2) diff --git a/src/rotate.c b/src/rotate.c index cd4658f4..e94e367b 100644 --- a/src/rotate.c +++ b/src/rotate.c @@ -74,7 +74,8 @@ static void reverse_inplace_quad(unsigned char *src, int size) } } -static void flip_inplace_horizontal(unsigned char *src, int width, int height) { +static void flip_inplace_horizontal(unsigned char *src, int width, int height) +{ uint8_t *nsrc, *ndst; register uint8_t tmp; int l,w; @@ -187,7 +188,8 @@ static inline void rot90ccw(unsigned char *src, register unsigned char *dst, * * Returns: nothing */ -void rotate_init(struct context *cnt){ +void rotate_init(struct context *cnt) +{ int size_norm, size_high; /* Make sure buffer_norm isn't freed if it hasn't been allocated. */ @@ -275,7 +277,8 @@ void rotate_init(struct context *cnt){ * * Returns: nothing */ -void rotate_deinit(struct context *cnt){ +void rotate_deinit(struct context *cnt) +{ if (cnt->rotate_data.buffer_norm) free(cnt->rotate_data.buffer_norm); @@ -299,7 +302,8 @@ void rotate_deinit(struct context *cnt){ * 0 - success * -1 - failure (shouldn't happen) */ -int rotate_map(struct context *cnt, struct image_data *img_data){ +int rotate_map(struct context *cnt, struct image_data *img_data) +{ /* * The image format is YUV 4:2:0 planar, which has the pixel * data is divided in three parts: diff --git a/src/translate.c b/src/translate.c index e234860a..9de963d1 100644 --- a/src/translate.c +++ b/src/translate.c @@ -12,7 +12,8 @@ int nls_enabled; -void translate_locale_chg(const char *langcd){ +void translate_locale_chg(const char *langcd) +{ #ifdef HAVE_GETTEXT /* This routine is for development testing only. It is not used for * regular users because once this locale is change, it changes the @@ -28,7 +29,8 @@ void translate_locale_chg(const char *langcd){ #endif } -void translate_init(void){ +void translate_init(void) +{ #ifdef HAVE_GETTEXT /* Set the flag to enable native language support */ nls_enabled = 1; @@ -53,7 +55,8 @@ void translate_init(void){ #endif } -char* translate_text(const char *msgid){ +char* translate_text(const char *msgid) +{ #ifdef HAVE_GETTEXT if (nls_enabled){ return (char*)gettext(msgid); diff --git a/src/video_bktr.c b/src/video_bktr.c index 7468c98f..1db22c1b 100644 --- a/src/video_bktr.c +++ b/src/video_bktr.c @@ -62,7 +62,8 @@ static void catchsignal(int sig ATTRIBUTE_UNUSED) bktr_frame_waiting++; } -static int bktr_set_hue(int viddev, int new_hue) { +static int bktr_set_hue(int viddev, int new_hue) +{ signed char ioctlval = new_hue; if (ioctl(viddev, METEORSHUE, &ioctlval) < 0) { @@ -76,7 +77,8 @@ static int bktr_set_hue(int viddev, int new_hue) { return ioctlval; } -static int bktr_get_hue(int viddev , int *hue) { +static int bktr_get_hue(int viddev , int *hue) +{ signed char ioctlval; if (ioctl(viddev, METEORGHUE, &ioctlval) < 0) { @@ -90,7 +92,8 @@ static int bktr_get_hue(int viddev , int *hue) { return ioctlval; } -static int bktr_set_saturation(int viddev, int new_saturation) { +static int bktr_set_saturation(int viddev, int new_saturation) +{ unsigned char ioctlval= new_saturation; if (ioctl(viddev, METEORSCSAT, &ioctlval) < 0) { @@ -104,7 +107,8 @@ static int bktr_set_saturation(int viddev, int new_saturation) { return ioctlval; } -static int bktr_get_saturation(int viddev , int *saturation) { +static int bktr_get_saturation(int viddev , int *saturation) +{ unsigned char ioctlval; if (ioctl(viddev, METEORGCSAT, &ioctlval) < 0) { @@ -119,7 +123,8 @@ static int bktr_get_saturation(int viddev , int *saturation) { return ioctlval; } -static int bktr_set_contrast(int viddev, int new_contrast) { +static int bktr_set_contrast(int viddev, int new_contrast) +{ unsigned char ioctlval = new_contrast; if (ioctl(viddev, METEORSCONT, &ioctlval) < 0) { @@ -133,7 +138,8 @@ static int bktr_set_contrast(int viddev, int new_contrast) { return ioctlval; } -static int bktr_get_contrast(int viddev, int *contrast) { +static int bktr_get_contrast(int viddev, int *contrast) +{ unsigned char ioctlval; if (ioctl(viddev, METEORGCONT, &ioctlval) < 0) { @@ -333,7 +339,8 @@ static int bktr_set_geometry(struct video_dev *viddev, int width, int height) return 0; } -static void bktr_picture_controls(struct context *cnt, struct video_dev *viddev) { +static void bktr_picture_controls(struct context *cnt, struct video_dev *viddev) +{ int dev = viddev->fd_device; int indx_user, retcd; @@ -535,7 +542,8 @@ static unsigned char *bktr_device_init(struct video_dev *viddev, int width, int * -1 Fatal error * 1 Non fatal error (not implemented) */ -static int bktr_capture(struct video_dev *viddev, unsigned char *map, int width, int height) { +static int bktr_capture(struct video_dev *viddev, unsigned char *map, int width, int height) +{ int dev_bktr = viddev->fd_device; unsigned char *cap_map = NULL; unsigned char *common_buffer; @@ -655,7 +663,8 @@ static void bktr_set_input(struct context *cnt, struct video_dev *viddev, unsign #endif /* HAVE_BKTR */ -void bktr_mutex_init(void) { +void bktr_mutex_init(void) +{ #ifdef HAVE_BKTR pthread_mutex_init(&bktr_mutex, NULL); #else @@ -663,7 +672,8 @@ void bktr_mutex_init(void) { #endif } -void bktr_mutex_destroy(void) { +void bktr_mutex_destroy(void) +{ #ifdef HAVE_BKTR pthread_mutex_destroy(&bktr_mutex); #else @@ -671,7 +681,8 @@ void bktr_mutex_destroy(void) { #endif } -void bktr_cleanup(struct context *cnt){ +void bktr_cleanup(struct context *cnt) +{ #ifdef HAVE_BKTR struct video_dev *dev = viddevs; @@ -770,7 +781,8 @@ void bktr_cleanup(struct context *cnt){ } -int bktr_start(struct context *cnt) { +int bktr_start(struct context *cnt) +{ #ifdef HAVE_BKTR struct config *conf = &cnt->conf; @@ -951,7 +963,8 @@ int bktr_start(struct context *cnt) { } -int bktr_next(struct context *cnt, struct image_data *img_data) { +int bktr_next(struct context *cnt, struct image_data *img_data) +{ #ifdef HAVE_BKTR struct config *conf = &cnt->conf; diff --git a/src/video_common.c b/src/video_common.c index 60e13a10..27c73da6 100644 --- a/src/video_common.c +++ b/src/video_common.c @@ -518,7 +518,8 @@ void vid_mutex_destroy(void) bktr_mutex_destroy(); } -void vid_close(struct context *cnt) { +void vid_close(struct context *cnt) +{ #ifdef HAVE_MMAL if (cnt->mmalcam) { @@ -582,7 +583,8 @@ void vid_close(struct context *cnt) { * -1 if failed to open device. * -3 image dimensions are not modulo 8 */ -int vid_start(struct context *cnt) { +int vid_start(struct context *cnt) +{ int dev = -1; #ifdef HAVE_MMAL @@ -663,7 +665,8 @@ int vid_start(struct context *cnt) { * with bit 0 set Non fatal V4L error (copy grey image and discard this image) * with bit 1 set Non fatal Netcam error */ -int vid_next(struct context *cnt, struct image_data *img_data){ +int vid_next(struct context *cnt, struct image_data *img_data) +{ #ifdef HAVE_MMAL if (cnt->camera_type == CAMERA_TYPE_MMAL) { diff --git a/src/video_loopback.c b/src/video_loopback.c index 3d42648d..1c48f276 100644 --- a/src/video_loopback.c +++ b/src/video_loopback.c @@ -120,7 +120,8 @@ typedef struct capent {const char *cap; int code;} capentT; {"Last",0} }; -static void vlp_show_vcap(struct v4l2_capability *cap) { +static void vlp_show_vcap(struct v4l2_capability *cap) +{ unsigned int vers = cap->version; unsigned int c = cap->capabilities; int i; @@ -137,7 +138,8 @@ static void vlp_show_vcap(struct v4l2_capability *cap) { MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "------------------------"); } -static void vlp_show_vfmt(struct v4l2_format *v) { +static void vlp_show_vfmt(struct v4l2_format *v) +{ MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "type: type: %d",v->type); MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.width: %d",v->fmt.pix.width); MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.height: %d",v->fmt.pix.height); diff --git a/src/video_v4l2.c b/src/video_v4l2.c index 08a47319..616206b9 100644 --- a/src/video_v4l2.c +++ b/src/video_v4l2.c @@ -79,7 +79,8 @@ typedef struct palette_item_struct{ char fourcc[5]; } palette_item; -static void v4l2_palette_init(palette_item *palette_array){ +static void v4l2_palette_init(palette_item *palette_array) +{ int indx; @@ -132,7 +133,8 @@ static int xioctl(src_v4l2_t *vid_source, int request, void *arg) return ret; } -static void v4l2_vdev_free(struct context *cnt){ +static void v4l2_vdev_free(struct context *cnt) +{ /* free the information we collected regarding the controls */ if (cnt->vdev != NULL){ @@ -143,7 +145,8 @@ static void v4l2_vdev_free(struct context *cnt){ } } -static int v4l2_vdev_init(struct context *cnt){ +static int v4l2_vdev_init(struct context *cnt) +{ /* Create the v4l2 context within the main thread context */ cnt->vdev = mymalloc(sizeof(struct params_context)); @@ -156,7 +159,8 @@ static int v4l2_vdev_init(struct context *cnt){ } -static int v4l2_ctrls_count(struct video_dev *curdev){ +static int v4l2_ctrls_count(struct video_dev *curdev) +{ /* Get the count of how many controls and menu items the device supports */ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -189,7 +193,8 @@ static int v4l2_ctrls_count(struct video_dev *curdev){ } -static int v4l2_ctrls_list(struct video_dev *curdev){ +static int v4l2_ctrls_list(struct video_dev *curdev) +{ /* Get the names of the controls and menu items the device supports */ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -280,7 +285,8 @@ static int v4l2_ctrls_list(struct video_dev *curdev){ } -static int v4l2_ctrls_set(struct video_dev *curdev) { +static int v4l2_ctrls_set(struct video_dev *curdev) +{ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; struct vid_devctrl_ctx *devitem; @@ -320,7 +326,8 @@ static int v4l2_ctrls_set(struct video_dev *curdev) { return 0; } -static int v4l2_parms_set(struct context *cnt, struct video_dev *curdev){ +static int v4l2_parms_set(struct context *cnt, struct video_dev *curdev) +{ struct vid_devctrl_ctx *devitem; struct params_item_ctx *usritem; @@ -373,7 +380,8 @@ static int v4l2_parms_set(struct context *cnt, struct video_dev *curdev){ } -static int v4l2_autobright(struct context *cnt, struct video_dev *curdev, int method) { +static int v4l2_autobright(struct context *cnt, struct video_dev *curdev, int method) +{ struct vid_devctrl_ctx *devitem; struct params_item_ctx *usritem; @@ -511,7 +519,8 @@ static int v4l2_autobright(struct context *cnt, struct video_dev *curdev, int me return 0; } -static int v4l2_input_select(struct context *cnt, struct video_dev *curdev) { +static int v4l2_input_select(struct context *cnt, struct video_dev *curdev) +{ /* Set the input number for the device if applicable */ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -571,7 +580,8 @@ static int v4l2_input_select(struct context *cnt, struct video_dev *curdev) { return 0; } -static int v4l2_norm_select(struct context *cnt, struct video_dev *curdev) { +static int v4l2_norm_select(struct context *cnt, struct video_dev *curdev) +{ /* Set the video standard (norm) for the device NTSC/PAL/etc*/ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -641,7 +651,8 @@ static int v4l2_norm_select(struct context *cnt, struct video_dev *curdev) { return 0; } -static int v4l2_frequency_select(struct context *cnt, struct video_dev *curdev) { +static int v4l2_frequency_select(struct context *cnt, struct video_dev *curdev) +{ /* Set the frequency for the tuner */ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -698,7 +709,8 @@ static int v4l2_frequency_select(struct context *cnt, struct video_dev *curdev) return 0; } -static int v4l2_pixfmt_set(struct context *cnt, struct video_dev *curdev, u32 pixformat){ +static int v4l2_pixfmt_set(struct context *cnt, struct video_dev *curdev, u32 pixformat) +{ /* Set the pixel format for the camera*/ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -769,7 +781,8 @@ static int v4l2_pixfmt_set(struct context *cnt, struct video_dev *curdev, u32 pi return -1; } -static int v4l2_pixfmt_select(struct context *cnt, struct video_dev *curdev) { +static int v4l2_pixfmt_select(struct context *cnt, struct video_dev *curdev) +{ /* Find and select the pixel format for camera*/ @@ -879,7 +892,8 @@ static int v4l2_pixfmt_select(struct context *cnt, struct video_dev *curdev) { } -static int v4l2_mmap_set(struct video_dev *curdev) { +static int v4l2_mmap_set(struct video_dev *curdev) +{ /* Set the memory mapping from device to Motion*/ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -977,7 +991,8 @@ static int v4l2_mmap_set(struct video_dev *curdev) { return 0; } -static int v4l2_imgs_set(struct context *cnt, struct video_dev *curdev) { +static int v4l2_imgs_set(struct context *cnt, struct video_dev *curdev) +{ /* Set the items on the imgs */ cnt->imgs.width = curdev->width; @@ -991,7 +1006,8 @@ static int v4l2_imgs_set(struct context *cnt, struct video_dev *curdev) { } -static int v4l2_capture(struct context *cnt, struct video_dev *curdev, unsigned char *map) { +static int v4l2_capture(struct context *cnt, struct video_dev *curdev, unsigned char *map) +{ /* Capture a image */ /* FIXME: This function needs to be refactored*/ @@ -1144,7 +1160,8 @@ static int v4l2_capture(struct context *cnt, struct video_dev *curdev, unsigned return 1; } -static int v4l2_device_init(struct context *cnt, struct video_dev *curdev) { +static int v4l2_device_init(struct context *cnt, struct video_dev *curdev) +{ src_v4l2_t *vid_source; int indx; @@ -1193,7 +1210,8 @@ static int v4l2_device_init(struct context *cnt, struct video_dev *curdev) { return 0; } -static void v4l2_device_select(struct context *cnt, struct video_dev *curdev, unsigned char *map) { +static void v4l2_device_select(struct context *cnt, struct video_dev *curdev, unsigned char *map) +{ int indx, retcd, newvals; @@ -1258,7 +1276,8 @@ static void v4l2_device_select(struct context *cnt, struct video_dev *curdev, un } } -static int v4l2_device_open(struct context *cnt, struct video_dev *curdev) { +static int v4l2_device_open(struct context *cnt, struct video_dev *curdev) +{ int fd_device, indx, usrinp; /* Open the video device */ @@ -1297,7 +1316,8 @@ static int v4l2_device_open(struct context *cnt, struct video_dev *curdev) { } -static void v4l2_device_close(struct video_dev *curdev) { +static void v4l2_device_close(struct video_dev *curdev) +{ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; enum v4l2_buf_type type; @@ -1314,7 +1334,8 @@ static void v4l2_device_close(struct video_dev *curdev) { } } -static void v4l2_device_cleanup(struct video_dev *curdev) { +static void v4l2_device_cleanup(struct video_dev *curdev) +{ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -1348,7 +1369,8 @@ static void v4l2_device_cleanup(struct video_dev *curdev) { } -static int v4l2_device_capability(struct video_dev *curdev) { +static int v4l2_device_capability(struct video_dev *curdev) +{ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; @@ -1397,7 +1419,8 @@ static int v4l2_device_capability(struct video_dev *curdev) { return 0; } -static int v4l2_fps_set(struct context *cnt, struct video_dev *curdev) { +static int v4l2_fps_set(struct context *cnt, struct video_dev *curdev) +{ src_v4l2_t *vid_source = (src_v4l2_t *) curdev->v4l2_private; struct v4l2_streamparm setfps; @@ -1426,7 +1449,8 @@ static int v4l2_fps_set(struct context *cnt, struct video_dev *curdev) { #endif /* HAVE_V4L2 */ -void v4l2_mutex_init(void) { +void v4l2_mutex_init(void) +{ #ifdef HAVE_V4L2 pthread_mutex_init(&v4l2_mutex, NULL); #else @@ -1434,7 +1458,8 @@ void v4l2_mutex_init(void) { #endif // HAVE_V4L2 } -void v4l2_mutex_destroy(void) { +void v4l2_mutex_destroy(void) +{ #ifdef HAVE_V4L2 pthread_mutex_destroy(&v4l2_mutex); #else @@ -1442,7 +1467,8 @@ void v4l2_mutex_destroy(void) { #endif // HAVE_V4L2 } -int v4l2_start(struct context *cnt) { +int v4l2_start(struct context *cnt) +{ #ifdef HAVE_V4L2 int retcd; @@ -1517,7 +1543,8 @@ int v4l2_start(struct context *cnt) { #endif // HAVE_V4l2 } -void v4l2_cleanup(struct context *cnt) { +void v4l2_cleanup(struct context *cnt) +{ #ifdef HAVE_V4L2 struct video_dev *dev = video_devices; @@ -1583,7 +1610,8 @@ void v4l2_cleanup(struct context *cnt) { #endif // HAVE_V4L2 } -int v4l2_next(struct context *cnt, struct image_data *img_data) { +int v4l2_next(struct context *cnt, struct image_data *img_data) +{ #ifdef HAVE_V4L2 int ret = -2; struct config *conf = &cnt->conf; @@ -1627,7 +1655,8 @@ int v4l2_next(struct context *cnt, struct image_data *img_data) { #endif // HAVE_V4L2 } -int v4l2_palette_valid(char *video_device, int v4l2_palette) { +int v4l2_palette_valid(char *video_device, int v4l2_palette) +{ #ifdef HAVE_V4L2 /* This function is a boolean that returns true(1) if the palette selected in the @@ -1681,7 +1710,8 @@ int v4l2_palette_valid(char *video_device, int v4l2_palette) { #endif // HAVE_V4L2 } -void v4l2_palette_fourcc(int v4l2_palette, char *fourcc) { +void v4l2_palette_fourcc(int v4l2_palette, char *fourcc) +{ #ifdef HAVE_V4L2 /* This function populates the provided fourcc pointer with the fourcc code for the @@ -1711,7 +1741,8 @@ void v4l2_palette_fourcc(int v4l2_palette, char *fourcc) { #endif // HAVE_V4L2 } -int v4l2_parms_valid(char *video_device, int v4l2_palette, int v4l2_fps, int v4l2_width, int v4l2_height){ +int v4l2_parms_valid(char *video_device, int v4l2_palette, int v4l2_fps, int v4l2_width, int v4l2_height) +{ #ifdef HAVE_V4L2 /* This function is a boolean that returns true(1) if the parms selected in the diff --git a/src/webu.c b/src/webu.c index 991299d8..e69ae138 100644 --- a/src/webu.c +++ b/src/webu.c @@ -60,7 +60,8 @@ struct mhdstart_ctx { #endif -static void webu_context_init(struct context **cntlst, struct context *cnt, struct webui_ctx *webui) { +static void webu_context_init(struct context **cntlst, struct context *cnt, struct webui_ctx *webui) +{ int indx; @@ -114,7 +115,8 @@ static void webu_context_init(struct context **cntlst, struct context *cnt, stru return; } -static void webu_context_null(struct webui_ctx *webui) { +static void webu_context_null(struct webui_ctx *webui) +{ /* Null out all the pointers in our webui context */ webui->url = NULL; webui->hostname = NULL; @@ -140,7 +142,8 @@ static void webu_context_null(struct webui_ctx *webui) { return; } -static void webu_context_free(struct webui_ctx *webui) { +static void webu_context_free(struct webui_ctx *webui) +{ if (webui->hostname != NULL) free(webui->hostname); if (webui->url != NULL) free(webui->url); @@ -169,7 +172,8 @@ static void webu_context_free(struct webui_ctx *webui) { return; } -static void webu_badreq(struct webui_ctx *webui){ +static void webu_badreq(struct webui_ctx *webui) +{ /* This function is used in this webu module as a central function when there is a bad * request. Since sometimes we will be unable to determine what camera context (stream * or camera) originated the request and we have NULL for cntlist and cnt, we default the @@ -193,7 +197,8 @@ static void webu_badreq(struct webui_ctx *webui){ } } -void webu_write(struct webui_ctx *webui, const char *buf) { +void webu_write(struct webui_ctx *webui, const char *buf) +{ /* Copy the buf data to our response buffer. If the response buffer is not large enough to * accept our new data coming in, then expand it in chunks of 10 */ @@ -225,7 +230,8 @@ void webu_write(struct webui_ctx *webui, const char *buf) { return; } -static void webu_parms_edit(struct webui_ctx *webui) { +static void webu_parms_edit(struct webui_ctx *webui) +{ /* Determine the thread number provided. * If no thread provided, assign it to -1 @@ -278,7 +284,8 @@ static void webu_parms_edit(struct webui_ctx *webui) { } } -static void webu_parseurl_parms(struct webui_ctx *webui, char *st_pos) { +static void webu_parseurl_parms(struct webui_ctx *webui, char *st_pos) +{ /* Parse the parameters of the URI * Earlier functions have assigned the st_pos to the slash after the action and it is @@ -371,7 +378,8 @@ static void webu_parseurl_parms(struct webui_ctx *webui, char *st_pos) { } -static void webu_parseurl_reset(struct webui_ctx *webui) { +static void webu_parseurl_reset(struct webui_ctx *webui) +{ /* Reset the variables to empty strings*/ @@ -385,7 +393,8 @@ static void webu_parseurl_reset(struct webui_ctx *webui) { } -static int webu_parseurl(struct webui_ctx *webui) { +static int webu_parseurl(struct webui_ctx *webui) +{ /* Parse the sent URI into the commands and parameters * so we can check the resulting strings in later functions * and determine what actions to take. @@ -482,7 +491,8 @@ static int webu_parseurl(struct webui_ctx *webui) { } -void webu_process_action(struct webui_ctx *webui) { +void webu_process_action(struct webui_ctx *webui) +{ /* Process the actions from the webcontrol that the user requested. This is used * for both the html and text interface. The text interface just adds a additional * response whereas the html just performs the action @@ -600,7 +610,8 @@ void webu_process_action(struct webui_ctx *webui) { } } -static int webu_process_config_set(struct webui_ctx *webui) { +static int webu_process_config_set(struct webui_ctx *webui) +{ /* Process the request to change the configuration parameters. Used * both the html and text interfaces. If the parameter was found, then * we return 0 otherwise a -1 to tell the calling function whether it @@ -674,7 +685,8 @@ static int webu_process_config_set(struct webui_ctx *webui) { } -int webu_process_config(struct webui_ctx *webui) { +int webu_process_config(struct webui_ctx *webui) +{ int retcd; @@ -703,7 +715,8 @@ int webu_process_config(struct webui_ctx *webui) { } -int webu_process_track(struct webui_ctx *webui) { +int webu_process_track(struct webui_ctx *webui) +{ /* Call the tracking move functions as requested */ struct coord cent; int retcd; @@ -745,7 +758,8 @@ int webu_process_track(struct webui_ctx *webui) { } -static void webu_clientip(struct webui_ctx *webui) { +static void webu_clientip(struct webui_ctx *webui) +{ /* Extract the IP of the client that is connecting. When the * user specifies Motion to use IPV6 and a IPV4 address comes to us * the IPv4 address is prepended with a ::ffff: We then trim that off @@ -791,7 +805,8 @@ static void webu_clientip(struct webui_ctx *webui) { } -static void webu_hostname(struct webui_ctx *webui, int ctrl) { +static void webu_hostname(struct webui_ctx *webui, int ctrl) +{ /* use the hostname the browser used to connect to us when * constructing links to the stream ports. If available @@ -846,7 +861,8 @@ static void webu_hostname(struct webui_ctx *webui, int ctrl) { return; } -static int webu_mhd_digest_fail(struct webui_ctx *webui,int signal_stale) { +static int webu_mhd_digest_fail(struct webui_ctx *webui,int signal_stale) +{ /* Create a denied response to user*/ struct MHD_Response *response; int retcd; @@ -867,7 +883,8 @@ static int webu_mhd_digest_fail(struct webui_ctx *webui,int signal_stale) { return retcd; } -static int webu_mhd_digest(struct webui_ctx *webui) { +static int webu_mhd_digest(struct webui_ctx *webui) +{ /* Perform the digest authentication. This function gets called a couple of * times by MHD during the authentication process. */ @@ -907,7 +924,8 @@ static int webu_mhd_digest(struct webui_ctx *webui) { } -static int webu_mhd_basic_fail(struct webui_ctx *webui) { +static int webu_mhd_basic_fail(struct webui_ctx *webui) +{ /* Create a denied response to user*/ struct MHD_Response *response; int retcd; @@ -927,7 +945,8 @@ static int webu_mhd_basic_fail(struct webui_ctx *webui) { } -static int webu_mhd_basic(struct webui_ctx *webui) { +static int webu_mhd_basic(struct webui_ctx *webui) +{ /* Perform Basic Authentication. */ char *user, *pass; @@ -958,7 +977,8 @@ static int webu_mhd_basic(struct webui_ctx *webui) { } -static void webu_mhd_auth_parse(struct webui_ctx *webui, int ctrl){ +static void webu_mhd_auth_parse(struct webui_ctx *webui, int ctrl) +{ int auth_len; char *col_pos; @@ -1004,7 +1024,8 @@ static void webu_mhd_auth_parse(struct webui_ctx *webui, int ctrl){ } -static int webu_mhd_auth(struct webui_ctx *webui, int ctrl){ +static int webu_mhd_auth(struct webui_ctx *webui, int ctrl) +{ /* Set everything up for calling the authentication functions */ unsigned int rand1,rand2; @@ -1062,7 +1083,8 @@ static int webu_mhd_auth(struct webui_ctx *webui, int ctrl){ } -static int webu_mhd_send(struct webui_ctx *webui, int ctrl) { +static int webu_mhd_send(struct webui_ctx *webui, int ctrl) +{ /* Send the response that we created back to the user. Now if the user * provided a really bad URL, then we couldn't determine which Motion context * they were wanting. In this situation, we have a webui->cnt = NULL and we @@ -1108,7 +1130,8 @@ static int webu_mhd_send(struct webui_ctx *webui, int ctrl) { return retcd; } -static void webu_answer_strm_type(struct webui_ctx *webui) { +static void webu_answer_strm_type(struct webui_ctx *webui) +{ /* Assign the type of stream that is being answered*/ if ((strcmp(webui->uri_cmd1,"stream") == 0) || @@ -1149,7 +1172,8 @@ static mymhd_retcd webu_answer_ctrl(void *cls , const char *version , const char *upload_data , size_t *upload_data_size - , void **ptr) { + , void **ptr) +{ /* This function "answers" the request for a webcontrol.*/ int retcd; @@ -1221,7 +1245,8 @@ static mymhd_retcd webu_answer_strm(void *cls , const char *version , const char *upload_data , size_t *upload_data_size - , void **ptr) { + , void **ptr) +{ /* Answer the request for all the streams*/ int retcd; @@ -1305,7 +1330,8 @@ static mymhd_retcd webu_answer_strm(void *cls } -static void *webu_mhd_init(void *cls, const char *uri, struct MHD_Connection *connection) { +static void *webu_mhd_init(void *cls, const char *uri, struct MHD_Connection *connection) +{ /* This is called at the very start of getting a request before the "answer" * is processed. There are two variations of this and the difference is how * we call the webu_context_init. When we are processing for the webcontrol or @@ -1346,7 +1372,8 @@ static void *webu_mhd_init(void *cls, const char *uri, struct MHD_Connection *co return webui; } -static void *webu_mhd_init_one(void *cls, const char *uri, struct MHD_Connection *connection) { +static void *webu_mhd_init_one(void *cls, const char *uri, struct MHD_Connection *connection) +{ /* This function initializes all the webui variables as we are getting a request. This * variation of the init is the one used when the user has specified a unique port number * for each camera. The variation is in how the webu_context_init is invoked. This passes @@ -1383,7 +1410,8 @@ static void *webu_mhd_init_one(void *cls, const char *uri, struct MHD_Connection static void webu_mhd_deinit(void *cls , struct MHD_Connection *connection , void **con_cls - , enum MHD_RequestTerminationCode toe) { + , enum MHD_RequestTerminationCode toe) +{ /* This is the function called as the connection is closed so we free our webui variables*/ struct webui_ctx *webui = *con_cls; @@ -1424,7 +1452,8 @@ static void webu_mhd_deinit(void *cls return; } -static void webu_mhd_features_basic(struct mhdstart_ctx *mhdst){ +static void webu_mhd_features_basic(struct mhdstart_ctx *mhdst) +{ /* Use the MHD function to see what features it supports*/ #if MHD_VERSION < 0x00094400 (void)mhdst; @@ -1447,7 +1476,8 @@ static void webu_mhd_features_basic(struct mhdstart_ctx *mhdst){ #endif } -static void webu_mhd_features_digest(struct mhdstart_ctx *mhdst){ +static void webu_mhd_features_digest(struct mhdstart_ctx *mhdst) +{ /* Use the MHD function to see what features it supports*/ #if MHD_VERSION < 0x00094400 (void)mhdst; @@ -1470,7 +1500,8 @@ static void webu_mhd_features_digest(struct mhdstart_ctx *mhdst){ #endif } -static void webu_mhd_features_ipv6(struct mhdstart_ctx *mhdst){ +static void webu_mhd_features_ipv6(struct mhdstart_ctx *mhdst) +{ /* Use the MHD function to see what features it supports * If we have a really old version of MHD, then we will just support * IPv4 @@ -1492,7 +1523,8 @@ static void webu_mhd_features_ipv6(struct mhdstart_ctx *mhdst){ #endif } -static void webu_mhd_features_tls(struct mhdstart_ctx *mhdst){ +static void webu_mhd_features_tls(struct mhdstart_ctx *mhdst) +{ /* Use the MHD function to see what features it supports * If we have a really old version of MHD, then we will will not * support the ssl/tls request. @@ -1524,7 +1556,8 @@ static void webu_mhd_features_tls(struct mhdstart_ctx *mhdst){ #endif } -static void webu_mhd_features(struct mhdstart_ctx *mhdst){ +static void webu_mhd_features(struct mhdstart_ctx *mhdst) +{ /* This function goes through at least a few of the MHD features * and adjusts the user parameters from the configuration as * needed to reflect what MHD can do @@ -1540,7 +1573,8 @@ static void webu_mhd_features(struct mhdstart_ctx *mhdst){ } -static char *webu_mhd_loadfile(const char *fname){ +static char *webu_mhd_loadfile(const char *fname) +{ /* This function loads the requested certificate and key files into memory so we * can use them as needed if the user wants ssl/tls support. If the user did not * specify a file in the configuration, then we return NULL. @@ -1579,7 +1613,8 @@ static char *webu_mhd_loadfile(const char *fname){ return file_char; } -static void webu_mhd_checktls(struct mhdstart_ctx *mhdst){ +static void webu_mhd_checktls(struct mhdstart_ctx *mhdst) +{ /* This function validates that if the user requested a SSL/TLS connection, then * they also need to provide a certificate and key file. If those are not provided * then we revise the configuration request for ssl/tls @@ -1614,7 +1649,8 @@ static void webu_mhd_checktls(struct mhdstart_ctx *mhdst){ } -static void webu_mhd_opts_init(struct mhdstart_ctx *mhdst){ +static void webu_mhd_opts_init(struct mhdstart_ctx *mhdst) +{ /* This function sets the init function to use for the MHD connection. If * the connection is related to the webcontrol or the stream specified in the * motion.conf file, then we pass in the full context list of all cameras. If @@ -1636,7 +1672,8 @@ static void webu_mhd_opts_init(struct mhdstart_ctx *mhdst){ } -static void webu_mhd_opts_deinit(struct mhdstart_ctx *mhdst){ +static void webu_mhd_opts_deinit(struct mhdstart_ctx *mhdst) +{ /* Set the MHD option on the function to call when the connection closes */ mhdst->mhd_ops[mhdst->mhd_opt_nbr].option = MHD_OPTION_NOTIFY_COMPLETED; mhdst->mhd_ops[mhdst->mhd_opt_nbr].value = (intptr_t)webu_mhd_deinit; @@ -1645,7 +1682,8 @@ static void webu_mhd_opts_deinit(struct mhdstart_ctx *mhdst){ } -static void webu_mhd_opts_localhost(struct mhdstart_ctx *mhdst){ +static void webu_mhd_opts_localhost(struct mhdstart_ctx *mhdst) +{ /* Set the MHD option on the acceptable connections. This is used to handle the * motion configuation option of localhost only. */ @@ -1699,7 +1737,8 @@ static void webu_mhd_opts_localhost(struct mhdstart_ctx *mhdst){ } -static void webu_mhd_opts_digest(struct mhdstart_ctx *mhdst){ +static void webu_mhd_opts_digest(struct mhdstart_ctx *mhdst) +{ /* Set the MHD option for the type of authentication that we will be using. This * function is when we are wanting to use digest authentication */ @@ -1732,7 +1771,8 @@ static void webu_mhd_opts_digest(struct mhdstart_ctx *mhdst){ } -static void webu_mhd_opts_tls(struct mhdstart_ctx *mhdst){ +static void webu_mhd_opts_tls(struct mhdstart_ctx *mhdst) +{ /* Set the MHD options needed when we want TLS connections */ if ((( mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.webcontrol_tls)) || ((!mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.stream_tls))) { @@ -1750,7 +1790,8 @@ static void webu_mhd_opts_tls(struct mhdstart_ctx *mhdst){ } -static void webu_mhd_opts(struct mhdstart_ctx *mhdst){ +static void webu_mhd_opts(struct mhdstart_ctx *mhdst) +{ /* Set all the options we need based upon the motion configuration parameters*/ mhdst->mhd_opt_nbr = 0; @@ -1774,7 +1815,8 @@ static void webu_mhd_opts(struct mhdstart_ctx *mhdst){ } -static void webu_mhd_flags(struct mhdstart_ctx *mhdst){ +static void webu_mhd_flags(struct mhdstart_ctx *mhdst) +{ /* This sets the MHD startup flags based upon what user put into configuration */ mhdst->mhd_flags = MHD_USE_THREAD_PER_CONNECTION; @@ -1789,7 +1831,8 @@ static void webu_mhd_flags(struct mhdstart_ctx *mhdst){ } -static void webu_start_ctrl(struct context **cnt){ +static void webu_start_ctrl(struct context **cnt) +{ /* This is the function that actually starts the MHD daemon for handling the webcontrol. * There are many options for MHD and they will vary depending upon what our Motion user * has requested in the configuration. There are many functions in this module to assign @@ -1847,7 +1890,8 @@ static void webu_start_ctrl(struct context **cnt){ return; } -static void webu_strm_ntc(struct context **cnt, int indxthrd){ +static void webu_strm_ntc(struct context **cnt, int indxthrd) +{ int indx; if (indxthrd == 0 ){ @@ -1873,7 +1917,8 @@ static void webu_strm_ntc(struct context **cnt, int indxthrd){ } } -static void webu_start_strm(struct context **cnt){ +static void webu_start_strm(struct context **cnt) +{ /* This function starts up the daemon for the streams. It loops through * all of the camera context's provided and starts streams as requested. If * the thread number is zero, then it starts the full list stream context @@ -1945,7 +1990,8 @@ static void webu_start_strm(struct context **cnt){ return; } -static void webu_start_ports(struct context **cnt){ +static void webu_start_ports(struct context **cnt) +{ /* Perform check for duplicate ports being specified. The config loading will * duplicate ports from the motion.conf file to all the cameras so we do not * log these duplicates to the user and instead just silently set them to zero @@ -1991,7 +2037,8 @@ static void webu_start_ports(struct context **cnt){ } } -void webu_stop(struct context **cnt) { +void webu_stop(struct context **cnt) +{ /* This function is called from the main Motion loop to shutdown the * various MHD connections */ @@ -2015,7 +2062,8 @@ void webu_stop(struct context **cnt) { } } -void webu_start(struct context **cnt) { +void webu_start(struct context **cnt) +{ /* This function is called from the main motion thread to start up the * webcontrol and streams. We need to block some signals otherwise MHD * will not function correctly. diff --git a/src/webu_html.c b/src/webu_html.c index ff5595b3..5900ec65 100644 --- a/src/webu_html.c +++ b/src/webu_html.c @@ -49,7 +49,8 @@ struct strminfo_ctx { int motion_images; }; -static void webu_html_style_navbar(struct webui_ctx *webui) { +static void webu_html_style_navbar(struct webui_ctx *webui) +{ /* Write out the style section of the web page */ char response[WEBUI_LEN_RESP]; @@ -74,7 +75,8 @@ static void webu_html_style_navbar(struct webui_ctx *webui) { } -static void webu_html_style_dropdown(struct webui_ctx *webui) { +static void webu_html_style_dropdown(struct webui_ctx *webui) +{ /* Write out the style section of the web page */ char response[WEBUI_LEN_RESP]; @@ -123,7 +125,8 @@ static void webu_html_style_dropdown(struct webui_ctx *webui) { webu_write(webui, response); } -static void webu_html_style_input(struct webui_ctx *webui) { +static void webu_html_style_input(struct webui_ctx *webui) +{ /* Write out the style section of the web page */ char response[WEBUI_LEN_RESP]; @@ -146,7 +149,8 @@ static void webu_html_style_input(struct webui_ctx *webui) { webu_write(webui, response); } -static void webu_html_style_base(struct webui_ctx *webui) { +static void webu_html_style_base(struct webui_ctx *webui) +{ /* Write out the style section of the web page */ char response[WEBUI_LEN_RESP]; @@ -207,7 +211,8 @@ static void webu_html_style_base(struct webui_ctx *webui) { webu_write(webui, response); } -static void webu_html_style(struct webui_ctx *webui) { +static void webu_html_style(struct webui_ctx *webui) +{ /* Write out the style section of the web page */ char response[WEBUI_LEN_RESP]; @@ -227,7 +232,8 @@ static void webu_html_style(struct webui_ctx *webui) { } -static void webu_html_head(struct webui_ctx *webui) { +static void webu_html_head(struct webui_ctx *webui) +{ /* Write out the header section of the web page */ char response[WEBUI_LEN_RESP]; @@ -244,7 +250,8 @@ static void webu_html_head(struct webui_ctx *webui) { } -static void webu_html_navbar_camera(struct webui_ctx *webui) { +static void webu_html_navbar_camera(struct webui_ctx *webui) +{ /*Write out the options included in the camera dropdown */ char response[WEBUI_LEN_RESP]; int indx; @@ -307,7 +314,8 @@ static void webu_html_navbar_camera(struct webui_ctx *webui) { } -static void webu_html_navbar_action(struct webui_ctx *webui) { +static void webu_html_navbar_action(struct webui_ctx *webui) +{ /* Write out the options included in the actions dropdown*/ char response[WEBUI_LEN_RESP]; @@ -341,7 +349,8 @@ static void webu_html_navbar_action(struct webui_ctx *webui) { webu_write(webui, response); } -static void webu_html_navbar(struct webui_ctx *webui) { +static void webu_html_navbar(struct webui_ctx *webui) +{ /* Write the navbar section*/ char response[WEBUI_LEN_RESP]; @@ -363,7 +372,8 @@ static void webu_html_navbar(struct webui_ctx *webui) { } -static void webu_html_config_notice(struct webui_ctx *webui) { +static void webu_html_config_notice(struct webui_ctx *webui) +{ /* Print out the header description of which parameters are included based upon the * webcontrol_parms that was specified */ @@ -389,7 +399,8 @@ static void webu_html_config_notice(struct webui_ctx *webui) { webu_write(webui, response); } -static void webu_html_h3desc(struct webui_ctx *webui) { +static void webu_html_h3desc(struct webui_ctx *webui) +{ /* Write out the status description for the camera */ char response[WEBUI_LEN_RESP]; @@ -414,7 +425,8 @@ static void webu_html_h3desc(struct webui_ctx *webui) { } } -static void webu_html_config(struct webui_ctx *webui) { +static void webu_html_config(struct webui_ctx *webui) +{ /* Write out the options to put into the config dropdown * We use html data attributes to store the values for the options @@ -529,7 +541,8 @@ static void webu_html_config(struct webui_ctx *webui) { } -static void webu_html_track(struct webui_ctx *webui) { +static void webu_html_track(struct webui_ctx *webui) +{ /* Write the section for handling the tracking function */ char response[WEBUI_LEN_RESP]; @@ -562,7 +575,8 @@ static void webu_html_track(struct webui_ctx *webui) { } -static void webu_html_strminfo(struct strminfo_ctx *strm_info, int indx) { +static void webu_html_strminfo(struct strminfo_ctx *strm_info, int indx) +{ /* This determines all the items we need to know to specify links and * stream sources for the page. The options are 0-3 as of this writing * where 0 = full streams, 1 = substreams, 2 = static images and 3 is @@ -614,7 +628,8 @@ static void webu_html_strminfo(struct strminfo_ctx *strm_info, int indx) { } } -static void webu_html_preview(struct webui_ctx *webui) { +static void webu_html_preview(struct webui_ctx *webui) +{ /* Write the initial version of the preview section. The javascript * will change this section when user selects a different camera */ @@ -683,7 +698,8 @@ static void webu_html_preview(struct webui_ctx *webui) { } -static void webu_html_script_action(struct webui_ctx *webui) { +static void webu_html_script_action(struct webui_ctx *webui) +{ /* Write the javascript action_click() function. * We do not have a good notification section on the page so the successful * submission and response is currently a empty if block for the future @@ -748,7 +764,8 @@ static void webu_html_script_action(struct webui_ctx *webui) { webu_write(webui, response); } -static void webu_html_script_camera_thread(struct webui_ctx *webui) { +static void webu_html_script_camera_thread(struct webui_ctx *webui) +{ /* Write the javascript thread IF conditions of camera_click() function */ char response[WEBUI_LEN_RESP]; int indx, indx_st, preview_scale; @@ -824,7 +841,8 @@ static void webu_html_script_camera_thread(struct webui_ctx *webui) { return; } -static void webu_html_script_camera_all(struct webui_ctx *webui) { +static void webu_html_script_camera_all(struct webui_ctx *webui) +{ /* Write the javascript "All" IF condition of camera_click() function */ char response[WEBUI_LEN_RESP]; int indx, indx_st, preview_scale; @@ -893,7 +911,8 @@ static void webu_html_script_camera_all(struct webui_ctx *webui) { return; } -static void webu_html_script_camera(struct webui_ctx *webui) { +static void webu_html_script_camera(struct webui_ctx *webui) +{ /* Write the javascript camera_click() function */ char response[WEBUI_LEN_RESP]; @@ -920,7 +939,8 @@ static void webu_html_script_camera(struct webui_ctx *webui) { } -static void webu_html_script_menucam(struct webui_ctx *webui) { +static void webu_html_script_menucam(struct webui_ctx *webui) +{ /* Write the javascript display_cameras() function */ char response[WEBUI_LEN_RESP]; @@ -937,7 +957,8 @@ static void webu_html_script_menucam(struct webui_ctx *webui) { } -static void webu_html_script_menuact(struct webui_ctx *webui) { +static void webu_html_script_menuact(struct webui_ctx *webui) +{ /* Write the javascript display_actions() function */ char response[WEBUI_LEN_RESP]; @@ -954,7 +975,8 @@ static void webu_html_script_menuact(struct webui_ctx *webui) { } -static void webu_html_script_evtclk(struct webui_ctx *webui) { +static void webu_html_script_evtclk(struct webui_ctx *webui) +{ /* Write the javascript 'click' EventListener */ char response[WEBUI_LEN_RESP]; @@ -971,7 +993,8 @@ static void webu_html_script_evtclk(struct webui_ctx *webui) { } -static void webu_html_script_cfgclk(struct webui_ctx *webui) { +static void webu_html_script_cfgclk(struct webui_ctx *webui) +{ /* Write the javascript config_click function * We do not have a good notification section on the page so the successful * submission and response is currently a empty if block for the future @@ -1021,7 +1044,8 @@ static void webu_html_script_cfgclk(struct webui_ctx *webui) { } -static void webu_html_script_cfgchg(struct webui_ctx *webui) { +static void webu_html_script_cfgchg(struct webui_ctx *webui) +{ /* Write the javascript option_change function */ char response[WEBUI_LEN_RESP]; @@ -1038,7 +1062,8 @@ static void webu_html_script_cfgchg(struct webui_ctx *webui) { webu_write(webui, response); } -static void webu_html_script_trkchg(struct webui_ctx *webui) { +static void webu_html_script_trkchg(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; snprintf(response, sizeof (response),"%s", @@ -1077,7 +1102,8 @@ static void webu_html_script_trkchg(struct webui_ctx *webui) { } -static void webu_html_script_trkclk(struct webui_ctx *webui) { +static void webu_html_script_trkclk(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; snprintf(response, sizeof (response),"%s", " function track_click() {\n" @@ -1125,7 +1151,8 @@ static void webu_html_script_trkclk(struct webui_ctx *webui) { } -static void webu_html_script(struct webui_ctx *webui) { +static void webu_html_script(struct webui_ctx *webui) +{ /* Write the javascripts */ char response[WEBUI_LEN_RESP]; @@ -1155,7 +1182,8 @@ static void webu_html_script(struct webui_ctx *webui) { } -static void webu_html_body(struct webui_ctx *webui) { +static void webu_html_body(struct webui_ctx *webui) +{ /* Write the body section of the form */ char response[WEBUI_LEN_RESP]; @@ -1179,7 +1207,8 @@ static void webu_html_body(struct webui_ctx *webui) { } -static void webu_html_page(struct webui_ctx *webui) { +static void webu_html_page(struct webui_ctx *webui) +{ /* Write the main page html */ char response[WEBUI_LEN_RESP]; @@ -1197,7 +1226,8 @@ static void webu_html_page(struct webui_ctx *webui) { } -void webu_html_badreq(struct webui_ctx *webui) { +void webu_html_badreq(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; @@ -1215,7 +1245,8 @@ void webu_html_badreq(struct webui_ctx *webui) { } -void webu_html_main(struct webui_ctx *webui) { +void webu_html_main(struct webui_ctx *webui) +{ /* Note some detection and config requested actions call the * action function. This is because the legacy interface diff --git a/src/webu_stream.c b/src/webu_stream.c index a770e793..03666f2c 100644 --- a/src/webu_stream.c +++ b/src/webu_stream.c @@ -18,7 +18,8 @@ #include "webu_stream.h" #include "translate.h" -static void webu_stream_mjpeg_checkbuffers(struct webui_ctx *webui) { +static void webu_stream_mjpeg_checkbuffers(struct webui_ctx *webui) +{ /* Allocate buffers if needed */ if (webui->resp_size < (size_t)webui->cnt->imgs.size_norm){ if (webui->resp_page != NULL) free(webui->resp_page); @@ -30,7 +31,8 @@ static void webu_stream_mjpeg_checkbuffers(struct webui_ctx *webui) { } -static void webu_stream_mjpeg_delay(struct webui_ctx *webui) { +static void webu_stream_mjpeg_delay(struct webui_ctx *webui) +{ /* Sleep required time to get to the user requested frame * rate for the stream */ @@ -61,7 +63,8 @@ static void webu_stream_mjpeg_delay(struct webui_ctx *webui) { } -static void webu_stream_mjpeg_getimg(struct webui_ctx *webui) { +static void webu_stream_mjpeg_getimg(struct webui_ctx *webui) +{ long jpeg_size; char resp_head[80]; int header_len; @@ -114,7 +117,8 @@ static void webu_stream_mjpeg_getimg(struct webui_ctx *webui) { } -static ssize_t webu_stream_mjpeg_response (void *cls, uint64_t pos, char *buf, size_t max){ +static ssize_t webu_stream_mjpeg_response (void *cls, uint64_t pos, char *buf, size_t max) +{ /* This is the callback response function for MHD streams. It is kept "open" and * in process during the entire time that the user has the stream open in the web * browser. We sleep the requested amount of time between fetching images to match @@ -158,7 +162,8 @@ static ssize_t webu_stream_mjpeg_response (void *cls, uint64_t pos, char *buf, s } -static void webu_stream_static_getimg(struct webui_ctx *webui) { +static void webu_stream_static_getimg(struct webui_ctx *webui) +{ /* Obtain the current image, compress it to a JPG and put into webui->resp_page * for MHD to send back to user */ @@ -179,7 +184,8 @@ static void webu_stream_static_getimg(struct webui_ctx *webui) { } -static int webu_stream_checks(struct webui_ctx *webui) { +static int webu_stream_checks(struct webui_ctx *webui) +{ /* Perform edits to determine whether the user specified a valid URL * for the particular port */ @@ -220,7 +226,8 @@ static int webu_stream_checks(struct webui_ctx *webui) { return 0; } -static void webu_stream_cnct_count(struct webui_ctx *webui) { +static void webu_stream_cnct_count(struct webui_ctx *webui) +{ /* Increment the counters for the connections to the streams */ int cnct_count; @@ -260,7 +267,8 @@ static void webu_stream_cnct_count(struct webui_ctx *webui) { } -int webu_stream_mjpeg(struct webui_ctx *webui) { +int webu_stream_mjpeg(struct webui_ctx *webui) +{ /* Create the stream for the motion jpeg */ int retcd; struct MHD_Response *response; @@ -294,7 +302,8 @@ int webu_stream_mjpeg(struct webui_ctx *webui) { return retcd; } -int webu_stream_static(struct webui_ctx *webui) { +int webu_stream_static(struct webui_ctx *webui) +{ /* Create the response for the static image request*/ int retcd; struct MHD_Response *response; diff --git a/src/webu_text.c b/src/webu_text.c index 295b0295..9b3ef9ef 100644 --- a/src/webu_text.c +++ b/src/webu_text.c @@ -24,7 +24,8 @@ #include "webu_text.h" #include "translate.h" -static void webu_text_seteol(struct webui_ctx *webui) { +static void webu_text_seteol(struct webui_ctx *webui) +{ /* Set the end of line character for text interface */ if (webui->cntlst[0]->conf.webcontrol_interface == 2) { snprintf(webui->text_eol, WEBUI_LEN_PARM,"%s","
"); @@ -34,7 +35,8 @@ static void webu_text_seteol(struct webui_ctx *webui) { } -static void webu_text_camera_name(struct webui_ctx *webui) { +static void webu_text_camera_name(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; if (webui->cntlst[webui->thread_nbr]->conf.camera_name == NULL){ @@ -53,7 +55,8 @@ static void webu_text_camera_name(struct webui_ctx *webui) { } -static void webu_text_back(struct webui_ctx *webui, const char *prevuri) { +static void webu_text_back(struct webui_ctx *webui, const char *prevuri) +{ char response[WEBUI_LEN_RESP]; if (webui->cntlst[0]->conf.webcontrol_interface == 2) { @@ -66,7 +69,8 @@ static void webu_text_back(struct webui_ctx *webui, const char *prevuri) { } -static void webu_text_header(struct webui_ctx *webui) { +static void webu_text_header(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; if (webui->cntlst[0]->conf.webcontrol_interface == 2) { @@ -80,7 +84,8 @@ static void webu_text_header(struct webui_ctx *webui) { } } -static void webu_text_trailer(struct webui_ctx *webui) { +static void webu_text_trailer(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; if (webui->cntlst[0]->conf.webcontrol_interface == 2) { @@ -92,7 +97,8 @@ static void webu_text_trailer(struct webui_ctx *webui) { } -void webu_text_badreq(struct webui_ctx *webui) { +void webu_text_badreq(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; webu_text_header(webui); @@ -107,7 +113,8 @@ void webu_text_badreq(struct webui_ctx *webui) { return; } -static void webu_text_page_raw(struct webui_ctx *webui) { +static void webu_text_page_raw(struct webui_ctx *webui) +{ /* Write the main page text */ char response[WEBUI_LEN_RESP]; int indx; @@ -131,7 +138,8 @@ static void webu_text_page_raw(struct webui_ctx *webui) { } -static void webu_text_page_basic(struct webui_ctx *webui) { +static void webu_text_page_basic(struct webui_ctx *webui) +{ /* Write the main page text */ char response[WEBUI_LEN_RESP]; int indx; @@ -165,7 +173,8 @@ static void webu_text_page_basic(struct webui_ctx *webui) { } -static void webu_text_list_raw(struct webui_ctx *webui) { +static void webu_text_list_raw(struct webui_ctx *webui) +{ /* Write out the options and values */ char response[WEBUI_LEN_RESP]; int indx_parm; @@ -197,7 +206,8 @@ static void webu_text_list_raw(struct webui_ctx *webui) { } -static void webu_text_list_basic(struct webui_ctx *webui) { +static void webu_text_list_basic(struct webui_ctx *webui) +{ /* Write out the options and values */ char response[WEBUI_LEN_RESP]; int indx_parm; @@ -248,7 +258,8 @@ static void webu_text_list_basic(struct webui_ctx *webui) { } -static void webu_text_set_menu(struct webui_ctx *webui) { +static void webu_text_set_menu(struct webui_ctx *webui) +{ /* Write out the options and values to allow user to set them*/ char response[WEBUI_LEN_RESP]; @@ -311,7 +322,8 @@ static void webu_text_set_menu(struct webui_ctx *webui) { } -static void webu_text_set_query(struct webui_ctx *webui) { +static void webu_text_set_query(struct webui_ctx *webui) +{ /* Write out the options and values to allow user to set them*/ char response[WEBUI_LEN_RESP]; @@ -359,7 +371,8 @@ static void webu_text_set_query(struct webui_ctx *webui) { } -static void webu_text_set_assign(struct webui_ctx *webui) { +static void webu_text_set_assign(struct webui_ctx *webui) +{ /* Set a particular configuration parameter to desired value */ char response[WEBUI_LEN_RESP]; @@ -388,7 +401,8 @@ static void webu_text_set_assign(struct webui_ctx *webui) { } -static void webu_text_get_menu(struct webui_ctx *webui) { +static void webu_text_get_menu(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; int indx_parm; @@ -435,7 +449,8 @@ static void webu_text_get_menu(struct webui_ctx *webui) { } -static void webu_text_action_quit(struct webui_ctx *webui) { +static void webu_text_action_quit(struct webui_ctx *webui) +{ /* Shut down motion or the associated thread */ char response[WEBUI_LEN_RESP]; @@ -453,7 +468,8 @@ static void webu_text_action_quit(struct webui_ctx *webui) { } -static void webu_text_action_makemovie(struct webui_ctx *webui) { +static void webu_text_action_makemovie(struct webui_ctx *webui) +{ /* end the event. Legacy api name*/ char response[WEBUI_LEN_RESP]; @@ -475,7 +491,8 @@ static void webu_text_action_makemovie(struct webui_ctx *webui) { } -static void webu_text_action_eventstart(struct webui_ctx *webui) { +static void webu_text_action_eventstart(struct webui_ctx *webui) +{ /* Start the event*/ char response[WEBUI_LEN_RESP]; @@ -497,7 +514,8 @@ static void webu_text_action_eventstart(struct webui_ctx *webui) { } -static void webu_text_action_eventend(struct webui_ctx *webui) { +static void webu_text_action_eventend(struct webui_ctx *webui) +{ /* End any active event*/ char response[WEBUI_LEN_RESP]; @@ -519,7 +537,8 @@ static void webu_text_action_eventend(struct webui_ctx *webui) { } -static void webu_text_action_snapshot(struct webui_ctx *webui) { +static void webu_text_action_snapshot(struct webui_ctx *webui) +{ /* trigger a snapshot*/ char response[WEBUI_LEN_RESP]; @@ -541,7 +560,8 @@ static void webu_text_action_snapshot(struct webui_ctx *webui) { } -static void webu_text_action_restart(struct webui_ctx *webui) { +static void webu_text_action_restart(struct webui_ctx *webui) +{ /* Restart*/ char response[WEBUI_LEN_RESP]; @@ -562,7 +582,8 @@ static void webu_text_action_restart(struct webui_ctx *webui) { } -static void webu_text_action_start(struct webui_ctx *webui) { +static void webu_text_action_start(struct webui_ctx *webui) +{ /* un-pause the camera*/ char response[WEBUI_LEN_RESP]; @@ -584,7 +605,8 @@ static void webu_text_action_start(struct webui_ctx *webui) { } -static void webu_text_action_pause(struct webui_ctx *webui) { +static void webu_text_action_pause(struct webui_ctx *webui) +{ /* pause the camera*/ char response[WEBUI_LEN_RESP]; @@ -606,7 +628,8 @@ static void webu_text_action_pause(struct webui_ctx *webui) { } -static void webu_text_action_write(struct webui_ctx *webui) { +static void webu_text_action_write(struct webui_ctx *webui) +{ /* write the parms to file*/ char response[WEBUI_LEN_RESP]; @@ -628,7 +651,8 @@ static void webu_text_action_write(struct webui_ctx *webui) { } -static void webu_text_action(struct webui_ctx *webui) { +static void webu_text_action(struct webui_ctx *webui) +{ /* Call the action functions */ if (!strcmp(webui->uri_cmd2,"makemovie")){ @@ -670,7 +694,8 @@ static void webu_text_action(struct webui_ctx *webui) { } -static void webu_text_track_pantilt(struct webui_ctx *webui) { +static void webu_text_track_pantilt(struct webui_ctx *webui) +{ /* Call the track function */ char response[WEBUI_LEN_RESP]; @@ -697,7 +722,8 @@ static void webu_text_track_pantilt(struct webui_ctx *webui) { } -static void webu_text_track(struct webui_ctx *webui) { +static void webu_text_track(struct webui_ctx *webui) +{ /* Call the track function */ char response[WEBUI_LEN_RESP]; int retcd; @@ -725,7 +751,8 @@ static void webu_text_track(struct webui_ctx *webui) { } -static void webu_text_menu(struct webui_ctx *webui) { +static void webu_text_menu(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; webu_text_header(webui); @@ -749,7 +776,8 @@ static void webu_text_menu(struct webui_ctx *webui) { } -static void webu_text_menu_config(struct webui_ctx *webui) { +static void webu_text_menu_config(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; webu_text_header(webui); @@ -770,7 +798,8 @@ static void webu_text_menu_config(struct webui_ctx *webui) { } -static void webu_text_menu_action(struct webui_ctx *webui) { +static void webu_text_menu_action(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; webu_text_header(webui); @@ -793,7 +822,8 @@ static void webu_text_menu_action(struct webui_ctx *webui) { } -static void webu_text_menu_detection(struct webui_ctx *webui) { +static void webu_text_menu_detection(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; webu_text_header(webui); @@ -815,7 +845,8 @@ static void webu_text_menu_detection(struct webui_ctx *webui) { } -static void webu_text_menu_track(struct webui_ctx *webui) { +static void webu_text_menu_track(struct webui_ctx *webui) +{ char response[WEBUI_LEN_RESP]; webu_text_header(webui); @@ -835,7 +866,8 @@ static void webu_text_menu_track(struct webui_ctx *webui) { } -static void webu_text_submenu(struct webui_ctx *webui) { +static void webu_text_submenu(struct webui_ctx *webui) +{ if ((!strcmp(webui->uri_cmd1,"config")) && (strlen(webui->uri_cmd2) == 0)) { @@ -862,7 +894,8 @@ static void webu_text_submenu(struct webui_ctx *webui) { } -void webu_text_get_query(struct webui_ctx *webui) { +void webu_text_get_query(struct webui_ctx *webui) +{ /* Write out the option value for one parm */ char response[WEBUI_LEN_RESP]; int indx_parm; @@ -940,7 +973,8 @@ void webu_text_get_query(struct webui_ctx *webui) { } -void webu_text_status(struct webui_ctx *webui) { +void webu_text_status(struct webui_ctx *webui) +{ /* Write out the pause/active status */ char response[WEBUI_LEN_RESP]; @@ -977,7 +1011,8 @@ void webu_text_status(struct webui_ctx *webui) { webu_text_trailer(webui); } -void webu_text_connection(struct webui_ctx *webui) { +void webu_text_connection(struct webui_ctx *webui) +{ /* Write out the connection status */ char response[WEBUI_LEN_RESP]; int indx, indx_st; @@ -1019,7 +1054,8 @@ void webu_text_connection(struct webui_ctx *webui) { webu_text_trailer(webui); } -void webu_text_list(struct webui_ctx *webui) { +void webu_text_list(struct webui_ctx *webui) +{ if (webui->cntlst[0]->conf.webcontrol_interface == 2) { webu_text_list_basic(webui); @@ -1029,7 +1065,8 @@ void webu_text_list(struct webui_ctx *webui) { } -void webu_text_main(struct webui_ctx *webui) { +void webu_text_main(struct webui_ctx *webui) +{ /* Main entry point for processing requests for the text interface */