[FFmpeg-devel] [PATCH] #define LAVF_API_MAX_STREAMS

Måns Rullgård mans
Tue Aug 17 02:23:17 CEST 2010


Aurelien Jacobs <aurel at gnuage.org> writes:

> Hi,
>
> We currently have quite a few new API (or API deprecation) in lavf/lavc
> which are waiting for a major version bump to be fully enabled. Some of
> those new API are fully functionnal and ready to be used, some of them
> are work in progress that don't even compile for now (eg. AVPalette
> removal).
> All of them are currently protected by some check like:
>   #if LIBAVFORMAT_VERSION_MAJOR < 53
> So we now have quite of mess of MAJOR version check all around and it's
> not always easy to say which one match which API change. Moreover, it's
> not easy to enable just one of those API change to conduct some tests.
> Just bumping the major lead to a non-compilable source tree.
>
> So I propose to add one new define for each API transition we are
> working on. This would allow to trivially test each transition
> individually, and also to trivially re-schedule an (incomplete)
> transition to next major bump when bumping major.
>
> For example this allows testing the API transition with something like:
>   ./configure --extra-cflags=-DLAVF_API_MAX_STREAMS=0
>
> Attached patch does this for the currently worked on MAX_STREAMS
> transition, and I plan to propose patches for other transitions if this
> one is accepted.
>
> Aurel
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 1f08d1a..afcb344 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -35,6 +35,10 @@
>  
>  #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
>  
> +#ifndef LAVF_API_MAX_STREAMS
> +#define LAVF_API_MAX_STREAMS  (LIBAVFORMAT_VERSION_MAJOR < 53)
> +#endif
> +
>  /**
>   * I return the LIBAVFORMAT_VERSION_INT constant.  You got
>   * a fucking problem with that, douchebag?
> @@ -622,7 +624,7 @@ typedef struct AVChapter {
>      AVMetadata *metadata;
>  } AVChapter;
>  
> -#if LIBAVFORMAT_VERSION_MAJOR < 53
> +#if LAVF_API_MAX_STREAMS
>  #define MAX_STREAMS 20
>  #endif

I dislike the idea of putting transitional hacks in the public
headers.  I also doubt the usefulness of this in the first place.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list