[FFmpeg-devel] [RFC] missing close/free functions for avformat?

Reimar Döffinger Reimar.Doeffinger
Sun Dec 16 11:09:48 CET 2007

On Sun, Dec 16, 2007 at 02:44:09AM +0100, Michael Niedermayer wrote:
> On Sat, Dec 15, 2007 at 08:32:53PM +0100, Reimar D?ffinger wrote:
> > It's untested, but does something like this look good?
> if you test it and are sure its correct and theres no way to make
> av_close_input_file() work with _stream as well ...

Of course there are ways, e.g. a autoalloced_byteio flag (ok, preferably
a better name) in the AVFormatContext that indicates if we should do
url_fclose on the byteiocontext or not.
That would mean we could get rid of the (very minor) "must_open_file"
code duplication between open and close functions.
But then IMO the naming is inconsistent, and calling it
av_free_format_context would be better (keeping the av_close_input_file
as deprecated for compatibility).
I find that name appropriate because such a function frees the
AVFormatContext and everything that avformat allocated "behind the back"
of the user, and the only alternative that would give a consistent
scheme for allocation/deallocation IMO would involve having for
each function that allocates something (e.g. av_find_stream_info) a
counterpart that frees the same thing. And that would probably be an
overcomplicated mess.

Reimar D?ffinger

More information about the ffmpeg-devel mailing list