summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-06-12 17:22:22 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-07-31 16:36:54 +0100
commit2e7b6e44db4fd03b4ca69891eac241e073e7cf39 (patch)
tree6f78e079f845f544a8cccdf525e32362ddbef8a2
parentb6582939256d417ed5f2eae3c66d7b4cf0c668fc (diff)
downloadgst-plugins-bad-2e7b6e44db4fd03b4ca69891eac241e073e7cf39.tar.gz
gst-plugins-bad-2e7b6e44db4fd03b4ca69891eac241e073e7cf39.tar.bz2
gst-plugins-bad-2e7b6e44db4fd03b4ca69891eac241e073e7cf39.zip
flacparse: remove internal bitreader and bytereader now that these are in libgstbase
-rw-r--r--gst/flacparse/Makefile.am4
-rw-r--r--gst/flacparse/gstbitreader.c400
-rw-r--r--gst/flacparse/gstbitreader.h99
-rw-r--r--gst/flacparse/gstbytereader.c1231
-rw-r--r--gst/flacparse/gstbytereader.h134
-rw-r--r--gst/flacparse/gstflacparse.c4
6 files changed, 4 insertions, 1868 deletions
diff --git a/gst/flacparse/Makefile.am b/gst/flacparse/Makefile.am
index 00e6f93f..8278130b 100644
--- a/gst/flacparse/Makefile.am
+++ b/gst/flacparse/Makefile.am
@@ -1,6 +1,6 @@
plugin_LTLIBRARIES = libgstflacparse.la
-libgstflacparse_la_SOURCES = gstflac.c gstbaseparse.c gstflacparse.c gstbitreader.c gstbytereader.c
+libgstflacparse_la_SOURCES = gstflac.c gstbaseparse.c gstflacparse.c
libgstflacparse_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstflacparse_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_MAJORMINOR) \
@@ -9,4 +9,4 @@ libgstflacparse_la_LIBADD = \
libgstflacparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstflacparse_la_LIBTOOLFLAGS = --tag=disable-static
-noinst_HEADERS = gstbitreader.h gstbytereader.h gstbaseparse.h gstflacparse.h
+noinst_HEADERS = gstbaseparse.h gstflacparse.h
diff --git a/gst/flacparse/gstbitreader.c b/gst/flacparse/gstbitreader.c
deleted file mode 100644
index 7647ab94..00000000
--- a/gst/flacparse/gstbitreader.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstbitreader.h"
-
-#include <string.h>
-
-/**
- * SECTION:gstbitreader
- * @short_description: Reads any number of bits from a memory buffer
- *
- * #GstBitReader provides a bit reader that can read any number of bits
- * from a memory buffer. It provides functions for reading any number of bits
- * into 8, 16, 32 and 64 bit variables.
- */
-
-/**
- * gst_bit_reader_new:
- * @data: Data from which the #GstBitReader should read
- * @size: Size of @data in bytes
- *
- * Create a new #GstBitReader instance, which will read from @data.
- *
- * Returns: a new #GstBitReader instance
- *
- * Since: 0.10.22
- */
-GstBitReader *
-gst_bit_reader_new (const guint8 * data, guint size)
-{
- GstBitReader *ret = g_slice_new0 (GstBitReader);
-
- ret->data = data;
- ret->size = size;
-
- return ret;
-}
-
-/**
- * gst_bit_reader_new_from_buffer:
- * @buffer: Buffer from which the #GstBitReader should read
- *
- * Create a new #GstBitReader instance, which will read from the
- * #GstBuffer @buffer.
- *
- * Returns: a new #GstBitReader instance
- *
- * Since: 0.10.22
- */
-GstBitReader *
-gst_bit_reader_new_from_buffer (const GstBuffer * buffer)
-{
- g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
-
- return gst_bit_reader_new (GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
-}
-
-/**
- * gst_bit_reader_free:
- * @reader: a #GstBitReader instance
- *
- * Frees a #GstBitReader instance, which was previously allocated by
- * gst_bit_reader_new() or gst_bit_reader_new_from_buffer().
- *
- * Since: 0.10.22
- */
-void
-gst_bit_reader_free (GstBitReader * reader)
-{
- g_return_if_fail (reader != NULL);
-
- g_slice_free (GstBitReader, reader);
-}
-
-/**
- * gst_bit_reader_init:
- * @reader: a #GstBitReader instance
- * @data: Data from which the #GstBitReader should read
- * @size: Size of @data in bytes
- *
- * Initializes a #GstBitReader instance to read from @data. This function
- * can be called on already initialized instances.
- *
- * Since: 0.10.22
- */
-void
-gst_bit_reader_init (GstBitReader * reader, const guint8 * data, guint size)
-{
- g_return_if_fail (reader != NULL);
-
- reader->data = data;
- reader->size = size;
- reader->byte = reader->bit = 0;
-}
-
-/**
- * gst_bit_reader_init:
- * @reader: a #GstBitReader instance
- * @buffer: Buffer from which the #GstBitReader should read
- *
- * Initializes a #GstBitReader instance to read from @buffer. This function
- * can be called on already initialized instances.
- *
- * Since: 0.10.22
- */
-void
-gst_bit_reader_init_from_buffer (GstBitReader * reader,
- const GstBuffer * buffer)
-{
- g_return_if_fail (GST_IS_BUFFER (buffer));
-
- gst_bit_reader_init (reader, GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
-}
-
-/**
- * gst_bit_reader_set_pos:
- * @reader: a #GstBitReader instance
- * @pos: The new position in bits
- *
- * Sets the new position of a #GstBitReader instance to @pos in bits.
- *
- * Returns: %TRUE if the position could be set successfully, %FALSE
- * otherwise.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_bit_reader_set_pos (GstBitReader * reader, guint pos)
-{
- g_return_val_if_fail (reader != NULL, FALSE);
-
- if (pos > reader->size * 8)
- return FALSE;
-
- reader->byte = pos / 8;
- reader->bit = pos % 8;
-
- return TRUE;
-}
-
-/**
- * gst_bit_reader_get_pos:
- * @reader: a #GstBitReader instance
- *
- * Returns the current position of a #GstBitReader instance in bits.
- *
- * Returns: The current position of @reader in bits.
- *
- * Since: 0.10.22
- */
-guint
-gst_bit_reader_get_pos (const GstBitReader * reader)
-{
- g_return_val_if_fail (reader != NULL, 0);
-
- return reader->byte * 8 + reader->bit;
-}
-
-/**
- * gst_bit_reader_get_remaining:
- * @reader: a #GstBitReader instance
- *
- * Returns the remaining number of bits of a #GstBitReader instance.
- *
- * Returns: The remaining number of bits of @reader instance.
- *
- * Since: 0.10.22
- */
-guint
-gst_bit_reader_get_remaining (const GstBitReader * reader)
-{
- g_return_val_if_fail (reader != NULL, 0);
-
- return reader->size * 8 - (reader->byte * 8 + reader->bit);
-}
-
-/**
- * gst_bit_reader_skip:
- * @reader: a #GstBitReader instance
- * @nbits: the number of bits to skip
- *
- * Skips @nbits bits of the #GstBitReader instance.
- *
- * Returns: %TRUE if @nbits bits could be skipped, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_bit_reader_skip (GstBitReader * reader, guint nbits)
-{
- g_return_val_if_fail (reader != NULL, FALSE);
-
- if (gst_bit_reader_get_remaining (reader) < nbits)
- return FALSE;
-
- reader->bit += nbits;
- reader->byte += reader->bit / 8;
- reader->bit = reader->bit % 8;
-
- return TRUE;
-}
-
-/**
- * gst_bit_reader_skip_to_byte:
- * @reader: a #GstBitReader instance
- *
- * Skips until the next byte.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_bit_reader_skip_to_byte (GstBitReader * reader)
-{
- g_return_val_if_fail (reader != NULL, FALSE);
-
- if (reader->byte > reader->size)
- return FALSE;
-
- if (reader->bit) {
- reader->bit = 0;
- reader->byte++;
- }
-
- return TRUE;
-}
-
-/**
- * gst_bit_reader_get_bits_uint8:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint8 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_bit_reader_get_bits_uint16:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint16 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_bit_reader_get_bits_uint32:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint32 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_bit_reader_get_bits_uint64:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint64 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_bit_reader_peek_bits_uint8:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint8 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_bit_reader_peek_bits_uint16:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint16 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_bit_reader_peek_bits_uint32:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint32 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_bit_reader_peek_bits_uint64:
- * @reader: a #GstBitReader instance
- * @val: Pointer to a #guint64 to store the result
- * @nbits: number of bits to read
- *
- * Read @nbits bits into @val but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-#define GST_BIT_READER_READ_BITS(bits) \
-gboolean \
-gst_bit_reader_get_bits_uint##bits (GstBitReader *reader, guint##bits *val, guint nbits) \
-{ \
- guint##bits ret = 0; \
- \
- g_return_val_if_fail (reader != NULL, FALSE); \
- g_return_val_if_fail (val != NULL, FALSE); \
- g_return_val_if_fail (nbits <= bits, FALSE); \
- \
- if (reader->byte * 8 + reader->bit + nbits > reader->size * 8) \
- return FALSE; \
- \
- while (nbits > 0) { \
- guint toread = MIN (nbits, 8 - reader->bit); \
- \
- ret <<= toread; \
- ret |= (reader->data[reader->byte] & (0xff >> reader->bit)) >> (8 - toread - reader->bit); \
- \
- reader->bit += toread; \
- if (reader->bit >= 8) { \
- reader->byte++; \
- reader->bit = 0; \
- } \
- nbits -= toread; \
- } \
- \
- *val = ret; \
- return TRUE; \
-} \
-\
-gboolean \
-gst_bit_reader_peek_bits_uint##bits (const GstBitReader *reader, guint##bits *val, guint nbits) \
-{ \
- GstBitReader tmp; \
- \
- g_return_val_if_fail (reader != NULL, FALSE); \
- tmp = *reader; \
- return gst_bit_reader_get_bits_uint##bits (&tmp, val, nbits); \
-}
-
-GST_BIT_READER_READ_BITS (8);
-GST_BIT_READER_READ_BITS (16);
-GST_BIT_READER_READ_BITS (32);
-GST_BIT_READER_READ_BITS (64);
diff --git a/gst/flacparse/gstbitreader.h b/gst/flacparse/gstbitreader.h
deleted file mode 100644
index 5dc16a30..00000000
--- a/gst/flacparse/gstbitreader.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
- *
- * 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.
- */
-
-#ifndef __GST_BIT_READER_H__
-#define __GST_BIT_READER_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-/**
- * GstBitReader:
- * @data: Data from which the bit reader will read
- * @size: Size of @data in bytes
- * @byte: Current byte position
- * @bit: Bit position in the current byte
- *
- * A bit reader instance.
- */
-typedef struct {
- const guint8 *data;
- guint size;
-
- guint byte; /* Byte position */
- guint bit; /* Bit position in the current byte */
-} GstBitReader;
-
-GstBitReader * gst_bit_reader_new (const guint8 *data, guint size);
-GstBitReader * gst_bit_reader_new_from_buffer (const GstBuffer *buffer);
-void gst_bit_reader_free (GstBitReader *reader);
-
-void gst_bit_reader_init (GstBitReader *reader, const guint8 *data, guint size);
-void gst_bit_reader_init_from_buffer (GstBitReader *reader, const GstBuffer *buffer);
-
-gboolean gst_bit_reader_set_pos (GstBitReader *reader, guint pos);
-
-guint gst_bit_reader_get_pos (const GstBitReader *reader);
-guint gst_bit_reader_get_remaining (const GstBitReader *reader);
-
-gboolean gst_bit_reader_skip (GstBitReader *reader, guint nbits);
-gboolean gst_bit_reader_skip_to_byte (GstBitReader *reader);
-
-gboolean gst_bit_reader_get_bits_uint8 (GstBitReader *reader, guint8 *val, guint nbits);
-gboolean gst_bit_reader_get_bits_uint16 (GstBitReader *reader, guint16 *val, guint nbits);
-gboolean gst_bit_reader_get_bits_uint32 (GstBitReader *reader, guint32 *val, guint nbits);
-gboolean gst_bit_reader_get_bits_uint64 (GstBitReader *reader, guint64 *val, guint nbits);
-
-gboolean gst_bit_reader_peek_bits_uint8 (const GstBitReader *reader, guint8 *val, guint nbits);
-gboolean gst_bit_reader_peek_bits_uint16 (const GstBitReader *reader, guint16 *val, guint nbits);
-gboolean gst_bit_reader_peek_bits_uint32 (const GstBitReader *reader, guint32 *val, guint nbits);
-gboolean gst_bit_reader_peek_bits_uint64 (const GstBitReader *reader, guint64 *val, guint nbits);
-
-/**
- * GST_BIT_READER_INIT:
- * @data: Data from which the #GstBitReader should read
- * @size: Size of @data in bytes
- *
- * A #GstBitReader must be initialized with this macro, before it can be
- * used. This macro can used be to initialize a variable, but it cannot
- * be assigned to a variable. In that case you have to use
- * gst_bit_reader_init().
- *
- * Since: 0.10.22
- */
-#define GST_BIT_READER_INIT(data, size) {data, size, 0, 0}
-
-/**
- * GST_BIT_READER_INIT_FROM_BUFFER:
- * @buffer: Buffer from which the #GstBitReader should read
- *
- * A #GstBitReader must be initialized with this macro, before it can be
- * used. This macro can used be to initialize a variable, but it cannot
- * be assigned to a variable. In that case you have to use
- * gst_bit_reader_init().
- *
- * Since: 0.10.22
- */
-#define GST_BIT_READER_INIT_FROM_BUFFER(buffer) {GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), 0, 0}
-
-G_END_DECLS
-
-#endif /* __GST_BIT_READER_H__ */
diff --git a/gst/flacparse/gstbytereader.c b/gst/flacparse/gstbytereader.c
deleted file mode 100644
index cb91ea79..00000000
--- a/gst/flacparse/gstbytereader.c
+++ /dev/null
@@ -1,1231 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstbytereader.h"
-
-#include <string.h>
-
-/**
- * SECTION:gstbytereader
- * @short_description: Reads different integer and floating point types from a memory buffer
- *
- * #GstByteReader provides a byte reader that can read different integer and
- * floating point types from a memory buffer. It provides functions for reading
- * signed/unsigned, little/big endian integers of 8, 16, 24, 32 and 64 bits
- * and functions for reading little/big endian floating points numbers of
- * 32 and 64 bits.
- */
-
-
-/* Copied from gst/floatcast/floatcast.h as this is in gst-plugins-base */
-
-inline static gdouble
-GDOUBLE_SWAP_LE_BE (gdouble in)
-{
- union
- {
- guint64 i;
- gdouble d;
- } u;
-
- u.d = in;
- u.i = GUINT64_SWAP_LE_BE (u.i);
- return u.d;
-}
-
-inline static gfloat
-GFLOAT_SWAP_LE_BE (gfloat in)
-{
- union
- {
- guint32 i;
- gfloat f;
- } u;
-
- u.f = in;
- u.i = GUINT32_SWAP_LE_BE (u.i);
- return u.f;
-}
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define GFLOAT_TO_LE(val) ((gfloat) (val))
-#define GFLOAT_TO_BE(val) (GFLOAT_SWAP_LE_BE (val))
-#define GDOUBLE_TO_LE(val) ((gdouble) (val))
-#define GDOUBLE_TO_BE(val) (GDOUBLE_SWAP_LE_BE (val))
-
-#elif G_BYTE_ORDER == G_BIG_ENDIAN
-#define GFLOAT_TO_LE(val) (GFLOAT_SWAP_LE_BE (val))
-#define GFLOAT_TO_BE(val) ((gfloat) (val))
-#define GDOUBLE_TO_LE(val) (GDOUBLE_SWAP_LE_BE (val))
-#define GDOUBLE_TO_BE(val) ((gdouble) (val))
-
-#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
-#error unknown ENDIAN type
-#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
-
-#define GFLOAT_FROM_LE(val) (GFLOAT_TO_LE (val))
-#define GFLOAT_FROM_BE(val) (GFLOAT_TO_BE (val))
-#define GDOUBLE_FROM_LE(val) (GDOUBLE_TO_LE (val))
-#define GDOUBLE_FROM_BE(val) (GDOUBLE_TO_BE (val))
-
-
-/**
- * gst_byte_reader_new:
- * @data: Data from which the #GstByteReader should read
- * @size: Size of @data in bytes
- *
- * Create a new #GstByteReader instance, which will read from @data.
- *
- * Returns: a new #GstByteReader instance
- *
- * Since: 0.10.22
- */
-GstByteReader *
-gst_byte_reader_new (const guint8 * data, guint size)
-{
- GstByteReader *ret = g_slice_new0 (GstByteReader);
-
- ret->data = data;
- ret->size = size;
-
- return ret;
-}
-
-/**
- * gst_byte_reader_new_from_buffer:
- * @buffer: Buffer from which the #GstByteReader should read
- *
- * Create a new #GstByteReader instance, which will read from the
- * #GstBuffer @buffer.
- *
- * Returns: a new #GstByteReader instance
- *
- * Since: 0.10.22
- */
-GstByteReader *
-gst_byte_reader_new_from_buffer (const GstBuffer * buffer)
-{
- g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
-
- return gst_byte_reader_new (GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
-}
-
-/**
- * gst_byte_reader_free:
- * @reader: a #GstByteReader instance
- *
- * Frees a #GstByteReader instance, which was previously allocated by
- * gst_byte_reader_new() or gst_byte_reader_new_from_buffer().
- *
- * Since: 0.10.22
- */
-void
-gst_byte_reader_free (GstByteReader * reader)
-{
- g_return_if_fail (reader != NULL);
-
- g_slice_free (GstByteReader, reader);
-}
-
-/**
- * gst_byte_reader_init:
- * @reader: a #GstByteReader instance
- * @data: Data from which the #GstByteReader should read
- * @size: Size of @data in bytes
- *
- * Initializes a #GstByteReader instance to read from @data. This function
- * can be called on already initialized instances.
- *
- * Since: 0.10.22
- */
-void
-gst_byte_reader_init (GstByteReader * reader, const guint8 * data, guint size)
-{
- g_return_if_fail (reader != NULL);
-
- reader->data = data;
- reader->size = size;
- reader->byte = 0;
-}
-
-/**
- * gst_byte_reader_init:
- * @reader: a #GstByteReader instance
- * @buffer: Buffer from which the #GstByteReader should read
- *
- * Initializes a #GstByteReader instance to read from @buffer. This function
- * can be called on already initialized instances.
- *
- * Since: 0.10.22
- */
-void
-gst_byte_reader_init_from_buffer (GstByteReader * reader,
- const GstBuffer * buffer)
-{
- g_return_if_fail (GST_IS_BUFFER (buffer));
-
- gst_byte_reader_init (reader, GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
-}
-
-/**
- * gst_byte_reader_set_pos:
- * @reader: a #GstByteReader instance
- * @pos: The new position in bytes
- *
- * Sets the new position of a #GstByteReader instance to @pos in bytes.
- *
- * Returns: %TRUE if the position could be set successfully, %FALSE
- * otherwise.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_byte_reader_set_pos (GstByteReader * reader, guint pos)
-{
- g_return_val_if_fail (reader != NULL, FALSE);
-
- if (pos > reader->size)
- return FALSE;
-
- reader->byte = pos;
-
- return TRUE;
-}
-
-/**
- * gst_byte_reader_get_pos:
- * @reader: a #GstByteReader instance
- *
- * Returns the current position of a #GstByteReader instance in bytes.
- *
- * Returns: The current position of @reader in bytes.
- *
- * Since: 0.10.22
- */
-guint
-gst_byte_reader_get_pos (const GstByteReader * reader)
-{
- g_return_val_if_fail (reader != NULL, 0);
-
- return reader->byte;
-}
-
-/**
- * gst_byte_reader_get_remaining:
- * @reader: a #GstByteReader instance
- *
- * Returns the remaining number of bytes of a #GstByteReader instance.
- *
- * Returns: The remaining number of bytes of @reader instance.
- *
- * Since: 0.10.22
- */
-guint
-gst_byte_reader_get_remaining (const GstByteReader * reader)
-{
- g_return_val_if_fail (reader != NULL, 0);
-
- return reader->size - reader->byte;
-}
-
-/**
- * gst_byte_reader_skip:
- * @reader: a #GstByteReader instance
- * @nbytes: the number of bytes to skip
- *
- * Skips @nbytes bytes of the #GstByteReader instance.
- *
- * Returns: %TRUE if @nbytes bytes could be skipped, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_byte_reader_skip (GstByteReader * reader, guint nbytes)
-{
- g_return_val_if_fail (reader != NULL, FALSE);
-
- if (gst_byte_reader_get_remaining (reader) < nbytes)
- return FALSE;
-
- reader->byte += nbytes;
-
- return TRUE;
-}
-
-/**
- * gst_byte_reader_get_uint8:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint8 to store the result
- *
- * Read an unsigned 8 bit integer into @val and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int8:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint8 to store the result
- *
- * Read a signed 8 bit integer into @val and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint8:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint8 to store the result
- *
- * Read a signed 8 bit integer into @val but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int8:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint8 to store the result
- *
- * Read a signed 8 bit integer into @val but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_uint16_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint16 to store the result
- *
- * Read an unsigned 16 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int16_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint16 to store the result
- *
- * Read a signed 16 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint16_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint16 to store the result
- *
- * Read a signed 16 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int16_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint16 to store the result
- *
- * Read a signed 16 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_uint16_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint16 to store the result
- *
- * Read an unsigned 16 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int16_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint16 to store the result
- *
- * Read a signed 16 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint16_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint16 to store the result
- *
- * Read a signed 16 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int16_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint16 to store the result
- *
- * Read a signed 16 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_uint24_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read an unsigned 24 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int24_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 24 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint24_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read a signed 24 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int24_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 24 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_uint24_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read an unsigned 24 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int24_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 24 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint24_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read a signed 24 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int24_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 24 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-
-/**
- * gst_byte_reader_get_uint32_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read an unsigned 32 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int32_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 32 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint32_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read a signed 32 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int32_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 32 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_uint32_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read an unsigned 32 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int32_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 32 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint32_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint32 to store the result
- *
- * Read a signed 32 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int32_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint32 to store the result
- *
- * Read a signed 32 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_uint64_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint64 to store the result
- *
- * Read an unsigned 64 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int64_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint64 to store the result
- *
- * Read a signed 64 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint64_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint64 to store the result
- *
- * Read a signed 64 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int64_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint64 to store the result
- *
- * Read a signed 64 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_uint64_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint64 to store the result
- *
- * Read an unsigned 64 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_int64_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint64 to store the result
- *
- * Read a signed 64 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_uint64_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #guint64 to store the result
- *
- * Read a signed 64 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_int64_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gint64 to store the result
- *
- * Read a signed 64 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-#define GST_BYTE_READER_READ_INTS(bits) \
-gboolean \
-gst_byte_reader_get_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 (reader->byte + bits / 8 > reader->size) \
- return FALSE; \
- \
- *val = GST_READ_UINT##bits##_LE (&reader->data[reader->byte]); \
- reader->byte += bits / 8; \
- return TRUE; \
-} \
-\
-gboolean \
-gst_byte_reader_get_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 (reader->byte + bits / 8 > reader->size) \
- 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 (reader->byte + bits / 8 > reader->size) \
- 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 (reader->byte + bits / 8 > reader->size) \
- 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 (reader->byte + bits / 8 > reader->size) \
- 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 (reader->byte + bits / 8 > reader->size) \
- 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 (reader->byte + bits / 8 > reader->size) \
- 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 (reader->byte + bits / 8 > reader->size) \
- return FALSE; \
- \
- *val = GST_READ_UINT##bits##_BE (&reader->data[reader->byte]); \
- return TRUE; \
-}
-
-
-GST_BYTE_READER_READ_INTS (16);
-GST_BYTE_READER_READ_INTS (32);
-GST_BYTE_READER_READ_INTS (64);
-
-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);
-
- if (reader->byte + 1 > reader->size)
- return FALSE;
-
- *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 + 1 > 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 + 1 > 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 + 1 > 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- *val =
- (reader->data[reader->byte] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte + 2] << 16));
- 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- *val =
- (reader->data[reader->byte + 2] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte] << 16));
- 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- ret =
- (reader->data[reader->byte] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte + 2] << 16));
-
- 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- ret =
- (reader->data[reader->byte + 2] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte] << 16));
- 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- *val =
- (reader->data[reader->byte] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte + 2] << 16));
- 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- *val =
- (reader->data[reader->byte + 2] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte] << 16));
- 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- ret =
- (reader->data[reader->byte] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte + 2] << 16));
-
- 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 (reader->byte + 3 > reader->size)
- return FALSE;
-
- ret =
- (reader->data[reader->byte + 2] | (reader->data[reader->byte +
- 1] << 8) | (reader->data[reader->byte] << 16));
- if (ret & 0x00800000)
- ret |= 0xff000000;
-
- *val = ret;
- return TRUE;
-}
-
-/**
- * gst_byte_reader_get_float32_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gfloat to store the result
- *
- * Read a 32 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_float32_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gfloat to store the result
- *
- * Read a 32 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_float32_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gfloat to store the result
- *
- * Read a 32 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_float32_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gfloat to store the result
- *
- * Read a 32 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_float64_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gdouble to store the result
- *
- * Read a 64 bit little endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_float64_le:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gdouble to store the result
- *
- * Read a 64 bit little endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_get_float64_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gdouble to store the result
- *
- * Read a 64 bit big endian integer into @val
- * and update the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-/**
- * gst_byte_reader_peek_float64_be:
- * @reader: a #GstByteReader instance
- * @val: Pointer to a #gdouble to store the result
- *
- * Read a 64 bit big endian integer into @val
- * but keep the current position.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- *
- * Since: 0.10.22
- */
-
-#define GST_BYTE_READER_READ_FLOATS(bits, type, TYPE) \
-gboolean \
-gst_byte_reader_get_float##bits##_le (GstByteReader *reader, g##type *val) \
-{ \
- g##type ret; \
- \
- g_return_val_if_fail (reader != NULL, FALSE); \
- g_return_val_if_fail (val != NULL, FALSE); \
- \
- if (reader->byte + bits / 8 > reader->size) \
- return FALSE; \
- \
- memcpy (&ret, &reader->data[reader->byte], bits / 8); \
- *val = G##TYPE##_FROM_LE (ret); \
- reader->byte += bits / 8; \
- return TRUE; \
-} \
-gboolean \
-gst_byte_reader_get_float##bits##_be (GstByteReader *reader, g##type *val) \
-{ \
- g##type ret; \
- \
- g_return_val_if_fail (reader != NULL, FALSE); \
- g_return_val_if_fail (val != NULL, FALSE); \
- \
- if (reader->byte + bits / 8 > reader->size) \
- return FALSE; \
- \
- memcpy (&ret, &reader->data[reader->byte], bits / 8); \
- *val = G##TYPE##_FROM_BE (ret); \
- reader->byte += bits / 8; \
- return TRUE; \
-} \
-gboolean \
-gst_byte_reader_peek_float##bits##_le (GstByteReader *reader, g##type *val) \
-{ \
- g##type ret; \
- \
- g_return_val_if_fail (reader != NULL, FALSE); \
- g_return_val_if_fail (val != NULL, FALSE); \
- \
- if (reader->byte + bits / 8 > reader->size) \
- return FALSE; \
- \
- memcpy (&ret, &reader->data[reader->byte], bits / 8); \
- *val = G##TYPE##_FROM_LE (ret); \
- return TRUE; \
-} \
-gboolean \
-gst_byte_reader_peek_float##bits##_be (GstByteReader *reader, g##type *val) \
-{ \
- g##type ret; \
- \
- g_return_val_if_fail (reader != NULL, FALSE); \
- g_return_val_if_fail (val != NULL, FALSE); \
- \
- if (reader->byte + bits / 8 > reader->size) \
- return FALSE; \
- \
- memcpy (&ret, &reader->data[reader->byte], bits / 8); \
- *val = G##TYPE##_FROM_BE (ret); \
- return TRUE; \
-}
-
-GST_BYTE_READER_READ_FLOATS (32, float, FLOAT);
-GST_BYTE_READER_READ_FLOATS (64, double, DOUBLE);
diff --git a/gst/flacparse/gstbytereader.h b/gst/flacparse/gstbytereader.h
deleted file mode 100644
index 28534c00..00000000
--- a/gst/flacparse/gstbytereader.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
- *
- * 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.
- */
-
-#ifndef __GST_BYTE_READER_H__
-#define __GST_BYTE_READER_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-/**
- * GstByteReader:
- * @data: Data from which the bit reader will read
- * @size: Size of @data in bytes
- * @byte: Current byte position
- *
- * A byte reader instance.
- */
-typedef struct {
- const guint8 *data;
- guint size;
-
- guint byte; /* Byte position */
-} GstByteReader;
-
-GstByteReader * gst_byte_reader_new (const guint8 *data, guint size);
-GstByteReader * gst_byte_reader_new_from_buffer (const GstBuffer *buffer);
-void gst_byte_reader_free (GstByteReader *reader);
-
-void gst_byte_reader_init (GstByteReader *reader, const guint8 *data, guint size);
-void gst_byte_reader_init_from_buffer (GstByteReader *reader, const GstBuffer *buffer);
-
-gboolean gst_byte_reader_set_pos (GstByteReader *reader, guint pos);
-
-guint gst_byte_reader_get_pos (const GstByteReader *reader);
-guint gst_byte_reader_get_remaining (const GstByteReader *reader);
-
-gboolean gst_byte_reader_skip (GstByteReader *reader, guint nbytes);
-
-gboolean gst_byte_reader_get_uint8 (GstByteReader *reader, guint8 *val);
-gboolean gst_byte_reader_get_int8 (GstByteReader *reader, gint8 *val);
-gboolean gst_byte_reader_get_uint16_le (GstByteReader *reader, guint16 *val);
-gboolean gst_byte_reader_get_int16_le (GstByteReader *reader, gint16 *val);
-gboolean gst_byte_reader_get_uint16_be (GstByteReader *reader, guint16 *val);
-gboolean gst_byte_reader_get_int16_be (GstByteReader *reader, gint16 *val);
-gboolean gst_byte_reader_get_uint24_le (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_get_int24_le (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_get_uint24_be (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_get_int24_be (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_get_uint32_le (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_get_int32_le (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_get_uint32_be (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_get_int32_be (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_get_uint64_le (GstByteReader *reader, guint64 *val);
-gboolean gst_byte_reader_get_int64_le (GstByteReader *reader, gint64 *val);
-gboolean gst_byte_reader_get_uint64_be (GstByteReader *reader, guint64 *val);
-gboolean gst_byte_reader_get_int64_be (GstByteReader *reader, gint64 *val);
-
-gboolean gst_byte_reader_peek_uint8 (GstByteReader *reader, guint8 *val);
-gboolean gst_byte_reader_peek_int8 (GstByteReader *reader, gint8 *val);
-gboolean gst_byte_reader_peek_uint16_le (GstByteReader *reader, guint16 *val);
-gboolean gst_byte_reader_peek_int16_le (GstByteReader *reader, gint16 *val);
-gboolean gst_byte_reader_peek_uint16_be (GstByteReader *reader, guint16 *val);
-gboolean gst_byte_reader_peek_int16_be (GstByteReader *reader, gint16 *val);
-gboolean gst_byte_reader_peek_uint24_le (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_peek_int24_le (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_peek_uint24_be (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_peek_int24_be (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_peek_uint32_le (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_peek_int32_le (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_peek_uint32_be (GstByteReader *reader, guint32 *val);
-gboolean gst_byte_reader_peek_int32_be (GstByteReader *reader, gint32 *val);
-gboolean gst_byte_reader_peek_uint64_le (GstByteReader *reader, guint64 *val);
-gboolean gst_byte_reader_peek_int64_le (GstByteReader *reader, gint64 *val);
-gboolean gst_byte_reader_peek_uint64_be (GstByteReader *reader, guint64 *val);
-gboolean gst_byte_reader_peek_int64_be (GstByteReader *reader, gint64 *val);
-
-gboolean gst_byte_reader_get_float32_le (GstByteReader *reader, gfloat *val);
-gboolean gst_byte_reader_get_float32_be (GstByteReader *reader, gfloat *val);
-gboolean gst_byte_reader_get_float64_le (GstByteReader *reader, gdouble *val);
-gboolean gst_byte_reader_get_float64_be (GstByteReader *reader, gdouble *val);
-
-gboolean gst_byte_reader_peek_float32_le (GstByteReader *reader, gfloat *val);
-gboolean gst_byte_reader_peek_float32_be (GstByteReader *reader, gfloat *val);
-gboolean gst_byte_reader_peek_float64_le (GstByteReader *reader, gdouble *val);
-gboolean gst_byte_reader_peek_float64_be (GstByteReader *reader, gdouble *val);
-
-/**
- * GST_BYTE_READER_INIT:
- * @data: Data from which the #GstByteReader should read
- * @size: Size of @data in bytes
- *
- * A #GstByteReader must be initialized with this macro, before it can be
- * used. This macro can used be to initialize a variable, but it cannot
- * be assigned to a variable. In that case you have to use
- * gst_byte_reader_init().
- *
- * Since: 0.10.22
- */
-#define GST_BYTE_READER_INIT(data, size) {data, size, 0}
-
-/**
- * GST_BYTE_READER_INIT_FROM_BUFFER:
- * @buffer: Buffer from which the #GstByteReader should read
- *
- * A #GstByteReader must be initialized with this macro, before it can be
- * used. This macro can used be to initialize a variable, but it cannot
- * be assigned to a variable. In that case you have to use
- * gst_byte_reader_init().
- *
- * Since: 0.10.22
- */
-#define GST_BYTE_READER_INIT_FROM_BUFFER(buffer) {GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), 0}
-
-G_END_DECLS
-
-#endif /* __GST_BYTE_READER_H__ */
diff --git a/gst/flacparse/gstflacparse.c b/gst/flacparse/gstflacparse.c
index 871082b1..d65ba062 100644
--- a/gst/flacparse/gstflacparse.c
+++ b/gst/flacparse/gstflacparse.c
@@ -28,8 +28,8 @@
#include <gst/tag/tag.h>
#include <gst/audio/audio.h>
-#include "gstbitreader.h"
-#include "gstbytereader.h"
+#include <gst/base/gstbitreader.h>
+#include <gst/base/gstbytereader.h>
GST_DEBUG_CATEGORY_STATIC (flacparse_debug);
#define GST_CAT_DEFAULT flacparse_debug