[vorbis-dev] ov_read() reading too little.

MC Spanky mcspanky at mac.com
Wed Nov 29 14:38:29 PST 2000



Ah.  You might want to update the online documentation.  If you click
"documentation", "api reference" then "ov_read", you get to this page:

http://www.xiph.org/ogg/vorbis/doc/vorbisfile/ov_read.html

it says:

n indicates actual number of bytes read. Within a logical bitstream, the
number should equal length. At the end of a logical bitstream, the
number of bytes read will equal the remaining number of bytes in the
bitstream.

I don't need to fill up my buffer every time, but I do need to read at
least 1/10 of a second on average.  I can put the call to ov_read() in a
loop, decreasing the "available buffer size" after each iteration by the
amount read.  But what happens when the buffer size gets too small, e.g.
< 1K?  Will ov_read() refuse to read any bytes?  If so, then "0" doesn't
always mean EOF.

For now, I'll try putting it in a loop until the remaing buffer size
drops below 4K.  That should be more than enough for my needs.  I'll let
you know if it doesn't work.  :-)

Just curious, are there plans to change this or document it?

Thanks,
Spanky

On Wed, 29 Nov 2000, Monty wrote:

> Argh, apologies to anyone I confused.  I screwed up and remembered my
> own documentation incorrectly:
> 
> (from the comments preceeding ov_read() in vorbisfile.c):
> 
>    return values: <0) error/hole in data (OV_HOLE)
>                    0) EOF
> 		   n) number of bytes of PCM actually returned.  The
> 		   below works on a packet-by-packet basis, so the
> 		   return length is not related to the 'length' passed
> 		   in, just guaranteed to fit.
> 
> 	    *section) set to the logical bitstream number */
> 
> Monty

--- >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 at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list