summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8a76cb815e..a078d9c88b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2684,14 +2684,23 @@ void avformat_free_context(AVFormatContext *s)
av_free(s);
}
+#if FF_API_CLOSE_INPUT_FILE
void av_close_input_file(AVFormatContext *s)
{
+ avformat_close_input(&s);
+}
+#endif
+
+void avformat_close_input(AVFormatContext **ps)
+{
+ AVFormatContext *s = *ps;
AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
NULL : s->pb;
flush_packet_queue(s);
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
+ *ps = NULL;
if (pb)
avio_close(pb);
}