Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
cleanup
Brendan Allanfaf48df78fd4
diff --git a/apps/desktop/src-tauri/src/auth.rs b/apps/desktop/src-tauri/src/auth.rsindex 77898cc3e..af03c4f19 100644--- a/apps/desktop/src-tauri/src/auth.rs+++ b/apps/desktop/src-tauri/src/auth.rs@@ -1,7 +1,7 @@use serde::{Deserialize, Serialize};use serde_json::json;use specta::Type;-use tauri::{AppHandle, Manager, Runtime, Wry};+use tauri::{AppHandle, Runtime};use tauri_plugin_store::StoreExt;use web_api::ManagerExt;@@ -27,7 +27,7 @@ impl AuthStore {return Ok(None);};- Ok(serde_json::from_value(store).map_err(|e| e.to_string())?)+ serde_json::from_value(store).map_err(|e| e.to_string())}pub async fn fetch_and_update_plan(app: &AppHandle) -> Result<(), String> {@@ -58,7 +58,7 @@ impl AuthStore {last_checked: chrono::Utc::now().timestamp() as i32,});- let _ = Self::set(app, Some(auth))?;+ Self::set(app, Some(auth))?;Ok(())}diff --git a/apps/desktop/src-tauri/src/capture.rs b/apps/desktop/src-tauri/src/capture.rsdeleted file mode 100644index d546b1f80..000000000--- a/apps/desktop/src-tauri/src/capture.rs+++ /dev/null@@ -1,45 +0,0 @@-use std::{- path::PathBuf,- sync::{- atomic::{AtomicBool, Ordering},- Arc,- },-};--#[derive(Clone)]-pub struct CaptureController {- pub output_path: PathBuf,- is_stopped: Arc<AtomicBool>,- is_paused: Arc<AtomicBool>,-}--impl CaptureController {- pub fn new(output_path: PathBuf) -> Self {- Self {- output_path,- is_stopped: Arc::new(AtomicBool::new(false)),- is_paused: Arc::new(AtomicBool::new(false)),- }- }-- pub fn stop(&self) {- self.is_stopped.store(true, Ordering::Relaxed);- }-- pub fn pause(&mut self) {- println!("setting is_paused to true");- self.is_paused.store(true, Ordering::Relaxed);- }-- pub fn resume(&mut self) {- self.is_paused.store(false, Ordering::Relaxed);- }-- pub fn is_stopped(&self) -> bool {- self.is_stopped.load(Ordering::Relaxed)- }-- pub fn is_paused(&self) -> bool {- self.is_paused.load(Ordering::Relaxed)- }-}diff --git a/apps/desktop/src-tauri/src/encoder.rs b/apps/desktop/src-tauri/src/encoder.rsdeleted file mode 100644index ce16c1a28..000000000--- a/apps/desktop/src-tauri/src/encoder.rs+++ /dev/null@@ -1,285 +0,0 @@-use std::path::PathBuf;--use ffmpeg::{- self as ffmpeg,- format::{self as avformat, context::Output, Pixel},- frame::Video,- Dictionary,-};--macro_rules! dict {- ( $($key:expr => $value:expr),* $(,)*) => ({- let mut dict = ffmpeg::Dictionary::new();-- $(- dict.set($key, $value);- )*-- dict- }- );-}--pub struct H264Encoder {- pub output: ffmpeg::format::context::Output,- pub context: ffmpeg::encoder::Video,- pub stream_index: usize,- pub fps: f64,- pub start_time: Option<u64>,- last_frame: Option<ffmpeg::util::frame::Video>,-}--impl H264Encoder {- pub fn output_format() -> ffmpeg::format::Pixel {- ffmpeg::format::Pixel::YUV420P- }-- pub fn new(path: &PathBuf, width: u32, height: u32, fps: f64) -> Self {- let mut output = ffmpeg::format::output(path).unwrap();- let output_flags = output.format().flags();-- let codec = ffmpeg::encoder::find(ffmpeg::codec::Id::H264).unwrap();-- let mut stream = output.add_stream(codec).unwrap();- let stream_index = stream.index();-- let mut encoder = ffmpeg::codec::context::Context::new_with_codec(codec)- .encoder()- .video()- .unwrap();-- stream.set_parameters(&encoder);- encoder.set_width(width);- encoder.set_height(height);- encoder.set_format(Self::output_format());- encoder.set_frame_rate(Some(fps));- encoder.set_time_base(1.0 / fps);- encoder.set_gop(fps as u32);- encoder.set_max_bit_rate(8000);-- if output_flags.contains(ffmpeg::format::Flags::GLOBAL_HEADER) {- encoder.set_flags(ffmpeg::codec::Flags::GLOBAL_HEADER);- }-- let encoder = encoder- .open_as_with(- codec,- dict!("preset" => "ultrafast", "tune" => "zerolatency"),- )- .unwrap();- stream.set_parameters(&encoder);- stream.set_time_base(1.0 / fps);-- stream.set_metadata(Dictionary::from_iter(vec![("tune", "zerolatency")]));-- output.write_header().unwrap();-- Self {- output,- context: encoder,- stream_index,- start_time: None,- fps,- last_frame: None,- }- }-- pub fn encode_frame(&mut self, mut frame: ffmpeg::util::frame::Video, timestamp: u64) {- let last_frame_pts = self.last_frame.as_ref().and_then(|f| f.pts());-- if let Some(mut last_frame_pts) = last_frame_pts {- let pts = {- let delta_time = if let Some(start_time) = self.start_time {- (timestamp - start_time) as i64- } else {- self.start_time = Some(timestamp);- 0- };-- (delta_time as f64 / (1000.0 / self.fps)).round() as i64- };-- // Drop frames that are too old- if pts <= last_frame_pts {- return;- }-- // Limit the number of frames to duplicate- let max_duplicate_frames = 5;- let frames_to_duplicate = std::cmp::min(pts - last_frame_pts - 1, max_duplicate_frames);-- // Duplicate previous frame if this frame is >1 frame in the future- for _ in 0..frames_to_duplicate {- last_frame_pts += 1;-- if let Some(last_frame) = &mut self.last_frame {- last_frame.set_pts(Some(last_frame_pts));- if let Err(e) = self.context.send_frame(last_frame) {- eprintln!("Error sending duplicate frame: {:?}", e);- break;- }- }-- self.receive_and_process_packets();- }-- frame.set_pts(Some(pts));- } else {- frame.set_pts(Some(0));- }-- if let Err(e) = self.context.send_frame(&frame) {- eprintln!("Error sending frame: {:?}", e);- }- self.last_frame = Some(frame);-- self.receive_and_process_packets();- }-- fn receive_and_process_packets(&mut self) {- let mut encoded = ffmpeg::Packet::empty();- while self.context.receive_packet(&mut encoded).is_ok() {- encoded.set_stream(self.stream_index);- encoded.rescale_ts(- 1.0 / self.fps,- self.output.stream(self.stream_index).unwrap().time_base(),- );-- if let Err(e) = encoded.write_interleaved(&mut self.output) {- eprintln!("Error writing packet: {:?}", e);- break;- }- }- }-- pub fn close(mut self) {- self.context.send_eof().unwrap();-- self.receive_and_process_packets();-- self.output.write_trailer().unwrap();- }-}--pub fn uyvy422_frame(bytes: &[u8], width: u32, height: u32) -> ffmpeg::frame::Video {- let mut frame = ffmpeg::frame::Video::new(ffmpeg::format::Pixel::UYVY422, width, height);-- frame.data_mut(0).copy_from_slice(bytes);-- frame-}--pub fn yuyv422_frame(bytes: &[u8], width: u32, height: u32) -> ffmpeg::frame::Video {- let mut frame = ffmpeg::frame::Video::new(ffmpeg::format::Pixel::YUYV422, width, height);-- frame.data_mut(0).copy_from_slice(bytes);-- frame-}--pub fn nv12_frame(bytes: &[u8], width: u32, height: u32) -> ffmpeg::frame::Video {- let mut frame = ffmpeg::frame::Video::new(ffmpeg::format::Pixel::NV12, width, height);- let y_size = (width * height) as usize;- let uv_size = y_size / 2;-- frame.data_mut(0)[..y_size].copy_from_slice(&bytes[..y_size]);- frame.data_mut(1)[..uv_size].copy_from_slice(&bytes[y_size..y_size + uv_size]);-- frame-}--pub fn bgra_frame(data: &[u8], width: u32, height: u32) -> Option<ffmpeg::frame::Video> {- let expected_size = (width as usize) * (height as usize) * 4; // 4 bytes per pixel for BGRA-- if data.len() != expected_size {- return None;- }-- let mut frame = Video::new(Pixel::BGRA, width, height);-- let frame_linesize = frame.stride(0) as usize;- let bytes_per_pixel = 4; // For BGRA format-- let expected_linesize = (width as usize) * bytes_per_pixel;-- // Copy data line by line considering linesize differences- for (src_row, dst_row) in data- .chunks_exact(expected_linesize)- .zip(frame.data_mut(0).chunks_exact_mut(frame_linesize))- {- dst_row[..expected_linesize].copy_from_slice(src_row);- }-- Some(frame)-}--pub struct MP3Encoder {- pub output: ffmpeg::format::context::Output,- pub context: ffmpeg::encoder::Audio,- pub stream_index: usize,- pub sample_rate: u32,- sample_number: i64,-}--impl MP3Encoder {- pub fn new(path: &PathBuf, sample_rate: u32) -> Self {- dbg!(sample_rate);- let mut output = ffmpeg::format::output(path).unwrap();- let output_flags = output.format().flags();-- let codec = ffmpeg::encoder::find(ffmpeg::codec::Id::MP3).unwrap();- let audio_codec = codec.audio().unwrap();-- let mut stream = output.add_stream(audio_codec).unwrap();- let stream_index = stream.index();-- let mut encoder = ffmpeg::codec::context::Context::new_with_codec(codec)- .encoder()- .audio()- .unwrap();-- stream.set_parameters(&encoder);- encoder.set_rate(sample_rate as i32);- encoder.set_bit_rate(128000);- encoder.set_max_bit_rate(128000);- encoder.set_channel_layout(ffmpeg::ChannelLayout::MONO);- encoder.set_time_base((1, sample_rate as i32));- encoder.set_format(ffmpeg::format::Sample::F32(- ffmpeg::format::sample::Type::Packed,- ));-- if output_flags.contains(ffmpeg::format::Flags::GLOBAL_HEADER) {- encoder.set_flags(ffmpeg::codec::Flags::GLOBAL_HEADER);- }-- let encoder = encoder.open_as(codec).unwrap();- stream.set_parameters(&encoder);- stream.set_time_base((1, sample_rate as i32));-- Self {- output,- context: encoder,- stream_index,- sample_rate,- sample_number: 0,- }- }-- pub fn encode_frame(&mut self, mut frame: ffmpeg::frame::Audio) {- frame.set_pts(Some(self.sample_number as i64));- self.context.send_frame(&frame).unwrap();- self.sample_number += frame.samples() as i64;-- self.receive_and_process_packets();- }-- fn receive_and_process_packets(&mut self) {- let mut encoded = ffmpeg::Packet::empty();- while self.context.receive_packet(&mut encoded).is_ok() {- encoded.set_stream(self.stream_index);- encoded.set_time_base(self.output.stream(self.stream_index).unwrap().time_base());-- encoded.write(&mut self.output).unwrap();- }- }-}diff --git a/apps/desktop/src-tauri/src/general_settings.rs b/apps/desktop/src-tauri/src/general_settings.rsindex 1c5621e27..e92339353 100644--- a/apps/desktop/src-tauri/src/general_settings.rs+++ b/apps/desktop/src-tauri/src/general_settings.rs@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};use serde_json::json;use specta::Type;use std::sync::Mutex;-use tauri::{AppHandle, Manager, Runtime, Wry};+use tauri::{AppHandle, Manager, Wry};use tauri_plugin_store::StoreExt;#[derive(Serialize, Deserialize, Type, Default)]@@ -27,7 +27,7 @@ impl GeneralSettingsStore {return Ok(None);};- Ok(serde_json::from_value(store).map_err(|e| e.to_string())?)+ serde_json::from_value(store).map_err(|e| e.to_string())}pub fn set(app: &AppHandle, settings: Self) -> Result<(), String> {diff --git a/apps/desktop/src-tauri/src/hotkeys.rs b/apps/desktop/src-tauri/src/hotkeys.rsindex 090ad8b4b..b2d8d5f17 100644--- a/apps/desktop/src-tauri/src/hotkeys.rs+++ b/apps/desktop/src-tauri/src/hotkeys.rs@@ -62,7 +62,7 @@ impl HotkeysStore {return Ok(None);};- Ok(serde_json::from_value(store).map_err(|e| e.to_string())?)+ serde_json::from_value(store).map_err(|e| e.to_string())}}diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 7245270e4..d9d122f6e 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -1,8 +1,6 @@mod audio;mod auth;mod camera;-mod capture;-mod encoder;mod flags;mod general_settings;mod hotkeys;@@ -63,7 +61,7 @@ use tokio::{sync::{Mutex, RwLock},time::sleep,};-use upload::{get_s3_config, upload_image, upload_individual_file, upload_video, S3UploadMeta};+use upload::{get_s3_config, upload_image, upload_video, S3UploadMeta};use windows::{CapWindow, CapWindowId};#[derive(specta::Type, Serialize, Deserialize, Clone, Debug)]@@ -148,13 +146,13 @@ impl App {}fn close_occluder_window(&self) {- if let Some(window) = CapWindow::WindowCaptureOccluder.get(&self.handle) {+ if let Some(window) = CapWindowId::WindowCaptureOccluder.get(&self.handle) {window.close().ok();}}async fn set_start_recording_options(&mut self, new_options: RecordingOptions) {- match (CapWindow::Camera { ws_port: 0 }).get(&self.handle) {+ match CapWindowId::Camera.get(&self.handle) {Some(window) if new_options.camera_label.is_none() => {println!("closing camera window");window.close().ok();@@ -173,13 +171,13 @@ impl App {match &new_options.camera_label {Some(camera_label) => {if self.camera_feed.is_none() {- self.camera_feed = CameraFeed::init(&camera_label, self.camera_tx.clone())+ self.camera_feed = CameraFeed::init(camera_label, self.camera_tx.clone()).await.map_err(|error| eprintln!("{error}")).ok();} else if let Some(camera_feed) = self.camera_feed.as_mut() {camera_feed- .switch_cameras(&camera_label)+ .switch_cameras(camera_label).await.map_err(|error| eprintln!("{error}")).ok();@@ -354,11 +352,11 @@ async fn start_recording(app: AppHandle, state: MutableState<'_, App>) -> Result}};- if let Some(window) = CapWindow::Main.get(&app) {+ if let Some(window) = CapWindowId::Main.get(&app) {window.minimize().ok();}- if let Some(window) = (CapWindow::InProgressRecording { position: None }).get(&app) {+ if let Some(window) = CapWindowId::InProgressRecording.get(&app) {window.eval("window.location.reload()").unwrap();window.show().unwrap();} else {@@ -426,11 +424,11 @@ async fn stop_recording(app: AppHandle, state: MutableState<'_, App>) -> Result<let recording = current_recording.stop().await;println!("Recording stopped");- if let Some(window) = (CapWindow::InProgressRecording { position: None }).get(&app) {+ if let Some(window) = CapWindowId::InProgressRecording.get(&app) {window.hide().unwrap();}- if let Some(window) = CapWindow::Main.get(&app) {+ if let Some(window) = CapWindowId::Main.get(&app) {window.unminimize().ok();}@@ -649,7 +647,7 @@ async fn create_screenshot(let width = rgb_frame.width() as usize;let height = rgb_frame.height() as usize;let bytes_per_pixel = 3;- let src_stride = rgb_frame.stride(0) as usize;+ let src_stride = rgb_frame.stride(0);let dst_stride = width * bytes_per_pixel;let mut img_buffer = vec![0u8; height * dst_stride];@@ -1514,7 +1512,7 @@ fn show_previous_recordings_window(app: AppHandle) {let mut ignore = true;- for (_, bounds) in windows {+ for bounds in windows.values() {let x_min = (window_position.x as f64) + bounds.x * scale_factor;let x_max = (window_position.x as f64) + (bounds.x + bounds.width) * scale_factor;let y_min = (window_position.y as f64) + bounds.y * scale_factor;@@ -1551,7 +1549,7 @@ fn open_editor(app: AppHandle, id: String) {#[tauri::command(async)]#[specta::specta]fn close_previous_recordings_window(app: AppHandle) {- if let Ok(panel) = app.get_webview_panel(&CapWindow::PrevRecordings.label()) {+ if let Ok(panel) = app.get_webview_panel(&CapWindowId::PrevRecordings.label()) {panel.released_when_closed(true);panel.close();}@@ -1560,7 +1558,7 @@ fn close_previous_recordings_window(app: AppHandle) {#[tauri::command(async)]#[specta::specta]fn focus_captures_panel(app: AppHandle) {- if let Ok(panel) = app.get_webview_panel(&CapWindow::PrevRecordings.label()) {+ if let Ok(panel) = app.get_webview_panel(&CapWindowId::PrevRecordings.label()) {panel.make_key_window();}}@@ -1951,7 +1949,7 @@ async fn take_screenshot(app: AppHandle, _state: MutableState<'_, App>) -> Resul..Default::default()};- if let Some(window) = CapWindow::Main.get(&app) {+ if let Some(window) = CapWindowId::Main.get(&app) {window.hide().ok();}@@ -1995,7 +1993,7 @@ async fn take_screenshot(app: AppHandle, _state: MutableState<'_, App>) -> Resul// Create file and PNG encoderlet file = File::create(&screenshot_path).map_err(|e| e.to_string())?;- let ref mut w = BufWriter::new(file);+ let w = &mut BufWriter::new(file);let mut encoder = Encoder::new(w, width, height);encoder.set_color(ColorType::Rgba);@@ -2009,7 +2007,7 @@ async fn take_screenshot(app: AppHandle, _state: MutableState<'_, App>) -> ResulAppSounds::Screenshot.play();- if let Some(window) = CapWindow::Main.get(&app) {+ if let Some(window) = CapWindowId::Main.get(&app) {window.show().ok();}@@ -2171,11 +2169,11 @@ fn list_recordings(app: AppHandle) -> Result<Vec<(String, PathBuf, RecordingMetaresult.sort_by(|a, b| {b.1.metadata().and_then(|m| m.created())- .unwrap_or_else(|_| std::time::SystemTime::UNIX_EPOCH)+ .unwrap_or(std::time::SystemTime::UNIX_EPOCH).cmp(&a.1.metadata().and_then(|m| m.created())- .unwrap_or_else(|_| std::time::SystemTime::UNIX_EPOCH),+ .unwrap_or(std::time::SystemTime::UNIX_EPOCH),)});@@ -2213,11 +2211,11 @@ fn list_screenshots(app: AppHandle) -> Result<Vec<(String, PathBuf, RecordingMetresult.sort_by(|a, b| {b.1.metadata().and_then(|m| m.created())- .unwrap_or_else(|_| std::time::SystemTime::UNIX_EPOCH)+ .unwrap_or(std::time::SystemTime::UNIX_EPOCH).cmp(&a.1.metadata().and_then(|m| m.created())- .unwrap_or_else(|_| std::time::SystemTime::UNIX_EPOCH),+ .unwrap_or(std::time::SystemTime::UNIX_EPOCH),)});@@ -2319,7 +2317,7 @@ async fn reset_microphone_permissions(_app: AppHandle) -> Result<(), ()> {#[tauri::command]#[specta::specta]async fn is_camera_window_open(app: AppHandle) -> bool {- CapWindow::Camera { ws_port: 0 }.get(&app).is_some()+ CapWindowId::Camera.get(&app).is_some()}#[tauri::command]@@ -2530,12 +2528,10 @@ pub async fn run() {{eprintln!("Failed to stop recording: {}", e);}- } else {- if let Err(e) =- start_recording(app_handle.clone(), app_handle.state()).await- {- eprintln!("Failed to start recording: {}", e);- }+ } else if let Err(e) =+ start_recording(app_handle.clone(), app_handle.state()).await+ {+ eprintln!("Failed to start recording: {}", e);}});});@@ -2610,13 +2606,13 @@ pub async fn run() {match event {WindowEvent::Destroyed => {- match CapWindow::from_label(label) {- CapWindow::Main => {+ match CapWindowId::from_label(label) {+ CapWindowId::Main => {if let Some(w) = (CapWindow::Camera { ws_port: 0 }).get(app) {w.close().ok();}}- CapWindow::Editor { project_id } => {+ CapWindowId::Editor { project_id } => {let app_handle = app.clone();tokio::spawn(async move {let _ = remove_editor_instance(&app_handle, project_id).await;@@ -2632,7 +2628,7 @@ pub async fn run() {&& app.webview_windows().keys()- .all(|label| !CapWindow::from_label(label).activates_dock())+ .all(|label| !CapWindowId::from_label(label).activates_dock()){#[cfg(target_os = "macos")]app.set_activation_policy(tauri::ActivationPolicy::Accessory)@@ -2641,7 +2637,7 @@ pub async fn run() {}}WindowEvent::Focused(focused) if *focused => {- if CapWindow::from_label(label).activates_dock() {+ if CapWindowId::from_label(label).activates_dock() {#[cfg(target_os = "macos")]app.set_activation_policy(tauri::ActivationPolicy::Regular).ok();@@ -2672,14 +2668,14 @@ pub async fn remove_editor_instance(let mut map = map.lock().await;- let result = if let Some(editor) = map.remove(&video_id) {+++ if let Some(editor) = map.remove(&video_id) {editor.dispose().await;Some(editor)} else {None- };-- result+ }}pub async fn upsert_editor_instance(app: &AppHandle, video_id: String) -> Arc<EditorInstance> {diff --git a/apps/desktop/src-tauri/src/notifications.rs b/apps/desktop/src-tauri/src/notifications.rsindex 24d3b1f6b..7024de2f8 100644--- a/apps/desktop/src-tauri/src/notifications.rs+++ b/apps/desktop/src-tauri/src/notifications.rs@@ -1,6 +1,5 @@-use crate::{general_settings::GeneralSettingsStore, AppSounds, NewNotification};+use crate::{general_settings::GeneralSettingsStore, AppSounds};use tauri_plugin_notification::NotificationExt;-use tauri_specta::Event;pub enum NotificationType {VideoSaved,diff --git a/apps/desktop/src-tauri/src/permissions.rs b/apps/desktop/src-tauri/src/permissions.rsindex 356e8b850..77dcc3d24 100644--- a/apps/desktop/src-tauri/src/permissions.rs+++ b/apps/desktop/src-tauri/src/permissions.rs@@ -148,8 +148,8 @@ pub fn do_permissions_check(initial_check: bool) -> OSPermissionsCheck {microphone: check_av_permission(AVMediaType::Audio),camera: check_av_permission(AVMediaType::Video),accessibility: {- let accessibility_status = check_accessibility_permission();- accessibility_status++ check_accessibility_permission()},}}diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rsindex 4f439278d..e4a1c14d8 100644--- a/apps/desktop/src-tauri/src/recording.rs+++ b/apps/desktop/src-tauri/src/recording.rs@@ -2,7 +2,7 @@ use cap_flags::FLAGS;use cap_media::{encoders::*, feeds::*, filters::*, pipeline::*, sources::*, MediaError};use cap_project::CursorEvent;use cocoa::base::{id, nil};-use cocoa::foundation::{NSData, NSUInteger};+use cocoa::foundation::NSUInteger;use device_query::{DeviceQuery, DeviceState};use serde::Serialize;use specta::Type;@@ -15,7 +15,7 @@ use std::{path::PathBuf, time::Duration};use tokio::sync::{oneshot, Mutex};use objc::rc::autoreleasepool;-use objc::runtime::{Class, Object, Sel, BOOL, YES};+use objc::runtime::Class;use objc::*;use crate::RecordingOptions;@@ -210,7 +210,7 @@ pub async fn start(let screen_source =ScreenCaptureSource::init(dbg!(&recording_options.capture_target), None, None);let screen_config = screen_source.info();- let screen_bounds = screen_source.bounds.clone();+ let screen_bounds = screen_source.bounds;let output_config = screen_config.scaled(1920, 30);let screen_filter = VideoFilter::init("screen", screen_config, output_config)?;@@ -335,7 +335,7 @@ pub async fn start(if mouse_state.button_pressed[0] && !last_mouse_state.button_pressed[0] {let mouse_event = CursorEvent {active_modifiers: vec![],- cursor_id: cursor_id,+ cursor_id,process_time_ms: elapsed,unix_time_ms: unix_time,x: (mouse_state.coords.0 as f64 - screen_bounds.x) / screen_bounds.width,diff --git a/apps/desktop/src-tauri/src/upload.rs b/apps/desktop/src-tauri/src/upload.rsindex 15fdc208e..3917e7fc9 100644--- a/apps/desktop/src-tauri/src/upload.rs+++ b/apps/desktop/src-tauri/src/upload.rs@@ -2,15 +2,12 @@use image::codecs::jpeg::JpegEncoder;use image::ImageReader;-use reqwest::{multipart::Form, Client, StatusCode};+use reqwest::{multipart::Form, StatusCode};use std::path::PathBuf;use tauri::AppHandle;use tokio::task;-use crate::{- auth::AuthStore,- web_api::{self, ManagerExt},-};+use crate::web_api::{self, ManagerExt};use serde::{Deserialize, Serialize};use specta::Type;@@ -159,7 +156,7 @@ pub async fn upload_video(.join("display.jpg");let screenshot_upload = if screenshot_path.exists() {- Some(prepare_screenshot_upload(&app, &s3_config, screenshot_path).await?)+ Some(prepare_screenshot_upload(app, &s3_config, screenshot_path).await?)} else {None};@@ -297,7 +294,7 @@ pub async fn upload_audio(app: &AppHandle, file_path: PathBuf) -> Result<Uploadelet client = reqwest::Client::new();- let s3_config = get_s3_config(&app, false).await?;+ let s3_config = get_s3_config(app, false).await?;let file_key = format!("{}/{}/{}", s3_config.user_id, s3_config.id, file_name);@@ -313,7 +310,7 @@ pub async fn upload_audio(app: &AppHandle, file_path: PathBuf) -> Result<Uploade},)?;- let (upload_url, mut form) = presigned_s3_url_audio(&app, body).await?;+ let (upload_url, mut form) = presigned_s3_url_audio(app, body).await?;let file_content = tokio::fs::read(&file_path).awaitdiff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex b175810cc..6e29d1316 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -1,7 +1,6 @@use std::path::PathBuf;use tauri::{AppHandle, Manager, WebviewUrl, WebviewWindow, WebviewWindowBuilder, Wry};-use wgpu::StencilOperation;pub enum CapWindow {Main,@@ -301,7 +300,9 @@ impl CapWindow {let width = 160.0;let height = 40.0;- let window = self+++ self.window_builder(app, "/in-progress-recording").title(self.title()).maximized(false)@@ -320,9 +321,7 @@ impl CapWindow {(monitor.size().height as f64) / monitor.scale_factor() - height - 120.0,).visible(false)- .build()?;-- window+ .build()?}Self::Notifications => {let window = selfdiff --git a/crates/editor/src/editor_instance.rs b/crates/editor/src/editor_instance.rsindex fcc0bc61a..19a3da1ac 100644--- a/crates/editor/src/editor_instance.rs+++ b/crates/editor/src/editor_instance.rs@@ -263,7 +263,7 @@ impl EditorInstance {tokio::spawn(async move {loop {preview_rx.changed().await.unwrap();- let Some(frame_number) = preview_rx.borrow().deref().clone() else {+ let Some(frame_number) = *preview_rx.borrow().deref() else {continue;};diff --git a/crates/media/src/encoders/h264.rs b/crates/media/src/encoders/h264.rsindex 35079b40f..c54b48ae1 100644--- a/crates/media/src/encoders/h264.rs+++ b/crates/media/src/encoders/h264.rs@@ -21,9 +21,7 @@ pub struct H264Encoder {impl H264Encoder {pub fn init(tag: &'static str, config: VideoInfo, output: Output) -> Result<Self, MediaError> {- let destination = match output {- Output::File(path) => path,- };+ let Output::File(destination) = output;let mut output_ctx = format::output(&destination)?;let (codec, options) = get_codec_and_options(&config)?;diff --git a/crates/media/src/encoders/mp3.rs b/crates/media/src/encoders/mp3.rsindex 356b07726..1ef27ae49 100644--- a/crates/media/src/encoders/mp3.rs+++ b/crates/media/src/encoders/mp3.rs@@ -27,9 +27,7 @@ impl MP3Encoder {const OUTPUT_BITRATE: usize = 128 * 1000; // 128kpub fn init(tag: &'static str, config: AudioInfo, output: Output) -> Result<Self, MediaError> {- let destination = match output {- Output::File(path) => path,- };+ let Output::File(destination) = output;let mut output_ctx = format::output(&destination)?;println!("Sample format: {:#?}", config.sample_format);diff --git a/crates/media/src/feeds/camera.rs b/crates/media/src/feeds/camera.rsindex 406930ddc..a23692e93 100644--- a/crates/media/src/feeds/camera.rs+++ b/crates/media/src/feeds/camera.rs@@ -61,7 +61,7 @@ impl CameraFeed {) -> Result<CameraFeed, MediaError> {println!("Selected camera: {:?}", selected_camera);- let camera_info = find_camera(&selected_camera)?;+ let camera_info = find_camera(selected_camera)?;let (control, control_receiver) = flume::bounded(1);let (video_info, join_handle) =diff --git a/crates/media/src/pipeline/builder.rs b/crates/media/src/pipeline/builder.rsindex 048980395..77f3d4b9a 100644--- a/crates/media/src/pipeline/builder.rs+++ b/crates/media/src/pipeline/builder.rs@@ -88,7 +88,7 @@ impl<T: PipelineClock> PipelineBuilder<T> {// TODO: Shut down tasks if launch failed.for (name, task) in tasks.into_iter() {// TODO: Wait for these in parallel?- let _ = task+ task.ready_signal.recv_async().await@@ -117,7 +117,7 @@ impl<Clock: PipelineClock, PreviousOutput: Send + 'static>pub fn pipe<Output: Send + 'static>(self,name: impl Into<String>,- mut task: impl PipelinePipeTask<Input = PreviousOutput, Output = Output> + Send + 'static,+ mut task: impl PipelinePipeTask<Input = PreviousOutput, Output = Output> + 'static,) -> PipelinePathBuilder<Clock, Output> {let Self {mut pipeline,@@ -139,7 +139,7 @@ impl<Clock: PipelineClock, PreviousOutput: Send + 'static>pub fn sink(self,name: impl Into<String>,- mut task: impl PipelineSinkTask<Input = PreviousOutput> + Send + 'static,+ mut task: impl PipelineSinkTask<Input = PreviousOutput> + 'static,) -> PipelineBuilder<Clock> {let Self {mut pipeline,diff --git a/crates/media/src/pipeline/clock.rs b/crates/media/src/pipeline/clock.rsindex d512c7145..ae885a896 100644--- a/crates/media/src/pipeline/clock.rs+++ b/crates/media/src/pipeline/clock.rs@@ -85,6 +85,12 @@ impl<Source: LocalTimestamp, Target: LocalTimestamp> CloneInto<SynchronisedClock}}+impl<T: LocalTimestamp> Default for SynchronisedClock<T> {+ fn default() -> Self {+ Self::new()+ }+}+impl<T: LocalTimestamp> SynchronisedClock<T> {pub fn init() -> SynchronisedClock<()> {SynchronisedClock::<()>::new()diff --git a/crates/media/src/sources/screen_capture.rs b/crates/media/src/sources/screen_capture.rsindex f69ebb73d..59edbec51 100644--- a/crates/media/src/sources/screen_capture.rs+++ b/crates/media/src/sources/screen_capture.rs@@ -18,7 +18,7 @@ use crate::{platform,};-static EXCLUDED_WINDOWS: [&'static str; 4] = [+static EXCLUDED_WINDOWS: [&str; 4] = ["Cap","Cap Camera","Cap Recordings",@@ -88,8 +88,7 @@ impl ScreenCaptureSource {true}_ => false,- })- .map(|t| t.clone())+ }).cloned().collect();let (crop_area, bounds) = match capture_target {@@ -163,7 +162,7 @@ impl ScreenCaptureSource {for (idx, screen) in screens.into_iter().enumerate() {// Handle Target::Screen variant (assuming this is how it's structured in scap)targets.push(CaptureScreen {- id: screen.id as u32,+ id: screen.id,name: names.get(&screen.raw_handle.id).cloned()@@ -229,7 +228,7 @@ impl PipelineSourceTask for ScreenCaptureSource {};let mut capturer = Capturer::new(dbg!(self.options.clone()));let mut capturing = false;- let _ = ready_signal.send(Ok(())).unwrap();+ ready_signal.send(Ok(())).unwrap();loop {match control_signal.last() {@@ -270,7 +269,7 @@ impl PipelineSourceTask for ScreenCaptureSource {let src_data = &frame.data;let src_stride = src_data.len() / height;- let dst_stride = buffer.stride(0) as usize;+ let dst_stride = buffer.stride(0);if src_data.len() < src_stride * height {eprintln!("Frame data size mismatch.");diff --git a/crates/project/src/cursor.rs b/crates/project/src/cursor.rsindex 9d7f441c5..92996b19d 100644--- a/crates/project/src/cursor.rs+++ b/crates/project/src/cursor.rs@@ -1,5 +1,4 @@use serde::{Deserialize, Serialize};-use serde_json;use specta::Type;use std::collections::HashMap;use std::fs::File;diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rsindex 5f3a2bdd4..1df3af976 100644--- a/crates/rendering/src/lib.rs+++ b/crates/rendering/src/lib.rs@@ -380,7 +380,7 @@ const SCREEN_MAX_PADDING: f64 = 0.4;impl ProjectUniforms {fn get_crop(options: &RenderOptions, project: &ProjectConfiguration) -> Crop {- project.background.crop.clone().unwrap_or(Crop {+ project.background.crop.unwrap_or(Crop {position: XY { x: 0, y: 0 },size: XY {x: options.screen_size.0,@@ -393,7 +393,7 @@ impl ProjectUniforms {let crop = Self::get_crop(options, project);let basis = u32::max(crop.size.x, crop.size.y);- let padding_factor = project.background.padding / 100.0 * SCREEN_MAX_PADDING as f64;+ let padding_factor = project.background.padding / 100.0 * SCREEN_MAX_PADDING;basis as f64 * padding_factor}@@ -488,9 +488,9 @@ impl ProjectUniforms {let target_offset = (output_size - target_size) / 2.0;let start = Coord::new(if is_height_constrained {- XY::new(target_offset.x as f64, padding as f64)+ XY::new(target_offset.x, padding)} else {- XY::new(padding as f64, target_offset.y as f64)+ XY::new(padding, target_offset.y)});let end = Coord::new(output_size) - start;@@ -669,9 +669,9 @@ impl ZoomKeyframes {let t = delta_time / keyframe_length;let t = t.powf(0.5);- let amount = prev.amount + (next.amount - prev.amount) * t;+- amount+ prev.amount + (next.amount - prev.amount) * t}}@@ -1462,7 +1462,7 @@ fn interpolate_cursor_position() -> Option<Coord<RawDisplayUVSpace>> {let time_ms = (time_secs * 1000.0) as f64;- if cursor.moves.len() == 0 {+ if cursor.moves.is_empty() {None} else {let moves = &cursor.moves;