[FFmpeg-devel] [PATCH] Explicitely declare {dst, src}Format sws_get*Context() params as enum PixelFormat

Art Clarke aclarke
Tue Feb 10 00:30:45 CET 2009


On Mon, Feb 9, 2009 at 2:59 PM, Aurelien Jacobs <aurel at gnuage.org> wrote:
> Art Clarke wrote:
>> int foo = PIX_FMT_YUV420P;
>> ...
>> struct SwsContext * s = sws_getContext(10,20,foo,20,20,foo,0,0,0);
>>
>> was valid.  now it no longer is.
>
> It is still valid and still compiles fine !
> It don't even generate a warning with -Wall.
>

You're right; I went back to our source code, and we were actually
disguising the enum PixelFormat with another enum type (enum Foo) that
was a superset of enum PixelFormat, but we made sure only values that
were also enum PixelFormat int values could pass the boundary).

So:

enum Foo foo = (enum PixelFormat)PIX_FMT_YUV420P;
struct SwsContext* s = sws_getContext(..., foo,.... foo, ...);

This would work when sws_getContext required ints, but GCC correctly
gave an error once sws_getContext required an actual enum PixelFormat;
 While 'technically' the API did change, and that change caused our
technical legal C code builds, it's not a use case I think FFMPEG
needs to actively worry about (and we probably get what we deserve on
that).

Also, when I said a version number bump, I mean that a micro was
sufficient for me (e.g. 0.6.1 to 0.6.2), but that a minor was probably
the right thing (0.6.1 to 0.7.0) just because it is technically a non
100% backwards compatible change that can break previously working
code.

That said, I stand by my opinion on aluminum roofs.

- Art

-- 
http://www.xuggle.com/
xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and video.

Use Xuggle to get the power of FFMPEG in Java.




More information about the ffmpeg-devel mailing list