Top | ![]() |
![]() |
![]() |
![]() |
GstBitWriter provides a bit writer that can write any number of bits into a memory buffer. It provides functions for writing any number of bits into 8, 16, 32 and 64 bit variables.
GstBitWriter *
gst_bit_writer_new (void
);
Creates a new, empty GstBitWriter instance.
Free-function: gst_bit_writer_free
[skip]
GstBitWriter * gst_bit_writer_new_with_size (guint32 size
,gboolean fixed
);
Creates a GstBitWriter instance with the given initial data size.
Free-function: gst_bit_writer_free
[skip]
GstBitWriter * gst_bit_writer_new_with_data (guint8 *data
,guint size
,gboolean initialized
);
Creates a new GstBitWriter instance with the given memory area. If
initialized
is TRUE
it is possible to read size
bits from the
GstBitWriter from the beginnig.
Free-function: gst_bit_writer_free
[skip]
data |
Memory area for writing |
|
size |
Size of |
|
initialized |
if |
void
gst_bit_writer_free (GstBitWriter *bitwriter
);
Frees bitwriter
and the allocated data inside.
GstBuffer *
gst_bit_writer_free_and_get_buffer (GstBitWriter *bitwriter
);
Frees bitwriter
without destroying the internal data, which is
returned as GstBuffer.
Free-function: gst_buffer_unref
guint8 *
gst_bit_writer_free_and_get_data (GstBitWriter *bitwriter
);
Frees bitwriter
without destroying the internal data, which is
returned.
Free-function: g_free
void
gst_bit_writer_init (GstBitWriter *bitwriter
);
Initializes bitwriter
to an empty instance.
[skip]
void gst_bit_writer_init_with_size (GstBitWriter *bitwriter
,guint32 size
,gboolean fixed
);
Initializes a GstBitWriter instance and allocates the given data
size
.
[skip]
bitwriter |
GstBitWriter instance |
|
size |
the size on bytes to allocate for data |
|
fixed |
If |
void gst_bit_writer_init_with_data (GstBitWriter *bitwriter
,guint8 *data
,guint size
,gboolean initialized
);
Initializes bitwriter
with the given memory area data
. IF
initialized
is TRUE
it is possible to read size
bits from the
GstBitWriter from the beginning.
[skip]
bitwriter |
GstBitWriter instance |
|
data |
Memory area for writing. |
[array length=size][transfer none] |
size |
Size of |
|
initialized |
If |
void
gst_bit_writer_reset (GstBitWriter *bitwriter
);
Resets bitwriter
and frees the data if it's owned by bitwriter
.
GstBuffer *
gst_bit_writer_reset_and_get_buffer (GstBitWriter *bitwriter
);
Resets bitwriter
and returns the current data as GstBuffer.
Free-function: gst_buffer_unref
guint8 *
gst_bit_writer_reset_and_get_data (GstBitWriter *bitwriter
);
Resets bitwriter
and returns the current data.
Free-function: g_free
guint
gst_bit_writer_get_size (const GstBitWriter *bitwriter
);
Get size of written data
guint8 *
gst_bit_writer_get_data (const GstBitWriter *bitwriter
);
Get written data pointer
guint
gst_bit_writer_get_size_unchecked (const GstBitWriter *bitwriter
);
guint8 *
gst_bit_writer_get_data_unchecked (const GstBitWriter *bitwriter
);
gboolean gst_bit_writer_set_pos_unchecked (GstBitWriter *bitwriter
,guint pos
);
guint
gst_bit_writer_get_remaining_unchecked
(const GstBitWriter *bitwriter
);
gboolean gst_bit_writer_put_bits_uint16 (GstBitWriter *bitwriter
,guint16 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter.
bitwriter |
a GstBitWriter instance |
|
value |
value of guint16 to write |
|
nbits |
number of bits to write |
gboolean gst_bit_writer_put_bits_uint32 (GstBitWriter *bitwriter
,guint32 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter.
bitwriter |
a GstBitWriter instance |
|
value |
value of guint32 to write |
|
nbits |
number of bits to write |
gboolean gst_bit_writer_put_bits_uint64 (GstBitWriter *bitwriter
,guint64 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter.
bitwriter |
a GstBitWriter instance |
|
value |
value of guint64 to write |
|
nbits |
number of bits to write |
gboolean gst_bit_writer_put_bits_uint8 (GstBitWriter *bitwriter
,guint8 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter.
bitwriter |
a GstBitWriter instance |
|
value |
value of guint8 to write |
|
nbits |
number of bits to write |
gboolean gst_bit_writer_put_bytes (GstBitWriter *bitwriter
,const guint8 *data
,guint nbytes
);
Write nbytes
bytes of data
to GstBitWriter.
bitwriter |
a GstBitWriter instance |
|
data |
pointer of data to write |
|
nbytes |
number of bytes to write |
void gst_bit_writer_put_bits_uint16_unchecked (GstBitWriter *bitwriter
,guint16 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter without checking whether
there is enough space
bitwriter |
a GstBitWriter instance |
|
value |
value of guint16 to write |
|
nbits |
number of bits to write |
void gst_bit_writer_put_bits_uint32_unchecked (GstBitWriter *bitwriter
,guint32 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter without checking whether
there is enough space
bitwriter |
a GstBitWriter instance |
|
value |
value of guint32 to write |
|
nbits |
number of bits to write |
void gst_bit_writer_put_bits_uint64_unchecked (GstBitWriter *bitwriter
,guint64 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter without checking whether
there is enough space
bitwriter |
a GstBitWriter instance |
|
value |
value of guint64 to write |
|
nbits |
number of bits to write |
void gst_bit_writer_put_bits_uint8_unchecked (GstBitWriter *bitwriter
,guint8 value
,guint nbits
);
Write nbits
bits of value
to GstBitWriter without checking whether
there is enough space
bitwriter |
a GstBitWriter instance |
|
value |
value of guint8 to write |
|
nbits |
number of bits to write |
void gst_bit_writer_put_bytes_unchecked (GstBitWriter *bitwriter
,const guint8 *data
,guint nbytes
);
Write nbytes
bytes of data
to GstBitWriter without checking whether
there is enough space
bitwriter |
a GstBitWriter instance |
|
data |
pointer of data to write |
|
nbytes |
number of bytes to write |
gboolean gst_bit_writer_align_bytes (GstBitWriter *bitwriter
,guint8 trailing_bit
);
Write trailing bit to align last byte of data
. trailing_bit
can
only be 1 or 0.
void gst_bit_writer_align_bytes_unchecked (GstBitWriter *bitwriter
,guint8 trailing_bit
);
Write trailing bit to align last byte of data
without checking whether there
is enough space