Coverage Report

Created: 2025-09-05 06:29

/src/gstreamer/subprojects/gstreamer/libs/gst/base/gstbytewriter.c
Line
Count
Source (jump to first uncovered line)
1
/* GStreamer byte writer
2
 *
3
 * Copyright (C) 2009 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., 51 Franklin St, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 */
20
21
#ifdef HAVE_CONFIG_H
22
#include "config.h"
23
#endif
24
25
#define GST_BYTE_WRITER_DISABLE_INLINES
26
#include "gstbytewriter.h"
27
28
#include "gst/glib-compat-private.h"
29
30
/**
31
 * SECTION:gstbytewriter
32
 * @title: GstByteWriter
33
 * @short_description: Writes different integer, string and floating point
34
 *     types to a memory buffer and allows reading
35
 * @symbols:
36
 * - gst_byte_writer_put_uint8_unchecked
37
 * - gst_byte_writer_put_uint16_be_unchecked
38
 * - gst_byte_writer_put_uint24_be_unchecked
39
 * - gst_byte_writer_put_uint32_be_unchecked
40
 * - gst_byte_writer_put_uint64_be_unchecked
41
 * - gst_byte_writer_put_uint16_le_unchecked
42
 * - gst_byte_writer_put_uint24_le_unchecked
43
 * - gst_byte_writer_put_uint32_le_unchecked
44
 * - gst_byte_writer_put_uint64_le_unchecked
45
 * - gst_byte_writer_put_int8_unchecked
46
 * - gst_byte_writer_put_int16_be_unchecked
47
 * - gst_byte_writer_put_int24_be_unchecked
48
 * - gst_byte_writer_put_int32_be_unchecked
49
 * - gst_byte_writer_put_int64_be_unchecked
50
 * - gst_byte_writer_put_int16_le_unchecked
51
 * - gst_byte_writer_put_int24_le_unchecked
52
 * - gst_byte_writer_put_int32_le_unchecked
53
 * - gst_byte_writer_put_int64_le_unchecked
54
 * - gst_byte_writer_put_float32_be_unchecked
55
 * - gst_byte_writer_put_float64_be_unchecked
56
 * - gst_byte_writer_put_float32_le_unchecked
57
 * - gst_byte_writer_put_float64_le_unchecked
58
 * - gst_byte_writer_put_data_unchecked
59
 * - gst_byte_writer_fill_unchecked
60
 *
61
 * #GstByteWriter provides a byte writer and reader that can write/read different
62
 * integer and floating point types to/from a memory buffer. It provides functions
63
 * for writing/reading signed/unsigned, little/big endian integers of 8, 16, 24,
64
 * 32 and 64 bits and functions for reading little/big endian floating points numbers of
65
 * 32 and 64 bits. It also provides functions to write/read NUL-terminated strings
66
 * in various character encodings.
67
 */
68
69
/**
70
 * gst_byte_writer_new: (skip)
71
 *
72
 * Creates a new, empty #GstByteWriter instance
73
 *
74
 * Free-function: gst_byte_writer_free
75
 *
76
 * Returns: (transfer full): a new, empty #GstByteWriter instance
77
 */
78
GstByteWriter *
79
gst_byte_writer_new (void)
80
0
{
81
0
  GstByteWriter *ret = g_new0 (GstByteWriter, 1);
82
83
0
  ret->owned = TRUE;
84
0
  return ret;
85
0
}
86
87
/**
88
 * gst_byte_writer_new_with_size: (skip)
89
 * @size: Initial size of data
90
 * @fixed: If %TRUE the data can't be reallocated
91
 *
92
 * Creates a new #GstByteWriter instance with the given
93
 * initial data size.
94
 *
95
 * Free-function: gst_byte_writer_free
96
 *
97
 * Returns: (transfer full): a new #GstByteWriter instance
98
 */
