mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
transcriberbin: also support 608 inside 708
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1406>
This commit is contained in:
parent
55b4de779c
commit
e1cd52178e
3 changed files with 44 additions and 20 deletions
|
@ -5566,7 +5566,7 @@
|
|||
"mux-method": {
|
||||
"blurb": "The method for muxing multiple transcription streams",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "cea608 (0)",
|
||||
|
@ -5906,6 +5906,21 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"GstTranscriberBinMuxMethod": {
|
||||
"kind": "enum",
|
||||
"values": [
|
||||
{
|
||||
"desc": "Cea608",
|
||||
"name": "cea608",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"desc": "Cea708",
|
||||
"name": "cea708",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"GstTtToCea608Mode": {
|
||||
"kind": "enum",
|
||||
"values": [
|
||||
|
|
|
@ -17,7 +17,7 @@ use std::sync::Mutex;
|
|||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use super::CaptionSource;
|
||||
use super::{CaptionSource, MuxMethod};
|
||||
|
||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
|
@ -38,15 +38,6 @@ const DEFAULT_MUX_METHOD: MuxMethod = MuxMethod::Cea608;
|
|||
|
||||
const CEAX08MUX_LATENCY: gst::ClockTime = gst::ClockTime::from_mseconds(100);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Default, PartialEq, Eq, glib::Enum)]
|
||||
#[repr(u32)]
|
||||
#[enum_type(name = "GstTranscriberBinMuxMethod")]
|
||||
enum MuxMethod {
|
||||
#[default]
|
||||
Cea608,
|
||||
Cea708,
|
||||
}
|
||||
|
||||
/* One per language, including original */
|
||||
struct TranscriptionChannel {
|
||||
bin: gst::Bin,
|
||||
|
@ -176,7 +167,14 @@ impl TranscriberBin {
|
|||
"Multiple CEA-608 streams for a language are not supported"
|
||||
);
|
||||
}
|
||||
cea608_channel = Some(cea608.parse::<u32>()?);
|
||||
let channel = cea608.parse::<u32>()?;
|
||||
if (1..=4).contains(&channel) {
|
||||
cea608_channel = Some(channel);
|
||||
} else {
|
||||
anyhow::bail!(
|
||||
"CEA-608 channels only support values between 1 and 4 inclusive"
|
||||
);
|
||||
}
|
||||
} else if let Some(cea708_service) = cc.strip_prefix("708_") {
|
||||
if service_no.is_some() {
|
||||
anyhow::bail!(
|
||||
|
@ -191,13 +189,12 @@ impl TranscriberBin {
|
|||
}
|
||||
}
|
||||
let service_no = service_no.ok_or(anyhow!("No 708 caption service provided"))?;
|
||||
// TODO: handle cea608
|
||||
(
|
||||
gst::ElementFactory::make("tttocea708")
|
||||
.property("service-number", service_no)
|
||||
.build()?,
|
||||
format!("sink_{}", service_no),
|
||||
)
|
||||
let mut builder =
|
||||
gst::ElementFactory::make("tttocea708").property("service-number", service_no);
|
||||
if let Some(channel) = cea608_channel {
|
||||
builder = builder.property("cea608-channel", channel);
|
||||
}
|
||||
(builder.build()?, format!("sink_{}", service_no))
|
||||
}
|
||||
};
|
||||
let capsfilter = gst::ElementFactory::make("capsfilter").build()?;
|
||||
|
|
|
@ -20,13 +20,25 @@ pub enum CaptionSource {
|
|||
Inband,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Default, PartialEq, Eq, glib::Enum)]
|
||||
#[repr(u32)]
|
||||
#[enum_type(name = "GstTranscriberBinMuxMethod")]
|
||||
enum MuxMethod {
|
||||
#[default]
|
||||
Cea608,
|
||||
Cea708,
|
||||
}
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct TranscriberBin(ObjectSubclass<imp::TranscriberBin>) @extends gst::Bin, gst::Element, gst::Object;
|
||||
}
|
||||
|
||||
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
#[cfg(feature = "doc")]
|
||||
{
|
||||
CaptionSource::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||
MuxMethod::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||
}
|
||||
|
||||
gst::Element::register(
|
||||
Some(plugin),
|
||||
|
|
Loading…
Reference in a new issue