diff --git a/avconv.c b/avconv.c index 91549a24fd..90ed00d935 100644 --- a/avconv.c +++ b/avconv.c @@ -523,7 +523,7 @@ void exit_program(int ret) av_dict_free(&output_files[i].opts); } for(i=0;isubtitle_stream >= 0) stream_component_close(is, is->subtitle_stream); if (is->ic) { - av_close_input_file(is->ic); - is->ic = NULL; /* safety */ + avformat_close_input(&is->ic); } avio_set_interrupt_cb(NULL); diff --git a/avprobe.c b/avprobe.c index 992f07c5cf..de9657b7e3 100644 --- a/avprobe.c +++ b/avprobe.c @@ -325,7 +325,7 @@ static int probe_file(const char *filename) if (do_show_format) show_format(fmt_ctx); - av_close_input_file(fmt_ctx); + avformat_close_input(&fmt_ctx); return 0; } diff --git a/avserver.c b/avserver.c index 89e0e6da1d..9016d1f9df 100644 --- a/avserver.c +++ b/avserver.c @@ -849,7 +849,7 @@ static void close_connection(HTTPContext *c) if (st->codec->codec) avcodec_close(st->codec); } - av_close_input_file(c->fmt_in); + avformat_close_input(&c->fmt_in); } /* free RTP output streams if any */ @@ -2169,7 +2169,7 @@ static int open_input_stream(HTTPContext *c, const char *info) c->fmt_in = s; if (strcmp(s->iformat->name, "ffm") && avformat_find_stream_info(c->fmt_in, NULL) < 0) { http_log("Could not find stream info '%s'\n", input_filename); - av_close_input_file(s); + avformat_close_input(&s); return -1; } @@ -2311,8 +2311,7 @@ static int http_prepare_data(HTTPContext *c) return 0; } else { if (c->stream->loop) { - av_close_input_file(c->fmt_in); - c->fmt_in = NULL; + avformat_close_input(&c->fmt_in); if (open_input_stream(c, "") < 0) goto no_loop; goto redo; @@ -2736,7 +2735,7 @@ static int http_receive_data(HTTPContext *c) /* Now we have the actual streams */ if (s->nb_streams != feed->nb_streams) { - av_close_input_file(s); + avformat_close_input(&s); av_free(pb); http_log("Feed '%s' stream number does not match registered feed\n", c->stream->feed_filename); @@ -2749,7 +2748,7 @@ static int http_receive_data(HTTPContext *c) avcodec_copy_context(fst->codec, st->codec); } - av_close_input_file(s); + avformat_close_input(&s); av_free(pb); } c->buffer_ptr = c->buffer; @@ -3629,7 +3628,7 @@ static void build_file_streams(void) if (avformat_find_stream_info(infile, NULL) < 0) { http_log("Could not find codec parameters from '%s'\n", stream->feed_filename); - av_close_input_file(infile); + avformat_close_input(&infile); goto fail; } extract_mpeg4_header(infile); @@ -3637,7 +3636,7 @@ static void build_file_streams(void) for(i=0;inb_streams;i++) add_av_stream1(stream, infile->streams[i]->codec, 1); - av_close_input_file(infile); + avformat_close_input(&infile); } } } @@ -3727,7 +3726,7 @@ static void build_feed_streams(void) http_log("Deleting feed file '%s' as stream counts differ (%d != %d)\n", feed->feed_filename, s->nb_streams, feed->nb_streams); - av_close_input_file(s); + avformat_close_input(&s); } else http_log("Deleting feed file '%s' as it appears to be corrupt\n", feed->feed_filename); diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c index a5e9124128..dec499904e 100644 --- a/libavfilter/vsrc_movie.c +++ b/libavfilter/vsrc_movie.c @@ -192,7 +192,7 @@ static av_cold void uninit(AVFilterContext *ctx) if (movie->codec_ctx) avcodec_close(movie->codec_ctx); if (movie->format_ctx) - av_close_input_file(movie->format_ctx); + avformat_close_input(&movie->format_ctx); avfilter_unref_buffer(movie->picref); av_freep(&movie->frame); } diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 366d8327ff..7cc04999d1 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -132,7 +132,7 @@ static void free_variant_list(AppleHTTPContext *c) ffurl_close(var->input); if (var->ctx) { var->ctx->pb = NULL; - av_close_input_file(var->ctx); + avformat_close_input(&var->ctx); } av_free(var); } diff --git a/libavformat/avidec.c b/libavformat/avidec.c index ad35995b05..b45224f641 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1365,7 +1365,7 @@ static int avi_read_close(AVFormatContext *s) if (ast) { if (ast->sub_ctx) { av_freep(&ast->sub_ctx->pb); - av_close_input_file(ast->sub_ctx); + avformat_close_input(&ast->sub_ctx); } av_free(ast->sub_buffer); av_free_packet(&ast->sub_pkt); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 0d25e3f254..c9b34abe1f 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -368,7 +368,7 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter) PESContext *pes = filter->u.pes_filter.opaque; av_freep(&pes->buffer); /* referenced private data will be freed later in - * av_close_input_file */ + * avformat_close_input */ if (!((PESContext *)filter->u.pes_filter.opaque)->st) { av_freep(&filter->u.pes_filter.opaque); } diff --git a/libavformat/rdt.c b/libavformat/rdt.c index c06583e105..207fc92542 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -544,7 +544,7 @@ rdt_free_context (PayloadContext *rdt) av_freep(&rdt->rmst[i]); } if (rdt->rmctx) - av_close_input_file(rdt->rmctx); + avformat_close_input(&rdt->rmctx); av_freep(&rdt->mlti_data); av_freep(&rdt->rmst); av_free(rdt); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 6a8472844c..483b196d62 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -108,8 +108,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) "Failed to fix invalid RTSP-MS/ASF min_pktsize\n"); init_packetizer(&pb, buf, len); if (rt->asf_ctx) { - av_close_input_file(rt->asf_ctx); - rt->asf_ctx = NULL; + avformat_close_input(&rt->asf_ctx); } if (!(rt->asf_ctx = avformat_alloc_context())) return AVERROR(ENOMEM); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 52821545ff..fcf168d426 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -580,8 +580,7 @@ void ff_rtsp_close_streams(AVFormatContext *s) } av_free(rt->rtsp_streams); if (rt->asf_ctx) { - av_close_input_file(rt->asf_ctx); - rt->asf_ctx = NULL; + avformat_close_input(&rt->asf_ctx); } av_free(rt->p); av_free(rt->recvbuf); diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index 6ac7bfd484..531cfd204d 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -52,7 +52,7 @@ static int sap_read_close(AVFormatContext *s) { struct SAPState *sap = s->priv_data; if (sap->sdp_ctx) - av_close_input_file(sap->sdp_ctx); + avformat_close_input(&sap->sdp_ctx); if (sap->ann_fd) ffurl_close(sap->ann_fd); av_freep(&sap->sdp); diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c index 43dee56fe7..699c693c3f 100644 --- a/libavformat/seek-test.c +++ b/libavformat/seek-test.c @@ -127,7 +127,7 @@ int main(int argc, char **argv) printf("ret:%-10s st:%2d flags:%d ts:%s\n", ret_str(ret), stream_id, i&1, ts_buf); } - av_close_input_file(ic); + avformat_close_input(&ic); return 0; } diff --git a/tools/pktdumper.c b/tools/pktdumper.c index 2da1146430..e9e5acfdec 100644 --- a/tools/pktdumper.c +++ b/tools/pktdumper.c @@ -117,7 +117,7 @@ int main(int argc, char **argv) break; } - av_close_input_file(fctx); + avformat_close_input(&fctx); while (donotquit) sleep(60);