Help forcing decodebin to output certain caps

Tim-Philipp Müller t.i.m at zen.co.uk
Thu Jan 10 14:14:58 PST 2013


On Thu, 2013-01-10 at 13:14 -0800, gimmeamilk wrote:

Hi,

> I was doing some experimentation using the API rather than gst-launch,
> examining the pad caps in the "pad-added" signal. In the signal handler, if
> I try to link the h264parse srcpad manually, it fails because at that stage
> the srcpad caps is only avc, no byte-stream.
> 
> From looking at the decodebin code, I think it checks the decodebin caps
> property to see if it is a subset of the srcpad caps of the most downstream
> element in the bin. If it is a subset, the autoplugging is finished, but it
> does not actually set the srcpad caps to that subset. ie h264parse can
> output avc or byte-stream, so the autoplug finishes because my byte-stream
> requirement is indeed a subset of the srcpad caps.

Yes.

> But decodebin does not then instruct h264parse to actually use the
> subset caps. Is this a correct understanding? Presumably it then
> defaults to avc because that's the first one in the list?

Or because it's the cheapest/easiest (just passing through the input
format)?

> I had wondered about plugging my own conversion element downstream like you
> describe, but the problem is that ultimately I want to use this for several
> video codecs that my sink can handle. So ideally I'd like to avoid having to
> perform extra checks on the output of the decodebin, eg "if h264, add a
> h264parse, if vc1 add xyz.." etc. Avoiding this kind of thing was my reason
> for using decodebin in the first place.
> 
> How difficult would it be to change decodebin so that the srcpad caps of its
> last element were actually those specified in the decodebin caps property?
> Failing that, could the srcpad caps be left as the entire set for that
> element, and the exact caps then be negotiated when I link the pad to my
> sink pad. ie my decodebin has {avc,byte-stream} on its srcpad, allowing me
> to link it to my byte-stream sink.
> 
> One other nasty option I'd considered is using a custom version h264parse
> that only reports byte-stream, but this is obviously horrible.  

It might work if you link it to a capsfilter after uridecodebin as soon
as the pad is exposed.

Cheers
 -Tim



More information about the gstreamer-devel mailing list