Remove buggy video formats

This commit is contained in:
ochibani 2022-10-14 19:37:25 +02:00
parent 835e4660da
commit 3428d6dd35
5 changed files with 19 additions and 18 deletions

View File

@ -73,7 +73,7 @@ impl Ffmpeg {
height: u16, height: u16,
) -> (Option<u32>, Option<u32>) { ) -> (Option<u32>, Option<u32>) {
if self.video_process_id.is_some() || self.audio_process_id.is_some() { if self.video_process_id.is_some() || self.audio_process_id.is_some() {
self.stop_record(); //self.stop_record();
} }
self.saved_filename = Some( self.saved_filename = Some(
@ -88,14 +88,15 @@ impl Ffmpeg {
} else { } else {
self.filename.1.text().to_string().trim().to_string() self.filename.1.text().to_string().trim().to_string()
}, },
self.filename.2.active_id().unwrap()))) self.filename.2.active_id().unwrap()
)))
.as_path() .as_path()
.display() .display()
.to_string(), .to_string(),
); );
let is_file_already_exists = 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(); .exists();
if is_file_already_exists { if is_file_already_exists {
@ -122,7 +123,7 @@ impl Ffmpeg {
ffmpeg_command.arg("-f"); ffmpeg_command.arg("-f");
ffmpeg_command.arg("pulse"); ffmpeg_command.arg("pulse");
ffmpeg_command.arg("-i"); 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("-f");
ffmpeg_command.arg("ogg"); ffmpeg_command.arg("ogg");
ffmpeg_command.arg(format!( ffmpeg_command.arg(format!(
@ -221,8 +222,7 @@ impl Ffmpeg {
) )
.exists(); .exists();
if is_video_record {
if is_video_record {
let mut move_command = Command::new("mv"); let mut move_command = Command::new("mv");
move_command.arg(format!( move_command.arg(format!(
"{}{}", "{}{}",
@ -311,7 +311,7 @@ impl Ffmpeg {
self.progress_widget.set_progress( self.progress_widget.set_progress(
"execute custom command after finish".to_string(), "execute custom command after finish".to_string(),
5, 5,
6 6,
); );
Exec::shell(self.command.text().trim()).popen().unwrap(); Exec::shell(self.command.text().trim()).popen().unwrap();
} }
@ -320,7 +320,6 @@ impl Ffmpeg {
.progress_widget .progress_widget
.set_progress("Finish".to_string(), 6, 6); .set_progress("Finish".to_string(), 6, 6);
self.progress_widget.hide(); self.progress_widget.hide();
} }
pub fn play_record(self) { pub fn play_record(self) {
@ -334,7 +333,7 @@ impl Ffmpeg {
.unwrap(); .unwrap();
} else { } else {
Command::new("xdg-open") Command::new("xdg-open")
.arg(self.saved_filename.as_ref().unwrap()) .arg(self.saved_filename.unwrap())
.spawn() .spawn()
.unwrap(); .unwrap();
} }
@ -343,5 +342,5 @@ impl Ffmpeg {
} }
fn is_snap() -> bool { fn is_snap() -> bool {
std::env::var("SNAP").unwrap_or_default().is_empty() !std::env::var("SNAP").unwrap_or_default().is_empty()
} }

2
src/indicator.rs Normal file
View File

@ -0,0 +1,2 @@
// TODO: add timer
// https://docs.rs/stray/0.1.1/stray/index.html

View File

@ -111,16 +111,16 @@ pub fn build_ui(application: &Application) {
command_entry.set_text(&config_management::get("default", "command")); command_entry.set_text(&config_management::get("default", "command"));
// CheckBox // 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("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( format_chooser_combobox.append(
Some("mkv"), Some("mkv"),
&gettext("MKV (Matroska multimedia container format)"), &gettext("MKV (Matroska multimedia container format)"),
); );
format_chooser_combobox.append(Some("avi"), &gettext("AVI (Audio Video Interleaved)")); //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("wmv"), &gettext("WMV (Windows Media Video)"));
format_chooser_combobox.append(Some("nut"), &gettext("NUT (NUT Recording Format)")); //format_chooser_combobox.append(Some("nut"), &gettext("NUT (NUT Recording Format)"));
format_chooser_combobox.set_active(Some(0)); format_chooser_combobox.set_active(Some(0));
// get audio sources // get audio sources
@ -376,7 +376,6 @@ pub fn build_ui(application: &Application) {
})); }));
let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone();
let mut _area_capture = area_capture.clone();
let _stop_button = stop_button.clone(); let _stop_button = stop_button.clone();
let _record_button = record_button.clone(); let _record_button = record_button.clone();
record_button.connect_clicked(move |_| { record_button.connect_clicked(move |_| {
@ -405,9 +404,8 @@ pub fn build_ui(application: &Application) {
let _stop_button = stop_button.clone(); let _stop_button = stop_button.clone();
let _play_button = play_button.clone(); let _play_button = play_button.clone();
stop_button.connect_clicked(move |_| { stop_button.connect_clicked(move |_| {
let _record_button = record_button.clone();
_ffmpeg_record_interface.borrow_mut().clone().stop_record(); _ffmpeg_record_interface.borrow_mut().clone().stop_record();
_record_button.show(); record_button.show();
_stop_button.hide(); _stop_button.hide();
_play_button.show(); _play_button.show();
}); });

1
src/timer.rs Normal file
View File

@ -0,0 +1 @@
// TODO: add timer

1
src/waylan_interface.rs Normal file
View File

@ -0,0 +1 @@
// TODO: add wayland screen record support