libogg documentation | libogg release 1.0 - 20000615

# ogg_stream_state

declared in "ogg/ogg.h"

The ogg_stream_state struct tracks the current encode/decode state of the current logical bitstream.

    typedef struct {
      unsigned char   *body_data;    /* bytes from packet bodies */
      long    body_storage;          /* storage elements allocated */
      long    body_fill;             /* elements stored; fill mark */
      long    body_returned;         /* elements of fill returned */

      int     *lacing_vals;    /* The values that will go to the segment table */
      ogg_int64_t *granule_vals;      /* granulepos values for headers. Not compact
                                 this way, but it is simple coupled to the
                                 lacing fifo */
      long    lacing_storage;
      long    lacing_fill;
      long    lacing_packet;
      long    lacing_returned;

      unsigned char    header[282];      /* working space for header encode */
      int              header_fill;

      int     e_o_s;          /* set when we have buffered the last packet in the
                                 logical bitstream */
      int     b_o_s;          /* set after we've written the initial page
                                 of a logical bitstream */
      long     serialno;
      int      pageno;
      ogg_int64_t  packetno;      /* sequence number for decode; the framing
                                 knows where there's a hole in the data,
                                 but we need coupling so that the codec
                                 (which is in a seperate abstraction
                                 layer) also knows about the gap */
      ogg_int64_t   granulepos;

    } ogg_stream_state;

### Relevant Struct Members

body_data
  Pointer to data from packet bodies.
body_storage
  Storage allocated for bodies in bytes (filled or unfilled).
body_fill
  Amount of storage filled with stored packet bodies.
body_returned
  Number of elements returned from storage.
lacing_vals
  String of lacing values for the packet segments within the current page. Each value is a byte, indicating packet segment length.
granule_vals
  Pointer to the lacing values for the packet segments within the current page.
lacing_storage
  Total amount of storage (in bytes) allocated for storing lacing values.
lacing_fill
  Fill marker for the current vs. total allocated storage of lacing values for the page.
lacing_packet
  Lacing value for current packet segment.
lacing_returned
  Number of lacing values returned from lacing_storage.
header
  Temporary storage for page header during encode process, while the header is being created.
header_fill
  Fill marker for header storage allocation. Used during the header creation process.
e_o_s
  Marker set when the last packet of the logical bitstream has been buffered.
b_o_s
  Marker set after we have written the first page in the logical bitstream.
serialno
  Serial number of this logical bitstream.
pageno
  Number of the current page within the stream.
packetno
  Number of the current packet.
granulepos
  Exact position of decoding/encoding process.

copyright © 2000 xiph.org | Ogg Vorbis team@xiph.org
libogg documentation | libogg release 1.0 - 20000615