[FFmpeg-devel] [PATCH] Make av_close_input_file() do nothing is the input is NULL.
Stefano Sabatini
stefano.sabatini-lala
Sat Dec 4 19:39:11 CET 2010
---
libavformat/avformat.h | 1 +
libavformat/utils.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 86ef13a..a1d5070 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1240,6 +1240,7 @@ void av_close_input_stream(AVFormatContext *s);
/**
* Close a media file (but not its codecs).
+ * If s is NULL, do nothing.
*
* @param s media file handle
*/
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c8e6d66..494d0f6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2530,7 +2530,10 @@ void av_close_input_stream(AVFormatContext *s)
void av_close_input_file(AVFormatContext *s)
{
- ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
+ ByteIOContext *pb;
+ if (!s)
+ return;
+ pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
av_close_input_stream(s);
if (pb)
url_fclose(pb);
--
1.7.2.3
More information about the ffmpeg-devel
mailing list