From bf6669a9cba50e57ebd674b07afa3c198da17971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 20 Apr 2021 10:22:14 +0300 Subject: [PATCH] gstreamer: Add TagList::remove() for removing tags Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/327 --- gstreamer/src/tags.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index b3e8bff00..0df77be9b 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -419,6 +419,18 @@ impl TagListRef { Ok(()) } + pub fn remove<'a, T: Tag<'a>>(&mut self) { + self.remove_generic(T::tag_name()); + } + + pub fn remove_generic(&mut self, tag_name: &str) { + unsafe { + let tag_name = tag_name.to_glib_none(); + + ffi::gst_tag_list_remove_tag(self.as_mut_ptr(), tag_name.0); + } + } + pub fn get<'a, T: Tag<'a>>(&self) -> Option> { self.get_generic(T::tag_name()).map(|value| { if !value.is::() {