[FFmpeg-devel] [PATCH v2] avfilter/formats: optimize ff_all_formats

Nicolas George george at nsup.org
Fri Dec 27 18:13:01 EET 2019

zhilizhao (12019-12-24):
> I get the idea. However, if lavi is built agains version A of libavutils
> and use version B at runtime, it’s not guaranteed to work with or without
> access to AV_PIX_FMT_NB:

In principle, it is.

> 1. For major version bump, AV_PIX_FMT_XXX may have different values
> in different versions of libavutils

Major bumps are precisely the time to introduce unavoidable
incompatibilities. But we will not make a major bump when adding a new
pixel format.

> 2. For minor version bump, if there is new AV_PIX_FMT_XXX appends to
> AVPixelFormat, it would be safe to use a smaller AV_PIX_FMT_NB_old.

It may be safe, but it would make ff_all_formats() return not all
formats, which is not acceptable.

> (if we don’t know what the new format is, we don’t know how to deal with it)

If we don't know what the new format is but it is relevant, then we
don't use ff_all_formats(). Look at the filters that use it: mostly
filters that do not depend on the frame data, only the frame properties.

> libavcodec, libavfilter, and libavdevice have access to AV_PIX_FMT_NB.
> Can you help me figure out these contradictions?

They are bugs, they need to be fixed.

The rule is: only use AV_SOMEGHING_NB in the same library.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191227/9b619a82/attachment.sig>

More information about the ffmpeg-devel mailing list