Re: bad main-data-begin pointer?

Rob Leslie <[email protected]> Thu, 12 Oct 2006 11:55:10 -0700
Newsgroups gmane.comp.audio.mad.devel
Message-ID <[email protected]>
On Oct 3, 2006, at 8:30 PM, Matt Robbins wrote:
>    I am using libmad to handle mp3 access for my project  
> ( www.xbat.org ).  Our particular application requires fast,  
> accurate seeking, and I have been successful in using header  
> information to seek to the correct frame.  I am having trouble,  
> though when I set the decoder (from the "high-level" API) running.   
> For many files it works fine, but for some, I get "bad main-data- 
> begin pointer" errors for the first one or two frames decoded.
>   Right now, I am circumventing the problem through the use of the  
> MAD_FLOW_IGNORE symbol in the error callback function, but this  
> results in the somewhat-undesirable behavior of decoding zeros for  
> the first several frames.  Is there a way around this, short of  
> deliberately seeking several frames early and then discarding the  
> unneeded data?  Might this have something to do with bit reservoir  
> encoding?  Any help would be much appreciated.

You're right; it has to do with the bit reservoir. In general, to  
perform accurate seeking you must decode a few frames before the  
target frame in order to reload the reservoir.

You may want to review these messages on the subject of seeking:

     http://www.mars.org/mailman/public/mad-dev/2001-August/000338.html
     http://www.mars.org/mailman/public/mad-dev/2002-May/000631.html
     http://www.mars.org/mailman/public/mad-dev/2002-May/000634.html

Cheers,
   -rob