mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-09-02 09:43:48 +00:00
translationbin: expose read-only translator property on source pads
This lets users easily change the tokenization method on the translator object for instance. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2124>
This commit is contained in:
parent
ebcb8f220b
commit
780c724902
2 changed files with 28 additions and 5 deletions
|
@ -9673,6 +9673,17 @@
|
|||
"readable": true,
|
||||
"type": "gchararray",
|
||||
"writable": true
|
||||
},
|
||||
"translator": {
|
||||
"blurb": "The translator element in use",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"mutable": "null",
|
||||
"readable": true,
|
||||
"type": "GstElement",
|
||||
"writable": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -102,6 +102,10 @@ impl TranslationBin {
|
|||
pad_state.queue = Some(queue);
|
||||
pad_state.translator = Some(translator);
|
||||
|
||||
drop(pad_state);
|
||||
|
||||
srcpad.notify("translator");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -568,11 +572,18 @@ impl ObjectSubclass for TranslationSrcPad {
|
|||
impl ObjectImpl for TranslationSrcPad {
|
||||
fn properties() -> &'static [glib::ParamSpec] {
|
||||
static PROPERTIES: LazyLock<Vec<glib::ParamSpec>> = LazyLock::new(|| {
|
||||
vec![glib::ParamSpecString::builder("language-code")
|
||||
.nick("Language Code")
|
||||
.blurb("The language of the output stream")
|
||||
.default_value(Some(DEFAULT_OUTPUT_LANG_CODE))
|
||||
.build()]
|
||||
vec![
|
||||
glib::ParamSpecString::builder("language-code")
|
||||
.nick("Language Code")
|
||||
.blurb("The language of the output stream")
|
||||
.default_value(Some(DEFAULT_OUTPUT_LANG_CODE))
|
||||
.build(),
|
||||
glib::ParamSpecObject::builder::<gst::Element>("translator")
|
||||
.nick("Translator")
|
||||
.blurb("The translator element in use")
|
||||
.read_only()
|
||||
.build(),
|
||||
]
|
||||
});
|
||||
|
||||
PROPERTIES.as_ref()
|
||||
|
@ -599,6 +610,7 @@ impl ObjectImpl for TranslationSrcPad {
|
|||
let settings = self.settings.lock().unwrap();
|
||||
settings.language_code.to_value()
|
||||
}
|
||||
"translator" => self.state.lock().unwrap().translator.to_value(),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue