Q: HowTo: Detect video/audio DecodeBin's before linking Pads?

Tim-Philipp Müller t.i.m at zen.co.uk
Wed Mar 21 02:43:26 PDT 2012


On Tue, 2012-03-20 at 21:33 -0700, Izzy Softy wrote:

Hello,

> Problem:
>  - I want to automatically detect if a DecodeBin has Audio and Video.
>  - If just Audio, then Tee DecodeBin's Src0 pad to create a VideoSink
> for GOOM (or other Visualizers)
>    and Tee DecodeBin's Src0 pad for AlsaSink (or whatever)
> 
> 
> Tried:
>   - g_signal_connect( decoder, "new-decoded-pad",
> G_CALLBACK( on_decoder_pad_added ), NULL );
>   - on_decoder_pad_added(...) is only aware of One pad at a time. is
> there no way to check for audio/video?

Indeed, you only get one pad at a time from (uri)decodebin(2).

First of all, are you aware of playbin2 ? It looks like you're trying to
re-implement what it does already, namely show visualisations if there's
no video. If you're writing a playback application of some sort, you
probably want to use playbin2.

To answer your question, you can "block" the new pads you get notified
about by (uri)decodebin(2), and decide what to do with them (link
+unblock or just unblock+leave unlinked) once you've seen all pads (you
get a "no-more-pads" signal).

 Cheers
  -Tim




More information about the gstreamer-devel mailing list