[vlc-devel] [PATCH] switcher: Fix compilation with ffmpeg-0.10.2

Alexis Ballier aballier at gentoo.org
Wed Mar 21 14:02:57 CET 2012


On Wed, 21 Mar 2012 17:01:07 +0800
Richard Grenville <pyxlcy at gmail.com> wrote:

> On Wed, Mar 21, 2012 at 03:41:33AM -0400, Rafaël Carré wrote:
> > > ---
> > > #define LIBAVCODEC_VERSION_MAJOR 53
> > > /* ... */
> > > #define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
> > > ---
> > > 
> > > So ffmpeg should already have replaced FF_*_TYPE with the correct
> > > AV_PICTURE_TYPE_*, why this is not happening? Eventually I found
> > > these things in vlc's git tree, ./modules/codec/avcodec.h, which
> > > switch.c includes, too:
> > 
> > Perhaps because your headers are too recent
> > (LIBAVCODEC_VERSION_MAJOR >= 54)
> 
> Hmm? "#define LIBAVCODEC_VERSION_MAJOR 53", it's clearly written
> there. I use ffmpeg-0.10.2.
> 
> I did a test just now:
> ---
> $
> cd /var/tmp/portage/media-video/vlc-2.0.1/work/vlc-2.0.1/modules/stream_out
> $ gcc -E -dD -I/usr/include/libavcodec -I../../include switcher.c |
> grep FF_P_TYPE #define FF_P_TYPE AV_PICTURE_TYPE_P #define
> AV_PICTURE_TYPE_P FF_P_TYPE id->p_frame->pict_type = FF_P_TYPE;
>     case FF_P_TYPE:
> ---
> 
> Two circular macro definitions are there, and FF_P_TYPE is not
> replaced correctly. After I commented out the 3 "#define
> AV_PICTURE_TYPE_* FF_*_TYPE" lines
> in ./modules/codec/avcodec/avcodec.h, it worked as expected:



replacing FF_*_TYPE by AV_PICTURE_TYPE_* in switcher.c should rather
restore compatibility with older ffmpeg since current code triggers
these circular definitions with libavcodec < 54.

8f24e725ff9945975f6d7232477cff7f7a8e2cff changes them unconditionally in
modules/codec/avcodec/video.c for example, so this can't break more
compatibility than what it is currently :)

rest of the patch can be discussed for old versions compatibility, but
this part _restores_ compatibility with older versions of ffmpeg.

Regards,

Alexis.



More information about the vlc-devel mailing list