Hello, I have been changing my (C++)program over to the new FLAC++ API which has gone relatively smoothly. However, the function seek_absolute() (from the FLAC::Decoder::File class) does not seem to work. It always returns false and doesnt seek at all. Using gdb, I have narrowed down the problem somewhat, but being the novice programmer that I am, I still don't know whats wrong. When I call the seek_absolute() function eg. seek_absolute(3561525); and step inside it with gdb, then print the value of "sample" (the arguement), it is NOT 3561525, rather it is some huge number like 4621539102901141517. I figure it could be something to do with types or something, seek_absolute expects a FLAC__uint64, I have tried a few things along this line without success eg. FLAC__uint64 seekpos = 3561525; seek_absolute(seekpos); doesn't work either. Does anyone know what this problem is, or has anyone else had problem with seek_absolute of the C++ File decoder class ?? Thanks, Dave
On Wed, Jun 19, 2002 at 06:40:59PM +1000, David Collett wrote:> When I call the seek_absolute() function eg. > > seek_absolute(3561525); > > and step inside it with gdb, then print the value of "sample" (the > arguement), it is NOT 3561525, rather it is some huge number like > 4621539102901141517.This can happen sometimes when a function is optimized in certain ways. Add a bit of code to print the value of sample upon entering the function, and you will probably find it to be correct. You may want to build libFLAC/libFLAC++ without optimization for debugging purposes. -- - mdz
Nevermind, I have discovered the problem(not really a problem). I had called: set_metadata_ignore_all(); because I didnt actually need to use the metadata in my application. But it seems that with this option set, "total_samples" is not set correctly after calling init(). Upon further debugging, I discovered that the test "sample < total_samples" was what is failing in the seek routine. By removing the call to set_metadata_ignore_all() the problem has disapeared. Sorry this is a rushed explanation, I have to go now and wont be on a PC until saturday, better this that you thinking there is a real problem! Thanks for you quick response, David Josh Coalson wrote:>--- David Collett <jg@webone.com.au> wrote: > >>Hello, >>I have been changing my (C++)program over to the new FLAC++ API which >> >>has gone relatively smoothly. >> >>However, the function seek_absolute() (from the FLAC::Decoder::File >>class) does not seem to work. It always returns false and doesnt seek >>at >>all. Using gdb, I have narrowed down the problem somewhat, but being >>the >>novice programmer that I am, I still don't know whats wrong. >> >>When I call the seek_absolute() function eg. >> >>seek_absolute(3561525); >> >>and step inside it with gdb, then print the value of "sample" (the >>arguement), it is NOT 3561525, rather it is some huge number like >> 4621539102901141517. >> >>I figure it could be something to do with types or something, >>seek_absolute expects a FLAC__uint64, I have tried a few things along >> >>this line without success eg. >> >>FLAC__uint64 seekpos = 3561525; >>seek_absolute(seekpos); >> >>doesn't work either. >> >>Does anyone know what this problem is, or has anyone else had problem >>with seek_absolute of the C++ File decoder class ?? >> > >hmm... did the unit tests pass? they do seek_absolute >calls and fail if they return false. does the C version >work? because the C++ method just calls the C function >directly. > >anyway, I'll look into it too. > >Josh > > >__________________________________________________ >Do You Yahoo!? >Yahoo! - Official partner of 2002 FIFA World Cup >http://fifaworldcup.yahoo.com > >
--- David Collett <jg@webone.com.au> wrote:> Hello, > I have been changing my (C++)program over to the new FLAC++ API which > > has gone relatively smoothly. > > However, the function seek_absolute() (from the FLAC::Decoder::File > class) does not seem to work. It always returns false and doesnt seek > at > all. Using gdb, I have narrowed down the problem somewhat, but being > the > novice programmer that I am, I still don't know whats wrong. > > When I call the seek_absolute() function eg. > > seek_absolute(3561525); > > and step inside it with gdb, then print the value of "sample" (the > arguement), it is NOT 3561525, rather it is some huge number like > 4621539102901141517. > > I figure it could be something to do with types or something, > seek_absolute expects a FLAC__uint64, I have tried a few things along > > this line without success eg. > > FLAC__uint64 seekpos = 3561525; > seek_absolute(seekpos); > > doesn't work either. > > Does anyone know what this problem is, or has anyone else had problem > with seek_absolute of the C++ File decoder class ??hmm... did the unit tests pass? they do seek_absolute calls and fail if they return false. does the C version work? because the C++ method just calls the C function directly. anyway, I'll look into it too. Josh __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com