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.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to