From 155339b9e23c1ade7bac9b3859fb521045a43ca0 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 29 Dec 2006 14:51:19 +0000 Subject: [PATCH] gst/mpegaudioparse/gstmpegaudioparse.c: All sample-rates < 32khz come from the LSF extensions, which only use 1 granu... Original commit message from CVS: * gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain): All sample-rates < 32khz come from the LSF extensions, which only use 1 granule. Fixes parsing of 22.05khz, 24khz and 16khz files. Use gst_util_uint64_scale because we can. --- ChangeLog | 8 ++++++++ gst/mpegaudioparse/gstmpegaudioparse.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f07c0c..bc41c0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-12-29 Jan Schmidt + + * gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain): + All sample-rates < 32khz come from the LSF extensions, which only + use 1 granule. Fixes parsing of 22.05khz, 24khz and 16khz files. + + Use gst_util_uint64_scale because we can. + 2006-12-22 Stefan Kost * tests/check/elements/amrnbenc.c: (setup_amrnbenc), diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index c75662c..6e52b57 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -449,12 +449,14 @@ gst_mp3parse_chain (GstPad * pad, GstBuffer * buf) else if (mp3parse->layer == 2) spf = 1152; else { - if (mp3parse->rate < 16000) + /* Any sample_rate < 32000 indicates MPEG-2 or MPEG-2.5 */ + if (mp3parse->rate < 32000) spf = 576; else spf = 1152; } - GST_BUFFER_DURATION (outbuf) = spf * GST_SECOND / mp3parse->rate; + GST_BUFFER_DURATION (outbuf) = + gst_util_uint64_scale (GST_SECOND, spf, mp3parse->rate); if (GST_CLOCK_TIME_IS_VALID (mp3parse->next_ts)) { GST_BUFFER_TIMESTAMP (outbuf) = mp3parse->next_ts; -- 2.7.4