ext/lame/gstlame.c: Correctly set number of channels when using mono-encoding mode and fix the duration calculation o...

Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at syknet dot be>
* ext/lame/gstlame.c: (gst_lame_sink_setcaps),
(gst_lame_sink_event):
Correctly set number of channels when using mono-encoding mode
and fix the duration calculation of the EOS buffer.
This commit is contained in:
Mark Nauwelaerts 2008-01-14 09:17:47 +00:00 committed by Sebastian Dröge
parent 1db9aa8d23
commit 96205bedb5
2 changed files with 12 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2008-01-14 Sebastian Dröge <slomo@circular-chaos.org>
Patch by: Mark Nauwelaerts <manauw at syknet dot be>
* ext/lame/gstlame.c: (gst_lame_sink_setcaps),
(gst_lame_sink_event):
Correctly set number of channels when using mono-encoding mode
and fix the duration calculation of the EOS buffer.
2008-01-14 Sebastian Dröge <slomo@circular-chaos.org> 2008-01-14 Sebastian Dröge <slomo@circular-chaos.org>
* gst/mpegaudioparse/gstmpegaudioparse.c: * gst/mpegaudioparse/gstmpegaudioparse.c:

View file

@ -550,7 +550,7 @@ gst_lame_sink_setcaps (GstPad * pad, GstCaps * caps)
gst_caps_new_simple ("audio/mpeg", gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "mpegversion", G_TYPE_INT, 1,
"layer", G_TYPE_INT, 3, "layer", G_TYPE_INT, 3,
"channels", G_TYPE_INT, lame->num_channels, "channels", G_TYPE_INT, lame->mode == MONO ? 1 : lame->num_channels,
"rate", G_TYPE_INT, out_samplerate, NULL); "rate", G_TYPE_INT, out_samplerate, NULL);
/* and use these caps */ /* and use these caps */
@ -974,8 +974,8 @@ gst_lame_sink_event (GstPad * pad, GstEvent * event)
if (size > 0 && lame->last_flow == GST_FLOW_OK) { if (size > 0 && lame->last_flow == GST_FLOW_OK) {
gint64 duration; gint64 duration;
duration = gst_util_uint64_scale_int (size, GST_SECOND, duration = gst_util_uint64_scale_int (size, 8 * GST_SECOND,
2 * lame->samplerate * lame->num_channels); 1000 * lame->bitrate);
if (lame->last_ts == GST_CLOCK_TIME_NONE) { if (lame->last_ts == GST_CLOCK_TIME_NONE) {
lame->last_ts = lame->eos_ts; lame->last_ts = lame->eos_ts;