[FFmpeg-devel] [RFC] Global state into structure

Nicolas George george at nsup.org
Thu Dec 31 15:33:43 EET 2020


This mail is about a project I have to make FFmpeg's API and
infrastructure more convenient. For a common introduction, see this thread:
https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/274167.html

Global mutable state has annoyed developers for a long time. Log callbacks
and flags, malloc limits, etc., can only be set once. If an application and
a library it depends on both use FFmpeg, the settings will conflict.
Recently, the lists of registered codecs, formats, protocols, etc., have
been made const, but that cost us the ability to control which components
were registered.

I want to move all into a structure, maybe AVLibrary (or, more precisely,
several structures, one per library, pointing to each-other). Contexts will
have a pointer to it, making the access transparent in most cases.

Existing applications will continue to work by using a global instance of
AVLibrary, but new applications can allocate and their instance explicitly.

The benefits I want from this:

- Bring back the ability to register only a few codecs / formats /
  protocols. This is much more robust than a whitelist, because the
  whitelist must be checked each time, while a component that is not
  registered cannot be used at all.

- Allow applications that want to use different memory allocation functions
  to register their own.

Regards,

-- 
  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/20201231/577b9a7b/attachment.sig>


More information about the ffmpeg-devel mailing list