feat: Add keybinds to minimal example

This commit is contained in:
uttarayan21
2025-12-25 21:43:55 +05:30
parent a2491695b3
commit 4ed15c97f0
13 changed files with 156 additions and 113 deletions

View File

@@ -9,7 +9,7 @@ pub struct VideoFrame {
pub id: id::Id,
pub size: wgpu::Extent3d,
pub ready: Arc<AtomicBool>,
pub frame: Arc<Mutex<gst::app::Sample>>,
pub frame: Arc<Mutex<gst::Sample>>,
}
impl iced_wgpu::Primitive for VideoFrame {
@@ -97,7 +97,6 @@ impl iced_wgpu::Primitive for VideoFrame {
video.bind_group = new_bind_group;
}
if video.ready.load(std::sync::atomic::Ordering::SeqCst) {
let now = std::time::Instant::now();
let frame = self.frame.lock().expect("BUG: Mutex poisoned");
let buffer = frame
.buffer()
@@ -110,7 +109,6 @@ impl iced_wgpu::Primitive for VideoFrame {
video
.ready
.store(false, std::sync::atomic::Ordering::SeqCst);
tracing::info!("{:?} Taken to write to surface texture", now.elapsed());
}
}
@@ -148,12 +146,7 @@ impl iced_wgpu::Primitive for VideoFrame {
view: target,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {
r: 0.1,
g: 0.2,
b: 0.3,
a: 1.0,
}),
load: wgpu::LoadOp::Load,
store: wgpu::StoreOp::Store,
},
depth_slice: None,