From ebdcc403cf35f4ad2a4516f997d2c45bd9cfd9b0 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Tue, 28 May 2024 21:54:54 +0900 Subject: [PATCH] transcriberbin: Fix mux-method=cea708 * Update "translation-languages" property to include G_PARAM_CONSTRUCT so that it can be applied to initial state. * Change default "translation-languages" value to be None instead of cea608 specific one. Transcriberbin will be able to configure initia state depending on selected mux method if "translation-languages" is unspecified. Part-of: --- docs/plugins/gst_plugins_cache.json | 2 +- video/closedcaption/src/transcriberbin/imp.rs | 32 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index a0097042..2ab5f44f 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -6152,7 +6152,7 @@ "translation-languages": { "blurb": "A map of language codes to caption channels, e.g. translation-languages=\"languages, transcript={CC1, 708_1}, fr={708_2, CC3}\" will map the French translation to CC1/service 1 and the original transcript to CC3/service 2", "conditionally-available": false, - "construct": false, + "construct": true, "construct-only": false, "controllable": false, "default": "languages, transcript=(string)cc1;", diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index 03a20ae9..f24b7c30 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -1248,6 +1248,7 @@ impl ObjectImpl for TranscriberBin { glib::ParamSpecBoxed::builder::("translation-languages") .nick("Translation languages") .blurb("A map of language codes to caption channels, e.g. translation-languages=\"languages, transcript={CC1, 708_1}, fr={708_2, CC3}\" will map the French translation to CC1/service 1 and the original transcript to CC3/service 2") + .construct() .mutable_playing() .build(), glib::ParamSpecUInt::builder("translate-latency") @@ -1754,11 +1755,7 @@ struct TranscriberSinkPadSettings { impl Default for TranscriberSinkPadSettings { fn default() -> Self { Self { - translation_languages: Some( - gst::Structure::builder("languages") - .field("transcript", "cc1") - .build(), - ), + translation_languages: None, language_code: String::from(DEFAULT_INPUT_LANG_CODE), mode: DEFAULT_MODE, } @@ -1857,19 +1854,20 @@ impl ObjectImpl for TranscriberSinkPad { fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) { match pspec.name() { "translation-languages" => { - if let Some(this) = self.obj().parent().and_downcast::() { - let mut settings = self.settings.lock().unwrap(); - settings.translation_languages = value - .get::>() - .expect("type checked upstream"); - gst::debug!( - CAT, - imp: self, - "Updated translation-languages {:?}", - settings.translation_languages - ); - drop(settings); + let mut settings = self.settings.lock().unwrap(); + settings.translation_languages = value + .get::>() + .expect("type checked upstream"); + gst::debug!( + CAT, + imp: self, + "Updated translation-languages {:?}", + settings.translation_languages + ); + drop(settings); + + if let Some(this) = self.obj().parent().and_downcast::() { this.imp().update_languages(&self.obj(), false); } }