summaryrefslogtreecommitdiffstats
path: root/gst/wavparse
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sourceforge.net>2008-08-05 15:05:44 +0000
committerStefan Kost <ensonic@users.sourceforge.net>2008-08-05 15:05:44 +0000
commit1a9699c487eae4a1c54dd8802fae3ec594d117be (patch)
treee174d7c28edec0f81a6ebd1079db5585dc90d77e /gst/wavparse
parent8e98d264cdb9e227793b79af769175d1ae31ec73 (diff)
gst/wavparse/gstwavparse.c: Handle the list chunk and use gst_riff_parse_info() to parse the info sub-chunk.
Original commit message from CVS: * gst/wavparse/gstwavparse.c: Handle the list chunk and use gst_riff_parse_info() to parse the info sub-chunk.
Diffstat (limited to 'gst/wavparse')
-rw-r--r--gst/wavparse/gstwavparse.c67
1 files changed, 66 insertions, 1 deletions
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c
index fde7dbc3..8f87c2d5 100644
--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -1255,7 +1255,6 @@ gst_wavparse_stream_headers (GstWavParse * wav)
* So we have to go bit by bit until we find the 'data' header
*/
switch (tag) {
- /* TODO : Implement the various cases */
case GST_RIFF_TAG_data:{
GstFormat fmt;
@@ -1350,6 +1349,72 @@ gst_wavparse_stream_headers (GstWavParse * wav)
}
break;
}
+ /* FIXME: all list tags after data are ignored in streaming mode */
+ case GST_RIFF_TAG_LIST:{
+ guint32 ltag;
+
+ if (wav->streaming) {
+ const guint8 *data = NULL;
+
+ if (gst_adapter_available (wav->adapter) < 12) {
+ return GST_FLOW_OK;
+ }
+ data = gst_adapter_peek (wav->adapter, 12);
+ ltag = GST_READ_UINT32_LE (data + 8);
+ } else {
+ gst_buffer_unref (buf);
+ if ((res =
+ gst_pad_pull_range (wav->sinkpad, wav->offset, 12,
+ &buf)) != GST_FLOW_OK)
+ goto header_read_error;
+ ltag = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 8);
+ }
+ switch (ltag) {
+ case GST_RIFF_LIST_INFO:{
+ const guint data_size = size - 12;
+ GstTagList *new;
+
+ GST_INFO_OBJECT (wav, "Have LIST chunk INFO");
+ if (wav->streaming) {
+ gst_adapter_flush (wav->adapter, 12);
+ if (gst_adapter_available (wav->adapter) < data_size) {
+ return GST_FLOW_OK;
+ }
+ gst_buffer_unref (buf);
+ buf = gst_adapter_take_buffer (wav->adapter, data_size);
+ } else {
+ wav->offset += 12;
+ gst_buffer_unref (buf);
+ if ((res =
+ gst_pad_pull_range (wav->sinkpad, wav->offset, data_size,
+ &buf)) != GST_FLOW_OK)
+ goto header_read_error;
+ }
+ /* parse tags */
+ gst_riff_parse_info (GST_ELEMENT (wav), buf, &new);
+ if (new) {
+ GstTagList *old = wav->tags;
+ wav->tags = gst_tag_list_merge (old, new, GST_TAG_MERGE_REPLACE);
+ if (old)
+ gst_tag_list_free (old);
+ gst_tag_list_free (new);
+ }
+ if (wav->streaming) {
+ gst_adapter_flush (wav->adapter, data_size);
+ } else {
+ gst_buffer_unref (buf);
+ wav->offset += data_size;
+ }
+ break;
+ }
+ default:
+ GST_INFO_OBJECT (wav, "Ignoring LIST chunk %" GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (ltag));
+ gst_waveparse_ignore_chunk (wav, buf, tag, size);
+ break;
+ }
+ break;
+ }
default:
gst_waveparse_ignore_chunk (wav, buf, tag, size);
}