[0.11] gst-plugins-good: ac3parse: use bsid 9 and 10 to control sample rate
Wim Taymans
wtay at kemper.freedesktop.org
Wed Sep 28 03:45:28 PDT 2011
Module: gst-plugins-good
Branch: 0.11
Commit: d17d13219c3293e0eb586ef54cb43187060dca92
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=d17d13219c3293e0eb586ef54cb43187060dca92
Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
Date: Fri Sep 9 12:35:50 2011 +0100
ac3parse: use bsid 9 and 10 to control sample rate
See http://matroska.org/technical/specs/codecid/index.html
The spec is silent about this though...
https://bugzilla.gnome.org/show_bug.cgi?id=658546
---
gst/audioparsers/gstac3parse.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c
index a1cb997..b2f9764 100644
--- a/gst/audioparsers/gstac3parse.c
+++ b/gst/audioparsers/gstac3parse.c
@@ -144,10 +144,10 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-ac3, framed = (boolean) true, "
- " channels = (int) [ 1, 6 ], rate = (int) [ 32000, 48000 ], "
+ " channels = (int) [ 1, 6 ], rate = (int) [ 8000, 48000 ], "
" alignment = (string) { iec61937, frame}; "
"audio/x-eac3, framed = (boolean) true, "
- " channels = (int) [ 1, 6 ], rate = (int) [ 32000, 48000 ], "
+ " channels = (int) [ 1, 6 ], rate = (int) [ 8000, 48000 ], "
" alignment = (string) { iec61937, frame}; "));
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
@@ -300,7 +300,7 @@ gst_ac3_parse_frame_header_ac3 (GstAc3Parse * ac3parse, GstBuffer * buf,
guint * sid)
{
GstBitReader bits = GST_BIT_READER_INIT_FROM_BUFFER (buf);
- guint8 fscod, frmsizcod, bsid, acmod, lfe_on;
+ guint8 fscod, frmsizcod, bsid, acmod, lfe_on, rate_scale;
GST_LOG_OBJECT (ac3parse, "parsing ac3");
@@ -337,10 +337,14 @@ gst_ac3_parse_frame_header_ac3 (GstAc3Parse * ac3parse, GstBuffer * buf,
lfe_on = gst_bit_reader_get_bits_uint8_unchecked (&bits, 1);
+ /* 6/8->0, 9->1, 10->2,
+ see http://matroska.org/technical/specs/codecid/index.html */
+ rate_scale = (CLAMP (bsid, 8, 10) - 8);
+
if (frame_size)
*frame_size = frmsizcod_table[frmsizcod].frame_size[fscod] * 2;
if (rate)
- *rate = fscod_rates[fscod];
+ *rate = fscod_rates[fscod] >> rate_scale;
if (chans)
*chans = acmod_chans[acmod] + lfe_on;
if (blks)
More information about the gstreamer-commits
mailing list