Calling set_property for each buffer (video frame) from probe or signal handler?
michiel at aanmelder.nl
Sun Nov 15 16:23:00 UTC 2020
Works like a charm, and I don't think I'd ever have found that one :) So
just to clarify for others: it's on the *glvideomixerelement*, not on
the glvideomixer *bin*. To hook it up:
On 12-11-2020 07:06, Matthew Waters wrote:
> There is a samples-selected signal on glvideomixerelement (in 1.18+)
> where you can get a callback at the correct place to set the necessary
> pad information after selection but before composition which should
> work for this case.
> See e.g.
> On 12/11/20 2:42 am, Michiel Konstapel wrote:
>> Hi all,
>> What I am trying to achieve, is to do "digital pan/zoom" on live
>> video frames using a glvideomixer. For each frame, I want to set
>> xpos, ypos, width, and height on the glvideomixer sink (input) pad -
>> ideally, right before each buffer is processed. However, when I do
>> this in a buffer probe callback on the sink pad, I occasionally get
>> incorrect frames, where some of the properties have updated and
>> others have not. For example, the xpos might have been updated while
>> the ypos, height and width are still the old values, resulting in a
>> distorted frame. Note that I am using the Python bindings, so I don't
>> think I have access to a `set_property` that can set multiple
>> properties in one call, as would be possible from C.
>> My workaround so far is to set the properties from a probe on the
>> *source* pad instead. That way, the property changes have one frame
>> duration (40 ms, at 25 fps) to be applied. That appears to be
>> working, and I can live with the extra one frame delay, but I am
>> still curious why this is required. I would expect the buffer not to
>> be delivered to the input pad until the probe callback has returned,
>> and the set_property calls to have completed.
>> Is this an issue specifically with glvideomixer? Are set_property
>> calls allowed from a probe callback? If not, what about a signal
>> handler? Would it be better to insert an identity element before the
>> mixer and call set_property from its handoff signal?
>> Alternatively, I could do the set_property calls from the main
>> thread, but then I don't see any way to synchronize them against the
>> glvideomixer's redraws; there's no way to do locking to ensure all
>> four properties are updated at once, is there?
>> Kind regards,
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
/Lead Software Developer/
T: +31 (0)15 2400119
E: michiel at aanmelder.nl <mailto:michiel at aanmelder.nl>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gstreamer-devel