diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2007-12-19 14:07:13 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2007-12-19 14:07:13 +0000 |
commit | 2506fd54676003e8fce6b2b30464f3463beb3e87 (patch) | |
tree | c2b664b0f05d70def417e35befdca76e5fc38a1e /libavformat | |
parent | 2e9b86ac122e40686b77dab02dea3ee7d72c520a (diff) | |
download | ffmpeg-2506fd54676003e8fce6b2b30464f3463beb3e87.tar.gz |
Add a av_close_input_stream function
Originally committed as revision 11269 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avformat.h | 6 | ||||
-rw-r--r-- | libavformat/utils.c | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index b9e83bf73e..ac41fee95f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -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 diff --git a/libavformat/utils.c b/libavformat/utils.c index 386fe60718..f4cf10f14d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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 *s) 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; |