[0.11] gst-plugins-base: vorbisparse: Pass correct header buffer size to libvorbis and include channels/ rate in the srcpad caps

Sebastian Dröge slomo at kemper.freedesktop.org
Fri Jan 27 03:08:55 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: 76b7ff8f9967a30543bf8f8217b892c1a3826275
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=76b7ff8f9967a30543bf8f8217b892c1a3826275

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Fri Jan 27 12:08:33 2012 +0100

vorbisparse: Pass correct header buffer size to libvorbis and include channels/rate in the srcpad caps

---

 ext/vorbis/gstvorbisparse.c |   18 +++++++++++-------
 ext/vorbis/gstvorbisparse.h |    1 +
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ext/vorbis/gstvorbisparse.c b/ext/vorbis/gstvorbisparse.c
index c992c6d..adc128d 100644
--- a/ext/vorbis/gstvorbisparse.c
+++ b/ext/vorbis/gstvorbisparse.c
@@ -189,13 +189,6 @@ vorbis_parse_push_headers (GstVorbisParse * parse)
   ogg_packet packet;
   GstMapInfo map;
 
-  /* get the headers into the caps, passing them to vorbis as we go */
-  caps = gst_caps_make_writable (gst_pad_query_caps (parse->srcpad, NULL));
-  vorbis_parse_set_header_on_caps (parse, caps);
-  GST_DEBUG_OBJECT (parse, "here are the caps: %" GST_PTR_FORMAT, caps);
-  gst_pad_set_caps (parse->srcpad, caps);
-  gst_caps_unref (caps);
-
   outbuf = GST_BUFFER_CAST (parse->streamheader->data);
   gst_buffer_map (outbuf, &map, GST_MAP_READ);
   packet.packet = map.data;
@@ -207,6 +200,7 @@ vorbis_parse_push_headers (GstVorbisParse * parse)
   vorbis_synthesis_headerin (&parse->vi, &parse->vc, &packet);
   gst_buffer_unmap (outbuf, &map);
   parse->sample_rate = parse->vi.rate;
+  parse->channels = parse->vi.channels;
   outbuf1 = outbuf;
 
   outbuf = GST_BUFFER_CAST (parse->streamheader->next->data);
@@ -224,6 +218,7 @@ vorbis_parse_push_headers (GstVorbisParse * parse)
   outbuf = GST_BUFFER_CAST (parse->streamheader->next->next->data);
   gst_buffer_map (outbuf, &map, GST_MAP_READ);
   packet.packet = map.data;
+  packet.bytes = map.size;
   packet.granulepos = GST_BUFFER_OFFSET_END (outbuf);
   packet.packetno = 3;
   packet.e_o_s = 0;
@@ -232,6 +227,15 @@ vorbis_parse_push_headers (GstVorbisParse * parse)
   gst_buffer_unmap (outbuf, &map);
   outbuf3 = outbuf;
 
+  /* get the headers into the caps, passing them to vorbis as we go */
+  caps = gst_caps_new_simple ("audio/x-vorbis",
+      "rate", G_TYPE_INT, parse->sample_rate,
+      "channels", G_TYPE_INT, parse->channels, NULL);;
+  vorbis_parse_set_header_on_caps (parse, caps);
+  GST_DEBUG_OBJECT (parse, "here are the caps: %" GST_PTR_FORMAT, caps);
+  gst_pad_set_caps (parse->srcpad, caps);
+  gst_caps_unref (caps);
+
   /* first process queued events */
   vorbis_parse_drain_event_queue (parse);
 
diff --git a/ext/vorbis/gstvorbisparse.h b/ext/vorbis/gstvorbisparse.h
index 6538949..46183ea 100644
--- a/ext/vorbis/gstvorbisparse.h
+++ b/ext/vorbis/gstvorbisparse.h
@@ -66,6 +66,7 @@ struct _GstVorbisParse {
   gint64		prev_granulepos;
   gint32		prev_blocksize;
   guint32		sample_rate;
+  guint32               channels;
 };
 
 struct _GstVorbisParseClass {



More information about the gstreamer-commits mailing list