Opened 16 years ago

Closed 16 years ago

Last modified 16 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: Analyzed by developer:


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@… 16 years ago.
Fixes the problem
mp3_detect.diff (6.3 KB) - added by reimar 16 years ago.
(hopefully) better way to do it

Download all attachments as: .zip

Change History (5)

Changed 16 years ago by behrisch@…

Fixes the problem

comment:1 Changed 16 years ago by behrisch@…

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

Changed 16 years ago by reimar

(hopefully) better way to do it

comment:2 Changed 16 years ago by reimar

  • attachments.isobsolete changed from 0 to 1
  • Owner changed from moritz@… to Reimar.Doeffinger@…
  • Status changed from new to assigned

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 Changed 16 years ago by reimar

  • Resolution set to fixed
  • Status changed from assigned to closed

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.