libogg documentation | libogg release 1.3.5 - 20210603

# ogg_stream_packetpeek

declared in "ogg/ogg.h";

This function attempts to assemble a raw data packet and returns it without advancing decoding.

In a typical situation, this would be called speculatively after ogg_stream_pagein() to check the packet contents before handing it off to a codec for decompression. To advance page decoding and remove the packet from the sync structure, call ogg_stream_packetout().

    int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);

### Parameters

os
  Pointer to a previously declared ogg_stream_state struct. Before this function is called, an ogg_page should be submitted to the stream using ogg_stream_pagein().
op
  Pointer to the next packet available in the bitstream, if any. A NULL value may be passed in the case of a simple "is there a packet?" check.

### Return Values

> - -1 if there's no packet available due to lost sync or a hole in the data.
> - 0 if there is insufficient data available to complete a packet, or on unrecoverable internal error occurred.
> - 1 if a packet is available.

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