99
GstByteWriter *
100
gst_byte_writer_new_with_size (guint size, gboolean fixed)
101
0
{
102
0
  GstByteWriter *ret = gst_byte_writer_new ();
103
104
0
  ret->alloc_size = size;
105
0
  ret->parent.data = g_malloc (ret->alloc_size);
106
0
  ret->fixed = fixed;
107
0
  ret->owned = TRUE;
108
109
0
  return ret;
110
0
}
111
112
/**
113
 * gst_byte_writer_new_with_data: (skip)
114
 * @data: Memory area for writing
115
 * @size: Size of @data in bytes
116
 * @initialized: If %TRUE the complete data can be read from the beginning
117
 *
118
 * Creates a new #GstByteWriter instance with the given
119
 * memory area. If @initialized is %TRUE it is possible to
120
 * read @size bytes from the #GstByteWriter from the beginning.
121
 *
122
 * Free-function: gst_byte_writer_free
123
 *
124
 * Returns: (transfer full): a new #GstByteWriter instance
125
 */
126
GstByteWriter *
127
gst_byte_writer_new_with_data (guint8 * data, guint size, gboolean initialized)
128
0
{
129
0
  GstByteWriter *ret = gst_byte_writer_new ();
130
131
0
  ret->parent.data = data;
132
0
  ret->parent.size = (initialized) ? size : 0;
133
0
  ret->alloc_size = size;
134
0
  ret->fixed = TRUE;
135
0
  ret->owned = FALSE;
136
137
0
  return ret;
138
0
}
139
140
/**
141
 * gst_byte_writer_init:
142
 * @writer: #GstByteWriter instance
143
 *
144
 * Initializes @writer to an empty instance
145
 */
146
void
147
gst_byte_writer_init (GstByteWriter * writer)
148
0
{
149
0
  g_return_if_fail (writer != NULL);
150
151
0
  memset (writer, 0, sizeof (GstByteWriter));
152
153
0
  writer->owned = TRUE;
154
0
}
155
156
/**
157
 * gst_byte_writer_init_with_size:
158
 * @writer: #GstByteWriter instance
159
 * @size: Initial size of data
160
 * @fixed: If %TRUE the data can't be reallocated
161
 *
162
 * Initializes @writer with the given initial data size.
163
 */
164
void
165
gst_byte_writer_init_with_size (GstByteWriter * writer, guint size,
166
    gboolean fixed)
167
0
{
168
0
  g_return_if_fail (writer != NULL);
169
170
0
  gst_byte_writer_init (writer);
171
172
0
  writer->parent.data = g_malloc (size);
173
0
  writer->alloc_size = size;
174
0
  writer->fixed = fixed;
175
0
  writer->owned = TRUE;
176
0
}
177
178
/**
179
 * gst_byte_writer_init_with_data:
180
 * @writer: #GstByteWriter instance
181
 * @data: (array length=size) (transfer none): Memory area for writing
182
 * @size: Size of @data in bytes
183
 * @initialized: If %TRUE the complete data can be read from the beginning
184
 *
185
 * Initializes @writer with the given
186
 * memory area. If @initialized is %TRUE it is possible to
187
 * read @size bytes from the #GstByteWriter from the beginning.
188
 */
189
void
190
gst_byte_writer_init_with_data (GstByteWriter * writer, guint8 * data,
191
    guint size, gboolean initialized)
192
0
{
193
0
  g_return_if_fail (writer != NULL);
194
195
0
  gst_byte_writer_init (writer);
196
197
0
  writer->parent.data = data;
198
0
  writer->parent.size = (initialized) ? size : 0;
199
0
  writer->alloc_size = size;
200
0
  writer->fixed = TRUE;
201
0
  writer->owned = FALSE;
202
0
}
203
204
/**
205
 * gst_byte_writer_reset:
206
 * @writer: #GstByteWriter instance
207
 *
208
 * Resets @writer and frees the data if it's
209
 * owned by @writer.
210
 */
211
void
212
gst_byte_writer_reset (GstByteWriter * writer)
213
0
{
214
0
  g_return_if_fail (writer != NULL);
215
216
0
  if (writer->owned)
217
0
    g_free ((guint8 *) writer->parent.data);
218
0
  memset (writer, 0, sizeof (GstByteWriter));
219
0
}
220
221
/**
222
 * gst_byte_writer_reset_and_get_data:
223
 * @writer: #GstByteWriter instance
224
 *
225
 * Resets @writer and returns the current data.
226
 *
227
 * Free-function: g_free
228
 *
229
 * Returns: (array) (transfer full): the current data. g_free() after
230
 * usage.
231
 */
