History

Replace all usage of strcasecmp/strncasecmp

All current usages of it are incompatible with localization. For example strcasecmp("i", "I") != 0 is possible, but would break many of the places where it is used. Instead use our own implementations that always treat the data as ASCII.

Reimar Döffinger committed 15 years ago

Commit bb3244d1 parent ba04ecf14 files · +123 −132Browse files

Showing the changes to avserver.c (1 of 14 files). Show all

Unified · Split

avserver.c+88−89
@@ -24,7 +24,6 @@ · 23 unmodified lines
24#define closesocket close24#define closesocket close
25#endif25#endif
26#include <string.h>26#include <string.h>
27#include <strings.h>
28#include <stdlib.h>27#include <stdlib.h>
29#include "libavformat/avformat.h"28#include "libavformat/avformat.h"
30#include "libavformat/ffm.h"29#include "libavformat/ffm.h"
@@ -1085,13 +1084,13 @@ static int extract_rates(char *rates, int ratelen, const char *request) · 1054 unmodified lines
1085 const char *p;1084 const char *p;
1086 1085
1087 for (p = request; *p && *p != '\r' && *p != '\n'; ) {1086 for (p = request; *p && *p != '\r' && *p != '\n'; ) {
1088 if (strncasecmp(p, "Pragma:", 7) == 0) {1087 if (av_strncasecmp(p, "Pragma:", 7) == 0) {
1089 const char *q = p + 7;1088 const char *q = p + 7;
1090 1089
1091 while (*q && *q != '\n' && isspace(*q))1090 while (*q && *q != '\n' && isspace(*q))
1092 q++;1091 q++;
1093 1092
1094 if (strncasecmp(q, "stream-switch-entry=", 20) == 0) {1093 if (av_strncasecmp(q, "stream-switch-entry=", 20) == 0) {
1095 int stream_no;1094 int stream_no;
1096 int rate_no;1095 int rate_no;
1097 1096
@@ -1271,9 +1270,9 @@ static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_ac · 173 unmodified lines
1271 int errors = 0;1270 int errors = 0;
1272 1271
1273 get_arg(arg, sizeof(arg), &p);1272 get_arg(arg, sizeof(arg), &p);
1274 if (strcasecmp(arg, "allow") == 0)1273 if (av_strcasecmp(arg, "allow") == 0)
1275 acl.action = IP_ALLOW;1274 acl.action = IP_ALLOW;
1276 else if (strcasecmp(arg, "deny") == 0)1275 else if (av_strcasecmp(arg, "deny") == 0)
1277 acl.action = IP_DENY;1276 acl.action = IP_DENY;
1278 else {1277 else {
1279 fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n",1278 fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n",
@@ -1358,7 +1357,7 @@ static IPAddressACL* parse_dynamic_acl(FFStream *stream, HTTPContext *c) · 78 unmodified lines
1358 continue;1357 continue;
1359 get_arg(cmd, sizeof(cmd), &p);1358 get_arg(cmd, sizeof(cmd), &p);
1360 1359
1361 if (!strcasecmp(cmd, "ACL"))1360 if (!av_strcasecmp(cmd, "ACL"))
1362 parse_acl_row(NULL, NULL, acl, p, stream->dynamic_acl, line_num);1361 parse_acl_row(NULL, NULL, acl, p, stream->dynamic_acl, line_num);
1363 }1362 }
1364 fclose(f);1363 fclose(f);
@@ -1500,7 +1499,7 @@ static int http_parse_request(HTTPContext *c) · 135 unmodified lines
1500 av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);1499 av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
1501 1500
1502 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {1501 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
1503 if (strncasecmp(p, "User-Agent:", 11) == 0) {1502 if (av_strncasecmp(p, "User-Agent:", 11) == 0) {
1504 useragent = p + 11;1503 useragent = p + 11;
1505 if (*useragent && *useragent != '\n' && isspace(*useragent))1504 if (*useragent && *useragent != '\n' && isspace(*useragent))
1506 useragent++;1505 useragent++;
@@ -1518,7 +1517,7 @@ static int http_parse_request(HTTPContext *c) · 11 unmodified lines
1518 redir_type = REDIR_ASX;1517 redir_type = REDIR_ASX;
1519 filename[strlen(filename)-1] = 'f';1518 filename[strlen(filename)-1] = 'f';
1520 } else if (av_match_ext(filename, "asf") &&1519 } else if (av_match_ext(filename, "asf") &&
1521 (!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) {1520 (!useragent || av_strncasecmp(useragent, "NSPlayer", 8) != 0)) {
1522 /* if this isn't WMP or lookalike, return the redirector file */1521 /* if this isn't WMP or lookalike, return the redirector file */
1523 redir_type = REDIR_ASF;1522 redir_type = REDIR_ASF;
1524 } else if (av_match_ext(filename, "rpm,ram")) {1523 } else if (av_match_ext(filename, "rpm,ram")) {
@@ -1613,7 +1612,7 @@ static int http_parse_request(HTTPContext *c) · 88 unmodified lines
1613 char *hostinfo = 0;1612 char *hostinfo = 0;
1614 1613
1615 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {1614 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
1616 if (strncasecmp(p, "Host:", 5) == 0) {1615 if (av_strncasecmp(p, "Host:", 5) == 0) {
1617 hostinfo = p + 5;1616 hostinfo = p + 5;
1618 break;1617 break;
1619 }1618 }
@@ -1742,11 +1741,11 @@ static int http_parse_request(HTTPContext *c) · 122 unmodified lines
1742 int client_id = 0;1741 int client_id = 0;
1743 1742
1744 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {1743 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
1745 if (strncasecmp(p, "Pragma: log-line=", 17) == 0) {1744 if (av_strncasecmp(p, "Pragma: log-line=", 17) == 0) {
1746 logline = p;1745 logline = p;
1747 break;1746 break;
1748 }1747 }
1749 if (strncasecmp(p, "Pragma: client-id=", 18) == 0)1748 if (av_strncasecmp(p, "Pragma: client-id=", 18) == 0)
1750 client_id = strtol(p + 18, 0, 10);1749 client_id = strtol(p + 18, 0, 10);
1751 p = strchr(p, '\n');1750 p = strchr(p, '\n');
1752 if (!p)1751 if (!p)
@@ -4059,40 +4058,40 @@ static int parse_ffconfig(const char *filename) · 2306 unmodified lines
4059 4058
4060 get_arg(cmd, sizeof(cmd), &p);4059 get_arg(cmd, sizeof(cmd), &p);
4061 4060
4062 if (!strcasecmp(cmd, "Port")) {4061 if (!av_strcasecmp(cmd, "Port")) {
4063 get_arg(arg, sizeof(arg), &p);4062 get_arg(arg, sizeof(arg), &p);
4064 val = atoi(arg);4063 val = atoi(arg);
4065 if (val < 1 || val > 65536) {4064 if (val < 1 || val > 65536) {
4066 ERROR("Invalid_port: %s\n", arg);4065 ERROR("Invalid_port: %s\n", arg);
4067 }4066 }
4068 my_http_addr.sin_port = htons(val);4067 my_http_addr.sin_port = htons(val);
4069 } else if (!strcasecmp(cmd, "BindAddress")) {4068 } else if (!av_strcasecmp(cmd, "BindAddress")) {
4070 get_arg(arg, sizeof(arg), &p);4069 get_arg(arg, sizeof(arg), &p);
4071 if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {4070 if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
4072 ERROR("%s:%d: Invalid host/IP address: %s\n", arg);4071 ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
4073 }4072 }
4074 } else if (!strcasecmp(cmd, "NoDaemon")) {4073 } else if (!av_strcasecmp(cmd, "NoDaemon")) {
4075 avserver_daemon = 0;4074 avserver_daemon = 0;
4076 } else if (!strcasecmp(cmd, "RTSPPort")) {4075 } else if (!av_strcasecmp(cmd, "RTSPPort")) {
4077 get_arg(arg, sizeof(arg), &p);4076 get_arg(arg, sizeof(arg), &p);
4078 val = atoi(arg);4077 val = atoi(arg);
4079 if (val < 1 || val > 65536) {4078 if (val < 1 || val > 65536) {
4080 ERROR("%s:%d: Invalid port: %s\n", arg);4079 ERROR("%s:%d: Invalid port: %s\n", arg);
4081 }4080 }
4082 my_rtsp_addr.sin_port = htons(atoi(arg));4081 my_rtsp_addr.sin_port = htons(atoi(arg));
4083 } else if (!strcasecmp(cmd, "RTSPBindAddress")) {4082 } else if (!av_strcasecmp(cmd, "RTSPBindAddress")) {
4084 get_arg(arg, sizeof(arg), &p);4083 get_arg(arg, sizeof(arg), &p);
4085 if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) {4084 if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) {
4086 ERROR("Invalid host/IP address: %s\n", arg);4085 ERROR("Invalid host/IP address: %s\n", arg);
4087 }4086 }
4088 } else if (!strcasecmp(cmd, "MaxHTTPConnections")) {4087 } else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) {
4089 get_arg(arg, sizeof(arg), &p);4088 get_arg(arg, sizeof(arg), &p);
4090 val = atoi(arg);4089 val = atoi(arg);
4091 if (val < 1 || val > 65536) {4090 if (val < 1 || val > 65536) {
4092 ERROR("Invalid MaxHTTPConnections: %s\n", arg);4091 ERROR("Invalid MaxHTTPConnections: %s\n", arg);
4093 }4092 }
4094 nb_max_http_connections = val;4093 nb_max_http_connections = val;
4095 } else if (!strcasecmp(cmd, "MaxClients")) {4094 } else if (!av_strcasecmp(cmd, "MaxClients")) {
4096 get_arg(arg, sizeof(arg), &p);4095 get_arg(arg, sizeof(arg), &p);
4097 val = atoi(arg);4096 val = atoi(arg);
4098 if (val < 1 || val > nb_max_http_connections) {4097 if (val < 1 || val > nb_max_http_connections) {
@@ -4100,7 +4099,7 @@ static int parse_ffconfig(const char *filename) · 1 unmodified line
4100 } else {4099 } else {
4101 nb_max_connections = val;4100 nb_max_connections = val;
4102 }4101 }
4103 } else if (!strcasecmp(cmd, "MaxBandwidth")) {4102 } else if (!av_strcasecmp(cmd, "MaxBandwidth")) {
4104 int64_t llval;4103 int64_t llval;
4105 get_arg(arg, sizeof(arg), &p);4104 get_arg(arg, sizeof(arg), &p);
4106 llval = atoll(arg);4105 llval = atoll(arg);
@@ -4108,10 +4107,10 @@ static int parse_ffconfig(const char *filename) · 1 unmodified line
4108 ERROR("Invalid MaxBandwidth: %s\n", arg);4107 ERROR("Invalid MaxBandwidth: %s\n", arg);
4109 } else4108 } else
4110 max_bandwidth = llval;4109 max_bandwidth = llval;
4111 } else if (!strcasecmp(cmd, "CustomLog")) {4110 } else if (!av_strcasecmp(cmd, "CustomLog")) {
4112 if (!avserver_debug)4111 if (!avserver_debug)
4113 get_arg(logfilename, sizeof(logfilename), &p);4112 get_arg(logfilename, sizeof(logfilename), &p);
4114 } else if (!strcasecmp(cmd, "<Feed")) {4113 } else if (!av_strcasecmp(cmd, "<Feed")) {
4115 /*********************************************/4114 /*********************************************/
4116 /* Feed related options */4115 /* Feed related options */
4117 char *q;4116 char *q;
@@ -4145,7 +4144,7 @@ static int parse_ffconfig(const char *filename) · 27 unmodified lines
4145 *last_feed = feed;4144 *last_feed = feed;
4146 last_feed = &feed->next_feed;4145 last_feed = &feed->next_feed;
4147 }4146 }
4148 } else if (!strcasecmp(cmd, "Launch")) {4147 } else if (!av_strcasecmp(cmd, "Launch")) {
4149 if (feed) {4148 if (feed) {
4150 int i;4149 int i;
4151 4150
@@ -4167,24 +4166,24 @@ static int parse_ffconfig(const char *filename) · 15 unmodified lines
4167 inet_ntoa(my_http_addr.sin_addr),4166 inet_ntoa(my_http_addr.sin_addr),
4168 ntohs(my_http_addr.sin_port), feed->filename);4167 ntohs(my_http_addr.sin_port), feed->filename);
4169 }4168 }
4170 } else if (!strcasecmp(cmd, "ReadOnlyFile")) {4169 } else if (!av_strcasecmp(cmd, "ReadOnlyFile")) {
4171 if (feed) {4170 if (feed) {
4172 get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);4171 get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
4173 feed->readonly = 1;4172 feed->readonly = 1;
4174 } else if (stream) {4173 } else if (stream) {
4175 get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);4174 get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
4176 }4175 }
4177 } else if (!strcasecmp(cmd, "File")) {4176 } else if (!av_strcasecmp(cmd, "File")) {
4178 if (feed) {4177 if (feed) {
4179 get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);4178 get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
4180 } else if (stream)4179 } else if (stream)
4181 get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);4180 get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
4182 } else if (!strcasecmp(cmd, "Truncate")) {4181 } else if (!av_strcasecmp(cmd, "Truncate")) {
4183 if (feed) {4182 if (feed) {
4184 get_arg(arg, sizeof(arg), &p);4183 get_arg(arg, sizeof(arg), &p);
4185 feed->truncate = strtod(arg, NULL);4184 feed->truncate = strtod(arg, NULL);
4186 }4185 }
4187 } else if (!strcasecmp(cmd, "FileMaxSize")) {4186 } else if (!av_strcasecmp(cmd, "FileMaxSize")) {
4188 if (feed) {4187 if (feed) {
4189 char *p1;4188 char *p1;
4190 double fsize;4189 double fsize;
@@ -4208,12 +4207,12 @@ static int parse_ffconfig(const char *filename) · 17 unmodified lines
4208 ERROR("Feed max file size is too small, must be at least %d\n", FFM_PACKET_SIZE*4);4207 ERROR("Feed max file size is too small, must be at least %d\n", FFM_PACKET_SIZE*4);
4209 }4208 }
4210 }4209 }
4211 } else if (!strcasecmp(cmd, "</Feed>")) {4210 } else if (!av_strcasecmp(cmd, "</Feed>")) {
4212 if (!feed) {4211 if (!feed) {
4213 ERROR("No corresponding <Feed> for </Feed>\n");4212 ERROR("No corresponding <Feed> for </Feed>\n");
4214 }4213 }
4215 feed = NULL;4214 feed = NULL;
4216 } else if (!strcasecmp(cmd, "<Stream")) {4215 } else if (!av_strcasecmp(cmd, "<Stream")) {
4217 /*********************************************/4216 /*********************************************/
4218 /* Stream related options */4217 /* Stream related options */
4219 char *q;4218 char *q;
@@ -4246,7 +4245,7 @@ static int parse_ffconfig(const char *filename) · 26 unmodified lines
4246 *last_stream = stream;4245 *last_stream = stream;
4247 last_stream = &stream->next;4246 last_stream = &stream->next;
4248 }4247 }
4249 } else if (!strcasecmp(cmd, "Feed")) {4248 } else if (!av_strcasecmp(cmd, "Feed")) {
4250 get_arg(arg, sizeof(arg), &p);4249 get_arg(arg, sizeof(arg), &p);
4251 if (stream) {4250 if (stream) {
4252 FFStream *sfeed;4251 FFStream *sfeed;
@@ -4262,7 +4261,7 @@ static int parse_ffconfig(const char *filename) · 9 unmodified lines
4262 else4261 else
4263 stream->feed = sfeed;4262 stream->feed = sfeed;
4264 }4263 }
4265 } else if (!strcasecmp(cmd, "Format")) {4264 } else if (!av_strcasecmp(cmd, "Format")) {
4266 get_arg(arg, sizeof(arg), &p);4265 get_arg(arg, sizeof(arg), &p);
4267 if (stream) {4266 if (stream) {
4268 if (!strcmp(arg, "status")) {4267 if (!strcmp(arg, "status")) {
@@ -4283,7 +4282,7 @@ static int parse_ffconfig(const char *filename) · 14 unmodified lines
4283 video_id = stream->fmt->video_codec;4282 video_id = stream->fmt->video_codec;
4284 }4283 }
4285 }4284 }
4286 } else if (!strcasecmp(cmd, "InputFormat")) {4285 } else if (!av_strcasecmp(cmd, "InputFormat")) {
4287 get_arg(arg, sizeof(arg), &p);4286 get_arg(arg, sizeof(arg), &p);
4288 if (stream) {4287 if (stream) {
4289 stream->ifmt = av_find_input_format(arg);4288 stream->ifmt = av_find_input_format(arg);
@@ -4291,65 +4290,65 @@ static int parse_ffconfig(const char *filename) · 1 unmodified line
4291 ERROR("Unknown input format: %s\n", arg);4290 ERROR("Unknown input format: %s\n", arg);
4292 }4291 }
4293 }4292 }
4294 } else if (!strcasecmp(cmd, "FaviconURL")) {4293 } else if (!av_strcasecmp(cmd, "FaviconURL")) {
4295 if (stream && stream->stream_type == STREAM_TYPE_STATUS) {4294 if (stream && stream->stream_type == STREAM_TYPE_STATUS) {
4296 get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);4295 get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
4297 } else {4296 } else {
4298 ERROR("FaviconURL only permitted for status streams\n");4297 ERROR("FaviconURL only permitted for status streams\n");
4299 }4298 }
4300 } else if (!strcasecmp(cmd, "Author")) {4299 } else if (!av_strcasecmp(cmd, "Author")) {
4301 if (stream)4300 if (stream)
4302 get_arg(stream->author, sizeof(stream->author), &p);4301 get_arg(stream->author, sizeof(stream->author), &p);
4303 } else if (!strcasecmp(cmd, "Comment")) {4302 } else if (!av_strcasecmp(cmd, "Comment")) {
4304 if (stream)4303 if (stream)
4305 get_arg(stream->comment, sizeof(stream->comment), &p);4304 get_arg(stream->comment, sizeof(stream->comment), &p);
4306 } else if (!strcasecmp(cmd, "Copyright")) {4305 } else if (!av_strcasecmp(cmd, "Copyright")) {
4307 if (stream)4306 if (stream)
4308 get_arg(stream->copyright, sizeof(stream->copyright), &p);4307 get_arg(stream->copyright, sizeof(stream->copyright), &p);
4309 } else if (!strcasecmp(cmd, "Title")) {4308 } else if (!av_strcasecmp(cmd, "Title")) {
4310 if (stream)4309 if (stream)
4311 get_arg(stream->title, sizeof(stream->title), &p);4310 get_arg(stream->title, sizeof(stream->title), &p);
4312 } else if (!strcasecmp(cmd, "Preroll")) {4311 } else if (!av_strcasecmp(cmd, "Preroll")) {
4313 get_arg(arg, sizeof(arg), &p);4312 get_arg(arg, sizeof(arg), &p);
4314 if (stream)4313 if (stream)
4315 stream->prebuffer = atof(arg) * 1000;4314 stream->prebuffer = atof(arg) * 1000;
4316 } else if (!strcasecmp(cmd, "StartSendOnKey")) {4315 } else if (!av_strcasecmp(cmd, "StartSendOnKey")) {
4317 if (stream)4316 if (stream)
4318 stream->send_on_key = 1;4317 stream->send_on_key = 1;
4319 } else if (!strcasecmp(cmd, "AudioCodec")) {4318 } else if (!av_strcasecmp(cmd, "AudioCodec")) {
4320 get_arg(arg, sizeof(arg), &p);4319 get_arg(arg, sizeof(arg), &p);
4321 audio_id = opt_audio_codec(arg);4320 audio_id = opt_audio_codec(arg);
4322 if (audio_id == CODEC_ID_NONE) {4321 if (audio_id == CODEC_ID_NONE) {
4323 ERROR("Unknown AudioCodec: %s\n", arg);4322 ERROR("Unknown AudioCodec: %s\n", arg);
4324 }4323 }
4325 } else if (!strcasecmp(cmd, "VideoCodec")) {4324 } else if (!av_strcasecmp(cmd, "VideoCodec")) {
4326 get_arg(arg, sizeof(arg), &p);4325 get_arg(arg, sizeof(arg), &p);
4327 video_id = opt_video_codec(arg);4326 video_id = opt_video_codec(arg);
4328 if (video_id == CODEC_ID_NONE) {4327 if (video_id == CODEC_ID_NONE) {
4329 ERROR("Unknown VideoCodec: %s\n", arg);4328 ERROR("Unknown VideoCodec: %s\n", arg);
4330 }4329 }
4331 } else if (!strcasecmp(cmd, "MaxTime")) {4330 } else if (!av_strcasecmp(cmd, "MaxTime")) {
4332 get_arg(arg, sizeof(arg), &p);4331 get_arg(arg, sizeof(arg), &p);
4333 if (stream)4332 if (stream)
4334 stream->max_time = atof(arg) * 1000;4333 stream->max_time = atof(arg) * 1000;
4335 } else if (!strcasecmp(cmd, "AudioBitRate")) {4334 } else if (!av_strcasecmp(cmd, "AudioBitRate")) {
4336 get_arg(arg, sizeof(arg), &p);4335 get_arg(arg, sizeof(arg), &p);
4337 if (stream)4336 if (stream)
4338 audio_enc.bit_rate = lrintf(atof(arg) * 1000);4337 audio_enc.bit_rate = lrintf(atof(arg) * 1000);
4339 } else if (!strcasecmp(cmd, "AudioChannels")) {4338 } else if (!av_strcasecmp(cmd, "AudioChannels")) {
4340 get_arg(arg, sizeof(arg), &p);4339 get_arg(arg, sizeof(arg), &p);
4341 if (stream)4340 if (stream)
4342 audio_enc.channels = atoi(arg);4341 audio_enc.channels = atoi(arg);
4343 } else if (!strcasecmp(cmd, "AudioSampleRate")) {4342 } else if (!av_strcasecmp(cmd, "AudioSampleRate")) {
4344 get_arg(arg, sizeof(arg), &p);4343 get_arg(arg, sizeof(arg), &p);
4345 if (stream)4344 if (stream)
4346 audio_enc.sample_rate = atoi(arg);4345 audio_enc.sample_rate = atoi(arg);
4347 } else if (!strcasecmp(cmd, "AudioQuality")) {4346 } else if (!av_strcasecmp(cmd, "AudioQuality")) {
4348 get_arg(arg, sizeof(arg), &p);4347 get_arg(arg, sizeof(arg), &p);
4349 if (stream) {4348 if (stream) {
4350// audio_enc.quality = atof(arg) * 1000;4349// audio_enc.quality = atof(arg) * 1000;
4351 }4350 }
4352 } else if (!strcasecmp(cmd, "VideoBitRateRange")) {4351 } else if (!av_strcasecmp(cmd, "VideoBitRateRange")) {
4353 if (stream) {4352 if (stream) {
4354 int minrate, maxrate;4353 int minrate, maxrate;
4355 4354
@@ -4362,32 +4361,32 @@ static int parse_ffconfig(const char *filename) · 6 unmodified lines
4362 ERROR("Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", arg);4361 ERROR("Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", arg);
4363 }4362 }
4364 }4363 }
4365 } else if (!strcasecmp(cmd, "Debug")) {4364 } else if (!av_strcasecmp(cmd, "Debug")) {
4366 if (stream) {4365 if (stream) {
4367 get_arg(arg, sizeof(arg), &p);4366 get_arg(arg, sizeof(arg), &p);
4368 video_enc.debug = strtol(arg,0,0);4367 video_enc.debug = strtol(arg,0,0);
4369 }4368 }
4370 } else if (!strcasecmp(cmd, "Strict")) {4369 } else if (!av_strcasecmp(cmd, "Strict")) {
4371 if (stream) {4370 if (stream) {
4372 get_arg(arg, sizeof(arg), &p);4371 get_arg(arg, sizeof(arg), &p);
4373 video_enc.strict_std_compliance = atoi(arg);4372 video_enc.strict_std_compliance = atoi(arg);
4374 }4373 }
4375 } else if (!strcasecmp(cmd, "VideoBufferSize")) {4374 } else if (!av_strcasecmp(cmd, "VideoBufferSize")) {
4376 if (stream) {4375 if (stream) {
4377 get_arg(arg, sizeof(arg), &p);4376 get_arg(arg, sizeof(arg), &p);
4378 video_enc.rc_buffer_size = atoi(arg) * 8*1024;4377 video_enc.rc_buffer_size = atoi(arg) * 8*1024;
4379 }4378 }
4380 } else if (!strcasecmp(cmd, "VideoBitRateTolerance")) {4379 } else if (!av_strcasecmp(cmd, "VideoBitRateTolerance")) {
4381 if (stream) {4380 if (stream) {
4382 get_arg(arg, sizeof(arg), &p);4381 get_arg(arg, sizeof(arg), &p);
4383 video_enc.bit_rate_tolerance = atoi(arg) * 1000;4382 video_enc.bit_rate_tolerance = atoi(arg) * 1000;
4384 }4383 }
4385 } else if (!strcasecmp(cmd, "VideoBitRate")) {4384 } else if (!av_strcasecmp(cmd, "VideoBitRate")) {
4386 get_arg(arg, sizeof(arg), &p);4385 get_arg(arg, sizeof(arg), &p);
4387 if (stream) {4386 if (stream) {
4388 video_enc.bit_rate = atoi(arg) * 1000;4387 video_enc.bit_rate = atoi(arg) * 1000;
4389 }4388 }
4390 } else if (!strcasecmp(cmd, "VideoSize")) {4389 } else if (!av_strcasecmp(cmd, "VideoSize")) {
4391 get_arg(arg, sizeof(arg), &p);4390 get_arg(arg, sizeof(arg), &p);
4392 if (stream) {4391 if (stream) {
4393 av_parse_video_size(&video_enc.width, &video_enc.height, arg);4392 av_parse_video_size(&video_enc.width, &video_enc.height, arg);
@@ -4396,7 +4395,7 @@ static int parse_ffconfig(const char *filename) · 2 unmodified lines
4396 ERROR("Image size must be a multiple of 16\n");4395 ERROR("Image size must be a multiple of 16\n");
4397 }4396 }
4398 }4397 }
4399 } else if (!strcasecmp(cmd, "VideoFrameRate")) {4398 } else if (!av_strcasecmp(cmd, "VideoFrameRate")) {
4400 get_arg(arg, sizeof(arg), &p);4399 get_arg(arg, sizeof(arg), &p);
4401 if (stream) {4400 if (stream) {
4402 AVRational frame_rate;4401 AVRational frame_rate;
@@ -4407,29 +4406,29 @@ static int parse_ffconfig(const char *filename) · 4 unmodified lines
4407 video_enc.time_base.den = frame_rate.num;4406 video_enc.time_base.den = frame_rate.num;
4408 }4407 }
4409 }4408 }
4410 } else if (!strcasecmp(cmd, "VideoGopSize")) {4409 } else if (!av_strcasecmp(cmd, "VideoGopSize")) {
4411 get_arg(arg, sizeof(arg), &p);4410 get_arg(arg, sizeof(arg), &p);
4412 if (stream)4411 if (stream)
4413 video_enc.gop_size = atoi(arg);4412 video_enc.gop_size = atoi(arg);
4414 } else if (!strcasecmp(cmd, "VideoIntraOnly")) {4413 } else if (!av_strcasecmp(cmd, "VideoIntraOnly")) {
4415 if (stream)4414 if (stream)
4416 video_enc.gop_size = 1;4415 video_enc.gop_size = 1;
4417 } else if (!strcasecmp(cmd, "VideoHighQuality")) {4416 } else if (!av_strcasecmp(cmd, "VideoHighQuality")) {
4418 if (stream)4417 if (stream)
4419 video_enc.mb_decision = FF_MB_DECISION_BITS;4418 video_enc.mb_decision = FF_MB_DECISION_BITS;
4420 } else if (!strcasecmp(cmd, "Video4MotionVector")) {4419 } else if (!av_strcasecmp(cmd, "Video4MotionVector")) {
4421 if (stream) {4420 if (stream) {
4422 video_enc.mb_decision = FF_MB_DECISION_BITS; //FIXME remove4421 video_enc.mb_decision = FF_MB_DECISION_BITS; //FIXME remove
4423 video_enc.flags |= CODEC_FLAG_4MV;4422 video_enc.flags |= CODEC_FLAG_4MV;
4424 }4423 }
4425 } else if (!strcasecmp(cmd, "AVOptionVideo") ||4424 } else if (!av_strcasecmp(cmd, "AVOptionVideo") ||
4426 !strcasecmp(cmd, "AVOptionAudio")) {4425 !av_strcasecmp(cmd, "AVOptionAudio")) {
4427 char arg2[1024];4426 char arg2[1024];
4428 AVCodecContext *avctx;4427 AVCodecContext *avctx;
4429 int type;4428 int type;
4430 get_arg(arg, sizeof(arg), &p);4429 get_arg(arg, sizeof(arg), &p);
4431 get_arg(arg2, sizeof(arg2), &p);4430 get_arg(arg2, sizeof(arg2), &p);
4432 if (!strcasecmp(cmd, "AVOptionVideo")) {4431 if (!av_strcasecmp(cmd, "AVOptionVideo")) {
4433 avctx = &video_enc;4432 avctx = &video_enc;
4434 type = AV_OPT_FLAG_VIDEO_PARAM;4433 type = AV_OPT_FLAG_VIDEO_PARAM;
4435 } else {4434 } else {
@@ -4439,12 +4438,12 @@ static int parse_ffconfig(const char *filename) · 3 unmodified lines
4439 if (avserver_opt_default(arg, arg2, avctx, type|AV_OPT_FLAG_ENCODING_PARAM)) {4438 if (avserver_opt_default(arg, arg2, avctx, type|AV_OPT_FLAG_ENCODING_PARAM)) {
4440 ERROR("AVOption error: %s %s\n", arg, arg2);4439 ERROR("AVOption error: %s %s\n", arg, arg2);
4441 }4440 }
4442 } else if (!strcasecmp(cmd, "AVPresetVideo") ||4441 } else if (!av_strcasecmp(cmd, "AVPresetVideo") ||
4443 !strcasecmp(cmd, "AVPresetAudio")) {4442 !av_strcasecmp(cmd, "AVPresetAudio")) {
4444 AVCodecContext *avctx;4443 AVCodecContext *avctx;
4445 int type;4444 int type;
4446 get_arg(arg, sizeof(arg), &p);4445 get_arg(arg, sizeof(arg), &p);
4447 if (!strcasecmp(cmd, "AVPresetVideo")) {4446 if (!av_strcasecmp(cmd, "AVPresetVideo")) {
4448 avctx = &video_enc;4447 avctx = &video_enc;
4449 video_enc.codec_id = video_id;4448 video_enc.codec_id = video_id;
4450 type = AV_OPT_FLAG_VIDEO_PARAM;4449 type = AV_OPT_FLAG_VIDEO_PARAM;
@@ -4456,26 +4455,26 @@ static int parse_ffconfig(const char *filename) · 5 unmodified lines
4456 if (avserver_opt_preset(arg, avctx, type|AV_OPT_FLAG_ENCODING_PARAM, &audio_id, &video_id)) {4455 if (avserver_opt_preset(arg, avctx, type|AV_OPT_FLAG_ENCODING_PARAM, &audio_id, &video_id)) {
4457 ERROR("AVPreset error: %s\n", arg);4456 ERROR("AVPreset error: %s\n", arg);
4458 }4457 }
4459 } else if (!strcasecmp(cmd, "VideoTag")) {4458 } else if (!av_strcasecmp(cmd, "VideoTag")) {
4460 get_arg(arg, sizeof(arg), &p);4459 get_arg(arg, sizeof(arg), &p);
4461 if ((strlen(arg) == 4) && stream)4460 if ((strlen(arg) == 4) && stream)
4462 video_enc.codec_tag = MKTAG(arg[0], arg[1], arg[2], arg[3]);4461 video_enc.codec_tag = MKTAG(arg[0], arg[1], arg[2], arg[3]);
4463 } else if (!strcasecmp(cmd, "BitExact")) {4462 } else if (!av_strcasecmp(cmd, "BitExact")) {
4464 if (stream)4463 if (stream)
4465 video_enc.flags |= CODEC_FLAG_BITEXACT;4464 video_enc.flags |= CODEC_FLAG_BITEXACT;
4466 } else if (!strcasecmp(cmd, "DctFastint")) {4465 } else if (!av_strcasecmp(cmd, "DctFastint")) {
4467 if (stream)4466 if (stream)
4468 video_enc.dct_algo = FF_DCT_FASTINT;4467 video_enc.dct_algo = FF_DCT_FASTINT;
4469 } else if (!strcasecmp(cmd, "IdctSimple")) {4468 } else if (!av_strcasecmp(cmd, "IdctSimple")) {
4470 if (stream)4469 if (stream)
4471 video_enc.idct_algo = FF_IDCT_SIMPLE;4470 video_enc.idct_algo = FF_IDCT_SIMPLE;
4472 } else if (!strcasecmp(cmd, "Qscale")) {4471 } else if (!av_strcasecmp(cmd, "Qscale")) {
4473 get_arg(arg, sizeof(arg), &p);4472 get_arg(arg, sizeof(arg), &p);
4474 if (stream) {4473 if (stream) {
4475 video_enc.flags |= CODEC_FLAG_QSCALE;4474 video_enc.flags |= CODEC_FLAG_QSCALE;
4476 video_enc.global_quality = FF_QP2LAMBDA * atoi(arg);4475 video_enc.global_quality = FF_QP2LAMBDA * atoi(arg);
4477 }4476 }
4478 } else if (!strcasecmp(cmd, "VideoQDiff")) {4477 } else if (!av_strcasecmp(cmd, "VideoQDiff")) {
4479 get_arg(arg, sizeof(arg), &p);4478 get_arg(arg, sizeof(arg), &p);
4480 if (stream) {4479 if (stream) {
4481 video_enc.max_qdiff = atoi(arg);4480 video_enc.max_qdiff = atoi(arg);
@@ -4483,7 +4482,7 @@ static int parse_ffconfig(const char *filename) · 1 unmodified line
4483 ERROR("VideoQDiff out of range\n");4482 ERROR("VideoQDiff out of range\n");
4484 }4483 }
4485 }4484 }
4486 } else if (!strcasecmp(cmd, "VideoQMax")) {4485 } else if (!av_strcasecmp(cmd, "VideoQMax")) {
4487 get_arg(arg, sizeof(arg), &p);4486 get_arg(arg, sizeof(arg), &p);
4488 if (stream) {4487 if (stream) {
4489 video_enc.qmax = atoi(arg);4488 video_enc.qmax = atoi(arg);
@@ -4491,7 +4490,7 @@ static int parse_ffconfig(const char *filename) · 1 unmodified line
4491 ERROR("VideoQMax out of range\n");4490 ERROR("VideoQMax out of range\n");
4492 }4491 }
4493 }4492 }
4494 } else if (!strcasecmp(cmd, "VideoQMin")) {4493 } else if (!av_strcasecmp(cmd, "VideoQMin")) {
4495 get_arg(arg, sizeof(arg), &p);4494 get_arg(arg, sizeof(arg), &p);
4496 if (stream) {4495 if (stream) {
4497 video_enc.qmin = atoi(arg);4496 video_enc.qmin = atoi(arg);
@@ -4499,39 +4498,39 @@ static int parse_ffconfig(const char *filename) · 1 unmodified line
4499 ERROR("VideoQMin out of range\n");4498 ERROR("VideoQMin out of range\n");
4500 }4499 }
4501 }4500 }
4502 } else if (!strcasecmp(cmd, "LumaElim")) {4501 } else if (!av_strcasecmp(cmd, "LumaElim")) {
4503 get_arg(arg, sizeof(arg), &p);4502 get_arg(arg, sizeof(arg), &p);
4504 if (stream)4503 if (stream)
4505 video_enc.luma_elim_threshold = atoi(arg);4504 video_enc.luma_elim_threshold = atoi(arg);
4506 } else if (!strcasecmp(cmd, "ChromaElim")) {4505 } else if (!av_strcasecmp(cmd, "ChromaElim")) {
4507 get_arg(arg, sizeof(arg), &p);4506 get_arg(arg, sizeof(arg), &p);
4508 if (stream)4507 if (stream)
4509 video_enc.chroma_elim_threshold = atoi(arg);4508 video_enc.chroma_elim_threshold = atoi(arg);
4510 } else if (!strcasecmp(cmd, "LumiMask")) {4509 } else if (!av_strcasecmp(cmd, "LumiMask")) {
4511 get_arg(arg, sizeof(arg), &p);4510 get_arg(arg, sizeof(arg), &p);
4512 if (stream)4511 if (stream)
4513 video_enc.lumi_masking = atof(arg);4512 video_enc.lumi_masking = atof(arg);
4514 } else if (!strcasecmp(cmd, "DarkMask")) {4513 } else if (!av_strcasecmp(cmd, "DarkMask")) {
4515 get_arg(arg, sizeof(arg), &p);4514 get_arg(arg, sizeof(arg), &p);
4516 if (stream)4515 if (stream)
4517 video_enc.dark_masking = atof(arg);4516 video_enc.dark_masking = atof(arg);
4518 } else if (!strcasecmp(cmd, "NoVideo")) {4517 } else if (!av_strcasecmp(cmd, "NoVideo")) {
4519 video_id = CODEC_ID_NONE;4518 video_id = CODEC_ID_NONE;
4520 } else if (!strcasecmp(cmd, "NoAudio")) {4519 } else if (!av_strcasecmp(cmd, "NoAudio")) {
4521 audio_id = CODEC_ID_NONE;4520 audio_id = CODEC_ID_NONE;
4522 } else if (!strcasecmp(cmd, "ACL")) {4521 } else if (!av_strcasecmp(cmd, "ACL")) {
4523 parse_acl_row(stream, feed, NULL, p, filename, line_num);4522 parse_acl_row(stream, feed, NULL, p, filename, line_num);
4524 } else if (!strcasecmp(cmd, "DynamicACL")) {4523 } else if (!av_strcasecmp(cmd, "DynamicACL")) {
4525 if (stream) {4524 if (stream) {
4526 get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), &p);4525 get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), &p);
4527 }4526 }
4528 } else if (!strcasecmp(cmd, "RTSPOption")) {4527 } else if (!av_strcasecmp(cmd, "RTSPOption")) {
4529 get_arg(arg, sizeof(arg), &p);4528 get_arg(arg, sizeof(arg), &p);
4530 if (stream) {4529 if (stream) {
4531 av_freep(&stream->rtsp_option);4530 av_freep(&stream->rtsp_option);
4532 stream->rtsp_option = av_strdup(arg);4531 stream->rtsp_option = av_strdup(arg);
4533 }4532 }
4534 } else if (!strcasecmp(cmd, "MulticastAddress")) {4533 } else if (!av_strcasecmp(cmd, "MulticastAddress")) {
4535 get_arg(arg, sizeof(arg), &p);4534 get_arg(arg, sizeof(arg), &p);
4536 if (stream) {4535 if (stream) {
4537 if (resolve_host(&stream->multicast_ip, arg) != 0) {4536 if (resolve_host(&stream->multicast_ip, arg) != 0) {
@@ -4540,18 +4539,18 @@ static int parse_ffconfig(const char *filename) · 2 unmodified lines
4540 stream->is_multicast = 1;4539 stream->is_multicast = 1;
4541 stream->loop = 1; /* default is looping */4540 stream->loop = 1; /* default is looping */
4542 }4541 }
4543 } else if (!strcasecmp(cmd, "MulticastPort")) {4542 } else if (!av_strcasecmp(cmd, "MulticastPort")) {
4544 get_arg(arg, sizeof(arg), &p);4543 get_arg(arg, sizeof(arg), &p);
4545 if (stream)4544 if (stream)
4546 stream->multicast_port = atoi(arg);4545 stream->multicast_port = atoi(arg);
4547 } else if (!strcasecmp(cmd, "MulticastTTL")) {4546 } else if (!av_strcasecmp(cmd, "MulticastTTL")) {
4548 get_arg(arg, sizeof(arg), &p);4547 get_arg(arg, sizeof(arg), &p);
4549 if (stream)4548 if (stream)
4550 stream->multicast_ttl = atoi(arg);4549 stream->multicast_ttl = atoi(arg);
4551 } else if (!strcasecmp(cmd, "NoLoop")) {4550 } else if (!av_strcasecmp(cmd, "NoLoop")) {
4552 if (stream)4551 if (stream)
4553 stream->loop = 0;4552 stream->loop = 0;
4554 } else if (!strcasecmp(cmd, "</Stream>")) {4553 } else if (!av_strcasecmp(cmd, "</Stream>")) {
4555 if (!stream) {4554 if (!stream) {
4556 ERROR("No corresponding <Stream> for </Stream>\n");4555 ERROR("No corresponding <Stream> for </Stream>\n");
4557 } else {4556 } else {
@@ -4569,7 +4568,7 @@ static int parse_ffconfig(const char *filename) · 11 unmodified lines
4569 }4568 }
4570 stream = NULL;4569 stream = NULL;
4571 }4570 }
4572 } else if (!strcasecmp(cmd, "<Redirect")) {4571 } else if (!av_strcasecmp(cmd, "<Redirect")) {
4573 /*********************************************/4572 /*********************************************/
4574 char *q;4573 char *q;
4575 if (stream || feed || redirect) {4574 if (stream || feed || redirect) {
@@ -4585,10 +4584,10 @@ static int parse_ffconfig(const char *filename) · 9 unmodified lines
4585 *q = '\0';4584 *q = '\0';
4586 redirect->stream_type = STREAM_TYPE_REDIRECT;4585 redirect->stream_type = STREAM_TYPE_REDIRECT;
4587 }4586 }
4588 } else if (!strcasecmp(cmd, "URL")) {4587 } else if (!av_strcasecmp(cmd, "URL")) {
4589 if (redirect)4588 if (redirect)
4590 get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p);4589 get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p);
4591 } else if (!strcasecmp(cmd, "</Redirect>")) {4590 } else if (!av_strcasecmp(cmd, "</Redirect>")) {
4592 if (!redirect) {4591 if (!redirect) {
4593 ERROR("No corresponding <Redirect> for </Redirect>\n");4592 ERROR("No corresponding <Redirect> for </Redirect>\n");
4594 } else {4593 } else {
@@ -4597,7 +4596,7 @@ static int parse_ffconfig(const char *filename) · 2 unmodified lines
4597 }4596 }
4598 redirect = NULL;4597 redirect = NULL;
4599 }4598 }
4600 } else if (!strcasecmp(cmd, "LoadModule")) {4599 } else if (!av_strcasecmp(cmd, "LoadModule")) {
4601 get_arg(arg, sizeof(arg), &p);4600 get_arg(arg, sizeof(arg), &p);
4602#if HAVE_DLOPEN4601#if HAVE_DLOPEN
4603 load_module(arg);4602 load_module(arg);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t