From c2ec02e9e04f94746adde769b4ab06eae6443a10 Mon Sep 17 00:00:00 2001 From: Mr-Dave Date: Sat, 17 Aug 2024 21:15:48 -0600 Subject: [PATCH] Revise ctx_motapp to cls_motapp --- src/camera.cpp | 2 +- src/camera.hpp | 4 +- src/conf.cpp | 28 +-- src/conf.hpp | 28 +-- src/dbse.cpp | 2 +- src/dbse.hpp | 4 +- src/logger.cpp | 2 +- src/logger.hpp | 4 +- src/motionplus.cpp | 529 ++++++++++++++++++++++---------------------- src/motionplus.hpp | 63 ++++-- src/sound.cpp | 2 +- src/sound.hpp | 4 +- src/util.cpp | 6 +- src/webu.cpp | 4 +- src/webu.hpp | 4 +- src/webu_ans.cpp | 2 +- src/webu_ans.hpp | 4 +- src/webu_common.hpp | 2 +- src/webu_file.hpp | 2 +- src/webu_html.hpp | 2 +- src/webu_json.hpp | 2 +- src/webu_mpegts.hpp | 2 +- src/webu_post.cpp | 27 ++- src/webu_post.hpp | 2 +- src/webu_stream.hpp | 2 +- 25 files changed, 378 insertions(+), 355 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index 9aa12ed5..abf76d93 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -1533,7 +1533,7 @@ void cls_camera::handler_shutdown() } -cls_camera::cls_camera(ctx_motapp *p_app) +cls_camera::cls_camera(cls_motapp *p_app) { app = p_app; handler_finished = true; diff --git a/src/camera.hpp b/src/camera.hpp index e9995d05..8aca6f5a 100644 --- a/src/camera.hpp +++ b/src/camera.hpp @@ -116,10 +116,10 @@ struct ctx_stream { class cls_camera { public: - cls_camera(ctx_motapp *p_app); + cls_camera(cls_motapp *p_app); ~cls_camera(); - ctx_motapp *app; + cls_motapp *app; cls_config *cfg; cls_config *conf_src; ctx_images imgs; diff --git a/src/conf.cpp b/src/conf.cpp index 69ceea6e..45b9896b 100644 --- a/src/conf.cpp +++ b/src/conf.cpp @@ -3554,7 +3554,7 @@ void cls_config::usage(void) printf("\n"); } -void cls_config::cmdline(ctx_motapp *app) +void cls_config::cmdline(cls_motapp *app) { int c; @@ -3594,7 +3594,7 @@ void cls_config::cmdline(ctx_motapp *app) optind = 1; } -void cls_config::camera_filenm(ctx_motapp *app) +void cls_config::camera_filenm(cls_motapp *app) { int indx_cam, indx; std::string dirnm, fullnm; @@ -3629,7 +3629,7 @@ void cls_config::camera_filenm(ctx_motapp *app) conf_filename = fullnm; } -int cls_config::get_next_devid(ctx_motapp *app) +int cls_config::get_next_devid(cls_motapp *app) { int indx, dev_id; bool chkid; @@ -3657,7 +3657,7 @@ int cls_config::get_next_devid(ctx_motapp *app) } -void cls_config::camera_add(ctx_motapp *app, std::string fname, bool srcdir) +void cls_config::camera_add(cls_motapp *app, std::string fname, bool srcdir) { struct stat statbuf; int indx; @@ -3699,7 +3699,7 @@ void cls_config::camera_add(ctx_motapp *app, std::string fname, bool srcdir) } /* Create default configuration file name*/ -void cls_config::sound_filenm(ctx_motapp *app) +void cls_config::sound_filenm(cls_motapp *app) { int indx_snd, indx; std::string dirnm, fullnm; @@ -3734,7 +3734,7 @@ void cls_config::sound_filenm(ctx_motapp *app) conf_filename = fullnm; } -void cls_config::sound_add(ctx_motapp *app, std::string fname, bool srcdir) +void cls_config::sound_add(cls_motapp *app, std::string fname, bool srcdir) { struct stat statbuf; int indx; @@ -3775,7 +3775,7 @@ void cls_config::sound_add(ctx_motapp *app, std::string fname, bool srcdir) app->snd_cnt = (int)app->snd_list.size(); } -void cls_config::config_dir_parm(ctx_motapp *app, std::string confdir) +void cls_config::config_dir_parm(cls_motapp *app, std::string confdir) { DIR *dp; dirent *ep; @@ -3810,7 +3810,7 @@ void cls_config::config_dir_parm(ctx_motapp *app, std::string confdir) } -void cls_config::process(ctx_motapp *app) +void cls_config::process(cls_motapp *app) { size_t stpos; std::string line, parm_nm, parm_vl; @@ -3896,7 +3896,7 @@ void cls_config::parms_log_parm(std::string parm_nm, std::string parm_vl) } -void cls_config::parms_log(ctx_motapp *app) +void cls_config::parms_log(cls_motapp *app) { int i, indx; std::string parm_vl, parm_main, parm_nm; @@ -4011,7 +4011,7 @@ void cls_config::parms_write_parms(FILE *conffile, std::string parm_nm } } -void cls_config::parms_write_app(ctx_motapp *app) +void cls_config::parms_write_app(cls_motapp *app) { int i, indx; std::string parm_vl, parm_main, parm_nm; @@ -4090,7 +4090,7 @@ void cls_config::parms_write_app(ctx_motapp *app) } -void cls_config::parms_write_cam(ctx_motapp *app) +void cls_config::parms_write_cam(cls_motapp *app) { int i, indx; std::string parm_vl, parm_main, parm_nm; @@ -4150,7 +4150,7 @@ void cls_config::parms_write_cam(ctx_motapp *app) } -void cls_config::parms_write_snd(ctx_motapp *app) +void cls_config::parms_write_snd(cls_motapp *app) { int i, indx; std::string parm_vl, parm_main, parm_nm; @@ -4210,7 +4210,7 @@ void cls_config::parms_write_snd(ctx_motapp *app) } -void cls_config::parms_write(ctx_motapp *app) +void cls_config::parms_write(cls_motapp *app) { parms_write_app(app); parms_write_cam(app); @@ -4232,7 +4232,7 @@ void cls_config::parms_copy(cls_config *src) } -void cls_config::init(ctx_motapp *app) +void cls_config::init(cls_motapp *app) { std::string filename; char path[PATH_MAX]; diff --git a/src/conf.hpp b/src/conf.hpp index 9111555a..7fa19f53 100644 --- a/src/conf.hpp +++ b/src/conf.hpp @@ -274,11 +274,11 @@ std::string snd_window; bool snd_show; - void camera_add(ctx_motapp *app, std::string fname, bool srcdir); - void sound_add(ctx_motapp *app, std::string fname, bool srcdir); - void camera_filenm(ctx_motapp *app); - void sound_filenm(ctx_motapp *app); - void process(ctx_motapp *app); + void camera_add(cls_motapp *app, std::string fname, bool srcdir); + void sound_add(cls_motapp *app, std::string fname, bool srcdir); + void camera_filenm(cls_motapp *app); + void sound_filenm(cls_motapp *app); + void process(cls_motapp *app); void edit_set(std::string parm_nm, std::string parm_val); void edit_get(std::string parm_nm, std::string &parm_val, enum PARM_CAT parm_cat); @@ -288,22 +288,22 @@ std::string type_desc(enum PARM_TYP ptype); std::string cat_desc(enum PARM_CAT pcat, bool shrt); void usage(); - void init(ctx_motapp *app); - void parms_log(ctx_motapp *app); - void parms_write(ctx_motapp *app); + void init(cls_motapp *app); + void parms_log(cls_motapp *app); + void parms_write(cls_motapp *app); void parms_copy(cls_config *src); private: - void cmdline(ctx_motapp *app); + void cmdline(cls_motapp *app); void defaults(); - int get_next_devid(ctx_motapp *app); - void config_dir_parm(ctx_motapp *app, std::string confdir); + int get_next_devid(cls_motapp *app); + void config_dir_parm(cls_motapp *app, std::string confdir); void parms_log_parm(std::string parm_nm, std::string parm_vl); - void parms_write_app(ctx_motapp *app); - void parms_write_cam(ctx_motapp *app); + void parms_write_app(cls_motapp *app); + void parms_write_cam(cls_motapp *app); void parms_write_parms(FILE *conffile, std::string parm_nm, std::string parm_vl, enum PARM_CAT parm_ct, bool reset); - void parms_write_snd(ctx_motapp *app); + void parms_write_snd(cls_motapp *app); int edit_set_active(std::string parm_nm, std::string parm_val); int edit_set_depr(std::string &parm_nm, std::string &parm_val); diff --git a/src/dbse.cpp b/src/dbse.cpp index a1b250f4..6ac09027 100644 --- a/src/dbse.cpp +++ b/src/dbse.cpp @@ -1083,7 +1083,7 @@ void cls_dbse::dbse_edits() } -cls_dbse::cls_dbse(ctx_motapp *p_app) +cls_dbse::cls_dbse(cls_motapp *p_app) { app = p_app; diff --git a/src/dbse.hpp b/src/dbse.hpp index e0c54447..936f2b9f 100644 --- a/src/dbse.hpp +++ b/src/dbse.hpp @@ -53,7 +53,7 @@ class cls_dbse { public: - cls_dbse(ctx_motapp *p_app); + cls_dbse(cls_motapp *p_app); ~cls_dbse(); void sqlite3db_cb (int arg_nb, char **arg_val, char **col_nm); pthread_mutex_t mutex_dbse; @@ -89,7 +89,7 @@ void pgsqldb_init(); void pgsqldb_movielist(); #endif - ctx_motapp *app; + cls_motapp *app; enum DBSE_ACT dbse_action; /* action to perform with query*/ bool table_ok; /* bool of whether table exists*/ bool is_open; diff --git a/src/logger.cpp b/src/logger.cpp index e7fa3a20..7317175d 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -251,7 +251,7 @@ void cls_log::log_stop() } } -cls_log::cls_log(ctx_motapp *p_app) +cls_log::cls_log(cls_motapp *p_app) { app = p_app; log_mode = LOGMODE_NONE; diff --git a/src/logger.hpp b/src/logger.hpp index 703d98b0..5b36b63a 100644 --- a/src/logger.hpp +++ b/src/logger.hpp @@ -56,14 +56,14 @@ class cls_log { public: - cls_log(ctx_motapp *p_app); + cls_log(cls_motapp *p_app); ~cls_log(); int log_level; int log_fflevel; void set_log_file(std::string pname); void write_msg(int loglvl, int msg_type, int flgerr, int flgfnc, ...); private: - ctx_motapp *app; + cls_motapp *app; pthread_mutex_t mtx; int log_mode; FILE *log_file_ptr; diff --git a/src/motionplus.cpp b/src/motionplus.cpp index f40483ad..62e615e1 100644 --- a/src/motionplus.cpp +++ b/src/motionplus.cpp @@ -30,48 +30,6 @@ volatile enum MOTPLS_SIGNAL motsignal; -/** Process signals sent */ -static void motpls_signal_process(ctx_motapp *app) -{ - int indx; - - switch(motsignal){ - case MOTPLS_SIGNAL_ALARM: /* Trigger snapshot */ - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->action_snapshot = true; - } - break; - case MOTPLS_SIGNAL_USR1: /* Trigger the end of a event */ - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->event_stop = true; - } - break; - case MOTPLS_SIGNAL_SIGHUP: /* Reload the parameters and restart*/ - app->reload_all = true; - app->webu->wb_finish = true; - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->event_stop = true; - app->cam_list[indx]->handler_shutdown(); - } - for (indx=0; indxsnd_cnt; indx++) { - app->snd_list[indx]->handler_shutdown(); - } - break; - case MOTPLS_SIGNAL_SIGTERM: /* Quit application */ - app->webu->wb_finish = true; - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->event_stop = true; - app->cam_list[indx]->handler_shutdown(); - } - for (indx=0; indxsnd_cnt; indx++) { - app->snd_list[indx]->handler_shutdown(); - } - default: - break; - } - motsignal = MOTPLS_SIGNAL_NONE; -} - /** Handle signals sent */ static void sig_handler(int signo) { @@ -149,23 +107,63 @@ static void setup_signals(void) sigaction(SIGVTALRM, &sig_handler_action, NULL); } -/* Write out the pid file*/ -static void motpls_pid_write(ctx_motapp *app) +void cls_motapp::signal_process() +{ + int indx; + + switch(motsignal){ + case MOTPLS_SIGNAL_ALARM: /* Trigger snapshot */ + for (indx=0; indxaction_snapshot = true; + } + break; + case MOTPLS_SIGNAL_USR1: /* Trigger the end of a event */ + for (indx=0; indxevent_stop = true; + } + break; + case MOTPLS_SIGNAL_SIGHUP: /* Reload the parameters and restart*/ + reload_all = true; + webu->wb_finish = true; + for (indx=0; indxevent_stop = true; + cam_list[indx]->handler_shutdown(); + } + for (indx=0; indxhandler_shutdown(); + } + break; + case MOTPLS_SIGNAL_SIGTERM: /* Quit application */ + webu->wb_finish = true; + for (indx=0; indxevent_stop = true; + cam_list[indx]->handler_shutdown(); + } + for (indx=0; indxhandler_shutdown(); + } + default: + break; + } + motsignal = MOTPLS_SIGNAL_NONE; +} + +void cls_motapp::pid_write() { FILE *pidf = NULL; - if (app->cfg->pid_file != "") { - pidf = myfopen(app->cfg->pid_file.c_str(), "w+e"); + if (cfg->pid_file != "") { + pidf = myfopen(cfg->pid_file.c_str(), "w+e"); if (pidf) { (void)fprintf(pidf, "%d\n", getpid()); myfclose(pidf); MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Created process id file %s. Process ID is %d") - ,app->cfg->pid_file.c_str(), getpid()); + ,cfg->pid_file.c_str(), getpid()); } else { MOTPLS_LOG(EMG, TYPE_ALL, SHOW_ERRNO , _("Cannot create process id file (pid file) %s") - , app->cfg->pid_file.c_str()); + , cfg->pid_file.c_str()); } } @@ -174,11 +172,11 @@ static void motpls_pid_write(ctx_motapp *app) } /** Remove the process id file ( pid file ) before MotionPlus exit. */ -static void motpls_pid_remove(ctx_motapp *app) +void cls_motapp::pid_remove() { - if ((app->cfg->pid_file != "") && - (app->reload_all == false)) { - if (!unlink(app->cfg->pid_file.c_str())) { + if ((cfg->pid_file != "") && + (reload_all == false)) { + if (!unlink(cfg->pid_file.c_str())) { MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Removed process id file (pid file).")); } else{ MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Error removing pid file")); @@ -186,7 +184,7 @@ static void motpls_pid_remove(ctx_motapp *app) } } -static void motpls_daemon() +void cls_motapp::daemon() { int fd; struct sigaction sig_ign_action; @@ -244,7 +242,7 @@ static void motpls_daemon() sigaction(SIGTSTP, &sig_ign_action, NULL); } -void motpls_av_init(void) +void cls_motapp::av_init() { MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO, _("libavcodec version %d.%d.%d") , LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO); @@ -260,13 +258,13 @@ void motpls_av_init(void) avdevice_register_all(); } -void motpls_av_deinit(void) +void cls_motapp::av_deinit() { avformat_network_deinit(); } /* Validate or set the position on the all cameras image*/ -static void motpls_allcams_init(ctx_motapp *app) +void cls_motapp::allcams_init() { int indx, indx1; int row, col, mx_row, mx_col, col_chk; @@ -276,45 +274,45 @@ static void motpls_allcams_init(ctx_motapp *app) p_lst *lst; p_it it; - app->all_sizes = new ctx_all_sizes; - app->all_sizes->height = 0; - app->all_sizes->width = 0; - app->all_sizes->img_sz = 0; - app->all_sizes->reset = true; + all_sizes = new ctx_all_sizes; + all_sizes->height = 0; + all_sizes->width = 0; + all_sizes->img_sz = 0; + all_sizes->reset = true; - if (app->cam_cnt < 1) { + if (cam_cnt < 1) { return; } params_loc = new ctx_params; - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->all_loc.row = -1; - app->cam_list[indx]->all_loc.col = -1; - app->cam_list[indx]->all_loc.offset_user_col = 0; - app->cam_list[indx]->all_loc.offset_user_row = 0; - app->cam_list[indx]->all_loc.scale = - app->cam_list[indx]->cfg->stream_preview_scale; + for (indx=0; indxall_loc.row = -1; + cam_list[indx]->all_loc.col = -1; + cam_list[indx]->all_loc.offset_user_col = 0; + cam_list[indx]->all_loc.offset_user_row = 0; + cam_list[indx]->all_loc.scale = + cam_list[indx]->cfg->stream_preview_scale; params_loc->update_params = true; util_parms_parse(params_loc , "stream_preview_location" - , app->cam_list[indx]->cfg->stream_preview_location); + , cam_list[indx]->cfg->stream_preview_location); lst = ¶ms_loc->params_array; for (it = lst->begin(); it != lst->end(); it++) { if (it->param_name == "row") { - app->cam_list[indx]->all_loc.row = mtoi(it->param_value); + cam_list[indx]->all_loc.row = mtoi(it->param_value); } if (it->param_name == "col") { - app->cam_list[indx]->all_loc.col = mtoi(it->param_value); + cam_list[indx]->all_loc.col = mtoi(it->param_value); } if (it->param_name == "offset_col") { - app->cam_list[indx]->all_loc.offset_user_col = + cam_list[indx]->all_loc.offset_user_col = mtoi(it->param_value); } if (it->param_name == "offset_row") { - app->cam_list[indx]->all_loc.offset_user_row = + cam_list[indx]->all_loc.offset_user_row = mtoi(it->param_value); } } @@ -325,60 +323,60 @@ static void motpls_allcams_init(ctx_motapp *app) mx_row = 0; mx_col = 0; - for (indx=0; indxcam_cnt; indx++) { - if (mx_col < app->cam_list[indx]->all_loc.col) { - mx_col = app->cam_list[indx]->all_loc.col; + for (indx=0; indxall_loc.col) { + mx_col = cam_list[indx]->all_loc.col; } - if (mx_row < app->cam_list[indx]->all_loc.row) { - mx_row = app->cam_list[indx]->all_loc.row; + if (mx_row < cam_list[indx]->all_loc.row) { + mx_row = cam_list[indx]->all_loc.row; } } cfg_valid = true; - for (indx=0; indxcam_cnt; indx++) { - if ((app->cam_list[indx]->all_loc.col == -1) || - (app->cam_list[indx]->all_loc.row == -1)) { + for (indx=0; indxall_loc.col == -1) || + (cam_list[indx]->all_loc.row == -1)) { cfg_valid = false; MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO , "No stream_preview_location for cam %d" - , app->cam_list[indx]->cfg->device_id); + , cam_list[indx]->cfg->device_id); } else { - for (indx1=0; indx1cam_cnt; indx1++) { - if ((app->cam_list[indx]->all_loc.col == - app->cam_list[indx1]->all_loc.col) && - (app->cam_list[indx]->all_loc.row == - app->cam_list[indx1]->all_loc.row) && + for (indx1=0; indx1all_loc.col == + cam_list[indx1]->all_loc.col) && + (cam_list[indx]->all_loc.row == + cam_list[indx1]->all_loc.row) && (indx != indx1)) { MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO , "Duplicate stream_preview_location " " cam %d, cam %d row %d col %d" - , app->cam_list[indx]->cfg->device_id - , app->cam_list[indx1]->cfg->device_id - , app->cam_list[indx]->all_loc.row - , app->cam_list[indx]->all_loc.col); + , cam_list[indx]->cfg->device_id + , cam_list[indx1]->cfg->device_id + , cam_list[indx]->all_loc.row + , cam_list[indx]->all_loc.col); cfg_valid = false; } } } - if (app->cam_list[indx]->all_loc.row == 0) { + if (cam_list[indx]->all_loc.row == 0) { MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO , "Invalid stream_preview_location row cam %d, row %d" - , app->cam_list[indx]->cfg->device_id - , app->cam_list[indx]->all_loc.row); + , cam_list[indx]->cfg->device_id + , cam_list[indx]->all_loc.row); cfg_valid = false; } - if (app->cam_list[indx]->all_loc.col == 0) { + if (cam_list[indx]->all_loc.col == 0) { MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO , "Invalid stream_preview_location col cam %d, col %d" - , app->cam_list[indx]->cfg->device_id - , app->cam_list[indx]->all_loc.col); + , cam_list[indx]->cfg->device_id + , cam_list[indx]->all_loc.col); cfg_valid = false; } } for (row=1; row<=mx_row; row++) { chk = false; - for (indx=0; indxcam_cnt; indx++) { - if (row == app->cam_list[indx]->all_loc.row) { + for (indx=0; indxall_loc.row) { chk = true; } } @@ -390,9 +388,9 @@ static void motpls_allcams_init(ctx_motapp *app) } col_chk = 0; for (col=1; col<=mx_col; col++) { - for (indx=0; indxcam_cnt; indx++) { - if ((row == app->cam_list[indx]->all_loc.row) && - (col == app->cam_list[indx]->all_loc.col)) { + for (indx=0; indxall_loc.row) && + (col == cam_list[indx]->all_loc.col)) { if ((col_chk+1) == col) { col_chk = col; } else { @@ -411,67 +409,67 @@ static void motpls_allcams_init(ctx_motapp *app) ,"Creating default stream preview values"); row = 0; col = 0; - for (indx=0; indxcam_cnt; indx++) { + for (indx=0; indxcam_list[indx]->all_loc.col = col; - app->cam_list[indx]->all_loc.row = row; - app->cam_list[indx]->all_loc.scale = -1; + cam_list[indx]->all_loc.col = col; + cam_list[indx]->all_loc.row = row; + cam_list[indx]->all_loc.scale = -1; } } - for (indx=0; indxcam_cnt; indx++) { + for (indx=0; indxcam_list[indx]->device_id - , app->cam_list[indx]->all_loc.row - , app->cam_list[indx]->all_loc.col); + , cam_list[indx]->device_id + , cam_list[indx]->all_loc.row + , cam_list[indx]->all_loc.col); } } -static void motpls_device_ids(ctx_motapp *app) +void cls_motapp::device_ids() { int indx, indx2; int invalid_ids; /* Defaults */ - for (indx=0; indxcam_cnt; indx++) { - if (app->cam_list[indx]->cfg->device_id != 0) { - app->cam_list[indx]->device_id = app->cam_list[indx]->cfg->device_id; + for (indx=0; indxcfg->device_id != 0) { + cam_list[indx]->device_id = cam_list[indx]->cfg->device_id; } else { - app->cam_list[indx]->device_id = (int)indx + 1; + cam_list[indx]->device_id = (int)indx + 1; } } - for (indx=0; indxsnd_cnt; indx++) { - if (app->snd_list[indx]->cfg->device_id != 0) { - app->snd_list[indx]->device_id = app->snd_list[indx]->cfg->device_id; + for (indx=0; indxcfg->device_id != 0) { + snd_list[indx]->device_id = snd_list[indx]->cfg->device_id; } else { - app->snd_list[indx]->device_id = (int)(app->cam_cnt + indx + 1); + snd_list[indx]->device_id = (int)(cam_cnt + indx + 1); } } /*Check for unique values*/ invalid_ids = false; - for (indx=0; indxcam_cnt; indx++) { - for (indx2=indx+1; indx2cam_cnt; indx2++) { - if (app->cam_list[indx]->device_id == app->cam_list[indx2]->device_id) { + for (indx=0; indxdevice_id == cam_list[indx2]->device_id) { invalid_ids = true; } } - for (indx2=0; indx2snd_cnt; indx2++) { - if (app->cam_list[indx]->device_id == app->snd_list[indx2]->device_id) { + for (indx2=0; indx2device_id == snd_list[indx2]->device_id) { invalid_ids = true; } } } - for (indx=0; indxsnd_cnt; indx++) { - for (indx2=indx+1; indx2snd_cnt; indx2++) { - if (app->snd_list[indx]->device_id == app->snd_list[indx2]->device_id) { + for (indx=0; indxdevice_id == snd_list[indx2]->device_id) { invalid_ids = true; } } @@ -480,19 +478,18 @@ static void motpls_device_ids(ctx_motapp *app) if (invalid_ids) { MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Device IDs are not unique.")); MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Falling back to sequence numbers")); - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->device_id = indx + 1; + for (indx=0; indxdevice_id = indx + 1; } - for (indx=0; indxsnd_cnt; indx++) { - app->snd_list[indx]->device_id = app->cam_cnt+ indx + 1; + for (indx=0; indxdevice_id = cam_cnt+ indx + 1; } } } -static void motpls_ntc(void) +void cls_motapp::ntc() { - #ifdef HAVE_V4L2 MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : available")); #else @@ -556,85 +553,83 @@ static void motpls_ntc(void) } /* Check for whether any cams are locked */ -static void motpls_watchdog(ctx_motapp *app, uint camindx) +void cls_motapp::watchdog(uint camindx) { int indx; - if (app->cam_list[camindx]->handler_finished == true) { + if (cam_list[camindx]->handler_finished == true) { return; } - app->cam_list[camindx]->watchdog--; - if (app->cam_list[camindx]->watchdog > 0) { + cam_list[camindx]->watchdog--; + if (cam_list[camindx]->watchdog > 0) { return; } MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Camera %d - Watchdog timeout.") - , app->cam_list[camindx]->device_id); + , cam_list[camindx]->device_id); /* Shut down all the cameras */ - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->event_stop = true; - pthread_mutex_unlock(&app->mutex_camlst); - pthread_mutex_unlock(&app->mutex_parms); - pthread_mutex_unlock(&app->mutex_post); - pthread_mutex_unlock(&app->dbse->mutex_dbse); - pthread_mutex_unlock(&app->global_lock); - pthread_mutex_unlock(&app->cam_list[indx]->stream.mutex); + for (indx=0; indxevent_stop = true; + pthread_mutex_unlock(&mutex_camlst); + pthread_mutex_unlock(&mutex_post); + pthread_mutex_unlock(&dbse->mutex_dbse); + pthread_mutex_unlock(&cam_list[indx]->stream.mutex); - if ((app->cam_list[indx]->camera_type == CAMERA_TYPE_NETCAM) && - (app->cam_list[indx]->netcam != nullptr)) { - pthread_mutex_unlock(&app->cam_list[indx]->netcam->mutex); - pthread_mutex_unlock(&app->cam_list[indx]->netcam->mutex_pktarray); - pthread_mutex_unlock(&app->cam_list[indx]->netcam->mutex_transfer); - app->cam_list[indx]->netcam->handler_stop = true; + if ((cam_list[indx]->camera_type == CAMERA_TYPE_NETCAM) && + (cam_list[indx]->netcam != nullptr)) { + pthread_mutex_unlock(&cam_list[indx]->netcam->mutex); + pthread_mutex_unlock(&cam_list[indx]->netcam->mutex_pktarray); + pthread_mutex_unlock(&cam_list[indx]->netcam->mutex_transfer); + cam_list[indx]->netcam->handler_stop = true; } - if ((app->cam_list[indx]->camera_type == CAMERA_TYPE_NETCAM) && - (app->cam_list[indx]->netcam_high != nullptr)) { - pthread_mutex_unlock(&app->cam_list[indx]->netcam_high->mutex); - pthread_mutex_unlock(&app->cam_list[indx]->netcam_high->mutex_pktarray); - pthread_mutex_unlock(&app->cam_list[indx]->netcam_high->mutex_transfer); - app->cam_list[indx]->netcam_high->handler_stop = true; + if ((cam_list[indx]->camera_type == CAMERA_TYPE_NETCAM) && + (cam_list[indx]->netcam_high != nullptr)) { + pthread_mutex_unlock(&cam_list[indx]->netcam_high->mutex); + pthread_mutex_unlock(&cam_list[indx]->netcam_high->mutex_pktarray); + pthread_mutex_unlock(&cam_list[indx]->netcam_high->mutex_transfer); + cam_list[indx]->netcam_high->handler_stop = true; } - app->cam_list[indx]->handler_shutdown(); + cam_list[indx]->handler_shutdown(); if (motsignal != MOTPLS_SIGNAL_SIGTERM) { - app->cam_list[indx]->handler_stop = false; /*Trigger a restart*/ + cam_list[indx]->handler_stop = false; /*Trigger a restart*/ } } } -static bool motpls_check_devices(ctx_motapp *app) +bool cls_motapp::check_devices() { int indx; bool retcd; - for (indx=0; indxcam_cnt; indx++) { - motpls_watchdog(app, indx); + for (indx=0; indxcam_cnt; indx++) { - if (app->cam_list[indx]->handler_finished == false) { + for (indx=0; indxhandler_finished == false) { retcd = true; - } else if (app->cam_list[indx]->handler_stop == false) { - app->cam_list[indx]->handler_startup(); + } else if (cam_list[indx]->handler_stop == false) { + cam_list[indx]->handler_startup(); retcd = true; } } - for (indx=0; indxsnd_cnt; indx++) { - if (app->snd_list[indx]->handler_finished == false) { + for (indx=0; indxhandler_finished == false) { retcd = true; - } else if (app->snd_list[indx]->handler_stop == false) { - app->snd_list[indx]->handler_startup(); + } else if (snd_list[indx]->handler_stop == false) { + snd_list[indx]->handler_startup(); retcd = true; } } - if ((app->webu->wb_finish == false) && - (app->webu->wb_daemon != NULL)) { + if ((webu->wb_finish == false) && + (webu->wb_daemon != NULL)) { retcd = true; } @@ -642,69 +637,66 @@ static bool motpls_check_devices(ctx_motapp *app) } -static void motpls_init(ctx_motapp *app, int argc, char *argv[]) +void cls_motapp::init(int p_argc, char *p_argv[]) { int indx; - app->argc = argc; - app->argv = argv; + argc = p_argc; + argv = p_argv; - app->reload_all = false; - app->parms_changed = false; - app->pause = false; - app->cam_add = false; - app->cam_delete = -1; - app->cam_cnt = 0; - app->snd_cnt = 0; - app->conf_src = nullptr; - app->cfg = nullptr; - app->dbse = nullptr; - app->webu = nullptr; + reload_all = false; + pause = false; + cam_add = false; + cam_delete = -1; + cam_cnt = 0; + snd_cnt = 0; + conf_src = nullptr; + cfg = nullptr; + dbse = nullptr; + webu = nullptr; - pthread_mutex_init(&app->global_lock, NULL); - pthread_mutex_init(&app->mutex_parms, NULL); - pthread_mutex_init(&app->mutex_camlst, NULL); - pthread_mutex_init(&app->mutex_post, NULL); + pthread_mutex_init(&mutex_camlst, NULL); + pthread_mutex_init(&mutex_post, NULL); - app->conf_src = new cls_config; - app->conf_src->init(app); + conf_src = new cls_config; + conf_src->init(this); - app->cfg = new cls_config; - app->cfg->parms_copy(app->conf_src); + cfg = new cls_config; + cfg->parms_copy(conf_src); - motlog->log_level = app->cfg->log_level; - motlog->log_fflevel = app->cfg->log_fflevel; - motlog->set_log_file(app->cfg->log_file); + motlog->log_level = cfg->log_level; + motlog->log_fflevel = cfg->log_fflevel; + motlog->set_log_file(cfg->log_file); mytranslate_init(); - mytranslate_text("",app->cfg->native_language); + mytranslate_text("",cfg->native_language); - if (app->cfg->daemon) { - motpls_daemon(); + if (cfg->daemon) { + daemon(); MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("MotionPlus running as daemon process")); } - app->cfg->parms_log(app); + cfg->parms_log(this); - motpls_pid_write(app); + pid_write(); - motpls_ntc(); + ntc(); - motpls_device_ids(app); + device_ids(); - app->dbse = new cls_dbse(app); + dbse = new cls_dbse(this); - motpls_allcams_init(app); + allcams_init(); - motpls_av_init(); + av_init(); - if ((app->cam_cnt > 0) || (app->snd_cnt > 0)) { - for (indx=0; indxcam_cnt; indx++) { - app->cam_list[indx]->handler_startup(); + if ((cam_cnt > 0) || (snd_cnt > 0)) { + for (indx=0; indxhandler_startup(); } - for (indx=0; indxsnd_cnt; indx++) { - app->snd_list[indx]->handler_startup(); + for (indx=0; indxhandler_startup(); } } else { MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO @@ -714,70 +706,69 @@ static void motpls_init(ctx_motapp *app, int argc, char *argv[]) } /* Start web control last */ - app->webu = new cls_webu(app); + webu = new cls_webu(this); } -static void motpls_deinit(ctx_motapp *app) +void cls_motapp::deinit() { int indx; - motpls_av_deinit(); - motpls_pid_remove(app); + av_deinit(); + pid_remove(); - mydelete(app->webu); - mydelete(app->dbse); - mydelete(app->conf_src); - mydelete(app->cfg); - mydelete(app->all_sizes); + mydelete(webu); + mydelete(dbse); + mydelete(conf_src); + mydelete(cfg); + mydelete(all_sizes); - for (indx = 0; indx < app->cam_cnt;indx++) { - mydelete(app->cam_list[indx]); + for (indx = 0; indx < cam_cnt;indx++) { + mydelete(cam_list[indx]); } - for (indx = 0; indx < app->snd_cnt;indx++) { - mydelete(app->snd_list[indx]); + for (indx = 0; indx < snd_cnt;indx++) { + mydelete(snd_list[indx]); } - pthread_mutex_destroy(&app->global_lock); - pthread_mutex_destroy(&app->mutex_parms); - pthread_mutex_destroy(&app->mutex_camlst); - pthread_mutex_destroy(&app->mutex_post); + pthread_mutex_destroy(&mutex_camlst); + pthread_mutex_destroy(&mutex_post); } /* Check for whether to add a new cam */ -static void motpls_cam_add(ctx_motapp *app) +void cls_motapp::camera_add() { - if (app->cam_add == false) { + if (cam_add == false) { return; } - pthread_mutex_lock(&app->mutex_camlst); - app->cfg->camera_add(app, "", false); - pthread_mutex_unlock(&app->mutex_camlst); + pthread_mutex_lock(&mutex_camlst); + cfg->camera_add(this, "", false); + pthread_mutex_unlock(&mutex_camlst); - app->cam_add = false; + cam_add = false; } + /* Check for whether to delete a new cam */ -static void motpls_cam_delete(ctx_motapp *app) +void cls_motapp::camera_delete() { cls_camera *cam; - if ((app->cam_delete == -1) || - (app->cam_cnt == 0)) { - app->cam_delete = -1; + if ((cam_delete == -1) || + (cam_cnt == 0)) { + cam_delete = -1; return; } - if (app->cam_delete >= (int)app->cam_cnt) { + if (cam_delete >= (int)cam_cnt) { MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO - , _("Invalid camera specified for deletion. %d"), app->cam_delete); - app->cam_delete = -1; + , _("Invalid camera specified for deletion. %d"), cam_delete); + cam_delete = -1; return; } - cam = app->cam_list[app->cam_delete]; + cam = cam_list[cam_delete]; MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Stopping %s device_id %d") , cam->cfg->device_name.c_str(), cam->device_id); @@ -786,52 +777,53 @@ static void motpls_cam_delete(ctx_motapp *app) if (cam->handler_finished == false) { MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "Error stopping camera. Timed out shutting down"); - app->cam_delete = -1; + cam_delete = -1; return; } MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Camera stopped"); - pthread_mutex_lock(&app->mutex_camlst); - mydelete(app->cam_list[app->cam_delete]); - app->cam_list.erase(app->cam_list.begin() + app->cam_delete); - app->cam_cnt--; - pthread_mutex_unlock(&app->mutex_camlst); + pthread_mutex_lock(&mutex_camlst); + mydelete(cam_list[cam_delete]); + cam_list.erase(cam_list.begin() + cam_delete); + cam_cnt--; + pthread_mutex_unlock(&mutex_camlst); - app->cam_delete = -1; + cam_delete = -1; } /** Main entry point of MotionPlus. */ -int main (int argc, char **argv) +int main (int p_argc, char **p_argv) { - ctx_motapp *app; - - app = new ctx_motapp; - motlog = new cls_log(app); + cls_motapp *app; setup_signals(); + + app = new cls_motapp(); + motlog = new cls_log(app); + mythreadname_set("mp",0,""); while (true) { - motpls_init(app, argc, argv); - while (motpls_check_devices(app)) { + app->init(p_argc, p_argv); + while (app->check_devices()) { SLEEP(1, 0); if (motsignal != MOTPLS_SIGNAL_NONE) { - motpls_signal_process(app); + app->signal_process(); } - motpls_cam_add(app); - motpls_cam_delete(app); + app->camera_add(); + app->camera_delete(); } MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motionplus devices finished")); if (app->reload_all) { - motpls_deinit(app); + app->deinit(); app->reload_all = false; } else { break; } } - motpls_deinit(app); + app->deinit(); MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("MotionPlus terminating")); @@ -841,3 +833,12 @@ int main (int argc, char **argv) return 0; } +cls_motapp::cls_motapp() +{ + +} + +cls_motapp::~cls_motapp() +{ + +} \ No newline at end of file diff --git a/src/motionplus.hpp b/src/motionplus.hpp index 4926692e..b1eab948 100644 --- a/src/motionplus.hpp +++ b/src/motionplus.hpp @@ -112,10 +112,10 @@ } #endif -struct ctx_motapp; struct ctx_images; struct ctx_image_data; +class cls_motapp; class cls_camera; class cls_sound; class cls_algsec; @@ -288,31 +288,50 @@ struct ctx_all_sizes { typedef std::vector vec_cam; typedef std::vector vec_snd; -struct ctx_motapp { +class cls_motapp { + public: + cls_motapp(); + ~cls_motapp(); - vec_cam cam_list; - vec_snd snd_list; + vec_cam cam_list; + vec_snd snd_list; - bool reload_all; - bool cam_add; - int cam_delete; /* 0 for no action, other numbers specify camera to remove */ - int cam_cnt; - int snd_cnt; - int argc; - char **argv; - bool pause; + bool reload_all; + bool cam_add; + int cam_delete; /* 0 for no action, other numbers specify camera to remove */ + int cam_cnt; + int snd_cnt; - cls_config *conf_src; - cls_config *cfg; - ctx_all_sizes *all_sizes; - cls_webu *webu; - cls_dbse *dbse; + int argc; + char **argv; + bool pause; - bool parms_changed; /*bool indicating if the parms have changed */ - pthread_mutex_t global_lock; - pthread_mutex_t mutex_parms; /* mutex used to lock when changing parms */ - pthread_mutex_t mutex_camlst; /* Lock the list of cams while adding/removing */ - pthread_mutex_t mutex_post; /* mutex to allow for processing of post actions*/ + cls_config *conf_src; + cls_config *cfg; + ctx_all_sizes *all_sizes; + cls_webu *webu; + cls_dbse *dbse; + + pthread_mutex_t mutex_camlst; /* Lock the list of cams while adding/removing */ + pthread_mutex_t mutex_post; /* mutex to allow for processing of post actions*/ + + void signal_process(); + bool check_devices(); + void init(int p_argc, char *p_argv[]); + void deinit(); + void camera_add(); + void camera_delete(); + + private: + void pid_write(); + void pid_remove(); + void daemon(); + void av_init(); + void av_deinit(); + void allcams_init(); + void device_ids(); + void ntc(); + void watchdog(uint camindx); }; diff --git a/src/sound.cpp b/src/sound.cpp index c15fc1e3..e6682122 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -946,7 +946,7 @@ void cls_sound::handler_shutdown() } -cls_sound::cls_sound(ctx_motapp *p_app) +cls_sound::cls_sound(cls_motapp *p_app) { app = p_app; handler_finished = true; diff --git a/src/sound.hpp b/src/sound.hpp index 4040c7c4..e355de86 100644 --- a/src/sound.hpp +++ b/src/sound.hpp @@ -90,7 +90,7 @@ struct ctx_snd_info { class cls_sound { public: - cls_sound(ctx_motapp *p_app); + cls_sound(cls_motapp *p_app); ~cls_sound(); enum DEVICE_STATUS device_status; @@ -111,7 +111,7 @@ class cls_sound { void handler_shutdown(); private: - ctx_motapp *app; + cls_motapp *app; int watchdog; void cleanup(); diff --git a/src/util.cpp b/src/util.cpp index b68a1789..17b45fb0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -532,9 +532,9 @@ void mytranslate_init(void) //translate_locale_chg("li"); mytranslate_locale_chg("es"); - bindtextdomain ("motion", LOCALEDIR); - bind_textdomain_codeset ("motion", "UTF-8"); - textdomain ("motion"); + bindtextdomain ("motionplus", LOCALEDIR); + bind_textdomain_codeset ("motionplus", "UTF-8"); + textdomain ("motionplus"); MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Language: English")); diff --git a/src/webu.cpp b/src/webu.cpp index 2d099e03..30e4cd29 100644 --- a/src/webu.cpp +++ b/src/webu.cpp @@ -36,7 +36,7 @@ static void *webu_mhd_init(void *cls, const char *uri, struct MHD_Connection *connection) { (void)connection; - ctx_motapp *p_app =(ctx_motapp *)cls; + cls_motapp *p_app =(cls_motapp *)cls; cls_webu_ans *webua; mythreadname_set("wc", 0, NULL); @@ -539,7 +539,7 @@ void cls_webu::webu_stop() } -cls_webu::cls_webu(ctx_motapp *p_app) +cls_webu::cls_webu(cls_motapp *p_app) { app = p_app; webu_start(); diff --git a/src/webu.hpp b/src/webu.hpp index c4b9fba9..9b0e06dc 100644 --- a/src/webu.hpp +++ b/src/webu.hpp @@ -79,7 +79,7 @@ class cls_webu { public: - cls_webu(ctx_motapp *p_app); + cls_webu(cls_motapp *p_app); ~cls_webu(); bool wb_finish; ctx_params *wb_headers; @@ -92,7 +92,7 @@ private: ctx_mhdstart *mhdst; - ctx_motapp *app; + cls_motapp *app; void webu_start(); void webu_stop(); void init_actions(); diff --git a/src/webu_ans.cpp b/src/webu_ans.cpp index 73864e12..0687322d 100644 --- a/src/webu_ans.cpp +++ b/src/webu_ans.cpp @@ -704,7 +704,7 @@ mhdrslt cls_webu_ans::answer_main(struct MHD_Connection *p_connection } -cls_webu_ans::cls_webu_ans(ctx_motapp *p_app, const char *uri) +cls_webu_ans::cls_webu_ans(cls_motapp *p_app, const char *uri) { app = p_app; webu = p_app->webu; diff --git a/src/webu_ans.hpp b/src/webu_ans.hpp index f2001a7a..6763a271 100644 --- a/src/webu_ans.hpp +++ b/src/webu_ans.hpp @@ -20,7 +20,7 @@ #define _INCLUDE_WEBU_ANS_HPP_ class cls_webu_ans { public: - cls_webu_ans(ctx_motapp *p_motapp, const char *uri); + cls_webu_ans(cls_motapp *p_motapp, const char *uri); ~cls_webu_ans(); mhdrslt answer_main(struct MHD_Connection *connection, const char *method @@ -29,7 +29,7 @@ void mhd_send(); void bad_request(); - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_camera *cam; diff --git a/src/webu_common.hpp b/src/webu_common.hpp index e49b5062..d56d1772 100644 --- a/src/webu_common.hpp +++ b/src/webu_common.hpp @@ -39,7 +39,7 @@ int stream_fps; /* Stream rate per second */ private: - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_webu_ans *webua; diff --git a/src/webu_file.hpp b/src/webu_file.hpp index 1568084e..0469cba0 100644 --- a/src/webu_file.hpp +++ b/src/webu_file.hpp @@ -24,7 +24,7 @@ ~cls_webu_file(); void main(); private: - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_webu_ans *webua; }; diff --git a/src/webu_html.hpp b/src/webu_html.hpp index 94ca65e5..2d29f109 100644 --- a/src/webu_html.hpp +++ b/src/webu_html.hpp @@ -24,7 +24,7 @@ ~cls_webu_html(); void main(); private: - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_webu_ans *webua; diff --git a/src/webu_json.hpp b/src/webu_json.hpp index 652cf358..b084e899 100644 --- a/src/webu_json.hpp +++ b/src/webu_json.hpp @@ -24,7 +24,7 @@ ~cls_webu_json(); void main(); private: - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_webu_ans *webua; void parms_item(cls_config *conf, int indx_parm); diff --git a/src/webu_mpegts.hpp b/src/webu_mpegts.hpp index 83e47197..6dfe9220 100644 --- a/src/webu_mpegts.hpp +++ b/src/webu_mpegts.hpp @@ -28,7 +28,7 @@ mhdrslt main(); private: - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_webu_ans *webua; cls_webu_common *webuc; diff --git a/src/webu_post.cpp b/src/webu_post.cpp index b5c30747..3c488130 100644 --- a/src/webu_post.cpp +++ b/src/webu_post.cpp @@ -103,12 +103,7 @@ void cls_webu_post::cam_delete() } } - if (webua->camindx == -1) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "No camera specified for deletion." ); - return; - } else { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Deleting camera."); - } + MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Deleting camera."); app->cam_delete = webua->camindx; @@ -159,13 +154,21 @@ void cls_webu_post::parse_cmd() return; } - for (indx=0; indxcam_cnt; indx++) { - if (app->cam_list[indx]->device_id == webua->device_id) { - webua->camindx = indx; - break; + if (webua->device_id != 0) { + for (indx=0; indxcam_cnt; indx++) { + if (app->cam_list[indx]->device_id == webua->device_id) { + webua->camindx = indx; + break; + } + } + if (webua->camindx == -1) { + MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + , "Invalid request. Device id %d not found" + , webua->device_id); + webua->device_id = -1; + return; } } - } /* Process the event end action */ @@ -598,7 +601,7 @@ void cls_webu_post::process_actions() { parse_cmd(); - if (post_cmd == "") { + if ((post_cmd == "") || (webua->device_id == -1)) { return; } diff --git a/src/webu_post.hpp b/src/webu_post.hpp index 5b6fa47d..7ccd767a 100644 --- a/src/webu_post.hpp +++ b/src/webu_post.hpp @@ -28,7 +28,7 @@ mhdrslt processor_start(const char *upload_data, size_t *upload_data_size); private: - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_webu_ans *webua; cls_webu_html *webu_html; diff --git a/src/webu_stream.hpp b/src/webu_stream.hpp index 7f0bd2c0..8de40042 100644 --- a/src/webu_stream.hpp +++ b/src/webu_stream.hpp @@ -27,7 +27,7 @@ ssize_t mjpeg_response (char *buf, size_t max); private: - ctx_motapp *app; + cls_motapp *app; cls_webu *webu; cls_webu_ans *webua; cls_webu_common *webuc;