[FFmpeg-devel] [WIP] Event loop

Nicolas George george at nsup.org
Sat Jul 17 15:09:01 EEST 2021


Hi.

Some time ago, I started working on the project to update libavformat's
protocols to run with a proper event loop, instead of the several half-assed
event loops we have here and there in the code.

I started by writing the documentation for the low-level API, making sure it
is an API that (1) is sufficient for the high-level API and (2) I can
deliver on Unix using poll() and pthreads and could deliver with GLib, libev
and probably libuv.

Please have a look at it. In particular, if you know system/event
programming for other operating systems, please have a look to tell me if
there are flaws in that regard.

Here are a few comments:

The structure of my projects are:

- AVWorker, single-threaded low-level API, with the possibility of having
  several implementations to accommodate different operating systems or
  integrate into existing frameworks.

- AVScheduler, multi-threaded high-level API, with the possibility of having
  several implementations to integrate into existing frameworks.

- Redesign AVIO so that it works as tasks in an AVScheduler.

- Redesign libavfilter so that activating filters is tasks in an
  AVScheduler.

Note that I have made implementation choices different from what we are used
to. In particular, when it comes to making the API future-proof. Adding
low-level tasks needs to be extremely lightweight, to the exclusion of
dynamic allocation: our old and t[ier]+d foo_alloc() / foo_free() / add
fields at the end does not cut it. If you want to criticize these choices,
please make sure you understand how they work, what constraints I am working
with and what benefit they bring, and preferably have an alternate proposal.

Here is the current state of worker.h. Now I will be working on scheduler.h.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: worker.h
Type: text/x-chdr
Size: 17219 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210717/730038de/attachment.h>
-------------- 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/20210717/730038de/attachment.sig>


More information about the ffmpeg-devel mailing list