[FFmpeg-cvslog] r11269 - in trunk/libavformat: avformat.h utils.c

reimar subversion
Wed Dec 19 15:07:14 CET 2007


Author: reimar
Date: Wed Dec 19 15:07:13 2007
New Revision: 11269

Log:
Add a av_close_input_stream function


Modified:
   trunk/libavformat/avformat.h
   trunk/libavformat/utils.c

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	(original)
+++ trunk/libavformat/avformat.h	Wed Dec 19 15:07:13 2007
@@ -662,6 +662,12 @@ int av_read_play(AVFormatContext *s);
 int av_read_pause(AVFormatContext *s);
 
 /**
+ * Free a AVFormatContext allocated by av_open_input_stream.
+ * @param s context to free
+ */
+void av_close_input_stream(AVFormatContext *s);
+
+/**
  * Close a media file (but not its codecs).
  *
  * @param s media file handle

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Wed Dec 19 15:07:13 2007
@@ -2056,7 +2056,7 @@ int av_read_pause(AVFormatContext *s)
     return AVERROR(ENOSYS);
 }
 
-void av_close_input_file(AVFormatContext *s)
+void av_close_input_stream(AVFormatContext *s)
 {
     int i;
     AVStream *st;
@@ -2085,12 +2085,18 @@ void av_close_input_file(AVFormatContext
         av_freep(&s->programs[i]);
     }
     flush_packet_queue(s);
-    if (!(s->iformat->flags & AVFMT_NOFILE))
-        url_fclose(s->pb);
     av_freep(&s->priv_data);
     av_free(s);
 }
 
+void av_close_input_file(AVFormatContext *s)
+{
+    ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
+    av_close_input_stream(s);
+    if (pb)
+        url_fclose(pb);
+}
+
 AVStream *av_new_stream(AVFormatContext *s, int id)
 {
     AVStream *st;




More information about the ffmpeg-cvslog mailing list