Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2021-09-08 15:33:31 +0300
committerSebastian Dröge <slomo@coaxion.net>2021-09-08 15:35:41 +0300
commit96d86eaa069165f42abe6a0907c99016cab5db52 (patch)
tree17a116d8cb8dac35fb85d2f4d6a92ed675c0e084 /video/closedcaption/src/cea608overlay/imp.rs
parent626df039615f38535fed9d6f1f7c53ddeb4f40f0 (diff)
Clean up clippy warnings and CI configuration
Put clippy overrides into the sources files instead of the CI configuration, and fix various warnings / clean up code.
Diffstat (limited to 'video/closedcaption/src/cea608overlay/imp.rs')
-rw-r--r--video/closedcaption/src/cea608overlay/imp.rs93
1 files changed, 39 insertions, 54 deletions
diff --git a/video/closedcaption/src/cea608overlay/imp.rs b/video/closedcaption/src/cea608overlay/imp.rs
index bd8171051..100416d5d 100644
--- a/video/closedcaption/src/cea608overlay/imp.rs
+++ b/video/closedcaption/src/cea608overlay/imp.rs
@@ -353,26 +353,23 @@ impl Cea608Overlay {
}
if Some(cc_type) == state.selected_field {
- match state
+ if let Ok(Status::Ready) = state
.caption_frame
.decode((triple[1] as u16) << 8 | triple[2] as u16, 0.0)
{
- 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);
- }
- _ => (),
+ 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);
}
}
} else {
@@ -406,26 +403,19 @@ impl Cea608Overlay {
}
if Some(cc_type) == state.selected_field {
- match state
+ if let Ok(Status::Ready) = state
.caption_frame
.decode((triple[1] as u16) << 8 | triple[2] as u16, 0.0)
{
- 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;
- }
- };
+ 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);
- }
- _ => (),
+ self.overlay_text(element, &text, state);
}
}
}
@@ -468,26 +458,23 @@ impl Cea608Overlay {
let data = meta.data();
assert!(data.len() % 2 == 0);
for i in 0..data.len() / 2 {
- match state
+ if let Ok(Status::Ready) = state
.caption_frame
.decode((data[i * 2] as u16) << 8 | data[i * 2 + 1] as u16, 0.0)
{
- 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;
- }
- };
+ 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, &mut state);
- }
- _ => (),
+ self.overlay_text(element, &text, &mut state);
}
}
}
@@ -503,11 +490,9 @@ impl Cea608Overlay {
state.video_info.as_ref().unwrap(),
)
.unwrap();
- match composition.blend(&mut frame) {
- Err(_) => {
- gst_error!(CAT, obj: pad, "Failed to blend composition");
- }
- _ => (),
+
+ if composition.blend(&mut frame).is_err() {
+ gst_error!(CAT, obj: pad, "Failed to blend composition");
}
}
}