From e31e5b2c6f002a6dff9cc483b65822eada7e3384 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Wed, 26 Feb 2025 18:22:34 +0100 Subject: [PATCH] transcriberbin: fix caption-source selection .. with recent enough cccombiner. Originally, dropping transcriptions was enough to support caption-source=inband, as cccombiner did not implement output scheduling. However now that it does, even if no captions arrive on the caption pad the combiner will still output padding. Recent-enough combiners however expose an `input-meta-processing` property which lets us achieve the desired behavior, we thus make use of it when available. Part-of: --- video/closedcaption/src/transcriberbin/imp.rs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index d89a09f3..2ce4f8a9 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -2620,7 +2620,25 @@ impl ObjectImpl for TranscriberBin { let s = self.state.lock().unwrap(); if let Some(state) = s.as_ref() { - if settings.caption_source == CaptionSource::Inband { + if state.cccombiner.has_property("input-meta-processing") { + match settings.caption_source { + CaptionSource::Inband => { + state + .cccombiner + .set_property_from_str("input-meta-processing", "force"); + } + CaptionSource::Both => { + state + .cccombiner + .set_property_from_str("input-meta-processing", "append"); + } + CaptionSource::Transcription => { + state + .cccombiner + .set_property_from_str("input-meta-processing", "drop"); + } + } + } else if settings.caption_source == CaptionSource::Inband { gst::debug!( CAT, imp = self,