[Ffmpeg-devel] [PATCH] fix compilation when Snow ENcoder is disabled

Guillaume POIRIER gpoirier
Sun Aug 13 19:21:55 CEST 2006


Hi,

Michael Niedermayer wrote:
> On Sat, Aug 12, 2006 at 04:54:15PM +0200, Guillaume POIRIER wrote:
>> Michael Niedermayer wrote:
>>> On Thu, Aug 10, 2006 at 10:45:29AM +0200, Guillaume Poirier wrote:
>>>> Hi,
>>>> This commit:
>>>> http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/2006-June/002597.html
>>>> broke compilation when Snow encoder is disabled.
>>>>
>>>> The symptom as as follows:
>>>> libavcodec/libavcodec.a(snow.o)(.text+0xb422): In function `get_block_rd':
>>>> /usr/src/mplayer/mplayer/libavcodec/snow.c:3129: undefined reference
>>>> to `w53_32_c'
>>>> libavcodec/libavcodec.a(snow.o)(.text+0xb456):/usr/src/mplayer/mplayer/libavcodec/snow.c:3127:
>>>> undefined reference to `w97_32_c'
>>>> libavcodec/libavcodec.a(snow.o)(.text+0x14374): In function `encode_init':
>>>> /usr/src/mplayer/mplayer/libavcodec/snow.c:4064: undefined reference
>>>> to `h263_encode_init'
>>>>
>>>> My patch puts all functions used in the encoding process around #ifdef
>>>> CONFIG_SNOW_ENCODER pre-processor tests.
>>>> I don't know if it's the right way to go, as I'm not sure how tight
>>>> Snow encoding and decoding are.
>>>> It doesn't seem to break Snow decoding, though tests are welcome.
>>> IMHO the better solution would be to put
>>>
>>> #ifdef CONFIG_SNOW_ENCODER
>>> int w53_32_c(...);
>>> ...
>>> #else
>>> #define w53_32_c(...) assert(0)
>>> ...
>>> #endif
>>>
>>> in the correct .h file
>>
>> I get the idea. However, I don't seem to be able to come up with simple 
>> a solution residing in the .h that works[1] (but it's probably because I 
>> lack imagination).
> 
> whats the problem with
> 
> #ifdef CONFIG_ENCODER
>  void h263_encode_init(MpegEncContext *s);
> #else
> #define h263_encode_init(x) assert(0)
> #endif
> 
> or
> 
> #ifdef CONFIG_ENCODER
>  void h263_encode_init(MpegEncContext *s);
> #else
>  static void h263_encode_init(MpegEncContext *s) {assert(0);}
> #endif


The problem is that you end up having multiple definitions of the same 
function. This can be "solved" by using the "static" keyword, as in the 
attached patch.
With this patch, GCC3.3 and 4.2 are happy when encoders are disabled.

What do you think about it?

Guillaume
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compile_fix_when_encoders_disabled.diff
Type: text/x-patch
Size: 1679 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060813/8973a5ca/attachment.bin>



More information about the ffmpeg-devel mailing list