Opened 20 years ago

Closed 19 years ago

Last modified 19 years ago

#64 closed defect (fixed)

[Patch] fix detection of MP3s with junk at beginning

Reported by: behrisch@… Owned by: reimar
Priority: normal Component: demuxer
Version: HEAD Severity: normal
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

If there is junk at the beginning of an mp3 which looks at first sight
as if it were an mp3 header but is not followed by valid mp3 headers
the file gets simply discarded.
Fixing Patch attached.

Attachments (2)

audio_detect.diff (3.6 KB ) - added by behrisch@… 20 years ago.
Fixes the problem
mp3_detect.diff (6.3 KB ) - added by reimar 20 years ago.
(hopefully) better way to do it

Download all attachments as: .zip

Change History (5)

by behrisch@…, 20 years ago

Attachment: audio_detect.diff added

Fixes the problem

comment:1 by behrisch@…, 20 years ago

Fixes the problem at least if the junk has less than 3000 bytes

by reimar, 20 years ago

Attachment: mp3_detect.diff added

(hopefully) better way to do it

comment:2 by reimar, 20 years ago

attachments.isobsolete: 01
Owner: changed from moritz@… to Reimar.Doeffinger@…
Status: newassigned

a few comments about your patch first:
you did some changes that make it hard to find out what your patch changes,
like renaming step to bytes_to_read. I admit that this makes the resulting code
easier to read, but not the patch!
The main problem is that your patch relies heavily on the ability to seek
backwards in a stream - something that is not always possible.
try e.g. cat test.mp3 | ./mplayer -v -nocache -demuxer 17 -
to see the effect. At least for that case MPlayer still wouldn't detect some
MP3s correctly.
That's why I would propose my attached patch, which does not need to seek
backwards at all but is a bit more complicated. Please test it.
P.S.: I'm not sure if the modification to libmpdemux/stream.c is correct, but
the original code made MPlayer seek forward when attempting to seek backwards
in a linear stream.

comment:3 by reimar, 19 years ago

Resolution: fixed
Status: assignedclosed

Applied my version without the change to libmpdemux/stream.c
It fixed all problems for me. If you still have problems, please reopen this bug.

Note: See TracTickets for help on using tickets.