diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index 84e01d182..0d7303c9d 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -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 } } }, diff --git a/video/closedcaption/src/translationbin/imp.rs b/video/closedcaption/src/translationbin/imp.rs index c46c75b20..21f224fc0 100644 --- a/video/closedcaption/src/translationbin/imp.rs +++ b/video/closedcaption/src/translationbin/imp.rs @@ -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> = 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::("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!(), } }