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.
This commit is contained in:
Sebastian Dröge 2019-06-26 12:41:47 +03:00
parent 5da8ead7c9
commit 369d195e9f

View file

@ -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();
}