[Vorbis-dev] Reading from memory and ov_open

Michael Smith mlrsmith at gmail.com
Fri Jul 1 04:11:41 PDT 2005


On 6/30/05, Szinger, Martin R. <Martin.Szinger at gd-ais.com> wrote:
> Hi,
> 
> I've been working with oggvorbis-win32sdk-1.0.1 and have a
> semi-hypothetical question.
> 
> Let's suppose that, for whatever reason, I've allocated a block of
> memory, and I've loaded into this memory a perfectly valid ogg vorbis
> file.
> 
> Now I'd like to decode this vorbis data, but I'm stuck calling ov_open()
> because I don't have a FILE*, I have a block of memory. (This may in
> fact be an ignorant stdio question on my part; if so, I apologize). But
> - what do I do?

This is what ov_open_callbacks() is for (ov_open is in fact just a
simple wrapper around ov_open_callbacks() that passes appropriate
file-based callbacks).

This function lets you pass a structure containing a set of callbacks
(4 of them: one to read data, one to seek, one to tell the current
stream position, and one to close the stream).

If you have a memory buffer, these callbacks are really easy to write
(shouldn't be more than a few minutes work).

Mike


More information about the Vorbis-dev mailing list