[FFmpeg-devel] [PATCH 3/6] libavformat: Add a function for freeing an AVFormatContext

Martin Storsjö martin
Thu Feb 3 13:32:25 CET 2011


On Thu, 3 Feb 2011, Anton Khirnov wrote:

> On Thu, Feb 03, 2011 at 02:10:14PM +0200, Martin Storsj? wrote:
> > This function is useful for freeing data structures allocated by
> > muxers, which currently have to be freed manually by the caller.
> > ---
> >  libavformat/avformat.h |    6 ++++++
> >  libavformat/utils.c    |   11 ++++++++---
> >  2 files changed, 14 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index f9f9be5..1cbe274 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -1230,6 +1230,12 @@ void av_close_input_stream(AVFormatContext *s);
> >  void av_close_input_file(AVFormatContext *s);
> >  
> >  /**
> > + * Free an AVFormatContext and all its streams.
> > + * @param s context to free
> > + */
> > +void av_free_context(AVFormatContext *s);
> > +
> I think avformat_free_context would be a better name, because:
> 1) it's consistent with existing avformat_alloc_context
> 2) av_free_context doesn't tell you that you're freeing a _format_
> context; it might also conflict with future similar functions in
> lavc and friends.

Good point. Any others in favour of avformat_free_context, or preferring 
any other versions?

// Martin



More information about the ffmpeg-devel mailing list