From 38f3d3eff2ea8267cf5afc5419ebf4d5622573c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 26 Jun 2019 12:41:47 +0300 Subject: [PATCH] video-info: Use gst_video_info_set_interlaced_format() when building for 1.16 and having an interlace-mode set This ensures that the plane information is filled correctly. --- gstreamer-video/src/video_info.rs | 42 +++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index ddec7ec6b..4b19f4645 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -271,21 +271,43 @@ impl<'a> VideoInfoBuilder<'a> { unsafe { let mut info = mem::uninitialized(); - gst_video_sys::gst_video_info_set_format( - &mut info, - self.format.to_glib(), - self.width, - self.height, - ); + #[cfg(not(feature = "v1_16"))] + { + gst_video_sys::gst_video_info_set_format( + &mut info, + self.format.to_glib(), + self.width, + self.height, + ); + + if let Some(interlace_mode) = self.interlace_mode { + info.interlace_mode = interlace_mode.to_glib(); + } + } + #[cfg(feature = "v1_16")] + { + if let Some(interlace_mode) = self.interlace_mode { + gst_video_sys::gst_video_info_set_interlaced_format( + &mut info, + self.format.to_glib(), + interlace_mode.to_glib(), + self.width, + self.height, + ); + } else { + gst_video_sys::gst_video_info_set_format( + &mut info, + self.format.to_glib(), + self.width, + self.height, + ); + } + } if info.finfo.is_null() || info.width <= 0 || info.height <= 0 { return None; } - if let Some(interlace_mode) = self.interlace_mode { - info.interlace_mode = interlace_mode.to_glib(); - } - if let Some(flags) = self.flags { info.flags = flags.to_glib(); }