wavpackparse: fix handling of correction streams
authorTim-Philipp Müller <tim@centricular.com>
Tue, 11 Sep 2018 23:52:19 +0000 (00:52 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 12 Sep 2018 00:05:05 +0000 (01:05 +0100)
Accept wavpack correction streams (.wvc) on sink pad, so
that wavpackparse can also be used to packetise correction
streams.

Fix parsing of subblock ID tags - the higher bits are
flags and are not part of the ID. This resulted in
correction blocks not being recognised properly and
the output not having the right (correction) caps.

gst/audioparsers/gstwavpackparse.c

index 3e1d19c..7dc34cf 100644 (file)
@@ -61,7 +61,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-wavpack"));
+    GST_STATIC_CAPS ("audio/x-wavpack; audio/x-wavpack-correction"));
 
 static void gst_wavpack_parse_finalize (GObject * object);
 
@@ -325,7 +325,9 @@ gst_wavpack_parse_frame_metadata (GstWavpackParse * parse, GstBuffer * buf,
     CHECK (gst_byte_reader_get_data (&br, size + (size & 1), &data));
     gst_byte_reader_init (&mbr, data, size);
 
-    switch (id) {
+    /* 0x1f is the metadata id mask and 0x20 flag is for later extensions
+     * that do not need to be handled by the decoder */
+    switch (id & 0x3f) {
       case ID_WVC_BITSTREAM:
         GST_LOG_OBJECT (parse, "correction bitstream");
         wpi->correction = TRUE;