From 982c64800ba5ea7db14ad790c478a5879667baa7 Mon Sep 17 00:00:00 2001 From: ochibani <11yzyv86j@relay.firefox.com> Date: Mon, 27 Jan 2025 18:48:18 +0200 Subject: [PATCH] update ffmpeg_window --- core/src/ffmpeg_windows.rs | 12 +++++++----- gui/src/ui.rs | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/core/src/ffmpeg_windows.rs b/core/src/ffmpeg_windows.rs index 26f8dfa..1f3d207 100644 --- a/core/src/ffmpeg_windows.rs +++ b/core/src/ffmpeg_windows.rs @@ -628,13 +628,11 @@ impl Ffmpeg { ffmpeg_command.format("dshow") .input(format!("audio=\"{}\"", &self.audio_input_id.active_text() .ok_or_else(|| anyhow!("Failed to get audio input source."))?) - ) - .format("ogg"); + ); if self.audio_output_switch.is_active() { ffmpeg_command.format("dshow") .input(&self.audio_output_id); } - ffmpeg_command.format("ogg"); // Disable bitrate if value is zero if self.audio_record_bitrate.value() as u16 > 0 { @@ -646,6 +644,8 @@ impl Ffmpeg { // Remove metadate ffmpeg_command.args(["-map_metadata", "-1"]); + + // Output ffmpeg_command.arg(&self.saved_filename); ffmpeg_command.overwrite(); @@ -685,10 +685,12 @@ impl Ffmpeg { pub fn start_output_audio(&mut self) -> Result<()> { let mut ffmpeg_command = FfmpegCommand::new(); ffmpeg_command.format("dshow") - .input(format!("audio=\"{}\"", &self.audio_output_id)) - .format("ogg"); + .input(format!("audio=\"{}\"", &self.audio_output_id)); + // Remove metadate ffmpeg_command.args(["-map_metadata", "-1"]); + + // Output ffmpeg_command.arg(&self.saved_filename); ffmpeg_command.overwrite(); diff --git a/gui/src/ui.rs b/gui/src/ui.rs index 6cdba78..b7a4689 100644 --- a/gui/src/ui.rs +++ b/gui/src/ui.rs @@ -872,7 +872,9 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag } enable_input_widgets(_input_widgets.clone()); _record_button.show(); + _record_time_label.set_visible(false); _stop_button.hide(); + stop_timer(_record_time_label.clone()); let text_buffer = TextBuffer::new(None); text_buffer.set_text(&format!("{}", error)); _error_message.set_buffer(Some(&text_buffer)); @@ -917,8 +919,8 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag #[cfg(target_os = "windows")] let _window_title = window_title.borrow_mut(); disable_input_widgets(_input_widgets.clone()); - start_timer(record_time_label.clone()); - record_time_label.set_visible(true); + start_timer(_record_time_label.clone()); + _record_time_label.set_visible(true); if hide_switch.is_active() { _main_window.minimize(); } @@ -941,7 +943,9 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag } enable_input_widgets(_input_widgets.clone()); _record_button.show(); + _record_time_label.set_visible(false); _stop_button.hide(); + stop_timer(_record_time_label.clone()); let text_buffer = TextBuffer::new(None); text_buffer.set_text(&format!("{}", error)); _error_message.set_buffer(Some(&text_buffer)); @@ -965,7 +969,9 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag } enable_input_widgets(_input_widgets.clone()); _record_button.show(); + _record_time_label.set_visible(false); _stop_button.hide(); + stop_timer(_record_time_label.clone()); let text_buffer = TextBuffer::new(None); text_buffer.set_text(&format!("{}", error)); _error_message.set_buffer(Some(&text_buffer)); @@ -1006,7 +1012,9 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag } enable_input_widgets(_input_widgets.clone()); _record_button.show(); + _record_time_label.set_visible(false); _stop_button.hide(); + stop_timer(_record_time_label.clone()); let text_buffer = TextBuffer::new(None); text_buffer.set_text(&format!("{}", error)); _error_message.set_buffer(Some(&text_buffer)); @@ -1037,8 +1045,8 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag stop_button.connect_clicked(move |_| { _spinner_window.show(); let mut show_play = true; - _record_time_label.set_visible(false); - stop_timer(_record_time_label.clone()); + record_time_label.set_visible(false); + stop_timer(record_time_label.clone()); if _audio_input_switch.is_active() && !_video_switch.is_active() { match _ffmpeg_record_interface.borrow_mut().stop_input_audio() { Ok(_) => {