libavformat: Add a function for freeing an AVFormatContext

This function is useful for freeing data structures allocated by
muxers, which currently have to be freed manually by the caller.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Martin Storsjö
2011-02-04 12:04:16 +02:00
committed by Ronald S. Bultje
parent 1338dc0823
commit f124b087ee
3 changed files with 17 additions and 6 deletions

View File

@ -2556,12 +2556,17 @@ int av_read_pause(AVFormatContext *s)
void av_close_input_stream(AVFormatContext *s)
{
int i;
AVStream *st;
flush_packet_queue(s);
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
}
void avformat_free_context(AVFormatContext *s)
{
int i;
AVStream *st;
for(i=0;i<s->nb_streams;i++) {
/* free all data in a stream component */
st = s->streams[i];