gst/mpegaudioparse/gstmpegaudioparse.c: Don't set new caps on the srcpad everytime the bitrate or MPEG version change...

Original commit message from CVS:
* 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.
This commit is contained in:
Sebastian Dröge 2008-01-29 19:10:38 +00:00
parent bb56fbeed4
commit 0679293a71
3 changed files with 19 additions and 8 deletions

View file

@ -1,3 +1,11 @@
2008-01-29 Sebastian Dröge <slomo@circular-chaos.org>
* 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 <ensonic@users.sf.net> 2008-01-21 Stefan Kost <ensonic@users.sf.net>
* docs/plugins/Makefile.am: * docs/plugins/Makefile.am:

2
common

@ -1 +1 @@
Subproject commit 662f544d56a6d6ef20b8ea5f56e975f9e139bc78 Subproject commit 571dce3335f9be76978009b3842c050dbb900e6f

View file

@ -187,13 +187,12 @@ mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header,
} }
static GstCaps * static GstCaps *
mp3_caps_create (guint layer, guint channels, guint bitrate, guint samplerate) mp3_caps_create (guint layer, guint channels, guint samplerate)
{ {
GstCaps *new; GstCaps *new;
g_assert (layer); g_assert (layer);
g_assert (samplerate); g_assert (samplerate);
g_assert (bitrate);
g_assert (channels); g_assert (channels);
new = gst_caps_new_simple ("audio/mpeg", new = gst_caps_new_simple ("audio/mpeg",
@ -1096,19 +1095,21 @@ gst_mp3parse_chain (GstPad * pad, GstBuffer * buf)
"%d bytes, have %d", bpf, available); "%d bytes, have %d", bpf, available);
break; break;
} }
if (channels != mp3parse->channels || if (channels != mp3parse->channels ||
rate != mp3parse->rate || rate != mp3parse->rate || layer != mp3parse->layer) {
layer != mp3parse->layer || bitrate != mp3parse->bit_rate) {
GstCaps *caps; 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_pad_set_caps (mp3parse->srcpad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
mp3parse->channels = channels; mp3parse->channels = channels;
mp3parse->layer = layer;
mp3parse->rate = rate; mp3parse->rate = rate;
mp3parse->bit_rate = bitrate; }
if (layer != mp3parse->layer || version != mp3parse->version) {
mp3parse->layer = layer;
mp3parse->version = version; mp3parse->version = version;
/* see http://www.codeproject.com/audio/MPEGAudioInfo.asp */ /* see http://www.codeproject.com/audio/MPEGAudioInfo.asp */
@ -1122,6 +1123,8 @@ gst_mp3parse_chain (GstPad * pad, GstBuffer * buf)
mp3parse->spf = 1152; mp3parse->spf = 1152;
} }
mp3parse->bit_rate = bitrate;
mp3parse->max_bitreservoir = gst_util_uint64_scale (GST_SECOND, mp3parse->max_bitreservoir = gst_util_uint64_scale (GST_SECOND,
((version == 1) ? 10 : 30) * mp3parse->spf, mp3parse->rate); ((version == 1) ? 10 : 30) * mp3parse->spf, mp3parse->rate);