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
This commit is contained in:
Vincent Penquerc'h 2011-09-09 12:35:50 +01:00 committed by Sebastian Dröge
parent 95b5ece2c9
commit d17d13219c

View file

@ -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)