diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-12-11 10:34:08 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-12-12 20:23:56 +0100 |
commit | 526604545fb1cc0c11af356fbffd5cddf8cdc95f (patch) | |
tree | 1c3b0c53decd94ddd1c735283129c09af73b5938 /libavformat/utils.c | |
parent | 3a7f7678eb3be1f9a28414c9908ed8d34b1b9846 (diff) | |
download | ffmpeg-526604545fb1cc0c11af356fbffd5cddf8cdc95f.tar.gz |
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.c | 9 |
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); } |