232
guint8 *
233
gst_byte_writer_reset_and_get_data (GstByteWriter * writer)
234
0
{
235
0
  guint8 *data;
236
237
0
  g_return_val_if_fail (writer != NULL, NULL);
238
239
0
  data = (guint8 *) writer->parent.data;
240
0
  if (!writer->owned)
241
0
    data = g_memdup2 (data, writer->parent.size);
242
0
  writer->parent.data = NULL;
243
0
  gst_byte_writer_reset (writer);
244
245
0
  return data;
246
0
}
247
248
/**
249
 * gst_byte_writer_reset_and_get_buffer:
250
 * @writer: #GstByteWriter instance
251
 *
252
 * Resets @writer and returns the current data as buffer.
253
 *
254
 * Free-function: gst_buffer_unref
255
 *
256
 * Returns: (transfer full): the current data as buffer. gst_buffer_unref()
257
 *     after usage.
258
 */
259
GstBuffer *
260
gst_byte_writer_reset_and_get_buffer (GstByteWriter * writer)
261
0
{
262
0
  GstBuffer *buffer;
263
0
  gpointer data;
264
0
  gsize size;
265
266
0
  g_return_val_if_fail (writer != NULL, NULL);
267
268
0
  size = writer->parent.size;
269
0
  data = gst_byte_writer_reset_and_get_data (writer);
270
271
0
  buffer = gst_buffer_new ();
272
0
  if (data != NULL) {
273
0
    gst_buffer_append_memory (buffer,
274
0
        gst_memory_new_wrapped (0, data, size, 0, size, data, g_free));
275
0
  }
276
277
0
  return buffer;
278
0
}
279
280
/**
281
 * gst_byte_writer_free:
282
 * @writer: (in) (transfer full): #GstByteWriter instance
283
 *
284
 * Frees @writer and all memory allocated by it.
285
 */
286
void
287
gst_byte_writer_free (GstByteWriter * writer)
288
0
{
289
0
  g_return_if_fail (writer != NULL);
290
291
0
  gst_byte_writer_reset (writer);
292
0
  g_free (writer);
293
0
}
294
295
/**
296
 * gst_byte_writer_free_and_get_data:
297
 * @writer: (in) (transfer full): #GstByteWriter instance
298
 *
299
 * Frees @writer and all memory allocated by it except
300
 * the current data, which is returned.
301
 *
302
 * Free-function: g_free
303
 *
304
 * Returns: (transfer full): the current data. g_free() after usage.
305
 */
306
guint8 *
307
gst_byte_writer_free_and_get_data (GstByteWriter * writer)
308
0
{
309
0
  guint8 *data;
310
311
0
  g_return_val_if_fail (writer != NULL, NULL);
312
313
0
  data = gst_byte_writer_reset_and_get_data (writer);
314
0
  g_free (writer);
315
316
0
  return data;
317
0
}
318
319
/**
320
 * gst_byte_writer_free_and_get_buffer:
321
 * @writer: (in) (transfer full): #GstByteWriter instance
322
 *
323
 * Frees @writer and all memory allocated by it except
324
 * the current data, which is returned as #GstBuffer.
325
 *
326
 * Free-function: gst_buffer_unref
327
 *
328
 * Returns: (transfer full): the current data as buffer. gst_buffer_unref()
329
 *     after usage.
330
 */
331
GstBuffer *
332
gst_byte_writer_free_and_get_buffer (GstByteWriter * writer)
333
0
{
334
0
  GstBuffer *buffer;
335
336
0
  g_return_val_if_fail (writer != NULL, NULL);
337
338
0
  buffer = gst_byte_writer_reset_and_get_buffer (writer);
339
0
  g_free (writer);
340
341
0
  return buffer;
342
0
}
343
344
/**
345
 * gst_byte_writer_get_remaining:
346
 * @writer: #GstByteWriter instance
347
 *
348
 * Returns the remaining size of data that can still be written. If
349
 * -1 is returned the remaining size is only limited by system resources.
350
 *
351
 * Returns: the remaining size of data that can still be written
352
 */
