Add bindings for gst_element_class*() and similar class functions
I'm following this tutorial in order to implement a tee
in my audio pipeline.
To get the src
pads from the tee
, the tutorial proposes using:
tee_src_pad_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (tee), "src_%d");
tee_audio_pad = gst_element_request_pad (tee, tee_src_pad_template, NULL, NULL);
ElementClass
is not generated, but I found get_compatible_pad_template
on Element
. So I tried this in the connect_pad_added
callback (my source is a uridecodebin
):
[...]
let tee = gst::ElementFactory::make("tee", None).unwrap();
pipeline.add(&tee).unwrap();
let tee_sink = tee.get_static_pad("sink").unwrap();
assert_eq!(src_pad.link(&tee_sink), gst::PadLinkReturn::Ok);
let pad_tmpl = PadTemplate::new("src_%d",
PadDirection::Src,
PadPresence::Request,
&Caps::new_any()
);
let tee_src_pad_tmpl = tee.get_compatible_pad_template(&pad_tmpl).unwrap();
let tee_src_pad = tee.request_pad(&tee_src_pad_tmpl, None, None)
.expect("Couldn't get src pad from gst tee");
Which fails on tee.request_pad()
with the following message:
(.:8073): GStreamer-CRITICAL **: gst_element_request_pad: assertion 'templ->presence == GST_PAD_REQUEST' failed
I can continue investigating, but if you tell me that this isn't going to work, I'd implement the binding to ElementClass
instead.