Quoting wm4 (2017-03-30 17:25:50)
> On Thu, 30 Mar 2017 17:06:00 +0200
> Anton Khirnov <[email protected]> wrote:
> 
> > Quoting wm4 (2017-03-28 12:43:04)
> > > I propose that AV_PIX_FMT_NONE is changed from -1 to 0. The reason is
> > > that default-initializing an AVPixelFormat should set an invalid or
> > > neutral value, instead of a "random" valid value.
> > > 
> > > Currently, 0 means AV_PIX_FMT_YUV420P, which is confusing and can lead
> > > to errors, especially since almost all video is yuv420p anyway.
> > > 
> > > The only problem I see with this is that some code does "<0" to check
> > > for an "unset" format. Some code even uses "-1" instead of the enum
> > > constants, like avcodec_parameters_alloc(). This code would have to be
> > > changed. (You could consider it "buggy" because it didn't use the enum
> > > constant and hardcoded the exact integer values, even though that was
> > > not documented as allowed.)
> > > 
> > > The same applies to AV_SAMPLE_FMT_NONE (which currently is -1).  
> > 
> > I do not think this is a good idea. The number of places using literal
> > -1 is quite large and that's just inside libav. There's no telling how
> > many callers do this, and the change would silently break them, while
> > the benefits from it are IMO not that big.
> > 
> 
> I wonder how you can make this argument, but the move towards removing
> sizeof(AVPacket) from ABI is apparently ok.

The AVPacket change is being done gradually over a much larger period of
time (it's still just "encouraged", not enfoced). And it's possible to
add warnings before the switch (e.g. by adding a field with a magic
value on allocation).

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to