353
guint
354
gst_byte_writer_get_remaining (const GstByteWriter * writer)
355
0
{
356
0
  g_return_val_if_fail (writer != NULL, -1);
357
358
0
  if (!writer->fixed)
359
0
    return -1;
360
0
  else
361
0
    return writer->alloc_size - writer->parent.byte;
362
0
}
363
364
/**
365
 * gst_byte_writer_ensure_free_space:
366
 * @writer: #GstByteWriter instance
367
 * @size: Number of bytes that should be available
368
 *
369
 * Checks if enough free space from the current write cursor is
370
 * available and reallocates if necessary.
371
 *
372
 * Returns: %TRUE if at least @size bytes are still available
373
 */
374
gboolean
375
gst_byte_writer_ensure_free_space (GstByteWriter * writer, guint size)
376
0
{
377
0
  return _gst_byte_writer_ensure_free_space_inline (writer, size);
378
0
}
379
380
381
#define CREATE_WRITE_FUNC(bits,type,name,write_func) \
382
gboolean \
383
0
gst_byte_writer_put_##name (GstByteWriter *writer, type val) \
384
0
{ \
385
0
  return _gst_byte_writer_put_##name##_inline (writer, val); \
386
0
}
Unexecuted instantiation: gst_byte_writer_put_uint8
Unexecuted instantiation: gst_byte_writer_put_int8
Unexecuted instantiation: gst_byte_writer_put_uint16_le
Unexecuted instantiation: gst_byte_writer_put_uint16_be
Unexecuted instantiation: gst_byte_writer_put_int16_le
Unexecuted instantiation: gst_byte_writer_put_int16_be
Unexecuted instantiation: gst_byte_writer_put_uint24_le
Unexecuted instantiation: gst_byte_writer_put_uint24_be
Unexecuted instantiation: gst_byte_writer_put_int24_le
Unexecuted instantiation: gst_byte_writer_put_int24_be
Unexecuted instantiation: gst_byte_writer_put_uint32_le
Unexecuted instantiation: gst_byte_writer_put_uint32_be
Unexecuted instantiation: gst_byte_writer_put_int32_le
Unexecuted instantiation: gst_byte_writer_put_int32_be
Unexecuted instantiation: gst_byte_writer_put_uint64_le
Unexecuted instantiation: gst_byte_writer_put_uint64_be
Unexecuted instantiation: gst_byte_writer_put_int64_le
Unexecuted instantiation: gst_byte_writer_put_int64_be
Unexecuted instantiation: gst_byte_writer_put_float32_be
Unexecuted instantiation: gst_byte_writer_put_float32_le
Unexecuted instantiation: gst_byte_writer_put_float64_be
Unexecuted instantiation: gst_byte_writer_put_float64_le
387
388
CREATE_WRITE_FUNC (8, guint8, uint8, GST_WRITE_UINT8);
389
CREATE_WRITE_FUNC (8, gint8, int8, GST_WRITE_UINT8);
390
CREATE_WRITE_FUNC (16, guint16, uint16_le, GST_WRITE_UINT16_LE);
391
CREATE_WRITE_FUNC (16, guint16, uint16_be, GST_WRITE_UINT16_BE);
392
CREATE_WRITE_FUNC (16, gint16, int16_le, GST_WRITE_UINT16_LE);
393
CREATE_WRITE_FUNC (16, gint16, int16_be, GST_WRITE_UINT16_BE);
394
CREATE_WRITE_FUNC (24, guint32, uint24_le, GST_WRITE_UINT24_LE);
395
CREATE_WRITE_FUNC (24, guint32, uint24_be, GST_WRITE_UINT24_BE);
396
CREATE_WRITE_FUNC (24, gint32, int24_le, GST_WRITE_UINT24_LE);
397
CREATE_WRITE_FUNC (24, gint32, int24_be, GST_WRITE_UINT24_BE);
398
CREATE_WRITE_FUNC (32, guint32, uint32_le, GST_WRITE_UINT32_LE);
399
CREATE_WRITE_FUNC (32, guint32, uint32_be, GST_WRITE_UINT32_BE);
400
CREATE_WRITE_FUNC (32, gint32, int32_le, GST_WRITE_UINT32_LE);
401
CREATE_WRITE_FUNC (32, gint32, int32_be, GST_WRITE_UINT32_BE);
402
CREATE_WRITE_FUNC (64, guint64, uint64_le, GST_WRITE_UINT64_LE);
403
CREATE_WRITE_FUNC (64, guint64, uint64_be, GST_WRITE_UINT64_BE);
404
CREATE_WRITE_FUNC (64, gint64, int64_le, GST_WRITE_UINT64_LE);
405
CREATE_WRITE_FUNC (64, gint64, int64_be, GST_WRITE_UINT64_BE);
406
407
CREATE_WRITE_FUNC (32, gfloat, float32_be, GST_WRITE_FLOAT_BE);
408
CREATE_WRITE_FUNC (32, gfloat, float32_le, GST_WRITE_FLOAT_LE);
409
CREATE_WRITE_FUNC (64, gdouble, float64_be, GST_WRITE_DOUBLE_BE);
410
CREATE_WRITE_FUNC (64, gdouble, float64_le, GST_WRITE_DOUBLE_LE);
411
412
gboolean
413
gst_byte_writer_put_data (GstByteWriter * writer, const guint8 * data,
414
    guint size)
