AW: [vorbis] ov_open from memory
Michael Smith
msmith at labyrinth.net.au
Sat Mar 1 00:23:04 PST 2003
Mike <just.me at aon.at> said:
> Greetings again,
>
> thank's for the quick reply!
> I have a few more questions regarding the parameters of ov_open_callbacks()
> and 'struct ov_callback'.
> I suppose the first parameter at ov_open_callbacks must be a pointer to my
> data in memory.
> (This is a little bit opaque, because at documentation version 1.65 -
> 20020702, the parameter is defined as 'void* datasource', but the parameter
> description is the same as the first parameter at ov_open(). (this looks
> like a copy&paste mistake))
The datasource pointer is a pointer to any internal state you need to keep
track of (for you, for instance, this might be a pointer to a structure
containing the current offset in the memory buffer, the size of the buffer,
and a pointer to the actual memory buffer, etc. For example, when using stdio,
this is generally a FILE *.
>
> Now to the callback funktions, where i suppose the following:
> Each 'void *datasource' parameter should point to the raw ogg data in
> memory.
No. See above.
> In read_func, the first parameter (void* ptr) looks like the destination
> buffer, the third parameter should be the ammount of bytes to copy. What is
> the second parameter (size_t size) used for?
> Please let me know and thanks in advance,
> Mike
>
The callbacks are modelled after the stdio functions fread, fseek, ftell, and
fclose. The parameters are similar - so for the read callback, the amount to
be read is the product of the second and third parameters. Following the stdio
is particularly important for the seek callback (of course, you are not
required to support seeking - in that case, your seek callback should return
appropriately)
Mike
--- >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-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
mailing list