From 3428d6dd35404ea302c329b3fa5a48556c996d55 Mon Sep 17 00:00:00 2001 From: ochibani <11yzyv86j@relay.firefox.com> Date: Fri, 14 Oct 2022 19:37:25 +0200 Subject: [PATCH] Remove buggy video formats --- src/ffmpeg_interface.rs | 19 +++++++++---------- src/indicator.rs | 2 ++ src/main.rs | 14 ++++++-------- src/timer.rs | 1 + src/waylan_interface.rs | 1 + 5 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 src/indicator.rs create mode 100644 src/timer.rs create mode 100644 src/waylan_interface.rs diff --git a/src/ffmpeg_interface.rs b/src/ffmpeg_interface.rs index 51db477..9b90b78 100644 --- a/src/ffmpeg_interface.rs +++ b/src/ffmpeg_interface.rs @@ -73,7 +73,7 @@ impl Ffmpeg { height: u16, ) -> (Option, Option) { if self.video_process_id.is_some() || self.audio_process_id.is_some() { - self.stop_record(); + //self.stop_record(); } self.saved_filename = Some( @@ -88,14 +88,15 @@ impl Ffmpeg { } else { self.filename.1.text().to_string().trim().to_string() }, - self.filename.2.active_id().unwrap()))) + self.filename.2.active_id().unwrap() + ))) .as_path() .display() .to_string(), ); let is_file_already_exists = - std::path::Path::new(self.saved_filename.clone().unwrap().as_str()) + std::path::Path::new(&self.saved_filename.clone().unwrap()) .exists(); if is_file_already_exists { @@ -122,7 +123,7 @@ impl Ffmpeg { ffmpeg_command.arg("-f"); ffmpeg_command.arg("pulse"); ffmpeg_command.arg("-i"); - ffmpeg_command.arg(self.audio_id.active_id().unwrap()); + ffmpeg_command.arg(&self.audio_id.active_id().unwrap()); ffmpeg_command.arg("-f"); ffmpeg_command.arg("ogg"); ffmpeg_command.arg(format!( @@ -221,8 +222,7 @@ impl Ffmpeg { ) .exists(); - - if is_video_record { + if is_video_record { let mut move_command = Command::new("mv"); move_command.arg(format!( "{}{}", @@ -311,7 +311,7 @@ impl Ffmpeg { self.progress_widget.set_progress( "execute custom command after finish".to_string(), 5, - 6 + 6, ); Exec::shell(self.command.text().trim()).popen().unwrap(); } @@ -320,7 +320,6 @@ impl Ffmpeg { .progress_widget .set_progress("Finish".to_string(), 6, 6); self.progress_widget.hide(); - } pub fn play_record(self) { @@ -334,7 +333,7 @@ impl Ffmpeg { .unwrap(); } else { Command::new("xdg-open") - .arg(self.saved_filename.as_ref().unwrap()) + .arg(self.saved_filename.unwrap()) .spawn() .unwrap(); } @@ -343,5 +342,5 @@ impl Ffmpeg { } fn is_snap() -> bool { - std::env::var("SNAP").unwrap_or_default().is_empty() + !std::env::var("SNAP").unwrap_or_default().is_empty() } diff --git a/src/indicator.rs b/src/indicator.rs new file mode 100644 index 0000000..2a71c9f --- /dev/null +++ b/src/indicator.rs @@ -0,0 +1,2 @@ +// TODO: add timer +// https://docs.rs/stray/0.1.1/stray/index.html diff --git a/src/main.rs b/src/main.rs index e9345fe..65e0ca4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,16 +111,16 @@ pub fn build_ui(application: &Application) { command_entry.set_text(&config_management::get("default", "command")); // CheckBox - format_chooser_combobox.append(Some("webm"), &gettext("WEBM (Open Web Media File)")); + //format_chooser_combobox.append(Some("webm"), &gettext("WEBM (Open Web Media File)")); format_chooser_combobox.append(Some("mp4"), &gettext("MP4 (MPEG-4 Part 14)")); - format_chooser_combobox.append(Some("gif"), &gettext("GIF (Graphics Interchange Format)")); + //format_chooser_combobox.append(Some("gif"), &gettext("GIF (Graphics Interchange Format)")); format_chooser_combobox.append( Some("mkv"), &gettext("MKV (Matroska multimedia container format)"), ); - format_chooser_combobox.append(Some("avi"), &gettext("AVI (Audio Video Interleaved)")); - format_chooser_combobox.append(Some("wmv"), &gettext("WMV (Windows Media Video)")); - format_chooser_combobox.append(Some("nut"), &gettext("NUT (NUT Recording Format)")); + //format_chooser_combobox.append(Some("avi"), &gettext("AVI (Audio Video Interleaved)")); + //format_chooser_combobox.append(Some("wmv"), &gettext("WMV (Windows Media Video)")); + //format_chooser_combobox.append(Some("nut"), &gettext("NUT (NUT Recording Format)")); format_chooser_combobox.set_active(Some(0)); // get audio sources @@ -376,7 +376,6 @@ pub fn build_ui(application: &Application) { })); let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); - let mut _area_capture = area_capture.clone(); let _stop_button = stop_button.clone(); let _record_button = record_button.clone(); record_button.connect_clicked(move |_| { @@ -405,9 +404,8 @@ pub fn build_ui(application: &Application) { let _stop_button = stop_button.clone(); let _play_button = play_button.clone(); stop_button.connect_clicked(move |_| { - let _record_button = record_button.clone(); _ffmpeg_record_interface.borrow_mut().clone().stop_record(); - _record_button.show(); + record_button.show(); _stop_button.hide(); _play_button.show(); }); diff --git a/src/timer.rs b/src/timer.rs new file mode 100644 index 0000000..e6d2789 --- /dev/null +++ b/src/timer.rs @@ -0,0 +1 @@ +// TODO: add timer diff --git a/src/waylan_interface.rs b/src/waylan_interface.rs new file mode 100644 index 0000000..da53f84 --- /dev/null +++ b/src/waylan_interface.rs @@ -0,0 +1 @@ +// TODO: add wayland screen record support