415
0
{
416
0
  return _gst_byte_writer_put_data_inline (writer, data, size);
417
0
}
418
419
gboolean
420
gst_byte_writer_fill (GstByteWriter * writer, guint8 value, guint size)
421
0
{
422
0
  return _gst_byte_writer_fill_inline (writer, value, size);
423
0
}
424
425
#define CREATE_WRITE_STRING_FUNC(bits,type) \
426
gboolean \
427
0
gst_byte_writer_put_string_utf##bits (GstByteWriter *writer, const type * data) \
428
0
{ \
429
0
  guint size = 0; \
430
0
  \
431
0
  g_return_val_if_fail (writer != NULL, FALSE); \
432
0
  \
433
0
  /* endianness does not matter if we are looking for a NUL terminator */ \
434
0
  while (data[size] != 0) { \
435
0
    /* have prevent overflow */ \
436
0
    if (G_UNLIKELY (size == G_MAXUINT)) \
437
0
      return FALSE; \
438
0
    ++size; \
439
0
  } \
440
0
  ++size; \
441
0
  \
442
0
  if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline(writer, size * (bits / 8)))) \
443
0
    return FALSE; \
444
0
  \
445
0
  _gst_byte_writer_put_data_inline (writer, (const guint8 *) data, size * (bits / 8)); \
446
0
  \
447
0
  return TRUE; \
448
0
}
Unexecuted instantiation: gst_byte_writer_put_string_utf8
Unexecuted instantiation: gst_byte_writer_put_string_utf16
Unexecuted instantiation: gst_byte_writer_put_string_utf32
449
450
CREATE_WRITE_STRING_FUNC (8, gchar);
451
CREATE_WRITE_STRING_FUNC (16, guint16);
452
CREATE_WRITE_STRING_FUNC (32, guint32);
453
/**
454
 * gst_byte_writer_put_uint8:
455
 * @writer: #GstByteWriter instance
456
 * @val: Value to write
457
 *
458
 * Writes a unsigned 8 bit integer to @writer.
459
 *
460
 * Returns: %TRUE if the value could be written
461
 */
462
/**
463
 * gst_byte_writer_put_uint16_be:
464
 * @writer: #GstByteWriter instance
465
 * @val: Value to write
466
 *
467
 * Writes a unsigned big endian 16 bit integer to @writer.
468
 *
469
 * Returns: %TRUE if the value could be written
470
 */
