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 629831 - [API] add gst_structure_take_value() and gst_structure_id_take_value()
[API] add gst_structure_take_value() and gst_structure_id_take_value()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.10.31
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-16 09:56 UTC by Tim-Philipp Müller
Modified: 2010-09-16 18:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
structure: add gst_structure_{id_}take_value() (4.98 KB, patch)
2010-09-16 09:56 UTC, Tim-Philipp Müller
committed Details | Review
query: gst_query_add_buffering_range() optimisations (1.54 KB, patch)
2010-09-16 09:58 UTC, Tim-Philipp Müller
committed Details | Review

Description Tim-Philipp Müller 2010-09-16 09:56:18 UTC
Created attachment 170404 [details] [review]
structure: add gst_structure_{id_}take_value()

I propose to add some API to GstStructure that takes ownership of the GValue passed to it instead of copying it.

This is useful for setting structure fields to types that aren't refcounted and where a full copy will always be done otherwise (e.g. GValueArray, strings, string arrays etc.).
Comment 1 Tim-Philipp Müller 2010-09-16 09:58:43 UTC
Created attachment 170405 [details] [review]
query: gst_query_add_buffering_range() optimisations

Example patch that uses this new API:

    query: gst_query_add_buffering_range() optimisations
    
    Don't create a new GValueArray copy for every single _add_buffering_range()
    call, but append to the existing value array owned by the structure instead.
Comment 2 Sebastian Dröge (slomo) 2010-09-16 10:02:54 UTC
Yes, that's also a good idea for nested GstStructures for example.
Comment 3 Tim-Philipp Müller 2010-09-16 18:44:31 UTC
commit 7e5a9580ef2614111ba20e1c473df2fb02be1ef7
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Wed Sep 15 23:42:43 2010 +0100

    structure: add gst_structure_{id_}take_value()
    
    Add _set_value() variants that take ownership of the value passed
    instead of making a copy of the value. This is useful for setting
    values to things that aren't refcounted (e.g. GValueArrays or
    strings or string arrays, etc.).
    
    API: gst_structure_take_value()
    API: gst_structure_id_take_value()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=629831