mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
gst/typefind/gsttypefindfunctions.c: fix bug in length computation improve debugging output
Original commit message from CVS: 2004-01-23 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst/typefind/gsttypefindfunctions.c: (mp3_type_frame_length_from_header): fix bug in length computation (mp3_type_find): improve debugging output
This commit is contained in:
parent
15289fa2dd
commit
e93f72838d
2 changed files with 11 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2004-01-23 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||||
|
|
||||||
|
* gst/typefind/gsttypefindfunctions.c:
|
||||||
|
(mp3_type_frame_length_from_header): fix bug in length computation
|
||||||
|
(mp3_type_find): improve debugging output
|
||||||
|
|
||||||
2004-01-23 Julien MOUTTE <julien@moutte.net>
|
2004-01-23 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
* gst-libs/gst/play/gstplay.c: (gst_play_pipeline_setup),
|
* gst-libs/gst/play/gstplay.c: (gst_play_pipeline_setup),
|
||||||
|
|
|
@ -227,8 +227,7 @@ mp3_type_frame_length_from_header (guint32 header, guint *put_layer,
|
||||||
guint *put_channels, guint *put_bitrate,
|
guint *put_channels, guint *put_bitrate,
|
||||||
guint *put_samplerate)
|
guint *put_samplerate)
|
||||||
{
|
{
|
||||||
guint length;
|
guint bitrate, layer, length, mode, samplerate, version, channels;
|
||||||
gulong mode, samplerate, bitrate, layer, version, channels;
|
|
||||||
|
|
||||||
if ((header & 0xffe00000) != 0xffe00000)
|
if ((header & 0xffe00000) != 0xffe00000)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -279,12 +278,12 @@ mp3_type_frame_length_from_header (guint32 header, guint *put_layer,
|
||||||
if (layer == 1) {
|
if (layer == 1) {
|
||||||
length = ((12000 * bitrate / samplerate) + length) * 4;
|
length = ((12000 * bitrate / samplerate) + length) * 4;
|
||||||
} else {
|
} else {
|
||||||
length += ((layer == 3 && version == 0) ? 72000 : 144000) * bitrate / samplerate;
|
length += ((layer == 3 && version != 3) ? 72000 : 144000) * bitrate / samplerate;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG ("mp3typefind: alculated mp3 frame length of %u bytes", length);
|
GST_LOG ("mp3typefind: alculated mp3 frame length of %u bytes", length);
|
||||||
GST_LOG ("mp3typefind: samplerate = %lu - bitrate = %lu - layer = %lu - version = %lu"
|
GST_LOG ("mp3typefind: samplerate = %u - bitrate = %u - layer = %u - version = %u"
|
||||||
" - channels = %lu",
|
" - channels = %u",
|
||||||
samplerate, bitrate, layer, version, channels);
|
samplerate, bitrate, layer, version, channels);
|
||||||
|
|
||||||
if (put_layer)
|
if (put_layer)
|
||||||
|
@ -349,6 +348,7 @@ mp3_type_find (GstTypeFind *tf, gpointer unused)
|
||||||
head = GUINT32_FROM_BE(*((guint32 *) head_data));
|
head = GUINT32_FROM_BE(*((guint32 *) head_data));
|
||||||
if (!(length = mp3_type_frame_length_from_header (head, &layer,
|
if (!(length = mp3_type_frame_length_from_header (head, &layer,
|
||||||
&channels, &bitrate, &samplerate))) {
|
&channels, &bitrate, &samplerate))) {
|
||||||
|
GST_LOG ("%d. header at offset %"G_GUINT64_FORMAT" was not an mp3 header", found + 1, offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((prev_layer && prev_layer != layer) ||
|
if ((prev_layer && prev_layer != layer) ||
|
||||||
|
|
Loading…
Reference in a new issue