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 324162 - [API] Add gst_buffer_make_meta_writable or similar
[API] Add gst_buffer_make_meta_writable or similar
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2005-12-15 10:34 UTC by Jan Schmidt
Modified: 2006-01-18 14:47 UTC
See Also:
GNOME target: ---
GNOME version: ---

New API - gst_buffer_is_metadata_writable and gst_buffer_make_metadata_writable (7.64 KB, patch)
2006-01-16 10:03 UTC, Jan Schmidt
none Details | Review

Description Jan Schmidt 2005-12-15 10:34:28 UTC
It is dangerous to do modifications to the metadata of a buffer like:

Because buffers are refcounted, only the creator of a buffer can be sure that
the metadata can be safely modified. One option is to call
gst_buffer_make_writable, but that will copy the data block unnecessarily. 

I'dlike to add a core utility function called something like
gst_buffer_make_meta_writable that will check the refcount on the MiniObject. If
the refcount is 1, then the metadata is modifiable, otherwise create a subbuffer
of the entire contents and return that instead.

This would also remove the ugly bit of code in basetransform that checks the
refcount itself.
Comment 1 Jan Schmidt 2006-01-16 10:03:07 UTC
Created attachment 57460 [details] [review]
New API - gst_buffer_is_metadata_writable and gst_buffer_make_metadata_writable
Comment 2 Jan Schmidt 2006-01-16 10:03:51 UTC
Please review.
Comment 3 Andy Wingo 2006-01-16 14:19:48 UTC
Looks quite fine to me dogs.
Comment 4 Jan Schmidt 2006-01-16 14:36:14 UTC
        Reviewed By: Andy Wingo

        * gst/gstbuffer.c: (gst_buffer_is_metadata_writable),
        * gst/gstbuffer.h:
          Add gst_buffer_(is|make)_metadata_writable as analogues of

        * libs/gst/base/gstbasetransform.c:
        * plugins/elements/gstcapsfilter.c: (gst_capsfilter_prepare_buf):
          Use name gst_buffer_(is|make)_metadata_writable functions.

        * tests/check/gst/gstbuffer.c: (GST_START_TEST), (gst_test_suite):
          Test gst_buffer_(is|make)_metadata_writable

          (Closes: #324162)
Comment 5 Jan Schmidt 2006-01-16 15:25:02 UTC
Re-opening until after core release tonight.
Comment 6 Jan Schmidt 2006-01-18 14:47:27 UTC
Re-committed after 0.10.2