diff --git a/gstreamer/Gir.toml b/gstreamer/Gir.toml index 50963eae1..18c91519b 100644 --- a/gstreamer/Gir.toml +++ b/gstreamer/Gir.toml @@ -32,7 +32,6 @@ generate = [ "Gst.PromiseResult", "Gst.QOSType", "Gst.SchedulingFlags", - "Gst.SerializeFlags", "Gst.StreamStatusType", "Gst.StreamType", "Gst.StructureChangeType", @@ -2153,6 +2152,15 @@ status = "generate" name = "none" ignore = true +[[object]] +name = "Gst.SerializeFlags" +status = "generate" + [[object.member]] + name = "strict" + # Changes nullability of gst_structure_serialize() so moved to a + # separate function instead + ignore = true + [[object]] name = "Gst.StackTraceFlags" status = "generate" diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 61ceec6f8..7a3211913 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -744,6 +744,26 @@ impl StructureRef { unsafe { from_glib_full(ffi::gst_structure_serialize(&self.0, flags.into_glib())) } } + #[cfg(feature = "v1_24")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] + #[doc(alias = "gst_structure_serialize")] + pub fn serialize_strict( + &self, + flags: crate::SerializeFlags, + ) -> Result { + unsafe { + let res = ffi::gst_structure_serialize( + &self.0, + flags.into_glib() | ffi::GST_SERIALIZE_FLAG_STRICT, + ); + if res.is_null() { + Err(glib::bool_error!("Failed to serialize structure to string")) + } else { + Ok(from_glib_full(res)) + } + } + } + #[doc(alias = "gst_structure_foreach")] pub fn foreach std::ops::ControlFlow<()>>( &self,