gstreamer_core/libs/gst/base/gstbitreader.h
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
equal deleted inserted replaced
29:567bb019e3e3 30:7e817e7e631c
     1 /* GStreamer
       
     2  *
       
     3  * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Library General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Library General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Library General Public
       
    16  * License along with this library; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 #ifndef __GST_BIT_READER_H__
       
    22 #define __GST_BIT_READER_H__
       
    23 
       
    24 #include <gst/gst.h>
       
    25 
       
    26 G_BEGIN_DECLS
       
    27 
       
    28 /**
       
    29  * GstBitReader:
       
    30  * @data: Data from which the bit reader will read
       
    31  * @size: Size of @data in bytes
       
    32  * @byte: Current byte position
       
    33  * @bit: Bit position in the current byte
       
    34  *
       
    35  * A bit reader instance.
       
    36  */
       
    37 typedef struct {
       
    38   const guint8 *data;
       
    39   guint size;
       
    40 
       
    41   guint byte;  /* Byte position */
       
    42   guint bit;   /* Bit position in the current byte */
       
    43 } GstBitReader;
       
    44 #ifdef __SYMBIAN32__
       
    45 IMPORT_C
       
    46 #endif
       
    47 
       
    48 
       
    49 GstBitReader * gst_bit_reader_new (const guint8 *data, guint size);
       
    50 #ifdef __SYMBIAN32__
       
    51 IMPORT_C
       
    52 #endif
       
    53 
       
    54 GstBitReader * gst_bit_reader_new_from_buffer (const GstBuffer *buffer);
       
    55 #ifdef __SYMBIAN32__
       
    56 IMPORT_C
       
    57 #endif
       
    58 
       
    59 void gst_bit_reader_free (GstBitReader *reader);
       
    60 #ifdef __SYMBIAN32__
       
    61 IMPORT_C
       
    62 #endif
       
    63 
       
    64 
       
    65 void gst_bit_reader_init (GstBitReader *reader, const guint8 *data, guint size);
       
    66 #ifdef __SYMBIAN32__
       
    67 IMPORT_C
       
    68 #endif
       
    69 
       
    70 void gst_bit_reader_init_from_buffer (GstBitReader *reader, const GstBuffer *buffer);
       
    71 #ifdef __SYMBIAN32__
       
    72 IMPORT_C
       
    73 #endif
       
    74 
       
    75 
       
    76 gboolean gst_bit_reader_set_pos (GstBitReader *reader, guint pos);
       
    77 #ifdef __SYMBIAN32__
       
    78 IMPORT_C
       
    79 #endif
       
    80 
       
    81 
       
    82 guint gst_bit_reader_get_pos (const GstBitReader *reader);
       
    83 #ifdef __SYMBIAN32__
       
    84 IMPORT_C
       
    85 #endif
       
    86 
       
    87 guint gst_bit_reader_get_remaining (const GstBitReader *reader);
       
    88 #ifdef __SYMBIAN32__
       
    89 IMPORT_C
       
    90 #endif
       
    91 
       
    92 
       
    93 gboolean gst_bit_reader_skip (GstBitReader *reader, guint nbits);
       
    94 #ifdef __SYMBIAN32__
       
    95 IMPORT_C
       
    96 #endif
       
    97 
       
    98 gboolean gst_bit_reader_skip_to_byte (GstBitReader *reader);
       
    99 #ifdef __SYMBIAN32__
       
   100 IMPORT_C
       
   101 #endif
       
   102 
       
   103 gboolean gst_bit_reader_get_bits_uint8 (GstBitReader *reader, guint8 *val, guint nbits);
       
   104 #ifdef __SYMBIAN32__
       
   105 IMPORT_C
       
   106 #endif
       
   107 
       
   108 gboolean gst_bit_reader_get_bits_uint16 (GstBitReader *reader, guint16 *val, guint nbits);
       
   109 #ifdef __SYMBIAN32__
       
   110 IMPORT_C
       
   111 #endif
       
   112 
       
   113 gboolean gst_bit_reader_get_bits_uint32 (GstBitReader *reader, guint32 *val, guint nbits);
       
   114 #ifdef __SYMBIAN32__
       
   115 IMPORT_C
       
   116 #endif
       
   117 
       
   118 gboolean gst_bit_reader_get_bits_uint64 (GstBitReader *reader, guint64 *val, guint nbits);
       
   119 #ifdef __SYMBIAN32__
       
   120 IMPORT_C
       
   121 #endif
       
   122 
       
   123 gboolean gst_bit_reader_peek_bits_uint8 (const GstBitReader *reader, guint8 *val, guint nbits);
       
   124 #ifdef __SYMBIAN32__
       
   125 IMPORT_C
       
   126 #endif
       
   127 
       
   128 gboolean gst_bit_reader_peek_bits_uint16 (const GstBitReader *reader, guint16 *val, guint nbits);
       
   129 #ifdef __SYMBIAN32__
       
   130 IMPORT_C
       
   131 #endif
       
   132 
       
   133 gboolean gst_bit_reader_peek_bits_uint32 (const GstBitReader *reader, guint32 *val, guint nbits);
       
   134 #ifdef __SYMBIAN32__
       
   135 IMPORT_C
       
   136 #endif
       
   137 
       
   138 gboolean gst_bit_reader_peek_bits_uint64 (const GstBitReader *reader, guint64 *val, guint nbits);
       
   139 
       
   140 /**
       
   141  * GST_BIT_READER_INIT:
       
   142  * @data: Data from which the #GstBitReader should read
       
   143  * @size: Size of @data in bytes
       
   144  *
       
   145  * A #GstBitReader must be initialized with this macro, before it can be
       
   146  * used. This macro can used be to initialize a variable, but it cannot
       
   147  * be assigned to a variable. In that case you have to use
       
   148  * gst_bit_reader_init().
       
   149  *
       
   150  * Since: 0.10.22
       
   151  */
       
   152 #define GST_BIT_READER_INIT(data, size) {data, size, 0, 0}
       
   153 
       
   154 /**
       
   155  * GST_BIT_READER_INIT_FROM_BUFFER:
       
   156  * @buffer: Buffer from which the #GstBitReader should read
       
   157  *
       
   158  * A #GstBitReader must be initialized with this macro, before it can be
       
   159  * used. This macro can used be to initialize a variable, but it cannot
       
   160  * be assigned to a variable. In that case you have to use
       
   161  * gst_bit_reader_init().
       
   162  *
       
   163  * Since: 0.10.22
       
   164  */
       
   165 #define GST_BIT_READER_INIT_FROM_BUFFER(buffer) {GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), 0, 0}
       
   166 
       
   167 G_END_DECLS
       
   168 
       
   169 #endif /* __GST_BIT_READER_H__ */