34 #define MAX_CHILD_ARGS 64
39 int *errors,
const char *
fmt, va_list vl);
41 int *errors,
const char *
fmt, ...);
43 #define ERROR(...) report_config_error(config->filename, config->line_num,\
44 AV_LOG_ERROR, &config->errors, __VA_ARGS__)
45 #define WARNING(...) report_config_error(config->filename, config->line_num,\
46 AV_LOG_WARNING, &config->warnings, __VA_ARGS__)
50 static int resolve_host(
struct in_addr *sin_addr,
const char *hostname)
63 for (cur = ai; cur; cur = cur->
ai_next) {
65 *sin_addr = ((
struct sockaddr_in *)cur->
ai_addr)->sin_addr;
74 hp = gethostbyname(hostname);
77 memcpy(sin_addr, hp->h_addr_list[0],
sizeof(
struct in_addr));
93 if (*p ==
'\"' || *p ==
'\'')
105 if ((q - buf) < buf_size - 1)
110 if (quote && *p == quote)
117 const char *p,
const char *filename,
int line_num)
129 fprintf(stderr,
"%s:%d: ACL action '%s' is not ALLOW or DENY\n",
130 filename, line_num, arg);
137 fprintf(stderr,
"%s:%d: ACL refers to invalid host or IP address '%s'\n",
138 filename, line_num, arg);
148 "%s:%d: ACL refers to invalid host or IP address '%s'\n",
149 filename, line_num, arg);
162 naclp = &stream->
acl;
168 fprintf(stderr,
"%s:%d: ACL found not in <stream> or <feed>\n",
175 naclp = &(*naclp)->
next;
201 "Something is wrong, %d options are not set!\n",
av_dict_count(*opts));
211 WARNING(
"Setting default value for audio bit rate = %d. "
212 "Use NoDefaults to disable it.\n",
218 WARNING(
"Setting default value for audio sample rate = %d. "
219 "Use NoDefaults to disable it.\n",
225 WARNING(
"Setting default value for audio channel count = %d. "
226 "Use NoDefaults to disable it.\n",
234 WARNING(
"Setting default value for video bit rate = %d. "
235 "Use NoDefaults to disable it.\n",
238 if (!
av_dict_get(recommended,
"time_base", NULL, 0)){
242 WARNING(
"Setting default value for video frame rate = %d. "
243 "Use NoDefaults to disable it.\n",
246 if (!
av_dict_get(recommended,
"video_size", NULL, 0)) {
249 av_dict_set(&recommended,
"video_size",
"160x128", 0);
250 WARNING(
"Setting default value for video size = %dx%d. "
251 "Use NoDefaults to disable it.\n",
259 WARNING(
"Setting default value for video bit rate tolerance = %d. "
260 "Use NoDefaults to disable it.\n",
266 av_dict_set(&recommended,
"rc_eq",
"tex^qComp", 0);
267 WARNING(
"Setting default value for video rate control equation = %s. "
268 "Use NoDefaults to disable it.\n",
271 if (!
av_dict_get(recommended,
"maxrate", NULL, 0)) {
274 WARNING(
"Setting default value for video max rate = %d. "
275 "Use NoDefaults to disable it.\n",
282 WARNING(
"Setting default value for video buffer size = %d. "
283 "Use NoDefaults to disable it.\n",
295 &config->
errors,
"audio bit rate is not set\n");
298 &config->
errors,
"audio sample rate is not set\n");
303 &config->
errors,
"video size is not set\n");
326 &config->
errors,
"Invalid codec name: %s\n", codec_name);
336 "Inconsistent configuration: trying to set %s codec option, but %s codec is used previously\n",
344 char filename[1000], tmp[1000], tmp2[1000],
line[1000];
362 codec ? codec->
name : NULL))) {
368 int e= fscanf(f,
"%999[^\n]\n", line) - 1;
369 if(line[0] ==
'#' && !e)
371 e|= sscanf(line,
"%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
382 }
else if (!strcmp(tmp,
"scodec")) {
401 char stream_format_name[64];
403 snprintf(stream_format_name,
sizeof(stream_format_name),
"%s_stream",
416 av_log(NULL, log_level,
"%s:%d: ", filename, line_num);
417 av_vlog(NULL, log_level, fmt, vl);
435 if (!value || !value[0])
438 tmp = strtol(value, &tailp, 0);
439 if (tmp < min || tmp > max)
446 if (tailp[0] || errno)
454 va_start(vl, error_msg);
456 &config->
errors, error_msg, vl);
467 if (!value || !value[0])
470 tmp =
strtod(value, &tailp);
471 if (tmp < min || tmp > max)
475 if (tailp[0] || errno)
483 va_start(vl, error_msg);
485 &config->
errors, error_msg, vl);
493 static int hinted = 0;
497 const char *
option = NULL;
498 const char *codec_name = NULL;
521 if (strchr(opt,
':')) {
523 snprintf(buff,
sizeof(buff),
"%s", opt);
525 option = strchr(buff,
':');
526 buff[option - buff] =
'\0';
537 if (!o && (!strcmp(option,
"time_base") || !strcmp(option,
"pixel_format") ||
538 !strcmp(option,
"video_size") || !strcmp(option,
"codec_tag")))
542 &config->
errors,
"Option not found: %s\n", opt);
546 "If '%s' is a codec private option, then prefix it with codec name, "
547 "for example '%s:%s %s' or define codec earlier.\n",
552 &config->
errors,
"Invalid value for option %s (%s): %s\n", opt,
554 }
else if ((e =
av_dict_get(*dict, option, NULL, 0))) {
559 "Redeclaring value of the option %s, previous value: %s\n",
561 }
else if (
av_dict_set(dict, option, arg, 0) < 0) {
571 snprintf(buf,
sizeof(buf),
"%"PRId64, arg);
582 WARNING(
"Port option is deprecated, use HTTPPort instead\n");
585 "Invalid port: %s\n", arg);
587 WARNING(
"Trying to use IETF assigned system port: %d\n", val);
591 WARNING(
"BindAddress option is deprecated, use HTTPBindAddress instead\n");
594 ERROR(
"Invalid host/IP address: %s\n", arg);
596 WARNING(
"NoDaemon option has no effect, you should remove it\n");
600 "Invalid port: %s\n", arg);
605 ERROR(
"Invalid host/IP address: %s\n", arg);
609 "Invalid MaxHTTPConnections: %s\n", arg);
612 ERROR(
"Inconsistent configuration: MaxClients(%d) > MaxHTTPConnections(%d)\n",
617 "Invalid MaxClients: %s\n", arg);
620 ERROR(
"Inconsistent configuration: MaxClients(%d) > MaxHTTPConnections(%d)\n",
627 llval = strtoll(arg, &tailp, 10);
628 if (llval < 10 || llval > 10000000 || tailp[0] || errno)
629 ERROR(
"Invalid MaxBandwidth: %s\n", arg);
636 ERROR(
"Loadable modules are no longer supported\n");
642 ERROR(
"Incorrect keyword: '%s'\n", cmd);
698 (config->
http_addr.sin_addr.s_addr == INADDR_ANY) ?
"127.0.0.1" :
715 WARNING(
"Truncate N syntax in configuration file is deprecated, "
716 "use Truncate alone with no arguments\n");
731 fsize *= 1024 * 1024;
734 fsize *= 1024 * 1024 * 1024;
737 ERROR(
"Invalid file size: %s\n", arg);
742 ERROR(
"Feed max file size is too small, must be at least %d\n",
747 ERROR(
"Invalid entry '%s' inside <Feed></Feed>\n", cmd);
755 char arg[1024], arg2[1024];
811 ERROR(
"Feed with name '%s' for stream '%s' is not defined\n", arg,
814 stream->
feed = sfeed;
817 if (!strcmp(arg,
"status")) {
823 if (!strcmp(arg,
"jpeg"))
824 strcpy(arg,
"mjpeg");
827 ERROR(
"Unknown Format: %s\n", arg);
837 ERROR(
"Unknown input format: %s\n", arg);
843 ERROR(
"FaviconURL only permitted for status streams\n");
851 for (i = 0; i < strlen(cmd); i++)
854 WARNING(
"'%s' option in configuration file is deprecated, "
855 "use 'Metadata %s VALUE' instead\n", cmd, key);
876 stream->
max_time = atof(arg) * 1000;
881 "Invalid %s: %s\n", cmd, arg);
893 int minrate, maxrate;
896 dash = strchr(arg,
'-');
907 ERROR(
"Incorrect format for VideoBitRateRange -- should be "
908 "<min>-<max>: %s\n", arg);
922 "Invalid %s: %s", cmd, arg);
928 "Invalid %s: %s", cmd, arg);
934 "Invalid %s: %s", cmd, arg);
942 ERROR(
"Invalid video size '%s'\n", arg);
945 WARNING(
"Image size is not a multiple of 2\n");
951 arg[0] =
'1'; arg[1] =
'/';
959 ERROR(
"Unknown pixel format: %s\n", arg);
996 if (strlen(arg) == 4 &&
1012 "Invalid Qscale: %s\n", arg);
1053 ERROR(
"Invalid host/IP address: %s\n", arg);
1059 "Invalid MulticastPort: %s\n", arg);
1064 "Invalid MulticastTTL: %s\n", arg);
1070 if (stream->
feed && stream->
fmt && strcmp(stream->
fmt->
name,
"ffm")) {
1094 WARNING(
"Multiple UseDefaults/NoDefaults entries.\n");
1098 WARNING(
"Multiple UseDefaults/NoDefaults entries.\n");
1101 ERROR(
"Invalid entry '%s' inside <Stream></Stream>\n", cmd);
1118 redirect = *predirect;
1127 q = strrchr(redirect->
filename,
'>');
1131 *predirect = redirect;
1140 ERROR(
"No URL found for <Redirect>\n");
1143 ERROR(
"Invalid entry '%s' inside <Redirect></Redirect>\n", cmd);
1161 f = fopen(filename,
"r");
1165 "Could not open the configuration file '%s'\n", filename);
1176 if (fgets(line,
sizeof(line), f) == NULL)
1182 if (*p ==
'\0' || *p ==
'#')
1189 if (opening && (stream || feed || redirect)) {
1190 ERROR(
"Already in a tag\n");
1196 *last_stream = feed;
1197 last_stream = &feed->
next;
1205 if (opening && (stream || feed || redirect)) {
1206 ERROR(
"Already in a tag\n");
1212 *last_stream = stream;
1213 last_stream = &stream->
next;
1218 if (opening && (stream || feed || redirect))
1219 ERROR(
"Already in a tag\n");
1225 *last_stream = redirect;
1226 last_stream = &redirect->
next;
1233 if (stream || feed || redirect)
1234 ERROR(
"Not closed tag %s\n", stream ?
"<Stream>" : (feed ?
"<Feed>" :
"<Redirect>"));
1254 args = *(
char ***)argsp;