From 43db9a8267823d7a8c46d7b8aafb43c0ad41173c Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Tue, 3 Mar 2009 19:30:49 -0800 Subject: auto import from //depot/cupcake/@135843 --- Tremor/doc/callbacks.html | 113 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Tremor/doc/callbacks.html (limited to 'Tremor/doc/callbacks.html') diff --git a/Tremor/doc/callbacks.html b/Tremor/doc/callbacks.html new file mode 100644 index 0000000..9a6d392 --- /dev/null +++ b/Tremor/doc/callbacks.html @@ -0,0 +1,113 @@ + + + +Tremor - Callbacks and non-stdio I/O + + + + + + + + + +

Tremor documentation

Tremor version 1.0 - 20020403

+ +

Callbacks and non-stdio I/O

+ +Although stdio is convenient and nearly universally implemented as per +ANSI C, it is not suited to all or even most potential uses of Vorbis. +For additional flexibility, embedded applications may provide their +own I/O functions for use with Tremor when stdio is unavailable or not +suitable. One common example is decoding a Vorbis stream from a +memory buffer.

+ +Use custom I/O functions by populating an ov_callbacks structure and calling ov_open_callbacks() or ov_test_callbacks() rather than the +typical ov_open() or ov_test(). Past the open call, use of +libvorbisidec is identical to using it with stdio. + +

Read function

+ +The read-like function provided in the read_func field is +used to fetch the requested amount of data. It expects the fetch +operation to function similar to file-access, that is, a multiple read +operations will retrieve contiguous sequential pieces of data, +advancing a position cursor after each read.

+ +The following behaviors are also expected:

+

+

+ +

Seek function

+ +The seek-like function provided in the seek_func field is +used to request non-sequential data access by libvorbisidec, moving +the access cursor to the requested position.

+ +libvorbisidec expects the following behavior: +

+ +

Close function

+ +The close function should deallocate any access state used by the +passed in instance of the data access abstraction and invalidate the +instance handle. The close function is assumed to succeed.

+ +One common use of callbacks and the close function is to change the +behavior of libvorbisidec with respect to file closure for applications +that must fclose data files themselves. By passing +the normal stdio calls as callback functions, but passing a +close_func that does nothing, an application may call ov_clear() and then fclose() the +file originally passed to libvorbisidec. + +

Tell function

+ +The tell function is intended to mimic the +behavior of ftell() and must return the byte position of the +next data byte that would be read. If the data access cursor is at +the end of the 'file' (pointing to one past the last byte of data, as +it would be after calling fseek(file,SEEK_END,0)), the tell +function must return the data position (and thus the total file size), +not an error.

+ +The tell function need not be provided if the data IO abstraction is +not seekable.
+


+ + + + + + + + +

copyright © 2002 Xiph.org

Ogg Vorbis

Tremor documentation

Tremor version 1.0 - 20020403

+ + + + -- cgit v1.2.3