mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
transcriberbin: expose lateness property
Directly mapped to the lateness property on the transcriber object. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1910>
This commit is contained in:
parent
75a0baa6fa
commit
4284fe953a
2 changed files with 40 additions and 3 deletions
|
@ -7735,6 +7735,20 @@
|
||||||
"type": "guint",
|
"type": "guint",
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
|
"lateness": {
|
||||||
|
"blurb": "Amount of milliseconds to pass as lateness to the transcriber",
|
||||||
|
"conditionally-available": false,
|
||||||
|
"construct": false,
|
||||||
|
"construct-only": false,
|
||||||
|
"controllable": false,
|
||||||
|
"default": "0",
|
||||||
|
"max": "-1",
|
||||||
|
"min": "0",
|
||||||
|
"mutable": "ready",
|
||||||
|
"readable": true,
|
||||||
|
"type": "guint",
|
||||||
|
"writable": true
|
||||||
|
},
|
||||||
"mode": {
|
"mode": {
|
||||||
"blurb": "Which closed caption mode to operate in",
|
"blurb": "Which closed caption mode to operate in",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
|
|
|
@ -29,6 +29,7 @@ static CAT: LazyLock<gst::DebugCategory> = LazyLock::new(|| {
|
||||||
|
|
||||||
const DEFAULT_PASSTHROUGH: bool = false;
|
const DEFAULT_PASSTHROUGH: bool = false;
|
||||||
const DEFAULT_LATENCY: gst::ClockTime = gst::ClockTime::from_seconds(4);
|
const DEFAULT_LATENCY: gst::ClockTime = gst::ClockTime::from_seconds(4);
|
||||||
|
const DEFAULT_LATENESS: gst::ClockTime = gst::ClockTime::from_seconds(0);
|
||||||
const DEFAULT_TRANSLATE_LATENCY: gst::ClockTime = gst::ClockTime::from_mseconds(500);
|
const DEFAULT_TRANSLATE_LATENCY: gst::ClockTime = gst::ClockTime::from_mseconds(500);
|
||||||
const DEFAULT_ACCUMULATE: gst::ClockTime = gst::ClockTime::ZERO;
|
const DEFAULT_ACCUMULATE: gst::ClockTime = gst::ClockTime::ZERO;
|
||||||
const DEFAULT_MODE: Cea608Mode = Cea608Mode::RollUp2;
|
const DEFAULT_MODE: Cea608Mode = Cea608Mode::RollUp2;
|
||||||
|
@ -100,6 +101,7 @@ struct State {
|
||||||
struct Settings {
|
struct Settings {
|
||||||
cc_caps: gst::Caps,
|
cc_caps: gst::Caps,
|
||||||
latency: gst::ClockTime,
|
latency: gst::ClockTime,
|
||||||
|
lateness: gst::ClockTime,
|
||||||
translate_latency: gst::ClockTime,
|
translate_latency: gst::ClockTime,
|
||||||
accumulate_time: gst::ClockTime,
|
accumulate_time: gst::ClockTime,
|
||||||
caption_source: CaptionSource,
|
caption_source: CaptionSource,
|
||||||
|
@ -113,6 +115,7 @@ impl Default for Settings {
|
||||||
.field("format", "raw")
|
.field("format", "raw")
|
||||||
.build(),
|
.build(),
|
||||||
latency: DEFAULT_LATENCY,
|
latency: DEFAULT_LATENCY,
|
||||||
|
lateness: DEFAULT_LATENESS,
|
||||||
translate_latency: DEFAULT_TRANSLATE_LATENCY,
|
translate_latency: DEFAULT_TRANSLATE_LATENCY,
|
||||||
accumulate_time: DEFAULT_ACCUMULATE,
|
accumulate_time: DEFAULT_ACCUMULATE,
|
||||||
caption_source: DEFAULT_CAPTION_SOURCE,
|
caption_source: DEFAULT_CAPTION_SOURCE,
|
||||||
|
@ -517,16 +520,20 @@ impl TranscriberBin {
|
||||||
if let Some(ref transcriber) = pad_state.transcriber {
|
if let Some(ref transcriber) = pad_state.transcriber {
|
||||||
let latency_ms = settings.latency.mseconds() as u32;
|
let latency_ms = settings.latency.mseconds() as u32;
|
||||||
|
|
||||||
if transcriber.has_property("transcribe-latency", None) {
|
if transcriber.has_property("transcribe-latency", Some(u32::static_type())) {
|
||||||
transcriber.set_property("transcribe-latency", latency_ms);
|
transcriber.set_property("transcribe-latency", latency_ms);
|
||||||
} else if transcriber.has_property("latency", None) {
|
} else if transcriber.has_property("latency", Some(u32::static_type())) {
|
||||||
transcriber.set_property("latency", latency_ms);
|
transcriber.set_property("latency", latency_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if transcriber.has_property("translate-latency", None) {
|
if transcriber.has_property("translate-latency", Some(u32::static_type())) {
|
||||||
let translate_latency_ms = settings.translate_latency.mseconds() as u32;
|
let translate_latency_ms = settings.translate_latency.mseconds() as u32;
|
||||||
transcriber.set_property("translate-latency", translate_latency_ms);
|
transcriber.set_property("translate-latency", translate_latency_ms);
|
||||||
}
|
}
|
||||||
|
if transcriber.has_property("lateness", Some(u32::static_type())) {
|
||||||
|
let lateness_ms = settings.lateness.mseconds() as u32;
|
||||||
|
transcriber.set_property("lateness", lateness_ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pad_state
|
pad_state
|
||||||
.queue_passthrough
|
.queue_passthrough
|
||||||
|
@ -1372,6 +1379,12 @@ impl ObjectImpl for TranscriberBin {
|
||||||
.default_value(DEFAULT_LATENCY.mseconds() as u32)
|
.default_value(DEFAULT_LATENCY.mseconds() as u32)
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
.build(),
|
.build(),
|
||||||
|
glib::ParamSpecUInt::builder("lateness")
|
||||||
|
.nick("Lateness")
|
||||||
|
.blurb("Amount of milliseconds to pass as lateness to the transcriber")
|
||||||
|
.default_value(DEFAULT_LATENESS.mseconds() as u32)
|
||||||
|
.mutable_ready()
|
||||||
|
.build(),
|
||||||
glib::ParamSpecUInt::builder("accumulate-time")
|
glib::ParamSpecUInt::builder("accumulate-time")
|
||||||
.nick("accumulate-time")
|
.nick("accumulate-time")
|
||||||
.blurb("Cut-off time for textwrap accumulation, in milliseconds (0=do not accumulate). \
|
.blurb("Cut-off time for textwrap accumulation, in milliseconds (0=do not accumulate). \
|
||||||
|
@ -1439,6 +1452,12 @@ impl ObjectImpl for TranscriberBin {
|
||||||
value.get::<u32>().expect("type checked upstream").into(),
|
value.get::<u32>().expect("type checked upstream").into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
"lateness" => {
|
||||||
|
let mut settings = self.settings.lock().unwrap();
|
||||||
|
settings.lateness = gst::ClockTime::from_mseconds(
|
||||||
|
value.get::<u32>().expect("type checked upstream").into(),
|
||||||
|
);
|
||||||
|
}
|
||||||
"accumulate-time" => {
|
"accumulate-time" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
settings.accumulate_time = gst::ClockTime::from_mseconds(
|
settings.accumulate_time = gst::ClockTime::from_mseconds(
|
||||||
|
@ -1516,6 +1535,10 @@ impl ObjectImpl for TranscriberBin {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
(settings.latency.mseconds() as u32).to_value()
|
(settings.latency.mseconds() as u32).to_value()
|
||||||
}
|
}
|
||||||
|
"lateness" => {
|
||||||
|
let settings = self.settings.lock().unwrap();
|
||||||
|
(settings.lateness.mseconds() as u32).to_value()
|
||||||
|
}
|
||||||
"accumulate-time" => {
|
"accumulate-time" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
(settings.accumulate_time.mseconds() as u32).to_value()
|
(settings.accumulate_time.mseconds() as u32).to_value()
|
||||||
|
|
Loading…
Reference in a new issue