Unify mic and file input source in talk
Update talk sources to use new input format Quick fix to input sources
This commit is contained in:
1 parent
8b6cc4be7a
commit
5ca8eae8f4
2 files changed
+5
-20
No files matched your search
+2
-17
@@ -8,26 +8,11 @@ use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
|
||||
use super::errors::Error;
|
||||
use byte_slice_cast::*;
|
||||
|
||||
pub(super) fn file_input(
|
||||
filename: &str,
|
||||
pub(super) fn from_input(
|
||||
input_src: &str,
|
||||
volume: f32,
|
||||
block_align: u16,
|
||||
sample_rate: u16,
|
||||
) -> Result<Receiver<Vec<u8>>, Error> {
|
||||
let pipeline = create_pipeline(
|
||||
&format!("filesrc location={}", filename),
|
||||
volume,
|
||||
block_align,
|
||||
sample_rate,
|
||||
)?;
|
||||
input(pipeline)
|
||||
}
|
||||
|
||||
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(input_src, volume, block_align, sample_rate)?;
|
||||
input(pipeline)
|
||||
|
||||
+3
-3
@@ -79,13 +79,13 @@ pub fn main(opt: Opt) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
let rx = match (&opt.file_path, &opt.microphone) {
|
||||
(Some(path), false) => gst::file_input(
|
||||
path.to_str().expect("File path not UTF8 complient"),
|
||||
(Some(path), false) => gst::from_input(
|
||||
&format!("filesrc location={}", path.to_str().expect("File path not UTF8 complient")),
|
||||
opt.volume,
|
||||
block_size,
|
||||
sample_rate,
|
||||
)?,
|
||||
(None, true) => gst::mic_input(opt.volume, block_size, sample_rate, &opt.input_src)?,
|
||||
(None, true) => gst::from_input(&opt.input_src, opt.volume, block_size, sample_rate)?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user