fix cargo check/fmt

This commit is contained in:
jazzfool 2025-02-13 12:36:45 +11:00
parent 841a6412d5
commit 054ab37976
2 changed files with 4 additions and 12 deletions

View file

@ -1,3 +1,4 @@
use crate::video::Frame;
use iced_wgpu::primitive::Primitive; use iced_wgpu::primitive::Primitive;
use iced_wgpu::wgpu; use iced_wgpu::wgpu;
use std::{ use std::{
@ -9,8 +10,6 @@ use std::{
}, },
}; };
use crate::video::Frame;
#[repr(C)] #[repr(C)]
struct Uniforms { struct Uniforms {
rect: [f32; 4], rect: [f32; 4],

View file

@ -45,17 +45,10 @@ impl From<u64> for Position {
pub(crate) struct Frame(gst::Sample); pub(crate) struct Frame(gst::Sample);
impl Frame { impl Frame {
pub fn new() -> Self { pub fn empty() -> Self {
Self(gst::Sample::builder().build()) Self(gst::Sample::builder().build())
} }
pub fn store(&mut self, sample: gst::Sample) -> Option<()> {
if sample.buffer().is_some() {
self.0 = sample;
Some(())
} else {
None
}
}
pub fn readable(&self) -> Option<gst::BufferMap<gst::buffer::Readable>> { pub fn readable(&self) -> Option<gst::BufferMap<gst::buffer::Readable>> {
self.0.buffer().map(|x| x.map_readable().ok()).flatten() self.0.buffer().map(|x| x.map_readable().ok()).flatten()
} }
@ -312,7 +305,7 @@ impl Video {
let sync_av = pipeline.has_property("av-offset", None); let sync_av = pipeline.has_property("av-offset", None);
// NV12 = 12bpp // NV12 = 12bpp
let frame = Arc::new(Mutex::new(Frame::new())); let frame = Arc::new(Mutex::new(Frame::empty()));
let upload_frame = Arc::new(AtomicBool::new(false)); let upload_frame = Arc::new(AtomicBool::new(false));
let alive = Arc::new(AtomicBool::new(true)); let alive = Arc::new(AtomicBool::new(true));
let last_frame_time = Arc::new(Mutex::new(Instant::now())); let last_frame_time = Arc::new(Mutex::new(Instant::now()));