transcriberbin: fix property proxying

As part of https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1546
the element started implementing the GstChildProxy interface in order to
expose properties on its sink pads, but the implementation was
incorrect and broke proxying to children elements.

In addition, an intermediary bin was introduced with no name, making it
hard to set the properties of the inner elements through the child
proxy interface, it is now named according to the name of the pad it
corresponds to.

Finally, the default transcriber is back to being named "transcriber".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1642>
This commit is contained in:
Mathieu Duponchelle 2024-06-28 16:04:44 +02:00 committed by GStreamer Marge Bot
parent 960529d90d
commit f0df6874d8

View file

@ -235,6 +235,10 @@ impl TranscriberBin {
) -> Result<(), Error> {
gst::debug!(CAT, imp: self, "Linking input audio stream {pad_name}");
pad_state
.transcription_bin
.set_property("name", format!("transcription-bin-{}", pad_name));
state
.internal_bin
.add_many([
@ -1132,12 +1136,23 @@ impl TranscriberBin {
}
impl ChildProxyImpl for TranscriberBin {
fn child_by_index(&self, _index: u32) -> Option<glib::Object> {
None
fn child_by_index(&self, index: u32) -> Option<glib::Object> {
let parent_children_count = self.parent_children_count();
if index < parent_children_count {
self.parent_child_by_index(index)
} else {
self.obj()
.pads()
.into_iter()
.nth((index - parent_children_count) as usize)
.map(|p| p.upcast())
}
}
fn children_count(&self) -> u32 {
0
let object = self.obj();
self.parent_children_count() + object.num_pads() as u32
}
fn child_by_name(&self, name: &str) -> Option<glib::Object> {
@ -1796,7 +1811,9 @@ impl TranscriberSinkPadState {
transcription_bin: gst::Bin::new(),
transcriber_resample: gst::ElementFactory::make("audioresample").build()?,
transcriber_aconv: gst::ElementFactory::make("audioconvert").build()?,
transcriber: gst::ElementFactory::make("awstranscriber").build()?,
transcriber: gst::ElementFactory::make("awstranscriber")
.name("transcriber")
.build()?,
queue_passthrough: gst::ElementFactory::make("queue").build()?,
transcription_channels: HashMap::new(),
srcpad_name: None,