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": {
|
"mux-method": {
|
||||||
"blurb": "The method for muxing multiple transcription streams",
|
"blurb": "The method for muxing multiple transcription streams",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": true,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "cea608 (0)",
|
"default": "cea608 (0)",
|
||||||
|
@ -5906,6 +5906,21 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"GstTranscriberBinMuxMethod": {
|
||||||
|
"kind": "enum",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"desc": "Cea608",
|
||||||
|
"name": "cea608",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Cea708",
|
||||||
|
"name": "cea708",
|
||||||
|
"value": "1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"GstTtToCea608Mode": {
|
"GstTtToCea608Mode": {
|
||||||
"kind": "enum",
|
"kind": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
|
|
|
@ -17,7 +17,7 @@ use std::sync::Mutex;
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use super::CaptionSource;
|
use super::{CaptionSource, MuxMethod};
|
||||||
|
|
||||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
gst::DebugCategory::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);
|
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 */
|
/* One per language, including original */
|
||||||
struct TranscriptionChannel {
|
struct TranscriptionChannel {
|
||||||
bin: gst::Bin,
|
bin: gst::Bin,
|
||||||
|
@ -176,7 +167,14 @@ impl TranscriberBin {
|
||||||
"Multiple CEA-608 streams for a language are not supported"
|
"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_") {
|
} else if let Some(cea708_service) = cc.strip_prefix("708_") {
|
||||||
if service_no.is_some() {
|
if service_no.is_some() {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
|
@ -191,13 +189,12 @@ impl TranscriberBin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let service_no = service_no.ok_or(anyhow!("No 708 caption service provided"))?;
|
let service_no = service_no.ok_or(anyhow!("No 708 caption service provided"))?;
|
||||||
// TODO: handle cea608
|
let mut builder =
|
||||||
(
|
gst::ElementFactory::make("tttocea708").property("service-number", service_no);
|
||||||
gst::ElementFactory::make("tttocea708")
|
if let Some(channel) = cea608_channel {
|
||||||
.property("service-number", service_no)
|
builder = builder.property("cea608-channel", channel);
|
||||||
.build()?,
|
}
|
||||||
format!("sink_{}", service_no),
|
(builder.build()?, format!("sink_{}", service_no))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let capsfilter = gst::ElementFactory::make("capsfilter").build()?;
|
let capsfilter = gst::ElementFactory::make("capsfilter").build()?;
|
||||||
|
|
|
@ -20,13 +20,25 @@ pub enum CaptionSource {
|
||||||
Inband,
|
Inband,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Default, PartialEq, Eq, glib::Enum)]
|
||||||
|
#[repr(u32)]
|
||||||
|
#[enum_type(name = "GstTranscriberBinMuxMethod")]
|
||||||
|
enum MuxMethod {
|
||||||
|
#[default]
|
||||||
|
Cea608,
|
||||||
|
Cea708,
|
||||||
|
}
|
||||||
|
|
||||||
glib::wrapper! {
|
glib::wrapper! {
|
||||||
pub struct TranscriberBin(ObjectSubclass<imp::TranscriberBin>) @extends gst::Bin, gst::Element, gst::Object;
|
pub struct TranscriberBin(ObjectSubclass<imp::TranscriberBin>) @extends gst::Bin, gst::Element, gst::Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||||
#[cfg(feature = "doc")]
|
#[cfg(feature = "doc")]
|
||||||
CaptionSource::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
{
|
||||||
|
CaptionSource::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||||
|
MuxMethod::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||||
|
}
|
||||||
|
|
||||||
gst::Element::register(
|
gst::Element::register(
|
||||||
Some(plugin),
|
Some(plugin),
|
||||||
|
|
Loading…
Reference in a new issue