[Vorbis] ov_read, callbacks and 0 bytes read

Andrew Lentvorski bsder at allcaps.org
Fri Oct 6 01:23:58 PDT 2006


Ralph Giles wrote:
> But I'm not sure what you're expecting the decoder to do if your read 
> callback could return EAGAIN. Do you want it to bubble that up for you 
> so ov_read() returns it too, and then you go off and do UI stuff? 

Yes.  Basically, what I want is for ov_read to return EAGAIN and either:

A) Not touch anything.  Probably not practical as most streams can't 
handle a seek.

B) Put the consumed bytes into whatever buffer they are going into, mark 
the state as not yet complete, and return EAGAIN.

Unfortunately, your message seems to indicate to me that there is no 
good way to do this.

Looking at the code seems to suggest the same thing.  I already had to 
go diving through ov_read to break apart the PCM interleaving (I have 
two separate buffers for left and right).  This looks to be even more 
painful.  :(

Well, I figured I'd at least ask before starting the painful path.

> Or you could do it the other way, and just return zero when you've 
> blocked too long, and retry decoding later when you do have more data.

Retry?  How do I do that?  Once the 0 hits then the decoder returns EOF 
and closes all its state and returns EOF forevermore, right?

-a


More information about the Vorbis mailing list