Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-12-11 13:34:08 +0400
committerAnton Khirnov <anton@khirnov.net>2011-12-12 23:23:56 +0400
commit526604545fb1cc0c11af356fbffd5cddf8cdc95f (patch)
tree1c3b0c53decd94ddd1c735283129c09af73b5938 /libavformat/utils.c
parent3a7f7678eb3be1f9a28414c9908ed8d34b1b9846 (diff)
lavf: add avformat_close_input().
It sets the supplied AVFormatContext pointer to NULL after freeing it, which is safer and its name is consistent with other lavf functions. Also deprecate av_close_input_file().
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);
}