ffserver: refactor build_file_streams()

Avoid unneeded nesting, drop redundant var
Signed-off-by: 's avatarReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
parent 532a2833
...@@ -3567,23 +3567,26 @@ static void extract_mpeg4_header(AVFormatContext *infile) ...@@ -3567,23 +3567,26 @@ static void extract_mpeg4_header(AVFormatContext *infile)
/* compute the needed AVStream for each file */ /* compute the needed AVStream for each file */
static void build_file_streams(void) static void build_file_streams(void)
{ {
FFServerStream *stream, *stream_next; FFServerStream *stream;
AVFormatContext *infile;
int i, ret; int i, ret;
/* gather all streams */ /* gather all streams */
for(stream = config.first_stream; stream; stream = stream_next) { for(stream = config.first_stream; stream; stream = stream->next) {
AVFormatContext *infile = NULL; infile = NULL;
stream_next = stream->next;
if (stream->stream_type == STREAM_TYPE_LIVE && if (stream->stream_type != STREAM_TYPE_LIVE || stream->feed)
!stream->feed) { continue;
/* the stream comes from a file */ /* the stream comes from a file */
/* try to open the file */ /* try to open the file */
/* open stream */ /* open stream */
if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
/* specific case : if transport stream output to RTP,
/* specific case: if transport stream output to RTP,
* we use a raw transport stream reader */ * we use a raw transport stream reader */
if (stream->fmt && !strcmp(stream->fmt->name, "rtp"))
av_dict_set(&stream->in_opts, "mpeg2ts_compute_pcr", "1", 0); av_dict_set(&stream->in_opts, "mpeg2ts_compute_pcr", "1", 0);
}
if (!stream->feed_filename[0]) { if (!stream->feed_filename[0]) {
http_log("Unspecified feed file for stream '%s'\n", http_log("Unspecified feed file for stream '%s'\n",
...@@ -3593,6 +3596,7 @@ static void build_file_streams(void) ...@@ -3593,6 +3596,7 @@ static void build_file_streams(void)
http_log("Opening feed file '%s' for stream '%s'\n", http_log("Opening feed file '%s' for stream '%s'\n",
stream->feed_filename, stream->filename); stream->feed_filename, stream->filename);
ret = avformat_open_input(&infile, stream->feed_filename, ret = avformat_open_input(&infile, stream->feed_filename,
stream->ifmt, &stream->in_opts); stream->ifmt, &stream->in_opts);
if (ret < 0) { if (ret < 0) {
...@@ -3618,7 +3622,6 @@ static void build_file_streams(void) ...@@ -3618,7 +3622,6 @@ static void build_file_streams(void)
avformat_close_input(&infile); avformat_close_input(&infile);
} }
} }
}
} }
/* compute the needed AVStream for each feed */ /* compute the needed AVStream for each feed */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment