2 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * riff-read.c: RIFF input file parsing
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
27 #include <gst/gstutils.h>
28 #include <gst/tag/tag.h>
30 #include "riff-read.h"
32 GST_DEBUG_CATEGORY_EXTERN (riff_debug);
33 #define GST_CAT_DEFAULT riff_debug
36 * gst_riff_read_chunk:
37 * @element: caller element (used for debugging).
38 * @pad: pad to pull data from.
39 * @offset: offset to pull from, incremented by this function.
40 * @tag: fourcc of the chunk (returned by this function).
41 * @chunk_data: buffer (returned by this function).
43 * Reads a single chunk of data. Since 0.10.8 'JUNK' chunks
44 * are skipped automatically.
46 * Returns: flow status.
50 gst_riff_read_chunk (GstElement * element,
51 GstPad * pad, guint64 * _offset, guint32 * tag, GstBuffer ** _chunk_data)
56 guint64 offset = *_offset;
58 g_return_val_if_fail (element != NULL, GST_FLOW_ERROR);
59 g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
60 g_return_val_if_fail (_offset != NULL, GST_FLOW_ERROR);
61 g_return_val_if_fail (tag != NULL, GST_FLOW_ERROR);
62 g_return_val_if_fail (_chunk_data != NULL, GST_FLOW_ERROR);
66 if ((res = gst_pad_pull_range (pad, offset, size, &buf)) != GST_FLOW_OK)
68 else if (GST_BUFFER_SIZE (buf) < size)
71 *tag = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf));
72 size = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 4);
73 gst_buffer_unref (buf);
75 GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
76 GST_FOURCC_ARGS (*tag), size);
78 /* skip 'JUNK' chunks */
79 if (*tag == GST_RIFF_TAG_JUNK || *tag == GST_RIFF_TAG_JUNQ) {
80 size = GST_ROUND_UP_2 (size);
83 GST_DEBUG_OBJECT (element, "skipping JUNK chunk");
87 if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
89 else if (GST_BUFFER_SIZE (buf) < size)
93 *_offset += 8 + GST_ROUND_UP_2 (size);
100 /* short read, we return UNEXPECTED to mark the EOS case */
101 GST_DEBUG_OBJECT (element, "not enough data (available=%u, needed=%u)",
102 GST_BUFFER_SIZE (buf), size);
103 gst_buffer_unref (buf);
104 return GST_FLOW_UNEXPECTED;
109 * gst_riff_parse_chunk:
110 * @element: caller element (used for debugging).
111 * @buf: input buffer.
112 * @offset: offset in the buffer in the caller. Is incremented
113 * by the read size by this function.
114 * @fourcc: fourcc (returned by this function0 of the chunk.
115 * @chunk_data: buffer (returned by the function) containing the
116 * chunk data, which may be NULL if chunksize == 0
118 * Reads a single chunk.
120 * Returns: FALSE on error, TRUE otherwise
123 gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
124 guint * _offset, guint32 * _fourcc, GstBuffer ** chunk_data)
129 guint offset = *_offset;
131 g_return_val_if_fail (element != NULL, FALSE);
132 g_return_val_if_fail (buf != NULL, FALSE);
133 g_return_val_if_fail (_offset != NULL, FALSE);
134 g_return_val_if_fail (_fourcc != NULL, FALSE);
135 g_return_val_if_fail (chunk_data != NULL, FALSE);
140 bufsize = GST_BUFFER_SIZE (buf);
142 if (bufsize == offset)
145 if (bufsize < offset + 8)
149 data = GST_BUFFER_DATA (buf) + offset;
150 fourcc = GST_READ_UINT32_LE (data);
151 size = GST_READ_UINT32_LE (data + 4);
153 GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
154 GST_FOURCC_ARGS (fourcc), size);
156 /* be paranoid: size may be nonsensical value here, such as (guint) -1 */
157 if (G_UNLIKELY (size > G_MAXINT))
160 if (bufsize < size + 8 + offset) {
161 GST_DEBUG_OBJECT (element,
162 "Needed chunk data (%d) is more than available (%d), shortcutting",
163 size, bufsize - 8 - offset);
164 size = bufsize - 8 - offset;
168 *chunk_data = gst_buffer_create_sub (buf, offset + 8, size);
173 *_offset += 8 + GST_ROUND_UP_2 (size);
180 GST_DEBUG_OBJECT (element, "End of chunk (offset %d)", offset);
185 GST_DEBUG_OBJECT (element,
186 "Failed to parse chunk header (offset %d, %d available, %d needed)",
192 GST_ERROR_OBJECT (element, "Broken file: bogus chunk size %u", size);
198 * gst_riff_parse_file_header:
199 * @element: caller element (used for debugging/error).
200 * @buf: input buffer from which the file header will be parsed,
201 * should be at least 12 bytes long.
202 * @doctype: a fourcc (returned by this function) to indicate the
203 * type of document (according to the header).
205 * Reads the first few bytes from the provided buffer, checks
206 * if this stream is a RIFF stream, and determines document type.
207 * This function takes ownership of @buf so it should not be used anymore
208 * after calling this function.
210 * Returns: FALSE if this is not a RIFF stream (in which case the
211 * caller should error out; we already throw an error), or TRUE
215 gst_riff_parse_file_header (GstElement * element,
216 GstBuffer * buf, guint32 * doctype)
221 g_return_val_if_fail (buf != NULL, FALSE);
222 g_return_val_if_fail (doctype != NULL, FALSE);
224 if (GST_BUFFER_SIZE (buf) < 12)
227 data = GST_BUFFER_DATA (buf);
228 tag = GST_READ_UINT32_LE (data);
229 if (tag != GST_RIFF_TAG_RIFF && tag != GST_RIFF_TAG_AVF0)
232 *doctype = GST_READ_UINT32_LE (data + 8);
234 gst_buffer_unref (buf);
241 GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
242 ("Not enough data to parse RIFF header (%d available, %d needed)",
243 GST_BUFFER_SIZE (buf), 12));
244 gst_buffer_unref (buf);
249 GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
250 ("Stream is no RIFF stream: %" GST_FOURCC_FORMAT,
251 GST_FOURCC_ARGS (tag)));
252 gst_buffer_unref (buf);
258 * gst_riff_parse_strh:
259 * @element: caller element (used for debugging/error).
260 * @buf: input data to be used for parsing, stripped from header.
261 * @strh: a pointer (returned by this function) to a filled-in
262 * strh structure. Caller should free it.
264 * Parses a strh structure from input data. Takes ownership of @buf.
266 * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
267 * should be skipped on error, but it is not fatal.
271 gst_riff_parse_strh (GstElement * element,
272 GstBuffer * buf, gst_riff_strh ** _strh)
276 g_return_val_if_fail (buf != NULL, FALSE);
277 g_return_val_if_fail (_strh != NULL, FALSE);
279 if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh))
282 strh = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
283 gst_buffer_unref (buf);
285 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
286 strh->type = GUINT32_FROM_LE (strh->type);
287 strh->fcc_handler = GUINT32_FROM_LE (strh->fcc_handler);
288 strh->flags = GUINT32_FROM_LE (strh->flags);
289 strh->priority = GUINT32_FROM_LE (strh->priority);
290 strh->init_frames = GUINT32_FROM_LE (strh->init_frames);
291 strh->scale = GUINT32_FROM_LE (strh->scale);
292 strh->rate = GUINT32_FROM_LE (strh->rate);
293 strh->start = GUINT32_FROM_LE (strh->start);
294 strh->length = GUINT32_FROM_LE (strh->length);
295 strh->bufsize = GUINT32_FROM_LE (strh->bufsize);
296 strh->quality = GUINT32_FROM_LE (strh->quality);
297 strh->samplesize = GUINT32_FROM_LE (strh->samplesize);
300 /* avoid divisions by zero */
307 GST_INFO_OBJECT (element, "strh tag found:");
308 GST_INFO_OBJECT (element, " type %" GST_FOURCC_FORMAT,
309 GST_FOURCC_ARGS (strh->type));
310 GST_INFO_OBJECT (element, " fcc_handler %" GST_FOURCC_FORMAT,
311 GST_FOURCC_ARGS (strh->fcc_handler));
312 GST_INFO_OBJECT (element, " flags 0x%08x", strh->flags);
313 GST_INFO_OBJECT (element, " priority %d", strh->priority);
314 GST_INFO_OBJECT (element, " init_frames %d", strh->init_frames);
315 GST_INFO_OBJECT (element, " scale %d", strh->scale);
316 GST_INFO_OBJECT (element, " rate %d", strh->rate);
317 GST_INFO_OBJECT (element, " start %d", strh->start);
318 GST_INFO_OBJECT (element, " length %d", strh->length);
319 GST_INFO_OBJECT (element, " bufsize %d", strh->bufsize);
320 GST_INFO_OBJECT (element, " quality %d", strh->quality);
321 GST_INFO_OBJECT (element, " samplesize %d", strh->samplesize);
330 GST_ERROR_OBJECT (element,
331 "Too small strh (%d available, %d needed)",
332 GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
333 gst_buffer_unref (buf);
339 * gst_riff_parse_strf_vids:
340 * @element: caller element (used for debugging/error).
341 * @buf: input data to be used for parsing, stripped from header.
342 * @strf: a pointer (returned by this function) to a filled-in
343 * strf/vids structure. Caller should free it.
344 * @data: a pointer (returned by this function) to a buffer
345 * containing extradata for this particular stream (e.g.
346 * palette, codec initialization data).
348 * Parses a video streamĀ“s strf structure plus optionally some
349 * extradata from input data. This function takes ownership of @buf.
351 * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
352 * should be skipped on error, but it is not fatal.
356 gst_riff_parse_strf_vids (GstElement * element,
357 GstBuffer * buf, gst_riff_strf_vids ** _strf, GstBuffer ** data)
359 gst_riff_strf_vids *strf;
361 g_return_val_if_fail (buf != NULL, FALSE);
362 g_return_val_if_fail (_strf != NULL, FALSE);
363 g_return_val_if_fail (data != NULL, FALSE);
365 if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids))
368 strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
370 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
371 strf->size = GUINT32_FROM_LE (strf->size);
372 strf->width = GUINT32_FROM_LE (strf->width);
373 strf->height = GUINT32_FROM_LE (strf->height);
374 strf->planes = GUINT16_FROM_LE (strf->planes);
375 strf->bit_cnt = GUINT16_FROM_LE (strf->bit_cnt);
376 strf->compression = GUINT32_FROM_LE (strf->compression);
377 strf->image_size = GUINT32_FROM_LE (strf->image_size);
378 strf->xpels_meter = GUINT32_FROM_LE (strf->xpels_meter);
379 strf->ypels_meter = GUINT32_FROM_LE (strf->ypels_meter);
380 strf->num_colors = GUINT32_FROM_LE (strf->num_colors);
381 strf->imp_colors = GUINT32_FROM_LE (strf->imp_colors);
386 if (strf->size > GST_BUFFER_SIZE (buf)) {
387 GST_WARNING_OBJECT (element,
388 "strf_vids header gave %d bytes data, only %d available",
389 strf->size, GST_BUFFER_SIZE (buf));
390 strf->size = GST_BUFFER_SIZE (buf);
392 if (sizeof (gst_riff_strf_vids) < GST_BUFFER_SIZE (buf)) {
393 *data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_vids),
394 GST_BUFFER_SIZE (buf) - sizeof (gst_riff_strf_vids));
398 GST_INFO_OBJECT (element, "strf tag found in context vids:");
399 GST_INFO_OBJECT (element, " size %d", strf->size);
400 GST_INFO_OBJECT (element, " width %d", strf->width);
401 GST_INFO_OBJECT (element, " height %d", strf->height);
402 GST_INFO_OBJECT (element, " planes %d", strf->planes);
403 GST_INFO_OBJECT (element, " bit_cnt %d", strf->bit_cnt);
404 GST_INFO_OBJECT (element, " compression %" GST_FOURCC_FORMAT,
405 GST_FOURCC_ARGS (strf->compression));
406 GST_INFO_OBJECT (element, " image_size %d", strf->image_size);
407 GST_INFO_OBJECT (element, " xpels_meter %d", strf->xpels_meter);
408 GST_INFO_OBJECT (element, " ypels_meter %d", strf->ypels_meter);
409 GST_INFO_OBJECT (element, " num_colors %d", strf->num_colors);
410 GST_INFO_OBJECT (element, " imp_colors %d", strf->imp_colors);
412 GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
414 gst_buffer_unref (buf);
423 GST_ERROR_OBJECT (element,
424 "Too small strf_vids (%d available, %d needed)",
425 GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
426 gst_buffer_unref (buf);
432 * gst_riff_parse_strf_auds:
433 * @element: caller element (used for debugging/error).
434 * @buf: input data to be used for parsing, stripped from header.
435 * @strf: a pointer (returned by this function) to a filled-in
436 * strf/auds structure. Caller should free it.
437 * @data: a pointer (returned by this function) to a buffer
438 * containing extradata for this particular stream (e.g.
439 * codec initialization data).
441 * Parses an audio streamĀ“s strf structure plus optionally some
442 * extradata from input data. This function takes ownership of @buf.
445 * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
446 * should be skipped on error, but it is not fatal.
449 gst_riff_parse_strf_auds (GstElement * element,
450 GstBuffer * buf, gst_riff_strf_auds ** _strf, GstBuffer ** data)
452 gst_riff_strf_auds *strf;
455 g_return_val_if_fail (buf != NULL, FALSE);
456 g_return_val_if_fail (_strf != NULL, FALSE);
457 g_return_val_if_fail (data != NULL, FALSE);
459 bufsize = GST_BUFFER_SIZE (buf);
461 if (bufsize < sizeof (gst_riff_strf_auds))
464 strf = g_memdup (GST_BUFFER_DATA (buf), bufsize);
466 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
467 strf->format = GUINT16_FROM_LE (strf->format);
468 strf->channels = GUINT16_FROM_LE (strf->channels);
469 strf->rate = GUINT32_FROM_LE (strf->rate);
470 strf->av_bps = GUINT32_FROM_LE (strf->av_bps);
471 strf->blockalign = GUINT16_FROM_LE (strf->blockalign);
472 strf->size = GUINT16_FROM_LE (strf->size);
477 if (bufsize > sizeof (gst_riff_strf_auds) + 2) {
480 len = GST_READ_UINT16_LE (&GST_BUFFER_DATA (buf)[16]);
481 if (len + 2 + sizeof (gst_riff_strf_auds) > bufsize) {
482 GST_WARNING_OBJECT (element,
483 "Extradata indicated %d bytes, but only %" G_GSSIZE_FORMAT
484 " available", len, bufsize - 2 - sizeof (gst_riff_strf_auds));
485 len = bufsize - 2 - sizeof (gst_riff_strf_auds);
488 *data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_auds) + 2, len);
492 GST_INFO_OBJECT (element, "strf tag found in context auds:");
493 GST_INFO_OBJECT (element, " format %d", strf->format);
494 GST_INFO_OBJECT (element, " channels %d", strf->channels);
495 GST_INFO_OBJECT (element, " rate %d", strf->rate);
496 GST_INFO_OBJECT (element, " av_bps %d", strf->av_bps);
497 GST_INFO_OBJECT (element, " blockalign %d", strf->blockalign);
498 GST_INFO_OBJECT (element, " size %d", strf->size);
500 GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
502 gst_buffer_unref (buf);
511 GST_ERROR_OBJECT (element,
512 "Too small strf_auds (%d available, %" G_GSSIZE_FORMAT " needed)",
513 bufsize, sizeof (gst_riff_strf_auds));
514 gst_buffer_unref (buf);
520 * gst_riff_parse_strf_iavs:
521 * @element: caller element (used for debugging/error).
522 * @buf: input data to be used for parsing, stripped from header.
523 * @strf: a pointer (returned by this function) to a filled-in
524 * strf/iavs structure. Caller should free it.
525 * @data: a pointer (returned by this function) to a buffer
526 * containing extradata for this particular stream (e.g.
527 * codec initialization data).
529 * Parses a interleaved (also known as "complex") streamĀ“s strf
530 * structure plus optionally some extradata from input data. This
531 * function takes ownership of @buf.
533 * Returns: TRUE if parsing succeeded, otherwise FALSE.
537 gst_riff_parse_strf_iavs (GstElement * element,
538 GstBuffer * buf, gst_riff_strf_iavs ** _strf, GstBuffer ** data)
540 gst_riff_strf_iavs *strf;
542 g_return_val_if_fail (buf != NULL, FALSE);
543 g_return_val_if_fail (_strf != NULL, FALSE);
544 g_return_val_if_fail (data != NULL, FALSE);
546 if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs))
549 strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
550 gst_buffer_unref (buf);
552 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
553 strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc);
554 strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl);
555 strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1);
556 strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1);
557 strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc);
558 strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl);
559 strf->DVReserved1 = GUINT32_FROM_LE (strf->DVReserved1);
560 strf->DVReserved2 = GUINT32_FROM_LE (strf->DVReserved2);
564 GST_INFO_OBJECT (element, "strf tag found in context iavs:");
565 GST_INFO_OBJECT (element, " DVAAuxSrc %08x", strf->DVAAuxSrc);
566 GST_INFO_OBJECT (element, " DVAAuxCtl %08x", strf->DVAAuxCtl);
567 GST_INFO_OBJECT (element, " DVAAuxSrc1 %08x", strf->DVAAuxSrc1);
568 GST_INFO_OBJECT (element, " DVAAuxCtl1 %08x", strf->DVAAuxCtl1);
569 GST_INFO_OBJECT (element, " DVVAuxSrc %08x", strf->DVVAuxSrc);
570 GST_INFO_OBJECT (element, " DVVAuxCtl %08x", strf->DVVAuxCtl);
571 GST_INFO_OBJECT (element, " DVReserved1 %08x", strf->DVReserved1);
572 GST_INFO_OBJECT (element, " DVReserved2 %08x", strf->DVReserved2);
582 GST_ERROR_OBJECT (element,
583 "Too small strf_iavs (%d available, %" G_GSSIZE_FORMAT " needed)",
584 GST_BUFFER_SIZE (buf), sizeof (gst_riff_strf_iavs));
585 gst_buffer_unref (buf);
591 * gst_riff_parse_info:
592 * @element: caller element (used for debugging/error).
593 * @buf: input data to be used for parsing, stripped from header.
594 * @taglist: a pointer to a taglist (returned by this function)
595 * containing information about this stream. May be
596 * NULL if no supported tags were found.
598 * Parses stream metadata from input data.
601 gst_riff_parse_info (GstElement * element,
602 GstBuffer * buf, GstTagList ** _taglist)
610 g_return_if_fail (_taglist != NULL);
616 data = GST_BUFFER_DATA (buf);
617 size = GST_BUFFER_SIZE (buf);
618 taglist = gst_tag_list_new ();
621 tag = GST_READ_UINT32_LE (data);
622 tsize = GST_READ_UINT32_LE (data + 4);
626 GST_DEBUG ("tag %" GST_FOURCC_FORMAT ", size %u",
627 GST_FOURCC_ARGS (tag), tsize);
630 GST_WARNING_OBJECT (element,
631 "Tagsize %d is larger than available data %d", tsize, size);
635 /* find out the type of metadata */
637 case GST_RIFF_INFO_IARL:
638 type = GST_TAG_LOCATION;
640 case GST_RIFF_INFO_IART:
641 type = GST_TAG_ARTIST;
643 case GST_RIFF_INFO_ICMS:
644 type = NULL; /*"Commissioner"; */
646 case GST_RIFF_INFO_ICMT:
647 type = GST_TAG_COMMENT;
649 case GST_RIFF_INFO_ICOP:
650 type = GST_TAG_COPYRIGHT;
652 case GST_RIFF_INFO_ICRD:
655 case GST_RIFF_INFO_ICRP:
656 type = NULL; /*"Cropped"; */
658 case GST_RIFF_INFO_IDIM:
659 type = NULL; /*"Dimensions"; */
661 case GST_RIFF_INFO_IDPI:
662 type = NULL; /*"Dots per Inch"; */
664 case GST_RIFF_INFO_IENG:
665 type = NULL; /*"Engineer"; */
667 case GST_RIFF_INFO_IGNR:
668 type = GST_TAG_GENRE;
670 case GST_RIFF_INFO_IKEY:
671 type = GST_TAG_KEYWORDS;
673 case GST_RIFF_INFO_ILGT:
674 type = NULL; /*"Lightness"; */
676 case GST_RIFF_INFO_IMED:
677 type = NULL; /*"Medium"; */
679 case GST_RIFF_INFO_INAM:
680 type = GST_TAG_TITLE;
682 case GST_RIFF_INFO_IPLT:
683 type = NULL; /*"Palette"; */
685 case GST_RIFF_INFO_IPRD:
686 type = NULL; /*"Product"; */
688 case GST_RIFF_INFO_ISBJ:
689 type = NULL; /*"Subject"; */
691 case GST_RIFF_INFO_ISFT:
692 type = GST_TAG_ENCODER;
694 case GST_RIFF_INFO_ISHP:
695 type = NULL; /*"Sharpness"; */
697 case GST_RIFF_INFO_ISRC:
700 case GST_RIFF_INFO_ISRF:
701 type = NULL; /*"Source Form"; */
703 case GST_RIFF_INFO_ITCH:
704 type = NULL; /*"Technician"; */
708 GST_WARNING_OBJECT (element,
709 "Unknown INFO (metadata) tag entry %" GST_FOURCC_FORMAT,
710 GST_FOURCC_ARGS (tag));
714 if (type != NULL && data[0] != '\0') {
715 static const gchar *env_vars[] = { "GST_AVI_TAG_ENCODING",
716 "GST_RIFF_TAG_ENCODING", "GST_TAG_ENCODING", NULL
720 val = gst_tag_freeform_string_to_utf8 ((gchar *) data, tsize, env_vars);
723 gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL);
726 GST_WARNING_OBJECT (element, "could not extract %s tag", type);
740 if (!gst_tag_list_is_empty (taglist)) {
744 gst_tag_list_free (taglist);