nandi/jolt-nativepublic Fork 0
4956d1e
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Clear the clippy backlog the new CI enforces

`just lint` has always run clippy with `-D warnings`, but nothing enforced it,
so a backlog accumulated. `nix flake check` runs it now.

Most were mechanical. Two were not, and neither was dead code, which is what
they looked like at first:

* `upload_frame` and `NAV_HINT_ID` are reported as never used because their
  callers sit behind `#[cfg(feature = "video")]` and `#[cfg(target_os =
  "android")]` respectively. Deleting them would have broken both of those
  builds. They are gated to match instead, and video.rs's ColorImage and
  TextureOptions imports go with the method that uses them.
* `format_bps` really does have two arms with the same body — bytes take no
  decimal, and neither does anything three digits wide. That is one condition
  written as two, so it is now one.

jolt-moq's five sleek-derived files take a scoped allow rather than a rewrite.
They are kept close to sleek's `android/src` so a fix can be moved between the
two by eye, and idiomatising them costs more than the lints are worth — in
nv12_orient's tests, `oy[1 * 4 + 3]` mirrors the `row * width + col` in the
comment above it, and `oy[7]` would not.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-05T23:35:06-07:00 Browse files
4956d1e parent: 3e8c6f0
modified crates/jolt-moq/src/android_camera.rs +14 -0
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
115 //! Android Camera2 → MoQ video publish bridge.
216 //!
317 //! Java `CameraCapture` (in APK `classes.dex`) opens Camera2 / ImageReader and
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
1 //! Android Camera2 → MoQ video publish bridge.15 //! Android Camera2 → MoQ video publish bridge.
2 //!16 //!
3 //! Java `CameraCapture` (in APK `classes.dex`) opens Camera2 / ImageReader and17 //! Java `CameraCapture` (in APK `classes.dex`) opens Camera2 / ImageReader and
modified crates/jolt-moq/src/av.rs +14 -0
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
115 //! Call state and framing for the freeq AV media plane.
216 //!
317 //! Extracted from sleek, which reached this by calling Rust from Rust. The
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
1 //! Call state and framing for the freeq AV media plane.15 //! Call state and framing for the freeq AV media plane.
2 //!16 //!
3 //! Extracted from sleek, which reached this by calling Rust from Rust. The17 //! Extracted from sleek, which reached this by calling Rust from Rust. The
modified crates/jolt-moq/src/av_media.rs +14 -0
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
115 //! Native MoQ media plane for freeq AV calls.
216 //!
317 //! Publishes mic Opus (+ optional camera H.264) to the SFU and plays remote
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
1 //! Native MoQ media plane for freeq AV calls.15 //! Native MoQ media plane for freeq AV calls.
2 //!16 //!
3 //! Publishes mic Opus (+ optional camera H.264) to the SFU and plays remote17 //! Publishes mic Opus (+ optional camera H.264) to the SFU and plays remote
modified crates/jolt-moq/src/nv12_orient.rs +14 -0
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
115 //! Rotate NV12 frames so Camera2 sensor buffers appear upright.
216 //!
317 //! Phone sensors are usually mounted at 90°/270°. ImageReader delivers
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
1 //! Rotate NV12 frames so Camera2 sensor buffers appear upright.15 //! Rotate NV12 frames so Camera2 sensor buffers appear upright.
2 //!16 //!
3 //! Phone sensors are usually mounted at 90°/270°. ImageReader delivers17 //! Phone sensors are usually mounted at 90°/270°. ImageReader delivers
modified crates/jolt-moq/src/v4l2cam.rs +14 -0
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
115 //! Minimal V4L2 MMAP camera capture with a **correct `dqbuf`**.
216 //!
317 //! `v4l2r`'s `ioctl::dqbuf` leaves `v4l2_buffer.memory = 0`. Real UVC drivers
@@ -1,3 +1,17 @@
1+// This file tracks sleek's copy in `android/src` closely enough that a fix can
2+// be moved between the two by eye, so it is deliberately not idiomatised to
3+// this workspace's clippy settings. The lints below are the ones that would
4+// rewrite it away from its original; everything else still applies.
5+#![allow(
6+ clippy::chunks_exact_to_as_chunks,
7+ clippy::identity_op,
8+ clippy::manual_filter,
9+ clippy::manual_is_multiple_of,
10+ clippy::redundant_closure,
11+ clippy::too_many_arguments,
12+ clippy::unnecessary_sort_by
13+)]
14+
1 //! Minimal V4L2 MMAP camera capture with a **correct `dqbuf`**.15 //! Minimal V4L2 MMAP camera capture with a **correct `dqbuf`**.
2 //!16 //!
3 //! `v4l2r`'s `ioctl::dqbuf` leaves `v4l2_buffer.memory = 0`. Real UVC drivers17 //! `v4l2r`'s `ioctl::dqbuf` leaves `v4l2_buffer.memory = 0`. Real UVC drivers
modified crates/jolt-tui/src/tests.rs +1 -1
@@ -137,7 +137,7 @@ fn a_checkbutton_writes_its_new_state_back_as_well_as_reporting_it() {
137137 vec![(check, "toggled".into(), String::new(), 1.0)]
138138 );
139139 // A caller that ignores the event still has a working control.
140- assert_eq!(ui.tree.props(check).bool("active", false), true);
140+ assert!(ui.tree.props(check).bool("active", false));
141141 ui.frame();
142142 assert_eq!(ui.screen.line(0), "[x] live");
143143 }
@@ -137,7 +137,7 @@ fn a_checkbutton_writes_its_new_state_back_as_well_as_reporting_it() {
137 vec![(check, "toggled".into(), String::new(), 1.0)]137 vec![(check, "toggled".into(), String::new(), 1.0)]
138 );138 );
139 // A caller that ignores the event still has a working control.139 // A caller that ignores the event still has a working control.
140- assert_eq!(ui.tree.props(check).bool("active", false), true);140+ assert!(ui.tree.props(check).bool("active", false));
141 ui.frame();141 ui.frame();
142 assert_eq!(ui.screen.line(0), "[x] live");142 assert_eq!(ui.screen.line(0), "[x] live");
143 }143 }
modified crates/jolt-vidya/src/app.rs +1 -1
@@ -922,7 +922,7 @@ fn capture_frame(gl: &Gl, dims: [u32; 2], path: &str) {
922922 // GL origin is bottom-left; PPM is top-down.
923923 for row in (0..h as usize).rev() {
924924 let start = row * w as usize * 4;
925- for px in rgba[start..start + w as usize * 4].chunks_exact(4) {
925+ for px in rgba[start..start + w as usize * 4].as_chunks::<4>().0 {
926926 out.extend_from_slice(&px[..3]);
927927 }
928928 }
@@ -922,7 +922,7 @@ fn capture_frame(gl: &Gl, dims: [u32; 2], path: &str) {
922 // GL origin is bottom-left; PPM is top-down.922 // GL origin is bottom-left; PPM is top-down.
923 for row in (0..h as usize).rev() {923 for row in (0..h as usize).rev() {
924 let start = row * w as usize * 4;924 let start = row * w as usize * 4;
925- for px in rgba[start..start + w as usize * 4].chunks_exact(4) {925+ for px in rgba[start..start + w as usize * 4].as_chunks::<4>().0 {
926 out.extend_from_slice(&px[..3]);926 out.extend_from_slice(&px[..3]);
927 }927 }
928 }928 }
modified crates/jolt-vidya/src/lib.rs +3 -0
@@ -895,6 +895,9 @@ fn open_url(url: &str) -> bool {
895895 /// browses the filesystem itself, which is what a desktop has anyway.
896896 ///
897897 /// Needs no window and no particular thread.
898+///
899+/// # Safety
900+/// Takes no pointers, so there is nothing for the caller to keep valid.
898901 #[no_mangle]
899902 pub unsafe extern "C" fn vidya_pick_image() -> c_int {
900903 guard(0, || pick_image() as c_int)
@@ -895,6 +895,9 @@ fn open_url(url: &str) -> bool {
895 /// browses the filesystem itself, which is what a desktop has anyway.895 /// browses the filesystem itself, which is what a desktop has anyway.
896 ///896 ///
897 /// Needs no window and no particular thread.897 /// Needs no window and no particular thread.
898+///
899+/// # Safety
900+/// Takes no pointers, so there is nothing for the caller to keep valid.
898 #[no_mangle]901 #[no_mangle]
899 pub unsafe extern "C" fn vidya_pick_image() -> c_int {902 pub unsafe extern "C" fn vidya_pick_image() -> c_int {
900 guard(0, || pick_image() as c_int)903 guard(0, || pick_image() as c_int)
modified crates/jolt-vidya/src/tree.rs +5 -3
@@ -385,7 +385,9 @@ fn decode_png_rgba(bytes: &[u8]) -> Option<egui::ColorImage> {
385385 let rgba: Vec<u8> = match info.color_type {
386386 png::ColorType::Rgba => raw.to_vec(),
387387 png::ColorType::Rgb => raw
388- .chunks_exact(3)
388+ .as_chunks::<3>()
389+ .0
390+ .iter()
389391 .flat_map(|c| [c[0], c[1], c[2], 255])
390392 .collect(),
391393 _ => return None,
@@ -533,7 +535,7 @@ impl Tree {
533535 }
534536
535537 pub fn remove(&mut self, parent: u32, child: u32) {
536- if self.slot(child).map_or(true, |n| n.parent != parent) {
538+ if self.slot(child).is_none_or(|n| n.parent != parent) {
537539 return;
538540 }
539541 self.free_node(child);
@@ -564,7 +566,7 @@ impl Tree {
564566 let before = self
565567 .slot(parent)
566568 .and_then(|p| p.children.iter().position(|&c| c == child))
567- .map_or(false, |i| i < index);
569+ .is_some_and(|i| i < index);
568570 self.insert_at(parent, child, if before { index - 1 } else { index })
569571 }
570572
@@ -385,7 +385,9 @@ fn decode_png_rgba(bytes: &[u8]) -> Option<egui::ColorImage> {
385 let rgba: Vec<u8> = match info.color_type {385 let rgba: Vec<u8> = match info.color_type {
386 png::ColorType::Rgba => raw.to_vec(),386 png::ColorType::Rgba => raw.to_vec(),
387 png::ColorType::Rgb => raw387 png::ColorType::Rgb => raw
388- .chunks_exact(3)388+ .as_chunks::<3>()
389+ .0
390+ .iter()
389 .flat_map(|c| [c[0], c[1], c[2], 255])391 .flat_map(|c| [c[0], c[1], c[2], 255])
390 .collect(),392 .collect(),
391 _ => return None,393 _ => return None,
@@ -533,7 +535,7 @@ impl Tree {
533 }535 }
534 536
535 pub fn remove(&mut self, parent: u32, child: u32) {537 pub fn remove(&mut self, parent: u32, child: u32) {
536- if self.slot(child).map_or(true, |n| n.parent != parent) {538+ if self.slot(child).is_none_or(|n| n.parent != parent) {
537 return;539 return;
538 }540 }
539 self.free_node(child);541 self.free_node(child);
@@ -564,7 +566,7 @@ impl Tree {
564 let before = self566 let before = self
565 .slot(parent)567 .slot(parent)
566 .and_then(|p| p.children.iter().position(|&c| c == child))568 .and_then(|p| p.children.iter().position(|&c| c == child))
567- .map_or(false, |i| i < index);569+ .is_some_and(|i| i < index);
568 self.insert_at(parent, child, if before { index - 1 } else { index })570 self.insert_at(parent, child, if before { index - 1 } else { index })
569 }571 }
570 572
modified crates/vidya-core/src/app_icon.rs +1 -1
@@ -112,7 +112,7 @@ fn decode_png_rgba(bytes: &[u8]) -> Result<(u32, u32, Vec<u8>), AppIconError> {
112112 png::ColorType::Rgba => raw.to_vec(),
113113 png::ColorType::Rgb => {
114114 let mut out = Vec::with_capacity((w * h * 4) as usize);
115- for chunk in raw.chunks_exact(3) {
115+ for chunk in raw.as_chunks::<3>().0 {
116116 out.extend_from_slice(&[chunk[0], chunk[1], chunk[2], 255]);
117117 }
118118 out
@@ -112,7 +112,7 @@ fn decode_png_rgba(bytes: &[u8]) -> Result<(u32, u32, Vec<u8>), AppIconError> {
112 png::ColorType::Rgba => raw.to_vec(),112 png::ColorType::Rgba => raw.to_vec(),
113 png::ColorType::Rgb => {113 png::ColorType::Rgb => {
114 let mut out = Vec::with_capacity((w * h * 4) as usize);114 let mut out = Vec::with_capacity((w * h * 4) as usize);
115- for chunk in raw.chunks_exact(3) {115+ for chunk in raw.as_chunks::<3>().0 {
116 out.extend_from_slice(&[chunk[0], chunk[1], chunk[2], 255]);116 out.extend_from_slice(&[chunk[0], chunk[1], chunk[2], 255]);
117 }117 }
118 out118 out
modified crates/vidya-core/src/chrome.rs +3 -1
@@ -19,7 +19,9 @@ use crate::Theme;
1919
2020 /// Temp-data id for app-supplied measured insets (see [`set_system_chrome`]).
2121 const SYSTEM_CHROME_ID: &str = "vidya.system_chrome";
22-/// Last measured nav-band height when the keyboard was hidden.
22+/// Last measured nav-band height when the keyboard was hidden. Only read on
23+/// Android, where the insets come from the activity.
24+#[cfg(target_os = "android")]
2325 const NAV_HINT_ID: &str = "vidya.nav_bottom_hint";
2426
2527 /// Insets for system status / navigation chrome on edge-to-edge surfaces.
@@ -19,7 +19,9 @@ use crate::Theme;
19 19
20 /// Temp-data id for app-supplied measured insets (see [`set_system_chrome`]).20 /// Temp-data id for app-supplied measured insets (see [`set_system_chrome`]).
21 const SYSTEM_CHROME_ID: &str = "vidya.system_chrome";21 const SYSTEM_CHROME_ID: &str = "vidya.system_chrome";
22-/// Last measured nav-band height when the keyboard was hidden.22+/// Last measured nav-band height when the keyboard was hidden. Only read on
23+/// Android, where the insets come from the activity.
24+#[cfg(target_os = "android")]
23 const NAV_HINT_ID: &str = "vidya.nav_bottom_hint";25 const NAV_HINT_ID: &str = "vidya.nav_bottom_hint";
24 26
25 /// Insets for system status / navigation chrome on edge-to-edge surfaces.27 /// Insets for system status / navigation chrome on edge-to-edge surfaces.
modified crates/vidya-core/src/icons.rs +1 -1
@@ -505,7 +505,7 @@ fn decode_png_rgba(bytes: &[u8]) -> Option<ColorImage> {
505505 png::ColorType::Rgba => raw.to_vec(),
506506 png::ColorType::Rgb => {
507507 let mut out = Vec::with_capacity(w * h * 4);
508- for chunk in raw.chunks_exact(3) {
508+ for chunk in raw.as_chunks::<3>().0 {
509509 out.extend_from_slice(&[chunk[0], chunk[1], chunk[2], 255]);
510510 }
511511 out
@@ -505,7 +505,7 @@ fn decode_png_rgba(bytes: &[u8]) -> Option<ColorImage> {
505 png::ColorType::Rgba => raw.to_vec(),505 png::ColorType::Rgba => raw.to_vec(),
506 png::ColorType::Rgb => {506 png::ColorType::Rgb => {
507 let mut out = Vec::with_capacity(w * h * 4);507 let mut out = Vec::with_capacity(w * h * 4);
508- for chunk in raw.chunks_exact(3) {508+ for chunk in raw.as_chunks::<3>().0 {
509 out.extend_from_slice(&[chunk[0], chunk[1], chunk[2], 255]);509 out.extend_from_slice(&[chunk[0], chunk[1], chunk[2], 255]);
510 }510 }
511 out511 out
modified crates/vidya-core/src/layout.rs +2 -4
@@ -97,9 +97,7 @@ pub fn format_bps(bps: f64) -> String {
9797 v /= 1024.0;
9898 i += 1;
9999 }
100- if i == 0 {
101- format!("{v:.0} {}", UNITS[i])
102- } else if v >= 100.0 {
100+ if i == 0 || v >= 100.0 {
103101 format!("{v:.0} {}", UNITS[i])
104102 } else if v >= 10.0 {
105103 format!("{v:.1} {}", UNITS[i])
@@ -225,7 +223,7 @@ pub fn inset_row(ui: &mut Ui, theme: &Theme, add: impl FnOnce(&mut Ui)) -> Inner
225223 ui.set_max_width(outer);
226224 Frame::new()
227225 .fill(theme.palette.popover_bg)
228- .stroke(Stroke::new(1.0, theme.palette.border_soft))
226+ .stroke(Stroke::new(1.0_f32, theme.palette.border_soft))
229227 .corner_radius(theme.spacing.radius_sm)
230228 .inner_margin(Margin::symmetric(
231229 theme.spacing.md as i8,
@@ -97,9 +97,7 @@ pub fn format_bps(bps: f64) -> String {
97 v /= 1024.0;97 v /= 1024.0;
98 i += 1;98 i += 1;
99 }99 }
100- if i == 0 {100+ if i == 0 || v >= 100.0 {
101- format!("{v:.0} {}", UNITS[i])
102- } else if v >= 100.0 {
103 format!("{v:.0} {}", UNITS[i])101 format!("{v:.0} {}", UNITS[i])
104 } else if v >= 10.0 {102 } else if v >= 10.0 {
105 format!("{v:.1} {}", UNITS[i])103 format!("{v:.1} {}", UNITS[i])
@@ -225,7 +223,7 @@ pub fn inset_row(ui: &mut Ui, theme: &Theme, add: impl FnOnce(&mut Ui)) -> Inner
225 ui.set_max_width(outer);223 ui.set_max_width(outer);
226 Frame::new()224 Frame::new()
227 .fill(theme.palette.popover_bg)225 .fill(theme.palette.popover_bg)
228- .stroke(Stroke::new(1.0, theme.palette.border_soft))226+ .stroke(Stroke::new(1.0_f32, theme.palette.border_soft))
229 .corner_radius(theme.spacing.radius_sm)227 .corner_radius(theme.spacing.radius_sm)
230 .inner_margin(Margin::symmetric(228 .inner_margin(Margin::symmetric(
231 theme.spacing.md as i8,229 theme.spacing.md as i8,
modified crates/vidya-core/src/video.rs +5 -2
@@ -9,9 +9,11 @@ use std::sync::Arc;
99 use std::time::Instant;
1010
1111 use egui::{
12- Align2, Color32, ColorImage, CursorIcon, FontId, Pos2, Rect, Sense, Stroke, TextureHandle,
13- TextureOptions, Ui, Vec2,
12+ Align2, Color32, CursorIcon, FontId, Pos2, Rect, Sense, Stroke, TextureHandle, Ui, Vec2,
1413 };
14+// Only the texture upload uses these, and that is behind the same feature.
15+#[cfg(feature = "video")]
16+use egui::{ColorImage, TextureOptions};
1517
1618 use crate::Theme;
1719
@@ -164,6 +166,7 @@ impl VideoPlayerState {
164166 self.content_id = 0;
165167 }
166168
169+ #[cfg(feature = "video")]
167170 fn upload_frame(&mut self, ctx: &egui::Context, w: u32, h: u32, rgba: &[u8]) {
168171 let color = ColorImage::from_rgba_unmultiplied([w as usize, h as usize], rgba);
169172 match &mut self.texture {
@@ -9,9 +9,11 @@ use std::sync::Arc;
9 use std::time::Instant;9 use std::time::Instant;
10 10
11 use egui::{11 use egui::{
12- Align2, Color32, ColorImage, CursorIcon, FontId, Pos2, Rect, Sense, Stroke, TextureHandle,12+ Align2, Color32, CursorIcon, FontId, Pos2, Rect, Sense, Stroke, TextureHandle, Ui, Vec2,
13- TextureOptions, Ui, Vec2,
14 };13 };
14+// Only the texture upload uses these, and that is behind the same feature.
15+#[cfg(feature = "video")]
16+use egui::{ColorImage, TextureOptions};
15 17
16 use crate::Theme;18 use crate::Theme;
17 19
@@ -164,6 +166,7 @@ impl VideoPlayerState {
164 self.content_id = 0;166 self.content_id = 0;
165 }167 }
166 168
169+ #[cfg(feature = "video")]
167 fn upload_frame(&mut self, ctx: &egui::Context, w: u32, h: u32, rgba: &[u8]) {170 fn upload_frame(&mut self, ctx: &egui::Context, w: u32, h: u32, rgba: &[u8]) {
168 let color = ColorImage::from_rgba_unmultiplied([w as usize, h as usize], rgba);171 let color = ColorImage::from_rgba_unmultiplied([w as usize, h as usize], rgba);
169 match &mut self.texture {172 match &mut self.texture {