▾ modified crates/jolt-moq/src/android_camera.rs +14 -0 Viewed
@@ -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 15 //! Android Camera2 → MoQ video publish bridge. 2 16 //! 3 17 //! 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 and 17 //! Java `CameraCapture` (in APK `classes.dex`) opens Camera2 / ImageReader and
▾ modified crates/jolt-moq/src/av.rs +14 -0 Viewed
@@ -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 15 //! Call state and framing for the freeq AV media plane. 2 16 //! 3 17 //! 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. The 17 //! Extracted from sleek, which reached this by calling Rust from Rust. The
▾ modified crates/jolt-moq/src/nv12_orient.rs +14 -0 Viewed
@@ -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 15 //! Rotate NV12 frames so Camera2 sensor buffers appear upright. 2 16 //! 3 17 //! 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 delivers 17 //! Phone sensors are usually mounted at 90°/270°. ImageReader delivers
▾ modified crates/jolt-moq/src/v4l2cam.rs +14 -0 Viewed
@@ -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 15 //! Minimal V4L2 MMAP camera capture with a **correct `dqbuf`**. 2 16 //! 3 17 //! `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 drivers 17 //! `v4l2r`'s `ioctl::dqbuf` leaves `v4l2_buffer.memory = 0`. Real UVC drivers
▾ modified crates/jolt-tui/src/tests.rs +1 -1 Viewed
@@ -137,7 +137,7 @@ fn a_checkbutton_writes_its_new_state_back_as_well_as_reporting_it() { 137 137 vec! [ ( check , " toggled " . into ( ) , String ::new ( ) , 1.0 ) ] 138 138 ) ; 139 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 141 ui . frame ( ) ; 142 142 assert_eq! ( ui . screen . line ( 0 ) , " [x] live " ) ; 143 143 }
@@ -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/lib.rs +3 -0 Viewed
@@ -895,6 +895,9 @@ fn open_url(url: &str) -> bool { 895 895 /// browses the filesystem itself, which is what a desktop has anyway. 896 896 /// 897 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 901 #[ no_mangle ] 899 902 pub unsafe extern " C " fn vidya_pick_image ( ) -> c_int { 900 903 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 Viewed
@@ -385,7 +385,9 @@ fn decode_png_rgba(bytes: &[u8]) -> Option<egui::ColorImage> { 385 385 let rgba: Vec<u8> = match info.color_type { 386 386 png::ColorType::Rgba => raw.to_vec(), 387 387 png::ColorType::Rgb => raw 388 - .chunks_exact(3) 388 + .as_chunks::<3>() 389 + .0 390 + .iter() 389 391 .flat_map(|c| [c[0], c[1], c[2], 255]) 390 392 .collect(), 391 393 _ => return None, @@ -533,7 +535,7 @@ impl Tree { 533 535 } 534 536 535 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 539 return; 538 540 } 539 541 self.free_node(child); @@ -564,7 +566,7 @@ impl Tree { 564 566 let before = self 565 567 .slot(parent) 566 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 570 self.insert_at(parent, child, if before { index - 1 } else { index }) 569 571 } 570 572
@@ -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 => raw 387 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 = self 566 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 Viewed
@@ -112,7 +112,7 @@ fn decode_png_rgba(bytes: &[u8]) -> Result<(u32, u32, Vec<u8>), AppIconError> { 112 112 png ::ColorType ::Rgba = > raw . to_vec ( ) , 113 113 png ::ColorType ::Rgb = > { 114 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 116 out . extend_from_slice ( & [ chunk [ 0 ] , chunk [ 1 ] , chunk [ 2 ] , 255 ] ) ; 117 117 } 118 118 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 out 118 out
▾ modified crates/vidya-core/src/icons.rs +1 -1 Viewed
@@ -505,7 +505,7 @@ fn decode_png_rgba(bytes: &[u8]) -> Option<ColorImage> { 505 505 png ::ColorType ::Rgba = > raw . to_vec ( ) , 506 506 png ::ColorType ::Rgb = > { 507 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 509 out . extend_from_slice ( & [ chunk [ 0 ] , chunk [ 1 ] , chunk [ 2 ] , 255 ] ) ; 510 510 } 511 511 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 out 511 out
▾ modified crates/vidya-core/src/layout.rs +2 -4 Viewed
@@ -97,9 +97,7 @@ pub fn format_bps(bps: f64) -> String { 97 97 v / = 1024.0 ; 98 98 i + = 1 ; 99 99 } 100 - if i = = 0 { 101 - format! ( " {v:.0} {} " , UNITS [ i ] ) 102 - } else if v > = 100.0 { 100 + if i = = 0 | | v > = 100.0 { 103 101 format! ( " {v:.0} {} " , UNITS [ i ] ) 104 102 } else if v > = 10.0 { 105 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 223 ui . set_max_width ( outer ) ; 226 224 Frame ::new ( ) 227 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 227 . corner_radius ( theme . spacing . radius_sm ) 230 228 . inner_margin ( Margin ::symmetric ( 231 229 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 Viewed
@@ -9,9 +9,11 @@ use std::sync::Arc; 9 9 use std ::time ::Instant ; 10 10 11 11 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 , 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 18 use crate ::Theme ; 17 19 @@ -164,6 +166,7 @@ impl VideoPlayerState { 164 166 self . content_id = 0 ; 165 167 } 166 168 169 + #[ cfg(feature = " video " ) ] 167 170 fn upload_frame ( & mut self , ctx : & egui ::Context , w : u32 , h : u32 , rgba : & [ u8 ] ) { 168 171 let color = ColorImage ::from_rgba_unmultiplied ( [ w as usize , h as usize ] , rgba ) ; 169 172 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 {