471
/**
472
 * gst_byte_writer_put_uint24_be:
473
 * @writer: #GstByteWriter instance
474
 * @val: Value to write
475
 *
476
 * Writes a unsigned big endian 24 bit integer to @writer.
477
 *
478
 * Returns: %TRUE if the value could be written
479
 */
480
/**
481
 * gst_byte_writer_put_uint32_be:
482
 * @writer: #GstByteWriter instance
483
 * @val: Value to write
484
 *
485
 * Writes a unsigned big endian 32 bit integer to @writer.
486
 *
487
 * Returns: %TRUE if the value could be written
488
 */
489
/**
490
 * gst_byte_writer_put_uint64_be:
491
 * @writer: #GstByteWriter instance
492
 * @val: Value to write
493
 *
494
 * Writes a unsigned big endian 64 bit integer to @writer.
495
 *
496
 * Returns: %TRUE if the value could be written
497
 */
498
/**
499
 * gst_byte_writer_put_uint16_le:
500
 * @writer: #GstByteWriter instance
501
 * @val: Value to write
502
 *
503
 * Writes a unsigned little endian 16 bit integer to @writer.
504
 *
505
 * Returns: %TRUE if the value could be written
506
 */
507
/**
508
 * gst_byte_writer_put_uint24_le:
509
 * @writer: #GstByteWriter instance
510
 * @val: Value to write
511
 *
512
 * Writes a unsigned little endian 24 bit integer to @writer.
513
 *
514
 * Returns: %TRUE if the value could be written
515
 */
516
/**
517
 * gst_byte_writer_put_uint32_le:
518
 * @writer: #GstByteWriter instance
519
 * @val: Value to write
520
 *
521
 * Writes a unsigned little endian 32 bit integer to @writer.
522
 *
523
 * Returns: %TRUE if the value could be written
524
 */
525
/**
526
 * gst_byte_writer_put_uint64_le:
527
 * @writer: #GstByteWriter instance
528
 * @val: Value to write
529
 *
530
 * Writes a unsigned little endian 64 bit integer to @writer.
531
 *
532
 * Returns: %TRUE if the value could be written
533
 */
534
/**
535
 * gst_byte_writer_put_int8:
536
 * @writer: #GstByteWriter instance
537
 * @val: Value to write
538
 *
539
 * Writes a signed 8 bit integer to @writer.
540
 *
541
 * Returns: %TRUE if the value could be written
542
 */
543
/**
544
 * gst_byte_writer_put_int16_be:
545
 * @writer: #GstByteWriter instance
546
 * @val: Value to write
547
 *
548
 * Writes a signed big endian 16 bit integer to @writer.
549
 *
550
 * Returns: %TRUE if the value could be written
551
 */
552
/**
553
 * gst_byte_writer_put_int24_be:
554
 * @writer: #GstByteWriter instance
555
 * @val: Value to write
556
 *
557
 * Writes a signed big endian 24 bit integer to @writer.
558
 *
559
 * Returns: %TRUE if the value could be written
560
 */
561
/**
562
 * gst_byte_writer_put_int32_be:
563
 * @writer: #GstByteWriter instance
564
 * @val: Value to write
565
 *
566
 * Writes a signed big endian 32 bit integer to @writer.
567
 *
568
 * Returns: %TRUE if the value could be written
569
 */
570
/**
571
 * gst_byte_writer_put_int64_be:
572
 * @writer: #GstByteWriter instance
573
 * @val: Value to write
574
 *
575
 * Writes a signed big endian 64 bit integer to @writer.
576
 *
577
 * Returns: %TRUE if the value could be written
578
 */
579
/**
580
 * gst_byte_writer_put_int16_le:
581
 * @writer: #GstByteWriter instance
582
 * @val: Value to write
583
 *
584
 * Writes a signed little endian 16 bit integer to @writer.
585
 *
586
 * Returns: %TRUE if the value could be written
587
 */
588
/**
589
 * gst_byte_writer_put_int24_le:
590
 * @writer: #GstByteWriter instance
591
 * @val: Value to write
592
 *
593
 * Writes a signed little endian 24 bit integer to @writer.
594
 *
595
 * Returns: %TRUE if the value could be written
596
 */
