After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775727 - buffer: add gst_buffer_iterate_meta_filtered() convenience function
buffer: add gst_buffer_iterate_meta_filtered() convenience function
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal enhancement
: 1.11.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-12-06 21:58 UTC by Tim-Philipp Müller
Modified: 2016-12-14 18:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
buffer: add gst_buffer_iterate_meta_filtered() (3.59 KB, patch)
2016-12-06 21:58 UTC, Tim-Philipp Müller
committed Details | Review

Description Tim-Philipp Müller 2016-12-06 21:58:41 UTC
Created attachment 341513 [details] [review]
buffer: add gst_buffer_iterate_meta_filtered()

Pretty much every user of gst_buffer_iterate_meta() filters for a specific api type.

Maybe it should be called iterate_meta_api() instead, dunno.
Comment 1 Sebastian Dröge (slomo) 2016-12-07 10:22:46 UTC
Review of attachment 341513 [details] [review]:

Looks good to me

> Maybe it should be called iterate_meta_api() instead, dunno.

Then it would be iterating over meta APIs, not metas IMHO. iterate_meta_filtered_by_api() could make sense but what else would you filter on?

::: gst/gstbuffer.c
@@ +2279,3 @@
+ * gst_buffer_iterate_meta_filtered:
+ * @buffer: a #GstBuffer
+ * @state: an opaque state pointer

That should probably be marked as "out". Is this usable in bindings without having some non-void typedef instead?
Comment 2 Tim-Philipp Müller 2016-12-07 21:34:32 UTC
> + * gst_buffer_iterate_meta_filtered:
> + * @buffer: a #GstBuffer
> + * @state: an opaque state pointer
> 
> That should probably be marked as "out".

Probably, or (inout).

> Is this usable in bindings without
> having some non-void typedef instead?

No idea, I just copied it from gst_buffer_iterate_meta() :)

I suspect both should just be marked as 'skip' for bindings, bindings can use gst_buffer_meta_foreach().
Comment 3 Tim-Philipp Müller 2016-12-14 15:19:18 UTC
This is not usable in bindings, so I'll just mark it as '(skip)'. Bindings can use the foreach function instead.
Comment 4 Tim-Philipp Müller 2016-12-14 15:26:51 UTC
I also don't think a simple typedef would be enough, you'd have to register a boxed type and implement copy/free funcs and such.
Comment 5 Tim-Philipp Müller 2016-12-14 18:21:26 UTC
commit 3d283665cc7bf8cd64df4ed5c366e464f9c8e41c
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Wed Dec 14 18:19:00 2016 +0000

    tests: meta: add test for gst_buffer_iterate_meta*()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775727

commit ca4ac71555512befd628f9728bbbb0f5c7374d49
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Sat Dec 3 13:05:03 2016 +0000

    buffer: add gst_buffer_iterate_meta_filtered()
    
    For convenience. Pretty much every user of
    gst_buffer_iterate_meta() filters for a specific
    api type.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775727

commit de65b88d13389a7c1e82ac0fdd5ab0195af20215
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Wed Dec 14 15:22:30 2016 +0000

    buffer: mark gst_buffer_iterate_meta() as 'skip' for bindings
    
    The pointer state arg won't work well, bindings can use
    the foreach function instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775727