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