remove last unwraps
This commit is contained in:
parent
57cc94cd14
commit
dfd96f3781
@ -1,5 +1,4 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use tracing::Instrument;
|
|
||||||
|
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
|
@ -228,10 +228,22 @@ fn filter_graph(
|
|||||||
decoder.channel_layout().bits()
|
decoder.channel_layout().bits()
|
||||||
);
|
);
|
||||||
|
|
||||||
filter.add(&filter::find("abuffer").unwrap(), "in", &args)?;
|
let abuffer_filter = match filter::find("abuffer") {
|
||||||
filter.add(&filter::find("abuffersink").unwrap(), "out", "")?;
|
Some(filter) => filter,
|
||||||
|
None => return Err(ffmpeg::Error::Unknown),
|
||||||
|
};
|
||||||
|
filter.add(&abuffer_filter, "in", &args)?;
|
||||||
|
|
||||||
let mut out = filter.get("out").unwrap();
|
let abuffersink_filter = match filter::find("abuffersink") {
|
||||||
|
Some(filter) => filter,
|
||||||
|
None => return Err(ffmpeg::Error::Unknown),
|
||||||
|
};
|
||||||
|
filter.add(&abuffersink_filter, "out", "")?;
|
||||||
|
|
||||||
|
let mut out = match filter.get("out") {
|
||||||
|
Some(filter) => filter,
|
||||||
|
None => return Err(ffmpeg::Error::Unknown),
|
||||||
|
};
|
||||||
out.set_sample_format(encoder.format());
|
out.set_sample_format(encoder.format());
|
||||||
out.set_channel_layout(encoder.channel_layout());
|
out.set_channel_layout(encoder.channel_layout());
|
||||||
out.set_sample_rate(encoder.rate());
|
out.set_sample_rate(encoder.rate());
|
||||||
@ -244,11 +256,11 @@ fn filter_graph(
|
|||||||
.capabilities()
|
.capabilities()
|
||||||
.contains(codec::capabilities::Capabilities::VARIABLE_FRAME_SIZE)
|
.contains(codec::capabilities::Capabilities::VARIABLE_FRAME_SIZE)
|
||||||
{
|
{
|
||||||
filter
|
if let Some(mut out_filter) = filter.get("out") {
|
||||||
.get("out")
|
out_filter
|
||||||
.unwrap()
|
.sink()
|
||||||
.sink()
|
.set_frame_size(encoder.frame_size());
|
||||||
.set_frame_size(encoder.frame_size());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user