MCPcopy Create free account
hub / github.com/Motion-Project/motion / conf_cmdparse

Function conf_cmdparse

src/conf.c:2397–2477  ·  view source on GitHub ↗

* conf_cmdparse * Sets a config option given by 'cmd' to the value given by 'arg1'. * Based on the name of the option it searches through the struct 'config_params' * for an option where the config_params[i].param_name matches the option. * By calling the function pointed to by config_params[i].copy the option gets * assigned. * * Returns context struct. */

Source from the content-addressed store, hash-verified

2395 * Returns context struct.
2396 */
2397struct context **conf_cmdparse(struct context **cnt, char *param_name, char *param_val)
2398{
2399 int indx;
2400
2401 if (param_name == NULL) {
2402 return cnt;
2403 }
2404
2405 indx = 0;
2406 while (config_params[indx].param_name != NULL) {
2407 if (mystrceq(param_name, config_params[indx].param_name)) {
2408 if (mystreq(param_name, "camera")) {
2409 cnt = config_camera(cnt, param_val, config_params[indx].conf_value);
2410 } else if (mystreq(param_name, "camera_dir")) {
2411 cnt = read_camera_dir(cnt, param_val, config_params[indx].conf_value);
2412 } else {
2413 config_params[indx].copy(*cnt, param_val, config_params[indx].conf_value);
2414 }
2415
2416 return cnt;
2417 }
2418 indx++;
2419 }
2420
2421 /* Now check deprecated options */
2422 indx = 0;
2423 while (dep_config_params[indx].name != NULL) {
2424 if (mystreq(param_name, dep_config_params[indx].name)) {
2425 MOTION_LOG(ALR, TYPE_ALL, NO_ERRNO, _("%s after version %s")
2426 , dep_config_params[indx].info
2427 , dep_config_params[indx].last_version);
2428
2429 if (mystreq(dep_config_params[indx].name,"brightness") ||
2430 mystreq(dep_config_params[indx].name,"contrast") ||
2431 mystreq(dep_config_params[indx].name,"saturation") ||
2432 mystreq(dep_config_params[indx].name,"hue") ||
2433 mystreq(dep_config_params[indx].name,"power_line_frequency") ||
2434 mystreq(dep_config_params[indx].name,"v4l2_palette") ||
2435 mystreq(dep_config_params[indx].name,"input") ||
2436 mystreq(dep_config_params[indx].name,"norm") ||
2437 mystreq(dep_config_params[indx].name,"frequency") ||
2438 mystreq(dep_config_params[indx].name,"vid_control_params")) {
2439 copy_video_params(*cnt, param_val, indx);
2440
2441 } else if (mystreq(dep_config_params[indx].name,"netcam_decoder") ||
2442 mystreq(dep_config_params[indx].name,"netcam_use_tcp") ||
2443 mystreq(dep_config_params[indx].name,"rtsp_uses_tcp") ||
2444 mystreq(dep_config_params[indx].name,"netcam_rate") ||
2445 mystreq(dep_config_params[indx].name,"netcam_ratehigh") ||
2446 mystreq(dep_config_params[indx].name,"netcam_proxy") ||
2447 mystreq(dep_config_params[indx].name,"netcam_tolerant_check") ||
2448 mystreq(dep_config_params[indx].name,"netcam_keepalive")) {
2449 copy_netcam_params(*cnt, param_val, indx);
2450
2451 } else if (mystreq(dep_config_params[indx].name,"webcontrol_cors_header")) {
2452 copy_webcontrol_header(*cnt, param_val);
2453
2454 } else if (mystreq(dep_config_params[indx].name,"stream_cors_header")) {

Callers 3

webu_process_config_setFunction · 0.85
mlp_timelapseFunction · 0.85
conf_processFunction · 0.85

Calls 10

mystrceqFunction · 0.85
mystreqFunction · 0.85
config_cameraFunction · 0.85
read_camera_dirFunction · 0.85
copy_video_paramsFunction · 0.85
copy_netcam_paramsFunction · 0.85
copy_webcontrol_headerFunction · 0.85
copy_stream_headerFunction · 0.85
copy_text_doubleFunction · 0.85
copy_html_outputFunction · 0.85

Tested by

no test coverage detected