Mercurial > libavformat.hg
changeset 2835:b158768c5352 libavformat
Add a av_close_input_stream function
author | reimar |
---|---|
date | Wed, 19 Dec 2007 14:07:13 +0000 |
parents | 63fda6ba2173 |
children | e043e56e6e6c |
files | avformat.h utils.c |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/avformat.h Wed Dec 19 11:31:36 2007 +0000 +++ b/avformat.h Wed Dec 19 14:07:13 2007 +0000 @@ -662,6 +662,12 @@ 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
--- a/utils.c Wed Dec 19 11:31:36 2007 +0000 +++ b/utils.c Wed Dec 19 14:07:13 2007 +0000 @@ -2056,7 +2056,7 @@ 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 @@ 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;