[FFmpeg-devel] [RFC] disentangling libavutil headers

Aurelien Jacobs aurel
Sat Jan 24 19:09:53 CET 2009


On Sat, 24 Jan 2009 14:47:57 +0100
Diego Biurrun <diego at biurrun.de> wrote:

> On Fri, Jan 23, 2009 at 11:33:19PM +0100, Aurelien Jacobs wrote:
> > Diego Biurrun wrote:
> > 
> > > Here is (part of) a patch to disentangle libavutil headers.
> > > It gets rid of the circular dependency/inclusion between mem.h and
> > > internal.h.  As a bonus we can get rid of a bit of ugliness in
> > > mem.c.
> > > 
> > > I did not send along the changes outside libavutil.  As you can
> > > imagine they're not too exciting, just adding #includes for mem.h
> > > in lots of places.
> > 
> > From my reading of this patch, it looks like no change is needed
> > outside libavutil.
> 
> You read wrongly.  After removing mem.h from common.h, mem.h is no
> longer indirectly #included in many places, but needed nevertheless.

mem.h is included by internal.h which is included by common.h.
That's why I think mem.h is still indirectly included everywhere.
And I think adding #include "mem.h" in almost all files is a bad
idea. common.h is supposed to provide all the very common feature,
and av_malloc and friends are definitely common functions.

> > > --- libavutil/internal.h	(revision 16729)
> > > +++ libavutil/internal.h	(working copy)
> > > @@ -33,7 +33,8 @@
> > >  #include <stdint.h>
> > >  #include <stddef.h>
> > >  #include <assert.h>
> > >  #include "common.h"
> > > +#include "mem.h"
> > >  #include "timer.h"
> > 
> > Shouldn't be needed.
> 
> It is needed, internal.h uses av_mallocz.

Indeed, I was a bit too fast for this one. It is indeed
required. And this is what will indirectly provide mem.h to
to all other files.

Aurel




More information about the ffmpeg-devel mailing list