mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 13:31:00 +00:00
Fix audio plugins build after gstreamer-rs!376
AudioInfo::from_caps() now returns a Result.
This commit is contained in:
parent
23ed11e52f
commit
0f99994d9e
4 changed files with 9 additions and 10 deletions
|
@ -295,11 +295,8 @@ impl BaseTransformImpl for AudioEcho {
|
|||
));
|
||||
}
|
||||
|
||||
let info = match gst_audio::AudioInfo::from_caps(incaps) {
|
||||
None => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
|
||||
Some(info) => info,
|
||||
};
|
||||
|
||||
let info = gst_audio::AudioInfo::from_caps(incaps)
|
||||
.or(Err(gst_loggable_error!(CAT, "Failed to parse input caps")))?;
|
||||
let max_delay = self.settings.lock().unwrap().max_delay;
|
||||
let size = max_delay * (info.rate() as u64) / gst::SECOND_VAL;
|
||||
let buffer_size = size * (info.channels() as u64);
|
||||
|
|
|
@ -573,7 +573,7 @@ impl AggregatorImpl for FallbackSwitch {
|
|||
let audio_info;
|
||||
let video_info;
|
||||
if caps.get_structure(0).unwrap().get_name() == "audio/x-raw" {
|
||||
audio_info = gst_audio::AudioInfo::from_caps(&caps);
|
||||
audio_info = gst_audio::AudioInfo::from_caps(&caps).ok();
|
||||
video_info = None;
|
||||
} else if caps.get_structure(0).unwrap().get_name() == "video/x-raw" {
|
||||
audio_info = None;
|
||||
|
|
|
@ -1161,7 +1161,7 @@ impl ToggleRecord {
|
|||
let caps = c.get_caps();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
if s.get_name().starts_with("audio/") {
|
||||
state.audio_info = gst_audio::AudioInfo::from_caps(caps);
|
||||
state.audio_info = gst_audio::AudioInfo::from_caps(caps).ok();
|
||||
gst_log!(CAT, obj: pad, "Got audio caps {:?}", state.audio_info);
|
||||
state.video_info = None;
|
||||
} else if s.get_name().starts_with("video/") {
|
||||
|
|
|
@ -443,9 +443,11 @@ impl BaseSrcImpl for SineSrc {
|
|||
) -> Result<(), gst::LoggableError> {
|
||||
use std::f64::consts::PI;
|
||||
|
||||
let info = gst_audio::AudioInfo::from_caps(caps).ok_or_else(|| {
|
||||
gst_loggable_error!(CAT, "Failed to build `AudioInfo` from caps {}", caps)
|
||||
})?;
|
||||
let info = gst_audio::AudioInfo::from_caps(caps).or(Err(gst_loggable_error!(
|
||||
CAT,
|
||||
"Failed to build `AudioInfo` from caps {}",
|
||||
caps
|
||||
)))?;
|
||||
|
||||
gst_debug!(CAT, obj: element, "Configuring for caps {}", caps);
|
||||
|
||||
|
|
Loading…
Reference in a new issue