static int read_option_disk(char *opt_name, char *opt_val) { char buf[MAX_PATH_LEN*2]; if (!read_line(buf, opt_file)) return 0; extract_option(opt_name, opt_val, buf); return 1; }
static vpx_codec_err_t parse_layer_options_from_string(SvcContext *svc_ctx, LAYER_OPTION_TYPE type, const char *input, int *option0, int *option1) { int i; vpx_codec_err_t res = VPX_CODEC_OK; char *input_string; char *token; const char *delim = ","; char *save_ptr; int num_layers = svc_ctx->spatial_layers; if (type == BITRATE) num_layers = svc_ctx->spatial_layers * svc_ctx->temporal_layers; if (input == NULL || option0 == NULL || (option1 == NULL && type == SCALE_FACTOR)) return VPX_CODEC_INVALID_PARAM; input_string = strdup(input); token = strtok_r(input_string, delim, &save_ptr); for (i = 0; i < num_layers; ++i) { if (token != NULL) { res = extract_option(type, token, option0 + i, option1 + i); if (res != VPX_CODEC_OK) break; token = strtok_r(NULL, delim, &save_ptr); } else { break; } } if (res == VPX_CODEC_OK && i != num_layers) { svc_log(svc_ctx, SVC_LOG_ERROR, "svc: layer params type: %d %d values required, " "but only %d specified\n", type, num_layers, i); res = VPX_CODEC_INVALID_PARAM; } free(input_string); return res; }
int set_options(const char args[]) { int err = 0; if(*args == '\0') { print_changed_options(); return 0; } while(*args != '\0') { char buf[1024]; args = extract_option(args, buf, 1); if(args == NULL) return -1; err += process_option(buf); } return err; }
static int read_option_cmdline(char *opt_name, char *opt_val) { if (strlen(cur_opt) == 0) return 0; cur_opt = extract_option(opt_name, opt_val, cur_opt); return 1; }