int default_port, stream_index;
default_port = 6000;
- for(stream = first_stream; stream != NULL; stream = stream->next) {
+ for(stream = first_stream; stream; stream = stream->next) {
if (stream->is_multicast) {
unsigned random0 = av_lfg_get(&random_state);
unsigned random1 = av_lfg_get(&random_state);
/* wait for events on each HTTP handle */
c = first_http_ctx;
delay = 1000;
- while (c != NULL) {
+ while (c) {
int fd;
fd = c->fd;
switch(c->state) {
}
/* now handle the events */
- for(c = first_http_ctx; c != NULL; c = c_next) {
+ for(c = first_http_ctx; c; c = c_next) {
c_next = c->next;
if (handle_connection(c) < 0) {
log_connection(c);
/* remove connection from list */
cp = &first_http_ctx;
- while ((*cp) != NULL) {
+ while (*cp) {
c1 = *cp;
if (c1 == c)
*cp = c->next;
}
/* remove references, if any (XXX: do it faster) */
- for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
+ for(c1 = first_http_ctx; c1; c1 = c1->next) {
if (c1->rtsp_c == c)
c1->rtsp_c = NULL;
}
p = strrchr(file1, '.');
if (p)
*p = '\0';
- for(stream = first_stream; stream != NULL; stream = stream->next) {
+ for(stream = first_stream; stream; stream = stream->next) {
av_strlcpy(file2, stream->filename, sizeof(file2));
p = strrchr(file2, '.');
if (p)
av_strlcpy(filename, "index.html", sizeof(filename) - 1);
stream = first_stream;
- while (stream != NULL) {
+ while (stream) {
if (!strcmp(stream->filename, filename) && validate_acl(stream, c))
break;
stream = stream->next;
}
- if (stream == NULL) {
+ if (!stream) {
snprintf(msg, sizeof(msg), "File '%s' not found", url);
http_log("File '%s' not found\n", url);
goto send_error;
avio_printf(pb, "<table cellspacing=0 cellpadding=4>\n");
avio_printf(pb, "<tr><th valign=top>Path<th align=left>Served<br>Conns<th><br>bytes<th valign=top>Format<th>Bit rate<br>kbits/s<th align=left>Video<br>kbits/s<th><br>Codec<th align=left>Audio<br>kbits/s<th><br>Codec<th align=left valign=top>Feed\n");
stream = first_stream;
- while (stream != NULL) {
+ while (stream) {
char sfilename[1024];
char *eosf;
avio_printf(pb, "</table>\n");
stream = first_stream;
- while (stream != NULL) {
+ while (stream) {
if (stream->feed == stream) {
avio_printf(pb, "<h2>Feed %s</h2>", stream->filename);
if (stream->pid) {
avio_printf(pb, "<tr><th>#<th>File<th>IP<th>Proto<th>State<th>Target bits/sec<th>Actual bits/sec<th>Bytes transferred\n");
c1 = first_http_ctx;
i = 0;
- while (c1 != NULL) {
+ while (c1) {
int bitrate;
int j;
}
/* wake up any waiting connections */
- for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
+ for(c1 = first_http_ctx; c1; c1 = c1->next) {
if (c1->state == HTTPSTATE_WAIT_FEED &&
c1->stream->feed == c->stream->feed)
c1->state = HTTPSTATE_SEND_DATA;
c->stream->feed_opened = 0;
close(c->feed_fd);
/* wake up any waiting connections to stop waiting for feed */
- for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
+ for(c1 = first_http_ctx; c1; c1 = c1->next) {
if (c1->state == HTTPSTATE_WAIT_FEED &&
c1->stream->feed == c->stream->feed)
c1->state = HTTPSTATE_SEND_DATA_TRAILER;
*pbuffer = NULL;
avc = avformat_alloc_context();
- if (avc == NULL || !rtp_format) {
+ if (!avc || !rtp_format) {
return -1;
}
avc->oformat = rtp_format;
if (*path == '/')
path++;
- for(stream = first_stream; stream != NULL; stream = stream->next) {
+ for(stream = first_stream; stream; stream = stream->next) {
if (!stream->is_feed &&
stream->fmt && !strcmp(stream->fmt->name, "rtp") &&
!strcmp(path, stream->filename)) {
if (session_id[0] == '\0')
return NULL;
- for(c = first_http_ctx; c != NULL; c = c->next) {
+ for(c = first_http_ctx; c; c = c->next) {
if (!strcmp(c->session_id, session_id))
return c;
}
path++;
/* now check each stream */
- for(stream = first_stream; stream != NULL; stream = stream->next) {
+ for(stream = first_stream; stream; stream = stream->next) {
if (!stream->is_feed &&
stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
/* accept aggregate filenames only if single stream */
{
FFStream **ps;
ps = &first_stream;
- while (*ps != NULL) {
+ while (*ps) {
if (*ps == stream)
*ps = (*ps)->next;
else
int i, ret;
/* gather all streams */
- for(stream = first_stream; stream != NULL; stream = stream_next) {
+ for(stream = first_stream; stream; stream = stream_next) {
AVFormatContext *infile = NULL;
stream_next = stream->next;
if (stream->stream_type == STREAM_TYPE_LIVE &&
int i;
/* gather all streams */
- for(stream = first_stream; stream != NULL; stream = stream->next) {
+ for(stream = first_stream; stream; stream = stream->next) {
feed = stream->feed;
if (feed) {
if (stream->is_feed) {
}
/* create feed files if needed */
- for(feed = first_feed; feed != NULL; feed = feed->next_feed) {
+ for(feed = first_feed; feed; feed = feed->next_feed) {
int fd;
if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) {
int i;
FFStream *stream;
- for(stream = first_stream; stream != NULL; stream = stream->next) {
+ for(stream = first_stream; stream; stream = stream->next) {
bandwidth = 0;
for(i=0;i<stream->nb_streams;i++) {
AVStream *st = stream->streams[i];
get_arg(cmd, sizeof(cmd), &p);
- if (!av_strcasecmp(cmd, "Port")) {
+ if (!av_strcasecmp(cmd, "Port") || !av_strcasecmp(cmd, "HTTPPort")) {
+ if (!av_strcasecmp(cmd, "Port"))
+ WARNING("Port option is deprecated, use HTTPPort instead\n");
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > 65536) {
- ERROR("Invalid_port: %s\n", arg);
+ ERROR("Invalid port: %s\n", arg);
}
+ if (val < 1024)
+ WARNING("Trying to use IETF assigned system port: %d\n", val);
my_http_addr.sin_port = htons(val);
- } else if (!av_strcasecmp(cmd, "BindAddress")) {
+ } else if (!av_strcasecmp(cmd, "HTTPBindAddress") || !av_strcasecmp(cmd, "BindAddress")) {
+ if (!av_strcasecmp(cmd, "BindAddress"))
+ WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n");
get_arg(arg, sizeof(arg), &p);
if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
FFStream *sfeed;
sfeed = first_feed;
- while (sfeed != NULL) {
+ while (sfeed) {
if (!strcmp(sfeed->filename, arg))
break;
sfeed = sfeed->next_feed;