[vlc-devel] [PATCH 02/15] filters: pass the owner sys to the buffer_new callback
robux4 at ycbcr.xyz
Mon Jul 22 07:12:40 CEST 2019
On 2019-07-19 18:32, Rémi Denis-Courmont wrote:
> Le perjantaina 19. heinäkuuta 2019, 16.32.06 EEST Steve Lhomme a écrit :
>> This way we don't have to modify the the owner for each call in the
>> filter chain.
> IMO, the fact that we even have to do this points at a larger problem.
> The owner of the filter chain should only care for the allocator of the last
> element in the chain (if any), but should not know about the filter, only the
> chain. The filter chain code should do the dispatch properly.
Yes, at first I thought we could just handle it through the video
context on the output of the filter chain (that's how I did it in a
previous version of my push branch). But since we're moving away from
the video context doing everything (no allocator in the context) we
still need a way to use the output pull for the last filter in the chain
(which may vary).
The filter must allocate output pictures in 2 different ways: its
original "owner" if it's an intermediate filter, the filter chain if
it's the last filter. Either we force a fake owner in some calls (what
the code does now) or we tell it what callbacks to use to allocate
pictures. When the filter is created we don't know if it's the last in
the chain (and it can be dynamic). So we set the allocator to something
Sometimes in the code the "owner" design pattern means it's the same
pointer but with extra fields/callbacks for its own use. It is not put
in the bare object (see decoder_owner for example). In other case the
"owner" is actually part of the object structure (vout_display_owner_t,
services_discovery_owner_t, vout_window_owner_t). In all cases it
doesn't seem logical to change the owner during the runtime. So I prefer
to pass the right callback set to use during allocation.
There might be a simple way to keep this special case in the filter
chain. I will have a look.
More information about the vlc-devel