[FFmpeg-devel] [PATCH] id3v2: fix unsynchronization

wm4 nfxjfg at googlemail.com
Wed Jan 31 13:04:55 EET 2018


On Wed, 31 Jan 2018 11:34:27 +0100
Michael Niedermayer <michael at niedermayer.cc> wrote:

> On Tue, Jan 30, 2018 at 01:43:25PM +0100, wm4 wrote:
> > The ID3v2 "unsynchronization scheme" requires replacing any 0xFF 0x00
> > sequences with 0xFF. This has to be done on every byte of the source
> > data, while the current code skipped a byte after a replacement. This
> > meant 0xFF 0x00 0xFF 00 was translated to 0xFF 0xFF 0x00 instead of 0xFF
> > 0xFF. It feels a bit messy to do this correctly with the avio use. But
> > fortunately, this translation can be done in-place, so we can just do it
> > in memory.
> > 
> > Inspired by what taglib does.
> > ---
> > Sample (which had corrupted cover art, displays fine with the fix):
> > https://0x0.st/sbQ9.bin (unfortunately a bit too large for FATE)
> > ---
> >  libavformat/id3v2.c | 26 ++++++++++++++------------
> >  1 file changed, 14 insertions(+), 12 deletions(-)  
> 
> if this works better than before then its a good idea.
> Also your code looks better and more efficient than what was there
> before

It definitely makes the sample at hand work, however the sample Libav
attempted to fix seems to be lost.


More information about the ffmpeg-devel mailing list