The pipeline above is static, but the decodebin buried inside transcoder is dynamic. What I want to achieve is to hide the dynamic nature of decodebin: when a video/x-raw is present, I want it to flow to othersink, but when a video/x-raw is absent, I want the pipeline to do nothing until the video/x-raw is present again.
There is a request_new_pad() function that responds by creating a ghost pad, ready for the target to be wired up when the video stream appears.
The problem I have is that if there is no target on one of the ghost pads (for example, the ghost pad wants video but there is no video in the stream), the transcoder element never enters the PLAYING state, and while data flows into transcoder, nothing flows out of transcoder. The pipeline stalls when the buffers get full.
What is the correct way to handle a pad that you want to exist, but don’t want to use at the moment?
To use the common water analogy, I have a bunch of pipes set up to handle video, but when there is no video I expect no video to flow through these pipes, but I want the audio to flow down the other pipes.
If the video disappears from the stream I want to shut off the video pipe again, but leave the stream in place until video starts arriving again.
I’d tried setting the active on the ghost pads to FALSE, but this makes no difference, the pipeline refuses to enter the PLAYING state, and the change_state() callback in transcoder is never called.