compute the needed AVStream for each file */
| 3593 | |
| 3594 | /* compute the needed AVStream for each file */ |
| 3595 | static void build_file_streams(void) |
| 3596 | { |
| 3597 | FFStream *stream, *stream_next; |
| 3598 | AVFormatContext *infile; |
| 3599 | int i, ret; |
| 3600 | |
| 3601 | /* gather all streams */ |
| 3602 | for(stream = first_stream; stream != NULL; stream = stream_next) { |
| 3603 | stream_next = stream->next; |
| 3604 | if (stream->stream_type == STREAM_TYPE_LIVE && |
| 3605 | !stream->feed) { |
| 3606 | /* the stream comes from a file */ |
| 3607 | /* try to open the file */ |
| 3608 | /* open stream */ |
| 3609 | stream->ap_in = av_mallocz(sizeof(AVFormatParameters)); |
| 3610 | if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) { |
| 3611 | /* specific case : if transport stream output to RTP, |
| 3612 | we use a raw transport stream reader */ |
| 3613 | stream->ap_in->mpeg2ts_raw = 1; |
| 3614 | stream->ap_in->mpeg2ts_compute_pcr = 1; |
| 3615 | } |
| 3616 | |
| 3617 | http_log("Opening file '%s'\n", stream->feed_filename); |
| 3618 | if ((ret = av_open_input_file(&infile, stream->feed_filename, |
| 3619 | stream->ifmt, 0, stream->ap_in)) < 0) { |
| 3620 | http_log("Could not open '%s': %d\n", stream->feed_filename, ret); |
| 3621 | /* remove stream (no need to spend more time on it) */ |
| 3622 | fail: |
| 3623 | remove_stream(stream); |
| 3624 | } else { |
| 3625 | /* find all the AVStreams inside and reference them in |
| 3626 | 'stream' */ |
| 3627 | if (av_find_stream_info(infile) < 0) { |
| 3628 | http_log("Could not find codec parameters from '%s'\n", |
| 3629 | stream->feed_filename); |
| 3630 | av_close_input_file(infile); |
| 3631 | goto fail; |
| 3632 | } |
| 3633 | extract_mpeg4_header(infile); |
| 3634 | |
| 3635 | for(i=0;i<infile->nb_streams;i++) |
| 3636 | add_av_stream1(stream, infile->streams[i]->codec, 1); |
| 3637 | |
| 3638 | av_close_input_file(infile); |
| 3639 | } |
| 3640 | } |
| 3641 | } |
| 3642 | } |
| 3643 | |
| 3644 | /* compute the needed AVStream for each feed */ |
| 3645 | static void build_feed_streams(void) |
no test coverage detected