Uridecodebin3 stream selection

i’m using uridecodebin3 and create pads for all streams by returning -1 from the select-stream handler.

how do i associate a pad with a stream?


  • the streams order is consistent across different invocations: if my media has the stream order [v1, a1, t1, v2, a2, t2], the both GST_MESSAGE_STREAM_COLLECTION and GST_MESSAGE_STREAMS_SELECTED return the streams in the correct order.
  • when the pads are added, the stream ordering is not consistent anymore. i.e. the pad audio_0 can contain the data from stream a1 or a2

how can i find out which pad corresponds to which pad in order to provide a consistent stream order to the application?

By getting the stream-id of the pad. Get the (sticky) GST_EVENT_STREAM_START and you can get the stream-id from that.

gst_pad_get_sticky_event (target_pad, GST_EVENT_STREAM_START, `0)
1 Like

There’s also a gst_pad_get_stream_id() function.

Even simpler :+1: Nice one