mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 11:31:06 +00:00
gstreamer: Don't try removing locked metas from buffers
And return success from the `remove()` function.
This commit is contained in:
parent
df36a7c57a
commit
a2e22416fe
1 changed files with 8 additions and 2 deletions
|
@ -257,13 +257,19 @@ impl<'a, T, U> MetaRefMut<'a, T, U> {
|
|||
|
||||
impl<'a, T> MetaRefMut<'a, T, Standalone> {
|
||||
#[doc(alias = "gst_buffer_remove_meta")]
|
||||
pub fn remove(self) {
|
||||
pub fn remove(self) -> Result<(), glib::BoolError> {
|
||||
if self.flags().contains(crate::MetaFlags::LOCKED) {
|
||||
return Err(glib::bool_error!("Can't remove locked meta"));
|
||||
}
|
||||
|
||||
unsafe {
|
||||
let res = ffi::gst_buffer_remove_meta(
|
||||
self.buffer.as_mut_ptr(),
|
||||
self.meta as *mut T as *mut ffi::GstMeta,
|
||||
);
|
||||
assert_ne!(res, glib::ffi::GFALSE);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -733,7 +739,7 @@ mod tests {
|
|||
unsafe {
|
||||
assert_eq!(meta.parent().as_ptr(), parent.as_ptr());
|
||||
}
|
||||
meta.remove();
|
||||
meta.remove().unwrap();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue