On Thu, Dec 31, 2020 at 2:33 PM <(unknown sender)> wrote: > > 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.
+1. As an API user, my main benefit would be to keep log for separate jobs going on in parallel separate. My application allows capturing data from one or more high-bandwidth machine vision cameras and storing them to file with ffmpeg. This often means multiple encodes are occurring in parallel, either because using multiple cameras or because a previous job didn't finish yet before the next one starts (these cameras generate so much data the encoder often can't quite keep up). I'd like each task to have its own log, not all of it mashed together into one. What is the intention here, have one context per library (so my filters have a different log_ctx than my muxer)? I think it would make most sense to allow user let them all use the same context, or not, depending on their use case (e.g. may want one specific filter to use a different log context as you need its output, or want it to use different memory allocation function for some reason)? In any case, i guess a bunch of different functions, like avformat_alloc_output_context2, avcodec_alloc_context3, avfilter_inout_alloc, avfilter_graph_alloc, would each need an extra input argument allowing user to set context to use. Further, AVLibrary or what it'll be called user have a user data pointer. I would like use the log callback from C++ classes, and need the user data to point to a specific class instance. This also means that av_log should provide the relevant context when calling the callback. Cheers, Dee _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".