mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-18 08:06:31 +00:00
cea708overlay: clear more things on caption timeout
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1983>
This commit is contained in:
parent
ae90dd4afe
commit
db8e1da65d
3 changed files with 33 additions and 6 deletions
|
@ -774,4 +774,13 @@ impl Cea608Renderer {
|
||||||
self.rectangle = Some(rect.clone());
|
self.rectangle = Some(rect.clone());
|
||||||
Some(rect)
|
Some(rect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn clear(&mut self) {
|
||||||
|
self.state.reset();
|
||||||
|
let channel = self.channel();
|
||||||
|
self.frame.reset();
|
||||||
|
if let Some(channel) = channel {
|
||||||
|
self.set_channel(channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,6 +241,7 @@ impl Cea708Overlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
state.cea708_renderer.push_service(service);
|
state.cea708_renderer.push_service(service);
|
||||||
|
self.reset_timeout(state, pts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +297,7 @@ impl Cea708Overlay {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset_timeout(&self, state: &mut State, pts: gst::ClockTime) {
|
fn reset_timeout(&self, state: &mut State, pts: gst::ClockTime) {
|
||||||
|
gst::trace!(CAT, "resetting timeout to {pts:?}");
|
||||||
state.last_cc_pts = Some(pts);
|
state.last_cc_pts = Some(pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -399,6 +399,10 @@ impl Cea708Renderer {
|
||||||
|
|
||||||
pub fn clear_composition(&mut self) {
|
pub fn clear_composition(&mut self) {
|
||||||
self.composition.take();
|
self.composition.take();
|
||||||
|
if let Some(service) = self.service.as_mut() {
|
||||||
|
service.clear();
|
||||||
|
}
|
||||||
|
self.cea608.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_composition(&mut self) -> Option<gst_video::VideoOverlayComposition> {
|
pub fn generate_composition(&mut self) -> Option<gst_video::VideoOverlayComposition> {
|
||||||
|
@ -583,6 +587,14 @@ impl ServiceState {
|
||||||
*self = Self::new();
|
*self = Self::new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
for window in self.windows.iter_mut() {
|
||||||
|
window.lines.clear();
|
||||||
|
window.pen_location = SetPenLocationArgs::default();
|
||||||
|
window.rectangle.take();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_code(&mut self, code: &Code) {
|
fn handle_code(&mut self, code: &Code) {
|
||||||
match code {
|
match code {
|
||||||
Code::DefineWindow(args) => self.define_window(args),
|
Code::DefineWindow(args) => self.define_window(args),
|
||||||
|
@ -1297,13 +1309,17 @@ impl Window {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let buffer = match render_buffer() {
|
let buffer = if width > 0 && height > 0 {
|
||||||
Ok(buffer) => buffer,
|
match render_buffer() {
|
||||||
Err(e) => {
|
Ok(buffer) => buffer,
|
||||||
self.dump();
|
Err(e) => {
|
||||||
gst::error!(CAT, "Failed to render buffer: \"{e}\"");
|
self.dump();
|
||||||
return None;
|
gst::error!(CAT, "Failed to render buffer: \"{e}\"");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
};
|
};
|
||||||
gst::trace!(
|
gst::trace!(
|
||||||
CAT,
|
CAT,
|
||||||
|
|
Loading…
Reference in a new issue