I'm in the final throes of debugging (hopefully) and the last thing I'm trying to do is figure out why I'm getting static instead of usable data. I have a verified Ogg file (it plays fine in WMA); I've visibly inspected the info struct and it matches my output format; I've verified my audio playback code by using a generated sine wave (sounds correct). So that leads to a problem with how I'm using ov_read(). I've modeled my code around the sample code, and I check my error returns fairly religiously. The only weird thing I'm doing is using ov_open_callbacks(). My callback routines simply read data out of an in-memory bit bucket, so there's not much code there, e.g. my read function is basically: memcpy(pDst, myStreamPtr, bytes ); myStreamPtr += bytes; ..etc. etc. I didn't bother implementing a close function (I just stubbed it out). Looking at my read callback, I always seem to get requests for one object of varying size. I've modeled my callbacks on the stream IO CRTL stuff (fseek/fread/ftell/fclose), including parameters and return values. I assume this is correct? Any other obvious problems I should look for? Barring any epiphanies, I may end up having to implement a test version using ov_open to see if it's my callbacks (which I suspect). Thanks, Brian --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
>So that leads to a problem with how I'm using ov_read(). I've modeled >my code around the sample code, and I check my error returns fairly >religiously. The only weird thing I'm doing is using >ov_open_callbacks(). My callback routines simply read data out of an >in-memory bit bucket, so there's not much code there, e.g. my read >function is basically:Getting just static out is most often a result of getting your endianness switched - make sure you have that parameter (to ov_read()) correct. Check docs for what it should be. There's nothing obvious apart from this, assuming you aren't doing anything too obviously wrong in the callbacks. Do note that the examples are NOT comprehensive in checking return values, so merely following how they work isn't a guarantee. Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Mine (using open_callbacks) didn't work until I disabled seeking by returning (i think) -1 on a call to my seek function. Brian Hook wrote:> I'm in the final throes of debugging (hopefully) and the last thing I'm > trying to do is figure out why I'm getting static instead of usable > data. I have a verified Ogg file (it plays fine in WMA); I've visibly > inspected the info struct and it matches my output format; I've verified > my audio playback code by using a generated sine wave (sounds correct). > > So that leads to a problem with how I'm using ov_read(). I've modeled > my code around the sample code, and I check my error returns fairly > religiously. The only weird thing I'm doing is using > ov_open_callbacks(). My callback routines simply read data out of an > in-memory bit bucket, so there's not much code there, e.g. my read > function is basically: > > memcpy(pDst, myStreamPtr, bytes ); > myStreamPtr += bytes; > > ...etc. etc. I didn't bother implementing a close function (I just > stubbed it out). > > Looking at my read callback, I always seem to get requests for one > object of varying size. I've modeled my callbacks on the stream IO CRTL > stuff (fseek/fread/ftell/fclose), including parameters and return > values. I assume this is correct? > > Any other obvious problems I should look for? Barring any epiphanies, I > may end up having to implement a test version using ov_open to see if > it's my callbacks (which I suspect). > > Thanks, > > Brian > > > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to 'vorbis-dev-request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered. > >--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.