Fix video plugins build after gstreamer-rs!377

VideoInfo::from_caps() now returns a Result.
This commit is contained in:
Sebastian Dröge 2019-12-15 10:51:12 +02:00
parent 0f99994d9e
commit 064cc827a3
3 changed files with 9 additions and 7 deletions

View file

@ -577,7 +577,7 @@ impl AggregatorImpl for FallbackSwitch {
video_info = None;
} else if caps.get_structure(0).unwrap().get_name() == "video/x-raw" {
audio_info = None;
video_info = gst_video::VideoInfo::from_caps(&caps);
video_info = gst_video::VideoInfo::from_caps(&caps).ok();
} else {
audio_info = None;
video_info = None;

View file

@ -1166,7 +1166,7 @@ impl ToggleRecord {
state.video_info = None;
} else if s.get_name().starts_with("video/") {
state.audio_info = None;
state.video_info = gst_video::VideoInfo::from_caps(caps);
state.video_info = gst_video::VideoInfo::from_caps(caps).ok();
gst_log!(CAT, obj: pad, "Got video caps {:?}", state.video_info);
} else {
state.audio_info = None;

View file

@ -366,7 +366,9 @@ impl BaseTransformImpl for Rgb2Gray {
// to the given caps. This is used for allocating a big enough output buffer and
// sanity checking the input buffer size, among other things.
fn get_unit_size(&self, _element: &gst_base::BaseTransform, caps: &gst::Caps) -> Option<usize> {
gst_video::VideoInfo::from_caps(caps).map(|info| info.size())
gst_video::VideoInfo::from_caps(caps)
.map(|info| info.size())
.ok()
}
// Called whenever the input/output caps are changing, i.e. in the very beginning before data
@ -382,12 +384,12 @@ impl BaseTransformImpl for Rgb2Gray {
outcaps: &gst::Caps,
) -> Result<(), gst::LoggableError> {
let in_info = match gst_video::VideoInfo::from_caps(incaps) {
None => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
Some(info) => info,
Err(_) => return Err(gst_loggable_error!(CAT, "Failed to parse input caps")),
Ok(info) => info,
};
let out_info = match gst_video::VideoInfo::from_caps(outcaps) {
None => return Err(gst_loggable_error!(CAT, "Failed to parse output caps")),
Some(info) => info,
Err(_) => return Err(gst_loggable_error!(CAT, "Failed to parse output caps")),
Ok(info) => info,
};
gst_debug!(