mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2025-04-03 08:14:55 +03:00
fix audio record
This commit is contained in:
parent
f3c3366a3c
commit
f0b101852c
72
Cargo.lock
generated
72
Cargo.lock
generated
@ -106,7 +106,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -285,7 +285,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -347,7 +347,7 @@ checksum = "1b1244b10dcd56c92219da4e14caa97e312079e185f04ba3eea25061561dc0a0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -421,7 +421,7 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"shlex",
|
"shlex",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -987,7 +987,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1080,7 +1080,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1262,7 +1262,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1370,7 +1370,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2126,7 +2126,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2216,7 +2216,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2692,7 +2692,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2742,7 +2742,7 @@ dependencies = [
|
|||||||
"proc-macro-crate 3.2.0",
|
"proc-macro-crate 3.2.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2794,9 +2794,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "open"
|
name = "open"
|
||||||
version = "5.3.1"
|
version = "5.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3ecd52f0b8d15c40ce4820aa251ed5de032e5d91fab27f7db2f40d42a8bdf69c"
|
checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"is-wsl",
|
"is-wsl",
|
||||||
"libc",
|
"libc",
|
||||||
@ -2826,7 +2826,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3086,7 +3086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
|
checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3541,7 +3541,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3564,7 +3564,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3752,9 +3752,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.94"
|
version = "2.0.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "987bc0be1cdea8b10216bd06e2ca407d40b9543468fafd3ddfb02f36e77f71f3"
|
checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -3778,7 +3778,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3867,7 +3867,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4039,7 +4039,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4235,7 +4235,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -4270,7 +4270,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
@ -4511,7 +4511,7 @@ checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4522,7 +4522,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4533,7 +4533,7 @@ checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4544,7 +4544,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4915,7 +4915,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5001,7 +5001,7 @@ dependencies = [
|
|||||||
"proc-macro-crate 3.2.0",
|
"proc-macro-crate 3.2.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
"zvariant_utils",
|
"zvariant_utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5034,7 +5034,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5054,7 +5054,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5083,7 +5083,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5158,7 +5158,7 @@ dependencies = [
|
|||||||
"proc-macro-crate 3.2.0",
|
"proc-macro-crate 3.2.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
"zvariant_utils",
|
"zvariant_utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5170,5 +5170,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.94",
|
"syn 2.0.95",
|
||||||
]
|
]
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
|
#[cfg(feature = "gtk")]
|
||||||
use adw::gtk::{CheckButton, ComboBoxText, Entry, FileChooserNative, SpinButton};
|
use adw::gtk::{CheckButton, ComboBoxText, Entry, FileChooserNative, SpinButton};
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
use adw::gtk::prelude::*;
|
use adw::gtk::prelude::*;
|
||||||
use anyhow::{anyhow, Error, Result};
|
use anyhow::{anyhow, Error, Result};
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use ffmpeg_sidecar::child::FfmpegChild;
|
use ffmpeg_sidecar::child::FfmpegChild;
|
||||||
use ffmpeg_sidecar::command::FfmpegCommand;
|
use ffmpeg_sidecar::command::FfmpegCommand;
|
||||||
use tempfile;
|
use tempfile;
|
||||||
use std::{cell::RefCell, time::Instant};
|
use std::{cell::RefCell, time::Instant};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -453,6 +458,9 @@ impl Ffmpeg {
|
|||||||
|
|
||||||
// Start video recording
|
// Start video recording
|
||||||
pub fn start_video(&mut self, x: u16, y: u16, width: u16, height: u16, mode: RecordMode) -> Result<()> {
|
pub fn start_video(&mut self, x: u16, y: u16, width: u16, height: u16, mode: RecordMode) -> Result<()> {
|
||||||
|
//if mode == RecordMode::Window && !self.follow_mouse.is_active() { //REVIEW //TODO
|
||||||
|
// pulse = gstreamer for video && add to cmd linux + add convert function to gstreamer ouput
|
||||||
|
//} else {}
|
||||||
let display = format!("{}+{},{}",
|
let display = format!("{}+{},{}",
|
||||||
std::env::var("DISPLAY").unwrap_or_else(|_| ":0".to_string())
|
std::env::var("DISPLAY").unwrap_or_else(|_| ":0".to_string())
|
||||||
.as_str(),
|
.as_str(),
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
|
#[cfg(feature = "gtk")]
|
||||||
use adw::gtk::{CheckButton, ComboBoxText, Entry, FileChooserNative, SpinButton};
|
use adw::gtk::{CheckButton, ComboBoxText, Entry, FileChooserNative, SpinButton};
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
use adw::gtk::prelude::*;
|
use adw::gtk::prelude::*;
|
||||||
use anyhow::{anyhow, Error, Result};
|
use anyhow::{anyhow, Error, Result};
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use ffmpeg_sidecar::child::FfmpegChild;
|
use ffmpeg_sidecar::child::FfmpegChild;
|
||||||
use ffmpeg_sidecar::command::FfmpegCommand;
|
use ffmpeg_sidecar::command::FfmpegCommand;
|
||||||
use tempfile;
|
use tempfile;
|
||||||
use std::{cell::RefCell, time::Instant};
|
use std::{cell::RefCell, time::Instant};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -105,6 +105,38 @@ pub fn is_wayland() -> bool {
|
|||||||
.eq_ignore_ascii_case("wayland")
|
.eq_ignore_ascii_case("wayland")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get audio output source
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
|
pub fn audio_output_source() -> Result<String> {
|
||||||
|
// Get the default sink
|
||||||
|
let default_sink_output = Command::new("pactl")
|
||||||
|
.arg("get-default-sink")
|
||||||
|
.output()?;
|
||||||
|
|
||||||
|
let default_sink = String::from_utf8_lossy(&default_sink_output.stdout)
|
||||||
|
.trim()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
// List sinks and filter for the monitor of the default sink
|
||||||
|
let sinks_output = Command::new("pactl")
|
||||||
|
.arg("list")
|
||||||
|
.arg("sinks")
|
||||||
|
.output()?;
|
||||||
|
|
||||||
|
let sinks = String::from_utf8_lossy(&sinks_output.stdout);
|
||||||
|
let monitor_line = sinks
|
||||||
|
.lines()
|
||||||
|
.find(|line| line.contains(&format!("{}.monitor", default_sink)))
|
||||||
|
.unwrap_or("");
|
||||||
|
|
||||||
|
// Extract the part after the colon
|
||||||
|
let output_source = monitor_line.split(':')
|
||||||
|
.nth(1)
|
||||||
|
.unwrap_or("")
|
||||||
|
.trim().to_string();
|
||||||
|
Ok(output_source)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gtk")]
|
#[cfg(feature = "gtk")]
|
||||||
// Play recorded file
|
// Play recorded file
|
||||||
pub fn play_record(file_name: &str) -> Result<()> {
|
pub fn play_record(file_name: &str) -> Result<()> {
|
||||||
@ -118,3 +150,34 @@ pub fn play_record(file_name: &str) -> Result<()> {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "gtk")]
|
||||||
|
// Get audio input source list
|
||||||
|
pub fn sources_descriptions_list() -> Result<Vec<String>> {
|
||||||
|
let sources_descriptions: Vec<String> = {
|
||||||
|
let list_sources_child = std::process::Command::new("pactl")
|
||||||
|
.args(["list", "sources"])
|
||||||
|
.stdout(std::process::Stdio::piped())
|
||||||
|
.spawn();
|
||||||
|
let sources_descriptions = String::from_utf8(if let Ok(..) = list_sources_child {
|
||||||
|
std::process::Command::new("grep")
|
||||||
|
.args(["-e", "device.description"])
|
||||||
|
.stdin(list_sources_child?.stdout.take()
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("Failed to get audio input source descriptions."))?)
|
||||||
|
.output()?
|
||||||
|
.stdout
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
})?;
|
||||||
|
sources_descriptions
|
||||||
|
.split('\n')
|
||||||
|
.map(|s| {
|
||||||
|
s.trim()
|
||||||
|
.replace("device.description = ", "")
|
||||||
|
.replace('\"', "")
|
||||||
|
})
|
||||||
|
.filter(|s| !s.is_empty())
|
||||||
|
.collect()
|
||||||
|
};
|
||||||
|
Ok(sources_descriptions)
|
||||||
|
}
|
||||||
|
@ -7,7 +7,6 @@ edition = "2021"
|
|||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||||
blue-recorder-core = { path = "../core", features = ["gtk"] }
|
blue-recorder-core = { path = "../core", features = ["gtk"] }
|
||||||
cpal = "0.15.3"
|
|
||||||
dark-light = "1.0.0"
|
dark-light = "1.0.0"
|
||||||
dirs = "4.0.0"
|
dirs = "4.0.0"
|
||||||
fluent-bundle = "0.15.3"
|
fluent-bundle = "0.15.3"
|
||||||
@ -19,6 +18,7 @@ secfmt = "0.1.1"
|
|||||||
|
|
||||||
# Windows-only dependency
|
# Windows-only dependency
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
cpal = "0.15.3"
|
||||||
display-info = "0.5.1"
|
display-info = "0.5.1"
|
||||||
winapi = { version = "0.3", features = ["winuser"] }
|
winapi = { version = "0.3", features = ["winuser"] }
|
||||||
x-win = "2.0.2"
|
x-win = "2.0.2"
|
||||||
|
@ -8,8 +8,9 @@ use anyhow::Result;
|
|||||||
use blue_recorder_core::ffmpeg_linux::Ffmpeg;
|
use blue_recorder_core::ffmpeg_linux::Ffmpeg;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use blue_recorder_core::ffmpeg_windows::Ffmpeg;
|
use blue_recorder_core::ffmpeg_windows::Ffmpeg;
|
||||||
use blue_recorder_core::utils::{disable_input_widgets, enable_input_widgets,
|
use blue_recorder_core::utils::{audio_output_source, disable_input_widgets, enable_input_widgets,
|
||||||
is_overwrite, is_wayland, play_record, RecordMode};
|
is_overwrite, is_wayland, play_record, RecordMode, sources_descriptions_list};
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
use cpal::traits::{DeviceTrait, HostTrait};
|
use cpal::traits::{DeviceTrait, HostTrait};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
@ -57,6 +58,7 @@ pub fn run_ui(application: &Application) {
|
|||||||
|
|
||||||
fn build_ui(application: &Application, error_dialog: MessageDialog, error_message: TextView) -> Result<()> {
|
fn build_ui(application: &Application, error_dialog: MessageDialog, error_message: TextView) -> Result<()> {
|
||||||
// Init audio source
|
// Init audio source
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
let host_audio_device = cpal::default_host();
|
let host_audio_device = cpal::default_host();
|
||||||
|
|
||||||
// Config initialize
|
// Config initialize
|
||||||
@ -186,16 +188,23 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
|||||||
format_chooser_combobox.set_active(Some(config_management::get("default", "format").parse::<u32>().unwrap_or(0u32)));
|
format_chooser_combobox.set_active(Some(config_management::get("default", "format").parse::<u32>().unwrap_or(0u32)));
|
||||||
|
|
||||||
// Get audio sources
|
// Get audio sources
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
{
|
||||||
let input_device = host_audio_device.input_devices()?;
|
let input_device = host_audio_device.input_devices()?;
|
||||||
let sources_descriptions: Vec<String> = input_device
|
let sources_descriptions: Vec<String> = input_device
|
||||||
.filter_map(|device| device.name().ok())
|
.filter_map(|device| device.name().ok())
|
||||||
.collect();
|
.collect();
|
||||||
let host_output_device = host_audio_device.default_output_device();
|
let host_output_device = host_audio_device.default_output_device();
|
||||||
let output_device = if host_output_device.is_some() {
|
let audio_output_source = if host_output_device.is_some() {
|
||||||
host_output_device.unwrap().name()?
|
host_output_device.unwrap().name()?
|
||||||
} else {
|
} else {
|
||||||
String::new()
|
String::new()
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
#[cfg(any(target_os = "freebsd", target_os = "linux"))]
|
||||||
|
let sources_descriptions: Vec<String> = sources_descriptions_list().unwrap_or_else(|_| Vec::new());
|
||||||
|
#[cfg(any(target_os = "freebsd", target_os = "linux"))]
|
||||||
|
let audio_output_source: String = audio_output_source().unwrap_or_else(|_| String::new());
|
||||||
|
|
||||||
audio_source_combobox.append(Some("default"), &get_bundle("audio-input", None));
|
audio_source_combobox.append(Some("default"), &get_bundle("audio-input", None));
|
||||||
for (id, audio_source) in sources_descriptions.iter().enumerate() {
|
for (id, audio_source) in sources_descriptions.iter().enumerate() {
|
||||||
@ -686,7 +695,6 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
|||||||
filename_entry.clone().into(),
|
filename_entry.clone().into(),
|
||||||
folder_chooser_button.clone().into(),
|
folder_chooser_button.clone().into(),
|
||||||
format_chooser_combobox.clone().into(),
|
format_chooser_combobox.clone().into(),
|
||||||
area_grab_button.clone().into(),
|
|
||||||
screen_grab_button.clone().into(),
|
screen_grab_button.clone().into(),
|
||||||
window_grab_button.clone().into(),
|
window_grab_button.clone().into(),
|
||||||
video_switch.clone().into(),
|
video_switch.clone().into(),
|
||||||
@ -708,6 +716,11 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
|||||||
command_label.clone().into(),
|
command_label.clone().into(),
|
||||||
command_entry.clone().into()
|
command_entry.clone().into()
|
||||||
];
|
];
|
||||||
|
// Temporary solution
|
||||||
|
if !is_wayland() {
|
||||||
|
// Keep area_selection disaled in wayland
|
||||||
|
input_widgets.push(area_grab_button.clone().into());
|
||||||
|
}
|
||||||
|
|
||||||
// Disable show area check button
|
// Disable show area check button
|
||||||
if !area_grab_button.is_active() {
|
if !area_grab_button.is_active() {
|
||||||
@ -718,7 +731,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
|||||||
|
|
||||||
// Record struct values
|
// Record struct values
|
||||||
let audio_output_id = if audio_output_switch.is_active() {
|
let audio_output_id = if audio_output_switch.is_active() {
|
||||||
output_device
|
audio_output_source
|
||||||
} else {
|
} else {
|
||||||
String::new()
|
String::new()
|
||||||
};
|
};
|
||||||
@ -855,7 +868,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
|||||||
second_click.clone(),
|
second_click.clone(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if _delay_spin.value() as u16 == 0 && !is_wayland() {
|
} else if _delay_spin.value() as u16 == 0 {
|
||||||
let _area_capture = area_capture.borrow_mut();
|
let _area_capture = area_capture.borrow_mut();
|
||||||
disable_input_widgets(_input_widgets.clone());
|
disable_input_widgets(_input_widgets.clone());
|
||||||
start_timer(record_time_label.clone());
|
start_timer(record_time_label.clone());
|
||||||
@ -898,7 +911,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _video_switch.is_active() {
|
if _video_switch.is_active() && !is_wayland() {
|
||||||
match _ffmpeg_record_interface.borrow_mut().start_video(
|
match _ffmpeg_record_interface.borrow_mut().start_video(
|
||||||
_area_capture.x,
|
_area_capture.x,
|
||||||
_area_capture.y,
|
_area_capture.y,
|
||||||
|
Loading…
Reference in New Issue
Block a user