diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2022-05-10 19:31:57 +0300 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2022-05-10 19:52:56 +0300 |
commit | 6b80fdc2705f06b997dfc9e22fa8b683241ccf74 (patch) | |
tree | 66c7a9a4a152d9db70dab2dceae8319f3d5ba610 /video/closedcaption/src/cea608overlay/imp.rs | |
parent | 7425b31173ef8285e066ff63a56fed3b3af85e84 (diff) |
cea608overlay: handle CLEAR status
+ log errors
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/754>
Diffstat (limited to 'video/closedcaption/src/cea608overlay/imp.rs')
-rw-r--r-- | video/closedcaption/src/cea608overlay/imp.rs | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/video/closedcaption/src/cea608overlay/imp.rs b/video/closedcaption/src/cea608overlay/imp.rs index ead742e92..a1200bcaa 100644 --- a/video/closedcaption/src/cea608overlay/imp.rs +++ b/video/closedcaption/src/cea608overlay/imp.rs @@ -351,23 +351,37 @@ impl Cea608Overlay { } if Some(cc_type) == state.selected_field { - if let Ok(Status::Ready) = state + match state .caption_frame .decode((triple[1] as u16) << 8 | triple[2] as u16, 0.0) { - let text = match state.caption_frame.to_text(true) { - Ok(text) => text, - Err(_) => { - gst::error!( - CAT, - obj: pad, - "Failed to convert caption frame to text" - ); - continue; - } - }; - - self.overlay_text(element, &text, state); + Ok(Status::Ready) => { + let text = match state.caption_frame.to_text(true) { + Ok(text) => text, + Err(_) => { + gst::error!( + CAT, + obj: pad, + "Failed to convert caption frame to text" + ); + continue; + } + }; + + self.overlay_text(element, &text, state); + } + Ok(Status::Clear) => { + self.overlay_text(element, "", state); + } + Ok(Status::Ok) => (), + Err(err) => { + gst::error!( + CAT, + obj: pad, + "Failed to decode caption frame: {:?}", + err + ); + } } self.reset_timeout(state, pts); |