liboggz  1.1.1
Typedefs | Functions
oggz_seek.h File Reference

Seeking within files. More...

Go to the source code of this file.

Typedefs

typedef ogg_int64_t(* OggzMetric )(OGGZ *oggz, long serialno, ogg_int64_t granulepos, void *user_data)
 This is the signature of a function to correlate Ogg streams. More...
 

Functions

ogg_int64_t oggz_tell_units (OGGZ *oggz)
 Query the current offset in milliseconds, or custom units as specified by a Metric function you have provided. More...
 
ogg_int64_t oggz_seek_units (OGGZ *oggz, ogg_int64_t units, int whence)
 Seek to an offset in milliseconds, or custom units as specified by a Metric function you have provided. More...
 
ogg_int64_t oggz_tell_granulepos (OGGZ *oggz)
 Provide the exact stored granulepos (from the page header) if relevant to the current packet, or a constructed granulepos if the stored granulepos does not belong to this packet, or -1 if this codec does not have support for granulepos interpolation. More...
 
oggz_off_t oggz_tell (OGGZ *oggz)
 Query the file offset in bytes corresponding to the data read. More...
 
oggz_off_t oggz_seek (OGGZ *oggz, oggz_off_t offset, int whence)
 Seek to a specific byte offset. More...
 
int oggz_get_preroll (OGGZ *oggz, long serialno)
 Retrieve the preroll of a logical bitstream. More...
 
int oggz_set_preroll (OGGZ *oggz, long serialno, int preroll)
 Specify the preroll of a logical bitstream. More...
 
int oggz_get_granuleshift (OGGZ *oggz, long serialno)
 Retrieve the granuleshift of a logical bitstream. More...
 
int oggz_set_granuleshift (OGGZ *oggz, long serialno, int granuleshift)
 Specify the granuleshift of a logical bitstream. More...
 
int oggz_get_granulerate (OGGZ *oggz, long serialno, ogg_int64_t *granulerate_n, ogg_int64_t *granulerate_d)
 Retrieve the granulerate of a logical bitstream. More...
 
int oggz_set_granulerate (OGGZ *oggz, long serialno, ogg_int64_t granule_rate_numerator, ogg_int64_t granule_rate_denominator)
 Specify the granulerate of a logical bitstream. More...
 
int oggz_set_metric (OGGZ *oggz, long serialno, OggzMetric metric, void *user_data)
 Set the OggzMetric to use for an OGGZ handle. More...
 
int oggz_set_data_start (OGGZ *oggz, oggz_off_t offset)
 Tell Oggz to remember the given offset as the start of data. More...
 
ogg_int64_t oggz_bounded_seek_set (OGGZ *oggz, ogg_int64_t unit_target, ogg_int64_t offset_begin, ogg_int64_t offset_end)
 Seeks Oggz to time unit_target, but with the bounds of the offset range [offset_begin, offset_end]. More...
 

Detailed Description

Seeking within files.

Function Documentation

ogg_int64_t oggz_bounded_seek_set ( OGGZ oggz,
ogg_int64_t  unit_target,
ogg_int64_t  offset_begin,
ogg_int64_t  offset_end 
)

Seeks Oggz to time unit_target, but with the bounds of the offset range [offset_begin, offset_end].

This is useful when seeking in network streams where only parts of a media are buffered, and retrieving unbuffered parts is expensive.

Parameters
oggzAn OGGZ handle previously opened for reading
unit_targetThe seek target, in milliseconds, or custom units
offset_beginStart of offset range to seek inside, in bytes
offset_endEnd of offset range to seek inside, in bytes, pass -1 for end of media
Returns
The new position, in milliseconds or custom units
Return values
-1on failure (unit_target is not within range)