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)
57 guint64 offset = *_offset;
60 g_return_val_if_fail (element != NULL, GST_FLOW_ERROR);
61 g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
62 g_return_val_if_fail (_offset != NULL, GST_FLOW_ERROR);
63 g_return_val_if_fail (tag != NULL, GST_FLOW_ERROR);
64 g_return_val_if_fail (_chunk_data != NULL, GST_FLOW_ERROR);
68 if ((res = gst_pad_pull_range (pad, offset, size, &buf)) != GST_FLOW_OK)
70 else if (gst_buffer_get_size (buf) < size)
73 data = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
74 *tag = GST_READ_UINT32_LE (data);
75 size = GST_READ_UINT32_LE (data + 4);
76 gst_buffer_unmap (buf, data, bsize);
77 gst_buffer_unref (buf);
79 GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
80 GST_FOURCC_ARGS (*tag), size);
82 /* skip 'JUNK' chunks */
83 if (*tag == GST_RIFF_TAG_JUNK || *tag == GST_RIFF_TAG_JUNQ) {
84 size = GST_ROUND_UP_2 (size);
87 GST_DEBUG_OBJECT (element, "skipping JUNK chunk");
91 if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
93 else if (gst_buffer_get_size (buf) < size)
97 *_offset += 8 + GST_ROUND_UP_2 (size);
104 /* short read, we return EOS to mark the EOS case */
105 GST_DEBUG_OBJECT (element, "not enough data (available=%" G_GSIZE_FORMAT
106 ", needed=%u)", gst_buffer_get_size (buf), size);
107 gst_buffer_unref (buf);
113 * gst_riff_parse_chunk:
114 * @element: caller element (used for debugging).
115 * @buf: input buffer.
116 * @offset: offset in the buffer in the caller. Is incremented
117 * by the read size by this function.
118 * @fourcc: fourcc (returned by this function0 of the chunk.
119 * @chunk_data: buffer (returned by the function) containing the
120 * chunk data, which may be NULL if chunksize == 0
122 * Reads a single chunk.
124 * Returns: FALSE on error, TRUE otherwise
127 gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
128 guint * _offset, guint32 * _fourcc, GstBuffer ** chunk_data)
134 guint offset = *_offset;
136 g_return_val_if_fail (element != NULL, FALSE);
137 g_return_val_if_fail (buf != NULL, FALSE);
138 g_return_val_if_fail (_offset != NULL, FALSE);
139 g_return_val_if_fail (_fourcc != NULL, FALSE);
140 g_return_val_if_fail (chunk_data != NULL, FALSE);
145 bufsize = gst_buffer_get_size (buf);
147 if (bufsize == offset)
150 if (bufsize < offset + 8)
154 data = ptr = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
156 fourcc = GST_READ_UINT32_LE (ptr);
157 size = GST_READ_UINT32_LE (ptr + 4);
158 gst_buffer_unmap (buf, data, bsize);
160 GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
161 GST_FOURCC_ARGS (fourcc), size);
163 /* be paranoid: size may be nonsensical value here, such as (guint) -1 */
164 if (G_UNLIKELY (size > G_MAXINT))
167 if (bufsize < size + 8 + offset) {
168 GST_DEBUG_OBJECT (element,
169 "Needed chunk data (%d) is more than available (%d), shortcutting",
170 size, bufsize - 8 - offset);
171 size = bufsize - 8 - offset;
176 gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, offset + 8, size);
181 *_offset += 8 + GST_ROUND_UP_2 (size);
188 GST_DEBUG_OBJECT (element, "End of chunk (offset %d)", offset);
193 GST_DEBUG_OBJECT (element,
194 "Failed to parse chunk header (offset %d, %d available, %d needed)",
200 GST_ERROR_OBJECT (element, "Broken file: bogus chunk size %u", size);
206 * gst_riff_parse_file_header:
207 * @element: caller element (used for debugging/error).
208 * @buf: input buffer from which the file header will be parsed,
209 * should be at least 12 bytes long.
210 * @doctype: a fourcc (returned by this function) to indicate the
211 * type of document (according to the header).
213 * Reads the first few bytes from the provided buffer, checks
214 * if this stream is a RIFF stream, and determines document type.
215 * This function takes ownership of @buf so it should not be used anymore
216 * after calling this function.
218 * Returns: FALSE if this is not a RIFF stream (in which case the
219 * caller should error out; we already throw an error), or TRUE
223 gst_riff_parse_file_header (GstElement * element,
224 GstBuffer * buf, guint32 * doctype)
230 g_return_val_if_fail (buf != NULL, FALSE);
231 g_return_val_if_fail (doctype != NULL, FALSE);
233 data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
237 tag = GST_READ_UINT32_LE (data);
238 if (tag != GST_RIFF_TAG_RIFF && tag != GST_RIFF_TAG_AVF0)
241 *doctype = GST_READ_UINT32_LE (data + 8);
242 gst_buffer_unmap (buf, data, size);
244 gst_buffer_unref (buf);
251 GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
252 ("Not enough data to parse RIFF header (%" G_GSIZE_FORMAT " available,"
253 " %d needed)", size, 12));
254 gst_buffer_unmap (buf, data, size);
255 gst_buffer_unref (buf);
260 GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
261 ("Stream is no RIFF stream: %" GST_FOURCC_FORMAT,
262 GST_FOURCC_ARGS (tag)));
263 gst_buffer_unmap (buf, data, size);
264 gst_buffer_unref (buf);
270 * gst_riff_parse_strh:
271 * @element: caller element (used for debugging/error).
272 * @buf: input data to be used for parsing, stripped from header.
273 * @strh: a pointer (returned by this function) to a filled-in
274 * strh structure. Caller should free it.
276 * Parses a strh structure from input data. Takes ownership of @buf.
278 * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
279 * should be skipped on error, but it is not fatal.
283 gst_riff_parse_strh (GstElement * element,
284 GstBuffer * buf, gst_riff_strh ** _strh)
290 g_return_val_if_fail (buf != NULL, FALSE);
291 g_return_val_if_fail (_strh != NULL, FALSE);
293 data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
294 if (size < sizeof (gst_riff_strh))
297 strh = g_memdup (data, size);
298 gst_buffer_unmap (buf, data, size);
300 gst_buffer_unref (buf);
302 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
303 strh->type = GUINT32_FROM_LE (strh->type);
304 strh->fcc_handler = GUINT32_FROM_LE (strh->fcc_handler);
305 strh->flags = GUINT32_FROM_LE (strh->flags);
306 strh->priority = GUINT32_FROM_LE (strh->priority);
307 strh->init_frames = GUINT32_FROM_LE (strh->init_frames);
308 strh->scale = GUINT32_FROM_LE (strh->scale);
309 strh->rate = GUINT32_FROM_LE (strh->rate);
310 strh->start = GUINT32_FROM_LE (strh->start);
311 strh->length = GUINT32_FROM_LE (strh->length);
312 strh->bufsize = GUINT32_FROM_LE (strh->bufsize);
313 strh->quality = GUINT32_FROM_LE (strh->quality);
314 strh->samplesize = GUINT32_FROM_LE (strh->samplesize);
317 /* avoid divisions by zero */
324 GST_INFO_OBJECT (element, "strh tag found:");
325 GST_INFO_OBJECT (element, " type %" GST_FOURCC_FORMAT,
326 GST_FOURCC_ARGS (strh->type));
327 GST_INFO_OBJECT (element, " fcc_handler %" GST_FOURCC_FORMAT,
328 GST_FOURCC_ARGS (strh->fcc_handler));
329 GST_INFO_OBJECT (element, " flags 0x%08x", strh->flags);
330 GST_INFO_OBJECT (element, " priority %d", strh->priority);
331 GST_INFO_OBJECT (element, " init_frames %d", strh->init_frames);
332 GST_INFO_OBJECT (element, " scale %d", strh->scale);
333 GST_INFO_OBJECT (element, " rate %d", strh->rate);
334 GST_INFO_OBJECT (element, " start %d", strh->start);
335 GST_INFO_OBJECT (element, " length %d", strh->length);
336 GST_INFO_OBJECT (element, " bufsize %d", strh->bufsize);
337 GST_INFO_OBJECT (element, " quality %d", strh->quality);
338 GST_INFO_OBJECT (element, " samplesize %d", strh->samplesize);
347 GST_ERROR_OBJECT (element,
348 "Too small strh (%" G_GSIZE_FORMAT " available, %d needed)",
349 size, (int) sizeof (gst_riff_strh));
350 gst_buffer_unmap (buf, data, size);
351 gst_buffer_unref (buf);
357 * gst_riff_parse_strf_vids:
358 * @element: caller element (used for debugging/error).
359 * @buf: input data to be used for parsing, stripped from header.
360 * @strf: a pointer (returned by this function) to a filled-in
361 * strf/vids structure. Caller should free it.
362 * @data: a pointer (returned by this function) to a buffer
363 * containing extradata for this particular stream (e.g.
364 * palette, codec initialization data).
366 * Parses a video streamĀ“s strf structure plus optionally some
367 * extradata from input data. This function takes ownership of @buf.
369 * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
370 * should be skipped on error, but it is not fatal.
374 gst_riff_parse_strf_vids (GstElement * element,
375 GstBuffer * buf, gst_riff_strf_vids ** _strf, GstBuffer ** data)
377 gst_riff_strf_vids *strf;
381 g_return_val_if_fail (buf != NULL, FALSE);
382 g_return_val_if_fail (_strf != NULL, FALSE);
383 g_return_val_if_fail (data != NULL, FALSE);
385 bdata = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
386 if (size < sizeof (gst_riff_strf_vids))
389 strf = g_memdup (bdata, size);
390 gst_buffer_unmap (buf, bdata, size);
392 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
393 strf->size = GUINT32_FROM_LE (strf->size);
394 strf->width = GUINT32_FROM_LE (strf->width);
395 strf->height = GUINT32_FROM_LE (strf->height);
396 strf->planes = GUINT16_FROM_LE (strf->planes);
397 strf->bit_cnt = GUINT16_FROM_LE (strf->bit_cnt);
398 strf->compression = GUINT32_FROM_LE (strf->compression);
399 strf->image_size = GUINT32_FROM_LE (strf->image_size);
400 strf->xpels_meter = GUINT32_FROM_LE (strf->xpels_meter);
401 strf->ypels_meter = GUINT32_FROM_LE (strf->ypels_meter);
402 strf->num_colors = GUINT32_FROM_LE (strf->num_colors);
403 strf->imp_colors = GUINT32_FROM_LE (strf->imp_colors);
408 if (strf->size > size) {
409 GST_WARNING_OBJECT (element,
410 "strf_vids header gave %d bytes data, only %" G_GSIZE_FORMAT
411 " available", strf->size, size);
414 if (sizeof (gst_riff_strf_vids) < size) {
416 gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL,
417 sizeof (gst_riff_strf_vids), size - sizeof (gst_riff_strf_vids));
419 gst_buffer_unref (buf);
422 GST_INFO_OBJECT (element, "strf tag found in context vids:");
423 GST_INFO_OBJECT (element, " size %d", strf->size);
424 GST_INFO_OBJECT (element, " width %d", strf->width);
425 GST_INFO_OBJECT (element, " height %d", strf->height);
426 GST_INFO_OBJECT (element, " planes %d", strf->planes);
427 GST_INFO_OBJECT (element, " bit_cnt %d", strf->bit_cnt);
428 GST_INFO_OBJECT (element, " compression %" GST_FOURCC_FORMAT,
429 GST_FOURCC_ARGS (strf->compression));
430 GST_INFO_OBJECT (element, " image_size %d", strf->image_size);
431 GST_INFO_OBJECT (element, " xpels_meter %d", strf->xpels_meter);
432 GST_INFO_OBJECT (element, " ypels_meter %d", strf->ypels_meter);
433 GST_INFO_OBJECT (element, " num_colors %d", strf->num_colors);
434 GST_INFO_OBJECT (element, " imp_colors %d", strf->imp_colors);
436 GST_INFO_OBJECT (element, " %" G_GSIZE_FORMAT " bytes extradata",
437 gst_buffer_get_size (*data));
446 GST_ERROR_OBJECT (element,
447 "Too small strf_vids (%" G_GSIZE_FORMAT " available, %d needed)",
448 size, (int) sizeof (gst_riff_strf_vids));
449 gst_buffer_unmap (buf, data, size);
450 gst_buffer_unref (buf);
456 * gst_riff_parse_strf_auds:
457 * @element: caller element (used for debugging/error).
458 * @buf: input data to be used for parsing, stripped from header.
459 * @strf: a pointer (returned by this function) to a filled-in
460 * strf/auds structure. Caller should free it.
461 * @data: a pointer (returned by this function) to a buffer
462 * containing extradata for this particular stream (e.g.
463 * codec initialization data).
465 * Parses an audio streamĀ“s strf structure plus optionally some
466 * extradata from input data. This function takes ownership of @buf.
469 * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
470 * should be skipped on error, but it is not fatal.
473 gst_riff_parse_strf_auds (GstElement * element,
474 GstBuffer * buf, gst_riff_strf_auds ** _strf, GstBuffer ** data)
476 gst_riff_strf_auds *strf;
480 g_return_val_if_fail (buf != NULL, FALSE);
481 g_return_val_if_fail (_strf != NULL, FALSE);
482 g_return_val_if_fail (data != NULL, FALSE);
484 bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
485 if (bsize < sizeof (gst_riff_strf_auds))
488 strf = g_memdup (bdata, bsize);
490 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
491 strf->format = GUINT16_FROM_LE (strf->format);
492 strf->channels = GUINT16_FROM_LE (strf->channels);
493 strf->rate = GUINT32_FROM_LE (strf->rate);
494 strf->av_bps = GUINT32_FROM_LE (strf->av_bps);
495 strf->blockalign = GUINT16_FROM_LE (strf->blockalign);
496 strf->size = GUINT16_FROM_LE (strf->size);
501 if (bsize > sizeof (gst_riff_strf_auds) + 2) {
504 len = GST_READ_UINT16_LE (&data[16]);
505 if (len + 2 + sizeof (gst_riff_strf_auds) > bsize) {
506 GST_WARNING_OBJECT (element,
507 "Extradata indicated %d bytes, but only %" G_GSSIZE_FORMAT
508 " available", len, bsize - 2 - sizeof (gst_riff_strf_auds));
509 len = bsize - 2 - sizeof (gst_riff_strf_auds);
512 *data = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL,
513 sizeof (gst_riff_strf_auds) + 2, len);
517 GST_INFO_OBJECT (element, "strf tag found in context auds:");
518 GST_INFO_OBJECT (element, " format %d", strf->format);
519 GST_INFO_OBJECT (element, " channels %d", strf->channels);
520 GST_INFO_OBJECT (element, " rate %d", strf->rate);
521 GST_INFO_OBJECT (element, " av_bps %d", strf->av_bps);
522 GST_INFO_OBJECT (element, " blockalign %d", strf->blockalign);
523 GST_INFO_OBJECT (element, " size %d", strf->size);
525 GST_INFO_OBJECT (element, " %" G_GSIZE_FORMAT " bytes extradata",
526 gst_buffer_get_size (*data));
528 gst_buffer_unmap (buf, bdata, bsize);
529 gst_buffer_unref (buf);
538 GST_ERROR_OBJECT (element,
539 "Too small strf_auds (%" G_GSIZE_FORMAT " available"
540 ", %" G_GSSIZE_FORMAT " needed)", bsize, sizeof (gst_riff_strf_auds));
541 gst_buffer_unmap (buf, bdata, bsize);
542 gst_buffer_unref (buf);
548 * gst_riff_parse_strf_iavs:
549 * @element: caller element (used for debugging/error).
550 * @buf: input data to be used for parsing, stripped from header.
551 * @strf: a pointer (returned by this function) to a filled-in
552 * strf/iavs structure. Caller should free it.
553 * @data: a pointer (returned by this function) to a buffer
554 * containing extradata for this particular stream (e.g.
555 * codec initialization data).
557 * Parses a interleaved (also known as "complex") streamĀ“s strf
558 * structure plus optionally some extradata from input data. This
559 * function takes ownership of @buf.
561 * Returns: TRUE if parsing succeeded, otherwise FALSE.
565 gst_riff_parse_strf_iavs (GstElement * element,
566 GstBuffer * buf, gst_riff_strf_iavs ** _strf, GstBuffer ** data)
568 gst_riff_strf_iavs *strf;
572 g_return_val_if_fail (buf != NULL, FALSE);
573 g_return_val_if_fail (_strf != NULL, FALSE);
574 g_return_val_if_fail (data != NULL, FALSE);
576 bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
577 if (bsize < sizeof (gst_riff_strf_iavs))
580 strf = g_memdup (bdata, bsize);
581 gst_buffer_unmap (buf, bdata, bsize);
583 gst_buffer_unref (buf);
585 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
586 strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc);
587 strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl);
588 strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1);
589 strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1);
590 strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc);
591 strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl);
592 strf->DVReserved1 = GUINT32_FROM_LE (strf->DVReserved1);
593 strf->DVReserved2 = GUINT32_FROM_LE (strf->DVReserved2);
597 GST_INFO_OBJECT (element, "strf tag found in context iavs:");
598 GST_INFO_OBJECT (element, " DVAAuxSrc %08x", strf->DVAAuxSrc);
599 GST_INFO_OBJECT (element, " DVAAuxCtl %08x", strf->DVAAuxCtl);
600 GST_INFO_OBJECT (element, " DVAAuxSrc1 %08x", strf->DVAAuxSrc1);
601 GST_INFO_OBJECT (element, " DVAAuxCtl1 %08x", strf->DVAAuxCtl1);
602 GST_INFO_OBJECT (element, " DVVAuxSrc %08x", strf->DVVAuxSrc);
603 GST_INFO_OBJECT (element, " DVVAuxCtl %08x", strf->DVVAuxCtl);
604 GST_INFO_OBJECT (element, " DVReserved1 %08x", strf->DVReserved1);
605 GST_INFO_OBJECT (element, " DVReserved2 %08x", strf->DVReserved2);
615 GST_ERROR_OBJECT (element,
616 "Too small strf_iavs (%" G_GSIZE_FORMAT "available"
617 ", %" G_GSSIZE_FORMAT " needed)", bsize, sizeof (gst_riff_strf_iavs));
618 gst_buffer_unmap (buf, bdata, bsize);
619 gst_buffer_unref (buf);
625 * gst_riff_parse_info:
626 * @element: caller element (used for debugging/error).
627 * @buf: input data to be used for parsing, stripped from header.
628 * @taglist: a pointer to a taglist (returned by this function)
629 * containing information about this stream. May be
630 * NULL if no supported tags were found.
632 * Parses stream metadata from input data.
635 gst_riff_parse_info (GstElement * element,
636 GstBuffer * buf, GstTagList ** _taglist)
645 g_return_if_fail (_taglist != NULL);
651 data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
653 taglist = gst_tag_list_new_empty ();
659 tag = GST_READ_UINT32_LE (ptr);
660 tsize = GST_READ_UINT32_LE (ptr + 4);
664 GST_DEBUG ("tag %" GST_FOURCC_FORMAT ", size %u",
665 GST_FOURCC_ARGS (tag), tsize);
668 GST_WARNING_OBJECT (element,
669 "Tagsize %d is larger than available data %" G_GSIZE_FORMAT,
674 /* find out the type of metadata */
676 case GST_RIFF_INFO_IARL:
677 type = GST_TAG_LOCATION;
679 case GST_RIFF_INFO_IART:
680 type = GST_TAG_ARTIST;
682 case GST_RIFF_INFO_ICMS:
683 type = NULL; /*"Commissioner"; */
685 case GST_RIFF_INFO_ICMT:
686 type = GST_TAG_COMMENT;
688 case GST_RIFF_INFO_ICOP:
689 type = GST_TAG_COPYRIGHT;
691 case GST_RIFF_INFO_ICRD:
694 case GST_RIFF_INFO_ICRP:
695 type = NULL; /*"Cropped"; */
697 case GST_RIFF_INFO_IDIM:
698 type = NULL; /*"Dimensions"; */
700 case GST_RIFF_INFO_IDPI:
701 type = NULL; /*"Dots per Inch"; */
703 case GST_RIFF_INFO_IENG:
704 type = NULL; /*"Engineer"; */
706 case GST_RIFF_INFO_IGNR:
707 type = GST_TAG_GENRE;
709 case GST_RIFF_INFO_IKEY:
710 type = GST_TAG_KEYWORDS;
712 case GST_RIFF_INFO_ILGT:
713 type = NULL; /*"Lightness"; */
715 case GST_RIFF_INFO_IMED:
716 type = NULL; /*"Medium"; */
718 case GST_RIFF_INFO_INAM:
719 type = GST_TAG_TITLE;
721 case GST_RIFF_INFO_IPLT:
722 type = NULL; /*"Palette"; */
724 case GST_RIFF_INFO_IPRD:
725 type = NULL; /*"Product"; */
727 case GST_RIFF_INFO_ISBJ:
728 type = NULL; /*"Subject"; */
730 case GST_RIFF_INFO_ISFT:
731 type = GST_TAG_ENCODER;
733 case GST_RIFF_INFO_ISHP:
734 type = NULL; /*"Sharpness"; */
736 case GST_RIFF_INFO_ISRC:
739 case GST_RIFF_INFO_ISRF:
740 type = NULL; /*"Source Form"; */
742 case GST_RIFF_INFO_ITCH:
743 type = NULL; /*"Technician"; */
747 GST_WARNING_OBJECT (element,
748 "Unknown INFO (metadata) tag entry %" GST_FOURCC_FORMAT,
749 GST_FOURCC_ARGS (tag));
753 if (type != NULL && ptr[0] != '\0') {
754 static const gchar *env_vars[] = { "GST_AVI_TAG_ENCODING",
755 "GST_RIFF_TAG_ENCODING", "GST_TAG_ENCODING", NULL
759 val = gst_tag_freeform_string_to_utf8 ((gchar *) ptr, tsize, env_vars);
762 gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL);
765 GST_WARNING_OBJECT (element, "could not extract %s tag", type);
779 if (!gst_tag_list_is_empty (taglist)) {
783 gst_tag_list_free (taglist);
785 gst_buffer_unmap (buf, data, size);