mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
bytewriter: add _fill function
Adds a new function to GstByteWriter that writes a constant value to a memory area (aka memset). Useful for adding padding to buffers. Also updates .def file and docs. API: gst_byte_writer_fill()
This commit is contained in:
parent
51d382e2ee
commit
bfff7a1b4e
4 changed files with 30 additions and 0 deletions
|
@ -595,6 +595,7 @@ gst_byte_writer_put_string_utf32
|
||||||
gst_byte_writer_put_string_utf8
|
gst_byte_writer_put_string_utf8
|
||||||
|
|
||||||
gst_byte_writer_put_data
|
gst_byte_writer_put_data
|
||||||
|
gst_byte_writer_fill
|
||||||
|
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
GST_BYTE_WRITER
|
GST_BYTE_WRITER
|
||||||
|
|
|
@ -492,6 +492,21 @@ gst_byte_writer_put_data (GstByteWriter * writer, const guint8 * data,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_byte_writer_fill (GstByteWriter * writer, const guint8 value, guint size)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (writer != NULL, FALSE);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (!gst_byte_writer_ensure_free_space (writer, size)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
memset ((guint8 *) & writer->parent.data[writer->parent.byte], value, size);
|
||||||
|
writer->parent.byte += size;
|
||||||
|
writer->parent.size = MAX (writer->parent.size, writer->parent.byte);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#define CREATE_WRITE_STRING_FUNC(bits,type) \
|
#define CREATE_WRITE_STRING_FUNC(bits,type) \
|
||||||
gboolean \
|
gboolean \
|
||||||
gst_byte_writer_put_string_utf##bits (GstByteWriter *writer, const type * data) \
|
gst_byte_writer_put_string_utf##bits (GstByteWriter *writer, const type * data) \
|
||||||
|
@ -806,3 +821,15 @@ CREATE_WRITE_STRING_FUNC (32, guint32);
|
||||||
*
|
*
|
||||||
* Since: 0.10.26
|
* Since: 0.10.26
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* gst_byte_writer_fill:
|
||||||
|
* @writer: #GstByteWriter instance
|
||||||
|
* @value: Value to be writen
|
||||||
|
* @size: Number of bytes to be writen
|
||||||
|
*
|
||||||
|
* Writes @size bytes containing @value to @writer.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the value could be written
|
||||||
|
*
|
||||||
|
* Since: 0.10.26
|
||||||
|
*/
|
||||||
|
|
|
@ -144,6 +144,7 @@ gboolean gst_byte_writer_put_double_be (GstByteWriter *writer, gdouble val);
|
||||||
gboolean gst_byte_writer_put_double_le (GstByteWriter *writer, gdouble val);
|
gboolean gst_byte_writer_put_double_le (GstByteWriter *writer, gdouble val);
|
||||||
|
|
||||||
gboolean gst_byte_writer_put_data (GstByteWriter *writer, const guint8 *data, guint size);
|
gboolean gst_byte_writer_put_data (GstByteWriter *writer, const guint8 *data, guint size);
|
||||||
|
gboolean gst_byte_writer_fill (GstByteWriter *writer, const guint8 value, guint size);
|
||||||
gboolean gst_byte_writer_put_string_utf8 (GstByteWriter *writer, const gchar *data);
|
gboolean gst_byte_writer_put_string_utf8 (GstByteWriter *writer, const gchar *data);
|
||||||
gboolean gst_byte_writer_put_string_utf16 (GstByteWriter *writer, const guint16 *data);
|
gboolean gst_byte_writer_put_string_utf16 (GstByteWriter *writer, const guint16 *data);
|
||||||
gboolean gst_byte_writer_put_string_utf32 (GstByteWriter *writer, const guint32 *data);
|
gboolean gst_byte_writer_put_string_utf32 (GstByteWriter *writer, const guint32 *data);
|
||||||
|
|
|
@ -142,6 +142,7 @@ EXPORTS
|
||||||
gst_byte_reader_skip_string_utf32
|
gst_byte_reader_skip_string_utf32
|
||||||
gst_byte_reader_skip_string_utf8
|
gst_byte_reader_skip_string_utf8
|
||||||
gst_byte_writer_ensure_free_space
|
gst_byte_writer_ensure_free_space
|
||||||
|
gst_byte_writer_fill
|
||||||
gst_byte_writer_free
|
gst_byte_writer_free
|
||||||
gst_byte_writer_free_and_get_buffer
|
gst_byte_writer_free_and_get_buffer
|
||||||
gst_byte_writer_free_and_get_data
|
gst_byte_writer_free_and_get_data
|
||||||
|
|
Loading…
Reference in a new issue