[FFmpeg-devel] [PATCH] Fix compilation when only MPEG-1encoder is enabled

Aurelien Jacobs aurel
Thu May 10 16:29:46 CEST 2007


On Thu, 10 May 2007 16:06:24 +0200
Panagiotis Issaris <takis.issaris at uhasselt.be> wrote:

> Hi Aurelien,
> 
> Aurelien Jacobs wrote:
> > On Thu, 10 May 2007 14:00:26 +0200
> > Panagiotis Issaris <takis.issaris at uhasselt.be> wrote:
> >> I could only think of compiling it all in,
> >> or making sure mpegvideo.c doesn't reference it when it isn't available.
> >> Unless of course your making bigger changes in mpegvideo.c, making the
> >> ff_wmv_* code generic and adding it to some commonly compiled code, I
> >> can't see a quick solution...
> > 
> > Well, in fact it's almost the same solution as you used, just without
> > the ugly ifdef jungle. But the result is the same.
> 
> Ah! You are right, looks much cleaner! I forgot about your work
> regarding the conditional registration of codecs, which used the same
> move-work-from-preprocessor-to-compiler trick :)
> 
> I remember reading about this some years ago, but never saw anyone use
> it before the codec registration cleanup patches. One thing I'm
> wondering about though, could there be compilers that are stupid enough
> to just keep the code there even if the " if(0 and" is there?

I guess that might be theoretically possible. I mean I don't think that
ANSI C requires that the compiler do dead branch elimination.
That said, I've never seen such a compiler...

In case you're interested, I learned this trick from the busybox
project which uses it intensively.

Aurel




More information about the ffmpeg-devel mailing list