mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
bytereader: add inlined _unchecked() variants for some functions
API: gst_byte_reader_skip_unchecked() API: gst_byte_reader_peek_*_unchecked() API: gst_byte_reader_get_*_unchecked() API: gst_byte_reader_{peek,get,dup}_data_unchecked()
This commit is contained in:
parent
741a946134
commit
080b2e4fd5
6 changed files with 722 additions and 294 deletions
|
@ -465,6 +465,56 @@ gst_byte_reader_skip_string
|
|||
gst_byte_reader_skip_string_utf8
|
||||
gst_byte_reader_skip_string_utf16
|
||||
gst_byte_reader_skip_string_utf32
|
||||
|
||||
gst_byte_reader_skip_unchecked
|
||||
|
||||
gst_byte_reader_get_int8_unchecked
|
||||
gst_byte_reader_get_int16_be_unchecked
|
||||
gst_byte_reader_get_int16_le_unchecked
|
||||
gst_byte_reader_get_int24_be_unchecked
|
||||
gst_byte_reader_get_int24_le_unchecked
|
||||
gst_byte_reader_get_int32_be_unchecked
|
||||
gst_byte_reader_get_int32_le_unchecked
|
||||
gst_byte_reader_get_int64_be_unchecked
|
||||
gst_byte_reader_get_int64_le_unchecked
|
||||
|
||||
gst_byte_reader_get_uint8_unchecked
|
||||
gst_byte_reader_get_uint16_be_unchecked
|
||||
gst_byte_reader_get_uint16_le_unchecked
|
||||
gst_byte_reader_get_uint24_be_unchecked
|
||||
gst_byte_reader_get_uint24_le_unchecked
|
||||
gst_byte_reader_get_uint32_be_unchecked
|
||||
gst_byte_reader_get_uint32_le_unchecked
|
||||
gst_byte_reader_get_uint64_be_unchecked
|
||||
gst_byte_reader_get_uint64_le_unchecked
|
||||
|
||||
gst_byte_reader_peek_int8_unchecked
|
||||
gst_byte_reader_peek_int16_be_unchecked
|
||||
gst_byte_reader_peek_int16_le_unchecked
|
||||
gst_byte_reader_peek_int24_be_unchecked
|
||||
gst_byte_reader_peek_int24_le_unchecked
|
||||
gst_byte_reader_peek_int32_be_unchecked
|
||||
gst_byte_reader_peek_int32_le_unchecked
|
||||
gst_byte_reader_peek_int64_be_unchecked
|
||||
gst_byte_reader_peek_int64_le_unchecked
|
||||
|
||||
gst_byte_reader_peek_uint8_unchecked
|
||||
gst_byte_reader_peek_uint16_be_unchecked
|
||||
gst_byte_reader_peek_uint16_le_unchecked
|
||||
gst_byte_reader_peek_uint24_be_unchecked
|
||||
gst_byte_reader_peek_uint24_le_unchecked
|
||||
gst_byte_reader_peek_uint32_be_unchecked
|
||||
gst_byte_reader_peek_uint32_le_unchecked
|
||||
gst_byte_reader_peek_uint64_be_unchecked
|
||||
gst_byte_reader_peek_uint64_le_unchecked
|
||||
|
||||
gst_byte_reader_dup_data_unchecked
|
||||
gst_byte_reader_get_data_unchecked
|
||||
gst_byte_reader_peek_data_unchecked
|
||||
|
||||
<SUBSECTION Private>
|
||||
# seems to be a header parsing bug
|
||||
g_memdup
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
|
|
@ -33,6 +33,9 @@ libgstbase_@GST_MAJORMINOR@include_HEADERS = \
|
|||
gsttypefindhelper.h \
|
||||
gstdataqueue.h
|
||||
|
||||
noinst_HEADERS = \
|
||||
gstbytereader-docs.h
|
||||
|
||||
CLEANFILES = *.gcno *.gcda *.gcov
|
||||
|
||||
%.c.gcov: .libs/libgstbase_@GST_MAJORMINOR@_la-%.gcda %.c
|
||||
|
|
547
libs/gst/base/gstbytereader-docs.h
Normal file
547
libs/gst/base/gstbytereader-docs.h
Normal file
|
@ -0,0 +1,547 @@
|
|||
/* GStreamer byte reader dummy header for gtk-doc
|
||||
* Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* This header is not installed, it just contains stuff for gtk-doc to parse,
|
||||
* in particular docs and some dummy function declarations for the static
|
||||
* inline functions we generate via macros in gstbytereader.h.
|
||||
*/
|
||||
|
||||
#error "This header should never be included in code, it is only for gtk-doc"
|
||||
|
||||
/**
|
||||
* gst_byte_reader_skip_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
* @nbytes: the number of bytes to skip
|
||||
*
|
||||
* Skips @nbytes bytes of the #GstByteReader instance without checking if
|
||||
* there are enough bytes available in the byte reader.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
void gst_byte_reader_skip_unchecked (GstByteReader * reader, guint nbytes);
|
||||
|
||||
/**
|
||||
* gst_byte_reader_get_uint8_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 8 bit integer without checking if there are enough bytes
|
||||
* available in the byte reader and update the current position.
|
||||
*
|
||||
* Returns: unsigned 8 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint8_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 8 bit integer without checking if there are enough bytes
|
||||
* available in the byte reader, but do not advance the current read position.
|
||||
*
|
||||
* Returns: unsigned 8 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int8_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an signed 8 bit integer without checking if there are enough bytes
|
||||
* available in the byte reader and update the current position.
|
||||
*
|
||||
* Returns: signed 8 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int8_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an signed 8 bit integer without checking if there are enough bytes
|
||||
* available in the byte reader, but do not advance the current read position.
|
||||
*
|
||||
* Returns: signed 8 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
guint8 gst_byte_reader_get_uint8_unchecked (GstByteReader * reader);
|
||||
guint8 gst_byte_reader_peek_uint8_unchecked (GstByteReader * reader);
|
||||
gint8 gst_byte_reader_get_int8_unchecked (GstByteReader * reader);
|
||||
gint8 gst_byte_reader_peek_int8_unchecked (GstByteReader * reader);
|
||||
|
||||
/**
|
||||
* gst_byte_reader_get_uint16_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 16 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint16_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 16 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_uint16_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 16 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint16_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 16 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int16_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 16 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int16_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 16 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int16_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 16 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int16_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 16 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 16 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
guint16 gst_byte_reader_get_uint16_le_unchecked (GstByteReader * reader);
|
||||
guint16 gst_byte_reader_get_uint16_be_unchecked (GstByteReader * reader);
|
||||
guint16 gst_byte_reader_peek_uint16_le_unchecked (GstByteReader * reader);
|
||||
guint16 gst_byte_reader_peek_uint16_be_unchecked (GstByteReader * reader);
|
||||
gint16 gst_byte_reader_get_int16_le_unchecked (GstByteReader * reader);
|
||||
gint16 gst_byte_reader_get_int16_be_unchecked (GstByteReader * reader);
|
||||
gint16 gst_byte_reader_peek_int16_le_unchecked (GstByteReader * reader);
|
||||
gint16 gst_byte_reader_peek_int16_be_unchecked (GstByteReader * reader);
|
||||
|
||||
/**
|
||||
* gst_byte_reader_get_uint24_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 24 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 24 bit integer (as guint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint24_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 24 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 24 bit integer (as guint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_uint24_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 24 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 24 bit integer (as guint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint24_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 24 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 24 bit integer (as guint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int24_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 24 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 24 bit integer (as gint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int24_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 24 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 24 bit integer (as gint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int24_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 24 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 24 bit integer (as gint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int24_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 24 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 24 bit integer (as gint32)
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
guint32 gst_byte_reader_get_uint24_le_unchecked (GstByteReader * reader);
|
||||
guint32 gst_byte_reader_get_uint24_be_unchecked (GstByteReader * reader);
|
||||
guint32 gst_byte_reader_peek_uint24_le_unchecked (GstByteReader * reader);
|
||||
guint32 gst_byte_reader_peek_uint24_be_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_get_int24_le_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_get_int24_be_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_peek_int24_le_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_peek_int24_be_unchecked (GstByteReader * reader);
|
||||
|
||||
/**
|
||||
* gst_byte_reader_get_uint32_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 32 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint32_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 32 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_uint32_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 32 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint32_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 32 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int32_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 32 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int32_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 32 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int32_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 32 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int32_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 32 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 32 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
guint32 gst_byte_reader_get_uint32_le_unchecked (GstByteReader * reader);
|
||||
guint32 gst_byte_reader_get_uint32_be_unchecked (GstByteReader * reader);
|
||||
guint32 gst_byte_reader_peek_uint32_le_unchecked (GstByteReader * reader);
|
||||
guint32 gst_byte_reader_peek_uint32_be_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_get_int32_le_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_get_int32_be_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_peek_int32_le_unchecked (GstByteReader * reader);
|
||||
gint32 gst_byte_reader_peek_int32_be_unchecked (GstByteReader * reader);
|
||||
|
||||
/**
|
||||
* gst_byte_reader_get_uint64_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 64 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint64_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 64 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_uint64_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 64 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: unsigned 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_uint64_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read an unsigned 64 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: unsigned 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int64_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 64 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int64_le_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 64 bit integer in little endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_get_int64_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 64 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader and update the
|
||||
* current position.
|
||||
*
|
||||
* Returns: signed 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
/**
|
||||
* gst_byte_reader_peek_int64_be_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Read a signed 64 bit integer in big endian format without checking
|
||||
* if there are enough bytes available in the byte reader, but do not advance
|
||||
* the current position.
|
||||
*
|
||||
* Returns: signed 64 bit integer.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
guint64 gst_byte_reader_get_uint64_le_unchecked (GstByteReader * reader);
|
||||
guint64 gst_byte_reader_get_uint64_be_unchecked (GstByteReader * reader);
|
||||
guint64 gst_byte_reader_peek_uint64_le_unchecked (GstByteReader * reader);
|
||||
guint64 gst_byte_reader_peek_uint64_be_unchecked (GstByteReader * reader);
|
||||
gint64 gst_byte_reader_get_int64_le_unchecked (GstByteReader * reader);
|
||||
gint64 gst_byte_reader_get_int64_be_unchecked (GstByteReader * reader);
|
||||
gint64 gst_byte_reader_peek_int64_le_unchecked (GstByteReader * reader);
|
||||
gint64 gst_byte_reader_peek_int64_be_unchecked (GstByteReader * reader);
|
||||
|
||||
|
||||
/**
|
||||
* gst_byte_reader_peek_data_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
*
|
||||
* Returns: a constant pointer to the current data position
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
const guint8 * gst_byte_reader_peek_data_unchecked (GstByteReader * reader);
|
||||
/**
|
||||
* gst_byte_reader_get_data_unchecked:
|
||||
* @reader: a #GstByteReader instance
|
||||
* @size: Size in bytes
|
||||
*
|
||||
* Returns a constant pointer to the current data position without checking
|
||||
* if at least @size bytes are left. Advances the current read position by
|
||||
* @size bytes.
|
||||
*
|
||||
* Returns: a constant pointer to the current data position.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
const guint8 * gst_byte_reader_get_data_unchecked (GstByteReader * reader, guint size);
|
||||
/**
|
||||
* gst_byte_reader_dup_data:
|
||||
* @reader: a #GstByteReader instance
|
||||
* @size: Size in bytes
|
||||
*
|
||||
* Returns a newly-allocated copy of the data at the current data position
|
||||
* without checking if at least @size bytes are left. Advances the current read
|
||||
* position by @size bytes.
|
||||
*
|
||||
* Returns: a newly-allocated copy of the data @size bytes in size. Free with
|
||||
* g_free() when no longer needed.
|
||||
*
|
||||
* Since: 0.10.25
|
||||
*/
|
||||
guint8 * gst_byte_reader_dup_data_unchecked (GstByteReader * reader, guint size);
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
/* GStreamer
|
||||
/* GStreamer byte reader
|
||||
*
|
||||
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
|
||||
* Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -689,9 +690,9 @@ gst_byte_reader_skip (GstByteReader * reader, guint nbytes)
|
|||
* Since: 0.10.22
|
||||
*/
|
||||
|
||||
#define GST_BYTE_READER_READ_INTS(bits) \
|
||||
#define GST_BYTE_READER_PEEK_GET_INTS(bits,type,name) \
|
||||
gboolean \
|
||||
gst_byte_reader_get_uint##bits##_le (GstByteReader *reader, guint##bits *val) \
|
||||
gst_byte_reader_get_##name (GstByteReader * reader, type * val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
|
@ -699,13 +700,12 @@ gst_byte_reader_get_uint##bits##_le (GstByteReader *reader, guint##bits *val) \
|
|||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_LE (&reader->data[reader->byte]); \
|
||||
reader->byte += bits / 8; \
|
||||
*val = gst_byte_reader_get_##name##_unchecked (reader); \
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
gboolean \
|
||||
gst_byte_reader_get_uint##bits##_be (GstByteReader *reader, guint##bits *val) \
|
||||
gst_byte_reader_peek_##name (GstByteReader * reader, type * val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
|
@ -713,282 +713,32 @@ gst_byte_reader_get_uint##bits##_be (GstByteReader *reader, guint##bits *val) \
|
|||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_BE (&reader->data[reader->byte]); \
|
||||
reader->byte += bits / 8; \
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
gboolean \
|
||||
gst_byte_reader_get_int##bits##_le (GstByteReader *reader, gint##bits *val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
\
|
||||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_LE (&reader->data[reader->byte]); \
|
||||
reader->byte += bits / 8; \
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
gboolean \
|
||||
gst_byte_reader_get_int##bits##_be (GstByteReader *reader, gint##bits *val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
\
|
||||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_BE (&reader->data[reader->byte]); \
|
||||
reader->byte += bits / 8; \
|
||||
return TRUE; \
|
||||
} \
|
||||
gboolean \
|
||||
gst_byte_reader_peek_uint##bits##_le (GstByteReader *reader, guint##bits *val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
\
|
||||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_LE (&reader->data[reader->byte]); \
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
gboolean \
|
||||
gst_byte_reader_peek_uint##bits##_be (GstByteReader *reader, guint##bits *val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
\
|
||||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_BE (&reader->data[reader->byte]); \
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
gboolean \
|
||||
gst_byte_reader_peek_int##bits##_le (GstByteReader *reader, gint##bits *val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
\
|
||||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_LE (&reader->data[reader->byte]); \
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
gboolean \
|
||||
gst_byte_reader_peek_int##bits##_be (GstByteReader *reader, gint##bits *val) \
|
||||
{ \
|
||||
g_return_val_if_fail (reader != NULL, FALSE); \
|
||||
g_return_val_if_fail (val != NULL, FALSE); \
|
||||
\
|
||||
if (gst_byte_reader_get_remaining (reader) < bits / 8) \
|
||||
return FALSE; \
|
||||
\
|
||||
*val = GST_READ_UINT##bits##_BE (&reader->data[reader->byte]); \
|
||||
*val = gst_byte_reader_peek_##name##_unchecked (reader); \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
GST_BYTE_READER_PEEK_GET_INTS(8,guint8,uint8)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(8,gint8,int8)
|
||||
|
||||
GST_BYTE_READER_READ_INTS (16);
|
||||
GST_BYTE_READER_READ_INTS (32);
|
||||
GST_BYTE_READER_READ_INTS (64);
|
||||
GST_BYTE_READER_PEEK_GET_INTS(16,guint16,uint16_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(16,guint16,uint16_be)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(16,gint16,int16_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(16,gint16,int16_be)
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_get_uint8 (GstByteReader * reader, guint8 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
GST_BYTE_READER_PEEK_GET_INTS(24,guint32,uint24_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(24,guint32,uint24_be)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(24,gint32,int24_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(24,gint32,int24_be)
|
||||
|
||||
if (reader->byte >= reader->size)
|
||||
return FALSE;
|
||||
GST_BYTE_READER_PEEK_GET_INTS(32,guint32,uint32_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(32,guint32,uint32_be)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(32,gint32,int32_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(32,gint32,int32_be)
|
||||
|
||||
*val = GST_READ_UINT8 (&reader->data[reader->byte]);
|
||||
reader->byte++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_get_int8 (GstByteReader * reader, gint8 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (reader->byte >= reader->size)
|
||||
return FALSE;
|
||||
|
||||
*val = GST_READ_UINT8 (&reader->data[reader->byte]);
|
||||
reader->byte++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_peek_uint8 (GstByteReader * reader, guint8 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (reader->byte >= reader->size)
|
||||
return FALSE;
|
||||
|
||||
*val = GST_READ_UINT8 (&reader->data[reader->byte]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_peek_int8 (GstByteReader * reader, gint8 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (reader->byte >= reader->size)
|
||||
return FALSE;
|
||||
|
||||
*val = GST_READ_UINT8 (&reader->data[reader->byte]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_get_uint24_le (GstByteReader * reader, guint32 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
*val = GST_READ_UINT24_LE (&reader->data[reader->byte]);
|
||||
reader->byte += 3;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_get_uint24_be (GstByteReader * reader, guint32 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
*val = GST_READ_UINT24_BE (&reader->data[reader->byte]);
|
||||
reader->byte += 3;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_get_int24_le (GstByteReader * reader, gint32 * val)
|
||||
{
|
||||
guint32 ret;
|
||||
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
ret = GST_READ_UINT24_LE (&reader->data[reader->byte]);
|
||||
if (ret & 0x00800000)
|
||||
ret |= 0xff000000;
|
||||
|
||||
reader->byte += 3;
|
||||
|
||||
*val = ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_get_int24_be (GstByteReader * reader, gint32 * val)
|
||||
{
|
||||
guint32 ret;
|
||||
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
ret = GST_READ_UINT24_BE (&reader->data[reader->byte]);
|
||||
if (ret & 0x00800000)
|
||||
ret |= 0xff000000;
|
||||
|
||||
reader->byte += 3;
|
||||
|
||||
*val = ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_peek_uint24_le (GstByteReader * reader, guint32 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
*val = GST_READ_UINT24_LE (&reader->data[reader->byte]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_peek_uint24_be (GstByteReader * reader, guint32 * val)
|
||||
{
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
*val = GST_READ_UINT24_BE (&reader->data[reader->byte]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_peek_int24_le (GstByteReader * reader, gint32 * val)
|
||||
{
|
||||
guint32 ret;
|
||||
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
ret = GST_READ_UINT24_LE (&reader->data[reader->byte]);
|
||||
if (ret & 0x00800000)
|
||||
ret |= 0xff000000;
|
||||
|
||||
*val = ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_byte_reader_peek_int24_be (GstByteReader * reader, gint32 * val)
|
||||
{
|
||||
guint32 ret;
|
||||
|
||||
g_return_val_if_fail (reader != NULL, FALSE);
|
||||
g_return_val_if_fail (val != NULL, FALSE);
|
||||
|
||||
if (gst_byte_reader_get_remaining (reader) < 3)
|
||||
return FALSE;
|
||||
|
||||
ret = GST_READ_UINT24_BE (&reader->data[reader->byte]);
|
||||
if (ret & 0x00800000)
|
||||
ret |= 0xff000000;
|
||||
|
||||
*val = ret;
|
||||
return TRUE;
|
||||
}
|
||||
GST_BYTE_READER_PEEK_GET_INTS(64,guint64,uint64_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(64,guint64,uint64_be)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(64,gint64,int64_le)
|
||||
GST_BYTE_READER_PEEK_GET_INTS(64,gint64,int64_be)
|
||||
|
||||
/**
|
||||
* gst_byte_reader_get_float32_le:
|
||||
|
@ -1174,8 +924,7 @@ gst_byte_reader_get_data (GstByteReader * reader, guint size,
|
|||
if (gst_byte_reader_get_remaining (reader) < size)
|
||||
return FALSE;
|
||||
|
||||
*val = reader->data + reader->byte;
|
||||
reader->byte += size;
|
||||
*val = gst_byte_reader_get_data_unchecked (reader, size);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1204,7 +953,7 @@ gst_byte_reader_peek_data (GstByteReader * reader, guint size,
|
|||
if (gst_byte_reader_get_remaining (reader) < size)
|
||||
return FALSE;
|
||||
|
||||
*val = reader->data + reader->byte;
|
||||
*val = gst_byte_reader_peek_data_unchecked (reader);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* GStreamer
|
||||
/* GStreamer byte reader
|
||||
*
|
||||
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
|
||||
* Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -162,6 +163,84 @@ guint gst_byte_reader_masked_scan_uint32 (GstByteReader * reader,
|
|||
*/
|
||||
#define GST_BYTE_READER_INIT_FROM_BUFFER(buffer) {GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), 0}
|
||||
|
||||
|
||||
/* unchecked variants */
|
||||
|
||||
static inline void
|
||||
gst_byte_reader_skip_unchecked (GstByteReader * reader, guint nbytes)
|
||||
{
|
||||
reader->byte += nbytes;
|
||||
}
|
||||
|
||||
#define __GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(bits,type,lower,upper,adj) \
|
||||
\
|
||||
static inline type \
|
||||
gst_byte_reader_peek_##lower##_unchecked (GstByteReader * reader) \
|
||||
{ \
|
||||
type val = (type) GST_READ_##upper (reader->data + reader->byte); \
|
||||
adj \
|
||||
return val; \
|
||||
} \
|
||||
\
|
||||
static inline type \
|
||||
gst_byte_reader_get_##lower##_unchecked (GstByteReader * reader) \
|
||||
{ \
|
||||
type val = gst_byte_reader_peek_##lower##_unchecked (reader); \
|
||||
reader->byte += bits / 8; \
|
||||
return val; \
|
||||
}
|
||||
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(8,guint8,uint8,UINT8,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(8,gint8,int8,UINT8,/* */)
|
||||
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,guint16,uint16_le,UINT16_LE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,guint16,uint16_be,UINT16_BE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,gint16,int16_le,UINT16_LE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,gint16,int16_be,UINT16_BE,/* */)
|
||||
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,guint32,uint32_le,UINT32_LE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,guint32,uint32_be,UINT32_BE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gint32,int32_le,UINT32_LE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gint32,int32_be,UINT32_BE,/* */)
|
||||
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,guint32,uint24_le,UINT24_LE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,guint32,uint24_be,UINT24_BE,/* */)
|
||||
|
||||
/* fix up the sign for 24-bit signed ints stored in 32-bit signed ints */
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,gint32,int24_le,UINT24_LE,
|
||||
if (val & 0x00800000) val |= 0xff000000;)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,gint32,int24_be,UINT24_BE,
|
||||
if (val & 0x00800000) val |= 0xff000000;)
|
||||
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,guint64,uint64_le,UINT64_LE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,guint64,uint64_be,UINT64_BE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gint64,int64_le,UINT64_LE,/* */)
|
||||
__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gint64,int64_be,UINT64_BE,/* */)
|
||||
|
||||
#undef __GET_PEEK_BITS_UNCHECKED
|
||||
|
||||
static inline const guint8 *
|
||||
gst_byte_reader_peek_data_unchecked (GstByteReader * reader)
|
||||
{
|
||||
return (const guint8 *) (reader->data + reader->byte);
|
||||
}
|
||||
|
||||
static inline const guint8 *
|
||||
gst_byte_reader_get_data_unchecked (GstByteReader * reader, guint size)
|
||||
{
|
||||
const guint8 *data;
|
||||
|
||||
data = gst_byte_reader_peek_data_unchecked (reader);
|
||||
gst_byte_reader_skip_unchecked (reader, size);
|
||||
return data;
|
||||
}
|
||||
|
||||
static inline guint8 *
|
||||
gst_byte_reader_dup_data_unchecked (GstByteReader * reader, guint size)
|
||||
{
|
||||
return g_memdup (gst_byte_reader_get_data_unchecked (reader, size), size);
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_BYTE_READER_H__ */
|
||||
|
|
|
@ -131,9 +131,9 @@ GST_START_TEST (test_get_uint_le)
|
|||
};
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, 16);
|
||||
guint8 a;
|
||||
guint16 b;
|
||||
guint32 c;
|
||||
guint64 d;
|
||||
guint16 b = 0;
|
||||
guint32 c = 0;
|
||||
guint64 d = 0;
|
||||
|
||||
GET_CHECK8 (&reader, a, 0x12);
|
||||
GET_CHECK (&reader, b, 16, le, 0x5634);
|
||||
|
@ -174,9 +174,9 @@ GST_START_TEST (test_get_uint_be)
|
|||
};
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, 16);
|
||||
guint8 a;
|
||||
guint16 b;
|
||||
guint32 c;
|
||||
guint64 d;
|
||||
guint16 b = 0;
|
||||
guint32 c = 0;
|
||||
guint64 d = 0;
|
||||
|
||||
GET_CHECK8 (&reader, a, 0x12);
|
||||
GET_CHECK (&reader, b, 16, be, 0x3456);
|
||||
|
@ -262,9 +262,9 @@ GST_START_TEST (test_get_int_le)
|
|||
};
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, 16);
|
||||
gint8 a;
|
||||
gint16 b;
|
||||
gint32 c;
|
||||
gint64 d;
|
||||
gint16 b = 0;
|
||||
gint32 c = 0;
|
||||
gint64 d = 0;
|
||||
|
||||
GET_CHECK8 (&reader, a, -1);
|
||||
GET_CHECK (&reader, b, 16, le, -1);
|
||||
|
@ -306,9 +306,9 @@ GST_START_TEST (test_get_int_be)
|
|||
};
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, 16);
|
||||
gint8 a;
|
||||
gint16 b;
|
||||
gint32 c;
|
||||
gint64 d;
|
||||
gint16 b = 0;
|
||||
gint32 c = 0;
|
||||
gint64 d = 0;
|
||||
|
||||
GET_CHECK8 (&reader, a, -1);
|
||||
GET_CHECK (&reader, b, 16, be, -1);
|
||||
|
@ -558,7 +558,7 @@ GST_START_TEST (test_string_funcs)
|
|||
guint32 *c32;
|
||||
guint16 *c16;
|
||||
gchar *c8;
|
||||
guint8 data[200], *d;
|
||||
guint8 data[200], *d = 0;
|
||||
guint i;
|
||||
|
||||
/* fill half the buffer with a pattern */
|
||||
|
@ -664,8 +664,8 @@ GST_START_TEST (test_dup_string)
|
|||
{
|
||||
const gchar moredata[] = { 0x99, 0x10, 'f', '0', '0', '!', '\0', 0xff };
|
||||
GstByteReader reader;
|
||||
guint16 num;
|
||||
guint8 x;
|
||||
guint16 num = 0;
|
||||
guint8 x = 0;
|
||||
gchar *s;
|
||||
|
||||
gst_byte_reader_init (&reader, (guint8 *) moredata, sizeof (moredata));
|
||||
|
|
Loading…
Reference in a new issue