cannam@86: cannam@86: cannam@86: cannam@86: libogg - function - ogg_sync_pageout cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86:

libogg documentation

libogg release 1.3.0 - 20110804

cannam@86: cannam@86:

ogg_sync_pageout

cannam@86: cannam@86:

declared in "ogg/ogg.h";

cannam@86: cannam@86:

This function takes the data stored in the buffer of the ogg_sync_state struct and inserts them into an ogg_page. cannam@86: cannam@86:

In an actual decoding loop, this function should be called first to ensure that the buffer is cleared. The example code below illustrates a clean reading loop which will fill and output pages. cannam@86:

Caution:This function should be called before reading into the buffer to ensure that data does not remain in the ogg_sync_state struct. Failing to do so may result in a memory leak. See the example code below for details. cannam@86: cannam@86:

cannam@86: cannam@86: cannam@86: cannam@86: cannam@86:
cannam@86:

cannam@86: int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
cannam@86: 
cannam@86:
cannam@86: cannam@86:

Parameters

cannam@86:
cannam@86:
oy
cannam@86:
Pointer to a previously declared ogg_sync_state struct. Normally, the internal storage of this struct should be filled with newly read data and verified using ogg_sync_wrote.
cannam@86:
og
cannam@86:
Pointer to page struct filled by this function. cannam@86:
cannam@86: cannam@86: cannam@86:

Return Values

cannam@86:
cannam@86:
  • -1 returned if stream has not yet captured sync (bytes were skipped).
  • cannam@86:
  • 0 returned if more data needed or an internal error occurred.
  • cannam@86:
  • 1 indicated a page was synced and returned.
  • cannam@86:
    cannam@86:

    cannam@86: cannam@86:

    Example Usage

    cannam@86:
    cannam@86: if (ogg_sync_pageout(&oy, &og) != 1) {
    cannam@86: 	buffer = ogg_sync_buffer(&oy, 8192);
    cannam@86: 	bytes = fread(buffer, 1, 8192, stdin);
    cannam@86: 	ogg_sync_wrote(&oy, bytes);
    cannam@86: }
    cannam@86: 
    cannam@86: cannam@86:

    cannam@86:
    cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: cannam@86:

    copyright © 2000-2011 Xiph.Org

    Ogg Container Format

    libogg documentation

    libogg release 1.3.0 - 20110804

    cannam@86: cannam@86: cannam@86: cannam@86: cannam@86: