Allow custom mic inputs
This commit is contained in:
1 parent
9d03821c54
commit
8b6cc4be7a
3 files changed
+7
-3
No files matched your search
+4
-1
@@ -17,10 +17,13 @@ pub struct Opt {
|
||||
/// The path to the audio file.
|
||||
#[structopt(short, long, parse(from_os_str), conflicts_with = "microphone")]
|
||||
pub file_path: Option<PathBuf>,
|
||||
/// Use the microphone as the source. Which microphone depends
|
||||
/// Use the microphone as the source. Defaults to autoaudiosrc - Which microphone depends
|
||||
/// on [gstraemer](https://gstreamer.freedesktop.org/documentation/autodetect/autoaudiosrc.html?gi-language=c#autoaudiosrc-page)
|
||||
#[structopt(short, long, conflicts_with = "file_path")]
|
||||
pub microphone: bool,
|
||||
/// Use a specific microphone like "alsasrc device=hw:1"
|
||||
#[structopt(short, long, default_value = "autoaudiosrc", conflicts_with = "file_path",)]
|
||||
pub input_src: String,
|
||||
/// Use to change the volume of the input
|
||||
#[structopt(short, long, default_value = "1.0")]
|
||||
pub volume: f32,
|
||||
|
||||
+2
-1
@@ -27,8 +27,9 @@ pub(super) fn mic_input(
|
||||
volume: f32,
|
||||
block_align: u16,
|
||||
sample_rate: u16,
|
||||
input_src:&str,
|
||||
) -> Result<Receiver<Vec<u8>>, Error> {
|
||||
let pipeline = create_pipeline("autoaudiosrc", volume, block_align, sample_rate)?;
|
||||
let pipeline = create_pipeline(input_src, volume, block_align, sample_rate)?;
|
||||
input(pipeline)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ pub fn main(opt: Opt) -> Result<(), Error> {
|
||||
block_size,
|
||||
sample_rate,
|
||||
)?,
|
||||
(None, true) => gst::mic_input(opt.volume, block_size, sample_rate)?,
|
||||
(None, true) => gst::mic_input(opt.volume, block_size, sample_rate, &opt.input_src)?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user