Skip to content

Pad: allow handling Events in PadProbes

Not sure if this is legit though! :) GStreamer doesn't complain.

TLDR

This allows an application or element to intercept an Event from a PadProbe and take action or drop it.

My use-case

In media-toc, I'm in the process of moving the audio visualization code from "all in-application" to as much as possible in a GStreamer plugin. Whenever possible the audio visualization is centred around current position. This way, the user gets context before and after current position (see this screenshot). When the pipeline is Paused and the user decides to seek, most of the time, a first seek must be triggered to retrieve the buffers for the "left" part of the visualization. Then a second seek is triggered to the initially sought position. So there is a sequence of initial seek, seek backward, wait for enough buffers, seek forward to the initially sought position.

The pipeline relies and tees and queues to achieve this. I'm building a bin that would abstract all this from the user concerns. Within the bin, a dedicate element takes care of the visualization rendering and takes actions when a two steps seek must be performed. When possible, I want the bin to intercept the seek events from the renderer and forward them only to the bin's upstream element, so that elements in the bin are not affected. The bin will filter intermediate downstream events and buffers so as to reduce resource usage.

Note: I tried offsetting the visualization stream when I started this 3 years ago, but ran into issues. Maybe I should try again now, but that's a different subject!

Merge request reports