[FFmpeg-devel] [RFC] disentangling libavutil headers

Diego Biurrun diego
Sat Jan 24 14:47:57 CET 2009


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.
The build will break without the DECLARE_ALIGNED macros for example.

> > --- libavutil/mathematics.c	(revision 16729)
> > +++ libavutil/mathematics.c	(working copy)
> > @@ -23,6 +23,7 @@
> >  
> > +#include <assert.h>
> >  #include "common.h"
> >  #include "mathematics.h"
> 
> Unrelated, so should probably be applied separately.
> Anyway, it looks OK.

It is related, otherwise we get implicit declaration warnings because
the file no longer indirectly #includes assert.h.

> > --- libavutil/tree.c	(revision 16729)
> > +++ libavutil/tree.c	(working copy)
> > @@ -18,8 +18,8 @@
> >  
> > -#include "common.h"
> >  #include "log.h"
> > +#include "mem.h"
> 
> All the similar changes are probably OK and could be applied
> independently.

Yes, I could split this...

> > --- libavutil/lzo.c	(revision 16729)
> > +++ libavutil/lzo.c	(working copy)
> > @@ -18,7 +18,9 @@
> > +
> >  #include "common.h"
> > +#include "mem.h"
> 
> Shouldn't be needed.

Indeed, this is a stray change.

> > --- 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.

Diego




More information about the ffmpeg-devel mailing list