597
/**
598
 * gst_byte_writer_put_int32_le:
599
 * @writer: #GstByteWriter instance
600
 * @val: Value to write
601
 *
602
 * Writes a signed little endian 32 bit integer to @writer.
603
 *
604
 * Returns: %TRUE if the value could be written
605
 */
606
/**
607
 * gst_byte_writer_put_int64_le:
608
 * @writer: #GstByteWriter instance
609
 * @val: Value to write
610
 *
611
 * Writes a signed little endian 64 bit integer to @writer.
612
 *
613
 * Returns: %TRUE if the value could be written
614
 */
615
/**
616
 * gst_byte_writer_put_float32_be:
617
 * @writer: #GstByteWriter instance
618
 * @val: Value to write
619
 *
620
 * Writes a big endian 32 bit float to @writer.
621
 *
622
 * Returns: %TRUE if the value could be written
623
 */
624
/**
625
 * gst_byte_writer_put_float64_be:
626
 * @writer: #GstByteWriter instance
627
 * @val: Value to write
628
 *
629
 * Writes a big endian 64 bit float to @writer.
630
 *
631
 * Returns: %TRUE if the value could be written
632
 */
633
/**
634
 * gst_byte_writer_put_float32_le:
635
 * @writer: #GstByteWriter instance
636
 * @val: Value to write
637
 *
638
 * Writes a little endian 32 bit float to @writer.
639
 *
640
 * Returns: %TRUE if the value could be written
641
 */
642
/**
643
 * gst_byte_writer_put_float64_le:
644
 * @writer: #GstByteWriter instance
645
 * @val: Value to write
646
 *
647
 * Writes a little endian 64 bit float to @writer.
648
 *
649
 * Returns: %TRUE if the value could be written
650
 */
651
/**
652
 * gst_byte_writer_put_string_utf8:
653
 * @writer: #GstByteWriter instance
654
 * @data: (transfer none): UTF8 string to write
655
 *
656
 * Writes a NUL-terminated UTF8 string to @writer (including the terminator).
657
 *
658
 * Returns: %TRUE if the value could be written
659
 */
660
/**
661
 * gst_byte_writer_put_string_utf16:
662
 * @writer: #GstByteWriter instance
663
 * @data: (transfer none) (array zero-terminated=1): UTF16 string to write
664
 *
665
 * Writes a NUL-terminated UTF16 string to @writer (including the terminator).
666
 *
667
 * Returns: %TRUE if the value could be written
668
 */
669
/**
670
 * gst_byte_writer_put_string_utf32:
671
 * @writer: #GstByteWriter instance
672
 * @data: (transfer none) (array zero-terminated=1): UTF32 string to write
673
 *
674
 * Writes a NUL-terminated UTF32 string to @writer (including the terminator).
675
 *
676
 * Returns: %TRUE if the value could be written
677
 */
678
/**
679
 * gst_byte_writer_put_data:
680
 * @writer: #GstByteWriter instance
681
 * @data: (transfer none) (array length=size): Data to write
682
 * @size: Size of @data in bytes
683
 *
684
 * Writes @size bytes of @data to @writer.
685
 *
686
 * Returns: %TRUE if the value could be written
687
 */
688
/**
689
 * gst_byte_writer_fill:
690
 * @writer: #GstByteWriter instance
691
 * @value: Value to be written
692
 * @size: Number of bytes to be written
693
 *
694
 * Writes @size bytes containing @value to @writer.
695
 *
696
 * Returns: %TRUE if the value could be written
697
 */
698
699
/**
700
 * gst_byte_writer_put_buffer:
701
 * @writer: #GstByteWriter instance
702
 * @buffer: (transfer none): source #GstBuffer
703
 * @offset: offset to copy from
704
 * @size: total size to copy. If -1, all data is copied
705
 *
706
 * Writes @size bytes of @data to @writer.
707
 *
708
 * Returns: %TRUE if the data could be written
709
 *
710
 */