Skip to content

Introduce typed callbacks for stream_t

Loïc requested to merge loic/vlc:typed-callbacks into master

This PR introduces typed callbacks as an alternative to the variadic argument pf_control.

The goal by introducing typed callbacks is to have a safer interface to plug into but also to move away from the mess around va_list (each compiler defines va_list differently, needs to have va_arg everywhere, limited support in safer languages, prone to errors, ...).

The driving factor behind this is to permit programming languages that don't have support for implementing a function that uses va_list to still be able to implement those callbacks.

As a first step this MR only transition the stream part of stream_t not it's demux part which will be done in a follow up MR.

A complete plan (still subject to change) can be found below !3200 (comment 365712).


This approach was suggested in the Rust RFC:

You can just add type-safe callbacks, and retain pf_control as fallback for legacy code. It wouldn't be the first time.

Edited by Loïc

Merge request reports