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 586568 - [bytereader] add misc. string functions and gst_byte_reader_dup_data()
[bytereader] add misc. string functions and gst_byte_reader_dup_data()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.10.24
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-06-21 20:30 UTC by Tim-Philipp Müller
Modified: 2009-06-23 01:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bytereader: add a bunch of utility functions for strings and a data dup function (12.47 KB, patch)
2009-06-21 20:32 UTC, Tim-Philipp Müller
none Details | Review

Description Tim-Philipp Müller 2009-06-21 20:30:42 UTC
I'd like to add the following functions to GstByteReader:

    bytereader: add a bunch of utility functions for strings and a data dup function
    
    API: gst_byte_reader_dup_data
    API: gst_byte_reader_skip_string
    API: gst_byte_reader_skip_string_utf8
    API: gst_byte_reader_skip_string_utf16
    API: gst_byte_reader_skip_string_utf32
    API: gst_byte_reader_peek_string
    API: gst_byte_reader_peek_string_utf8
    API: gst_byte_reader_peek_string_utf16
    API: gst_byte_reader_peek_string_utf32

They're useful for tag/chunk/atom parsing (making sure that theres's actually a full 0-terminated string in the byte reader).
Comment 1 Sebastian Dröge (slomo) 2009-06-21 20:32:24 UTC
Sounds like a very good idea to me, go for it! :)
Comment 2 Tim-Philipp Müller 2009-06-21 20:32:49 UTC
Created attachment 137137 [details] [review]
bytereader: add a bunch of utility functions for strings and a data dup function

(Note: the patch also moves gst_byte_reader_get_data() up to where its gtk-doc chunk is, hence the stuff at the beginning)
Comment 3 Sebastian Dröge (slomo) 2009-06-22 05:58:35 UTC
Looks good, but what about get_string() and dup_string() variants? :)
Comment 4 Tim-Philipp Müller 2009-06-22 09:42:29 UTC
Hrm, I'm wondering about whether providing _peek() and _get() functions for utf16/utf32 is really a good idea - might that not cause problems with alignment? Maybe we should only provide dup functions for these?
Comment 5 Sebastian Dröge (slomo) 2009-06-22 10:14:28 UTC
Oh right, yes... then only dup functions would be the best, assuming that normally UTF16/32 is handled by accessing the 16/32 bit integers directly and not byte based.
Comment 6 Tim-Philipp Müller 2009-06-23 01:21:19 UTC
commit 6b64d419373e3dcf6f243826410091cd589b2a75
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Fri May 22 14:47:33 2009 +0100

    bytereader: add a bunch of utility functions for strings and a data dup function
    
    API: gst_byte_reader_dup_data
    API: gst_byte_reader_dup_string
    API: gst_byte_reader_dup_string_utf8
    API: gst_byte_reader_dup_string_utf16
    API: gst_byte_reader_dup_string_utf32
    API: gst_byte_reader_skip_string
    API: gst_byte_reader_skip_string_utf8
    API: gst_byte_reader_skip_string_utf16
    API: gst_byte_reader_skip_string_utf32
    API: gst_byte_reader_peek_string
    API: gst_byte_reader_peek_string_utf8
    API: gst_byte_reader_get_string
    API: gst_byte_reader_get_string_utf8
    
    And some basic unit tests. Fixes #586568.