mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
structure: Manually bind GST_SERIALIZE_FLAG_STRICT
As the flag changes the nullability of `gst_structure_serialize()` and adding a new C function is apparently too much of a hassle for C developers, add a new `serialize_strict()` function here that always sets this flag and can fail. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1368>
This commit is contained in:
parent
0533160d94
commit
003ebbdf1c
2 changed files with 29 additions and 1 deletions
|
@ -32,7 +32,6 @@ generate = [
|
||||||
"Gst.PromiseResult",
|
"Gst.PromiseResult",
|
||||||
"Gst.QOSType",
|
"Gst.QOSType",
|
||||||
"Gst.SchedulingFlags",
|
"Gst.SchedulingFlags",
|
||||||
"Gst.SerializeFlags",
|
|
||||||
"Gst.StreamStatusType",
|
"Gst.StreamStatusType",
|
||||||
"Gst.StreamType",
|
"Gst.StreamType",
|
||||||
"Gst.StructureChangeType",
|
"Gst.StructureChangeType",
|
||||||
|
@ -2153,6 +2152,15 @@ status = "generate"
|
||||||
name = "none"
|
name = "none"
|
||||||
ignore = true
|
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]]
|
[[object]]
|
||||||
name = "Gst.StackTraceFlags"
|
name = "Gst.StackTraceFlags"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -744,6 +744,26 @@ impl StructureRef {
|
||||||
unsafe { from_glib_full(ffi::gst_structure_serialize(&self.0, flags.into_glib())) }
|
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<glib::GString, glib::BoolError> {
|
||||||
|
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")]
|
#[doc(alias = "gst_structure_foreach")]
|
||||||
pub fn foreach<F: FnMut(glib::Quark, &glib::Value) -> std::ops::ControlFlow<()>>(
|
pub fn foreach<F: FnMut(glib::Quark, &glib::Value) -> std::ops::ControlFlow<()>>(
|
||||||
&self,
|
&self,
|
||||||
|
|
Loading…
Reference in a new issue