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 553554 - [base] Add a generic bit reader
[base] Add a generic bit reader
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.10.22
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-09-24 11:16 UTC by Sebastian Dröge (slomo)
Modified: 2008-10-06 12:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bitreader.diff (58.12 KB, patch)
2008-09-24 11:19 UTC, Sebastian Dröge (slomo)
none Details | Review
bitreader.diff (80.41 KB, patch)
2008-09-26 10:33 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Sebastian Dröge (slomo) 2008-09-24 11:16:30 UTC
Hi,
the attached patch adds a generic bit reader that can ready any number of bits from a memory buffer and can update the current read position.
This makes parsing bit structures much easier.

The patch adds it to libgstbase, adds a unit test and documentation.
Comment 1 Sebastian Dröge (slomo) 2008-09-24 11:19:45 UTC
Created attachment 119290 [details] [review]
bitreader.diff
Comment 2 Sebastian Dröge (slomo) 2008-09-24 17:07:16 UTC
This will be splitted into a bit reader and byte reader tomorrow to avoid confusion as the byte functions only work on byte boundary and cause assertions otherwise.
Comment 3 Sebastian Dröge (slomo) 2008-09-26 10:33:44 UTC
Created attachment 119408 [details] [review]
bitreader.diff

Byte and Bit reader are splitted now and the byte reader also has support for reading 32 and 64 bit floating point numbers.
Comment 4 Sebastian Dröge (slomo) 2008-10-06 12:41:37 UTC
2008-10-06  Sebastian Dröge  <sebastian.droege@collabora.co.uk>

        * docs/libs/gstreamer-libs-docs.sgml:
        * docs/libs/gstreamer-libs-sections.txt:
        * libs/gst/base/Makefile.am:
        * libs/gst/base/gstbitreader.c: (gst_bit_reader_new),
        (gst_bit_reader_new_from_buffer), (gst_bit_reader_free),
        (gst_bit_reader_init), (gst_bit_reader_init_from_buffer),
        (gst_bit_reader_set_pos), (gst_bit_reader_get_pos),
        (gst_bit_reader_get_remaining), (gst_bit_reader_skip),
        (gst_bit_reader_skip_to_byte):
        * libs/gst/base/gstbitreader.h:
        * libs/gst/base/gstbytereader.c: (GDOUBLE_SWAP_LE_BE),
        (GFLOAT_SWAP_LE_BE), (gst_byte_reader_new),
        (gst_byte_reader_new_from_buffer), (gst_byte_reader_free),
        (gst_byte_reader_init), (gst_byte_reader_init_from_buffer),
        (gst_byte_reader_set_pos), (gst_byte_reader_get_pos),
        (gst_byte_reader_get_remaining), (gst_byte_reader_skip),
        (gst_byte_reader_get_uint8), (gst_byte_reader_get_int8),
        (gst_byte_reader_peek_uint8), (gst_byte_reader_peek_int8),
        (gst_byte_reader_get_uint24_le), (gst_byte_reader_get_uint24_be),
        (gst_byte_reader_get_int24_le), (gst_byte_reader_get_int24_be),
        (gst_byte_reader_peek_uint24_le), (gst_byte_reader_peek_uint24_be),
        (gst_byte_reader_peek_int24_le), (gst_byte_reader_peek_int24_be):
        * libs/gst/base/gstbytereader.h:
        * tests/check/Makefile.am:
        * tests/check/libs/bitreader.c: (GST_START_TEST),
        (gst_bit_reader_suite):
        * tests/check/libs/bytereader.c: (GST_START_TEST),
        (gst_byte_reader_suite):
        Add bit reader and byte reader classes, including documentation
        and an extensive unit test suite. Fixes bug #553554.