[FFmpeg-devel] [PATCH v2 1/6] fflcms2: move to libavcodec

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Jul 6 17:18:21 EEST 2022


Niklas Haas:
> From: Niklas Haas <git at haasn.dev>
> 
> We will need this helper inside libavcodec in the future, so move it
> there, leaving behind an #include to the raw source file in its old
> location in libvfilter. This approach is inspired by the handling of
> vulkan.c, and avoids us needing to expose any of it publicly (or
> semi-publicly) in e.g. libavutil, thus avoiding any ABI headaches.

This is only correct if you work under the assumption that when building
with static libraries, all the static libraries come from the same
commit. If you e.g. allow to build with an older libavfilter and a newer
libavcodec (like with shared libs), this assumption breaks down: if the
newer version of this file exports another function, you get linker
(ODR) errors because both versions might be pulled in.
Behaviour/signature changes by any function or modifications to any of
the structs would be similarly catastrophic.

A way out of this mess would be to version everything in the header like so:
#define FFLCMS2_VERSION 1

void AV_JOIN(ff_icc_context_uninit, FFLCMS2_VERSION)(FFIccContext *s);

(of course, there should be a dedicated macro for this to reduce typing.)

A patch that makes any of the "catastrophic" modifications described
above would need to bump the version. If one uses compatible versions,
the files would be deduplicated for static builds.
It would of course have the downside that these macros would be
everywhere where it is used, not only in fflcms2.[ch].

> 
> It's debatable whether the actual code belongs in libavcodec or
> libavfilter, but I decided to put it into libavcodec because it
> conceptually deals with encoding and decoding ICC profiles, and will be
> used to decode embedded ICC profiles in image files.
> 
> Signed-off-by: Niklas Haas <git at haasn.dev>
> ---
>  libavcodec/Makefile   |   1 +
>  libavcodec/fflcms2.c  | 311 ++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/fflcms2.h  |  87 ++++++++++++
>  libavfilter/fflcms2.c | 294 +--------------------------------------
>  libavfilter/fflcms2.h |  65 +--------
>  5 files changed, 401 insertions(+), 357 deletions(-)
>  create mode 100644 libavcodec/fflcms2.c
>  create mode 100644 libavcodec/fflcms2.h
> 



More information about the ffmpeg-devel mailing list