libogg documentation | libogg release 1.3.5 - 20210603

# ogg_sync_state

declared in "ogg/ogg.h"

The ogg_sync_state struct tracks the synchronization of the current page.

It is used during decoding to track the status of data as it is read in, synchronized, verified, and parsed into pages belonging to the various logical bistreams in the current physical bitstream link.

    typedef struct {
      unsigned char *data;
      int storage;
      int fill;
      int returned;

      int unsynced;
      int headerbytes;
      int bodybytes;
    } ogg_sync_state;

### Relevant Struct Members

data
  Pointer to buffered stream data.
storage
  Current allocated size of the stream buffer held in `*data`.
fill
  The number of valid bytes currently held in `*data`; functions as the buffer head pointer.
returned
  The number of bytes at the head of `*data` that have already been returned as pages; functions as the buffer tail pointer.
unsynced
  Synchronization state flag; nonzero if sync has not yet been attained or has been lost.
headerbytes
  If synced, the number of bytes used by the synced page's header.
bodybytes
  If synced, the number of bytes used by the synced page's body.

copyright © 2000-2021 Xiph.Org Foundation | Ogg Container Format
libogg documentation | libogg release 1.3.5 - 20210603