diff --git a/ChangeLog b/ChangeLog index 70cfb95b07..28e09b1830 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-01-29 Sebastian Dröge + + * gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_caps_create), + (gst_mp3parse_chain): + Don't set new caps on the srcpad everytime the bitrate or MPEG + version changes but calculate new spf value when the MPEG version + changes. + 2008-01-21 Stefan Kost * docs/plugins/Makefile.am: diff --git a/common b/common index 662f544d56..571dce3335 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 662f544d56a6d6ef20b8ea5f56e975f9e139bc78 +Subproject commit 571dce3335f9be76978009b3842c050dbb900e6f diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index b6360cf83c..b441fb0c2d 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -187,13 +187,12 @@ mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header, } static GstCaps * -mp3_caps_create (guint layer, guint channels, guint bitrate, guint samplerate) +mp3_caps_create (guint layer, guint channels, guint samplerate) { GstCaps *new; g_assert (layer); g_assert (samplerate); - g_assert (bitrate); g_assert (channels); new = gst_caps_new_simple ("audio/mpeg", @@ -1096,19 +1095,21 @@ gst_mp3parse_chain (GstPad * pad, GstBuffer * buf) "%d bytes, have %d", bpf, available); break; } + if (channels != mp3parse->channels || - rate != mp3parse->rate || - layer != mp3parse->layer || bitrate != mp3parse->bit_rate) { + rate != mp3parse->rate || layer != mp3parse->layer) { GstCaps *caps; - caps = mp3_caps_create (layer, channels, bitrate, rate); + caps = mp3_caps_create (layer, channels, rate); gst_pad_set_caps (mp3parse->srcpad, caps); gst_caps_unref (caps); mp3parse->channels = channels; - mp3parse->layer = layer; mp3parse->rate = rate; - mp3parse->bit_rate = bitrate; + } + + if (layer != mp3parse->layer || version != mp3parse->version) { + mp3parse->layer = layer; mp3parse->version = version; /* see http://www.codeproject.com/audio/MPEGAudioInfo.asp */ @@ -1122,6 +1123,8 @@ gst_mp3parse_chain (GstPad * pad, GstBuffer * buf) mp3parse->spf = 1152; } + mp3parse->bit_rate = bitrate; + mp3parse->max_bitreservoir = gst_util_uint64_scale (GST_SECOND, ((version == 1) ? 10 : 30) * mp3parse->spf, mp3parse->rate);