> 
> Karsten> But I have some mp3s the plugin plays half the way and then 
> Karsten> proceeds to the next song. 
> 
>   I think it's because those files are corrupted. Most of MP3 players try
> to resync on erroneous frames. But mpglib seems easily break when
> erroneous frame is fed. So, if I simply add resync code, decoder
> often breaks after resync. It seems another patch for mpglib is needed.
> 

Naoki:  How were you planning on adding the resync code?  
Would this be inside or outside of mpglib?

I have been doing some work on decodeMP3 in mpglib/interface.c,
and I now also need resync capibility :-)

I wanted to see how easy it would be to add support for free-format
bitstreams.  The new decodeMP3 looks like this:

decodeMP3:
  read data until enough bytes for header
  parse header, compute length of side_info

  read data until enough bytes for side_info
  parse side_info, compute length of main_data

  read data until enough bytes for main_data
  parse main_data, return mp3 frame output

  remaining data (until start of next frame) is
  ancillary data and/or bitreservoir data
  so this data is just added to the buffer

For non-free-bitrate streams, you know exactly how much "remaining data"
is left.  But for free bitrate streams, you have to go through
this data, adding it to the buffer, until you find a new syncword.
I guess you must also check to make sure the new header is really
the header for the next frame and that the syncword didn't just
happen to appear in the bitreservoir data.


Mark

--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to