Bug#641701: A solution for compiling ffaudio.so

Reinhard Tartler siretart at tauware.de
Mon Jan 16 07:22:45 UTC 2012


On Mo, Jan 16, 2012 at 07:06:36 (CET), Boris Gjenero wrote:

> This affects many formats, so I feel it's important. There are two
> relevant causes:
> 1) The plugin isn't built due to a problem with libavcodec detection
> code. Some parts were split into libavcore and then merged back into
> libavutil. The configure script expects to find libavcore.

This is what you get if you try to track a moving target. libavcore was
never in any released version of neither libav nor ffmpeg, so this added
complexity can go away now completely.

> 2) AVMEDIA_TYPE_AUDIO was removed, which would cause a problem if you
> try to build ffaudio.

The AVMedia enum has been introduced in March 2010. So it's the way
other way round. Do you intend to make the plugin work against both
Libav 0.5 as found in debian/stable as well with Libav 0.8 as found in
unstable? In that case you should declare that clearly, as I'm not
convinced at all its worth the effort. Note that there is a libavcodec53
from Libav 0.7 in squeeze-backports, which will be updated to Libav 0.8
as soon as it migrates to testing.


> I'm attaching a patch which fixes this. It is based on bits of
> audacious-plugins-2.5.4. For 1) the change is made to configure.ac, so
> autoconf must be rerun to update configure. This is not done
> automatically by the build process. There are some warnings about
> ffaudio calling depreciated functions, but the resulting ffaudio
> plugin works.
>
> diff -ur audacious-plugins-2.4.4/configure.ac audacious-plugins-2.4.4-fixed/configure.ac
> --- audacious-plugins-2.4.4/configure.ac	2011-02-22 12:29:46.000000000 -0500
> +++ audacious-plugins-2.4.4-fixed/configure.ac	2012-01-16 00:16:43.062542098 -0500
> @@ -783,12 +783,13 @@
>  
>  dnl In 2010, some libavcodec functions were moved into a new library called
>  dnl libavcore, making our checks here a bit complex.
> +dnl Later, in Feb, 2011 they got merged back into libavcodec.
>  
>  if test $enable_ffaudio = yes ; then
> -    PKG_CHECK_MODULES([NEED_AVCORE], [libavcodec >= 52.94.3],
> -     [have_new_ffmpeg=yes], [have_new_ffmpeg=no])
> +    PKG_CHECK_MODULES([NEED_AVCORE], [libavcodec >= 52.94.3 libavcodec <= 52.113.1],
> +     [have_split_ffmpeg=yes], [have_split_ffmpeg=no])

IMO that part would be much easier if you checked for libavcodec >= 53,
and be done with it. If you really want to support libav in stable, then
you'd need to provide some some backward compatibility definitions, see below:

> -    if test $have_new_ffmpeg = yes ; then
> +    if test $have_split_ffmpeg = yes ; then

split_ffmpeg? what a mess.

>          PKG_CHECK_MODULES([FFMPEG],
>           [libavcodec >= 52.20.0 libavcore >= 0.12.0 libavformat >= 52.31.0 libavutil >= 49.15.0],
>           [have_ffaudio=yes], [have_ffaudio=no])
> diff -ur audacious-plugins-2.4.4/src/ffaudio/ffaudio-core.c audacious-plugins-2.4.4-fixed/src/ffaudio/ffaudio-core.c
> --- audacious-plugins-2.4.4/src/ffaudio/ffaudio-core.c	2011-02-22 12:29:46.000000000 -0500
> +++ audacious-plugins-2.4.4-fixed/src/ffaudio/ffaudio-core.c	2012-01-16 00:14:44.044665933 -0500
> @@ -112,7 +112,11 @@
>      for (i = 0; i < ic->nb_streams; i++)
>      {
>          c = ic->streams[i]->codec;
> +#if CHECK_LIBAVCODEC_VERSION (52, 64, 0)
> +        if (c->codec_type == AVMEDIA_TYPE_AUDIO)
> +#else
>          if (c->codec_type == CODEC_TYPE_AUDIO)
> +#endif

See /usr/share/doc/libavcodec-dev/APIchanges.gz for details on the
AVMediaType enum:

2010-03-31 - r22736 - lavu 50.14.0 - AVMediaType
  Move AVMediaType enum from libavcodec to libavutil.

2010-03-31 - r22735 - lavc 52.64.0 - AVMediaType
  Define AVMediaType enum, and use it instead of enum CodecType, which
  is deprecated and will be dropped at the next major bump.

This means that a) the #ifdef should check avutil instead, and b), is
unnecessary anyways unless you really want to ensure that the plugin can
be built in debian/stable as well. But even if you want to do so, I
think it would be much cleaner to provide the AVMEDIA_TYPE_AUDIO alias
names in some central header rather than to duplicate this all over the
code. That way, all CODEC_TYPE_AUDIO can be safely replaced by
AVMEDIA_TYPE_AUDIO.

>          {
>              av_find_stream_info(ic);
>              codec = avcodec_find_decoder(c->codec_id);
> @@ -247,7 +251,11 @@
>      {
>          s = ic->streams[i];
>          c = s->codec;
> +#if CHECK_LIBAVCODEC_VERSION (52, 64, 0)
> +        if (c->codec_type == AVMEDIA_TYPE_AUDIO)
> +#else
>          if (c->codec_type == CODEC_TYPE_AUDIO)
> +#endif
>          {
>              av_find_stream_info(ic);
>              codec = avcodec_find_decoder(c->codec_id);
> @@ -323,7 +331,11 @@
>      {
>          s = ic->streams[i];
>          c = s->codec;
> +#if CHECK_LIBAVCODEC_VERSION (52, 64, 0)
> +        if (c->codec_type == AVMEDIA_TYPE_AUDIO)
> +#else
>          if (c->codec_type == CODEC_TYPE_AUDIO)
> +#endif
>          {
>              av_find_stream_info(ic);
>              codec = avcodec_find_decoder(c->codec_id);

-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4





More information about the pkg-multimedia-maintainers mailing list