|
These functions allow you to get basic information about a stream, including seekability, the number of links (for chained streams), plus the size, duration, bitrate, header parameters, and meta information for each link (or, where available, the stream as a whole).
Some of these (size, duration) are only available for seekable streams. You can also query the current stream position, link, and playback time, and instantaneous bitrate during playback.
Some of these functions may be used successfully on the partially open streams returned by op_test_callbacks() or one of the associated convenience functions. Their documention will indicate so explicitly.
|
int | op_seekable (const OggOpusFile *_of) OP_ARG_NONNULL(1) |
| Returns whether or not the data source being read is seekable. More...
|
|
int | op_link_count (const OggOpusFile *_of) OP_ARG_NONNULL(1) |
| Returns the number of links in this chained stream. More...
|
|
opus_uint32 | op_serialno (const OggOpusFile *_of, int _li) OP_ARG_NONNULL(1) |
| Get the serial number of the given link in a (possibly-chained) Ogg Opus stream. More...
|
|
int | op_channel_count (const OggOpusFile *_of, int _li) OP_ARG_NONNULL(1) |
| Get the channel count of the given link in a (possibly-chained) Ogg Opus stream. More...
|
|
opus_int64 | op_raw_total (const OggOpusFile *_of, int _li) OP_ARG_NONNULL(1) |
| Get the total (compressed) size of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing overhead. More...
|
|
ogg_int64_t | op_pcm_total (const OggOpusFile *_of, int _li) OP_ARG_NONNULL(1) |
| Get the total PCM length (number of samples at 48 kHz) of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream. More...
|
|
const OpusHead * | op_head (const OggOpusFile *_of, int _li) OP_ARG_NONNULL(1) |
| Get the ID header information for the given link in a (possibly chained) Ogg Opus stream. More...
|
|
const OpusTags * | op_tags (const OggOpusFile *_of, int _li) OP_ARG_NONNULL(1) |
| Get the comment header information for the given link in a (possibly chained) Ogg Opus stream. More...
|
|
int | op_current_link (const OggOpusFile *_of) OP_ARG_NONNULL(1) |
| Retrieve the index of the current link. More...
|
|
opus_int32 | op_bitrate (const OggOpusFile *_of, int _li) OP_ARG_NONNULL(1) |
| Computes the bitrate of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream. More...
|
|
opus_int32 | op_bitrate_instant (OggOpusFile *_of) OP_ARG_NONNULL(1) |
| Compute the instantaneous bitrate, measured as the ratio of bits to playable samples decoded since a) the last call to op_bitrate_instant(), b) the last seek, or c) the start of playback, whichever was most recent. More...
|
|
opus_int64 | op_raw_tell (const OggOpusFile *_of) OP_ARG_NONNULL(1) |
| Obtain the current value of the position indicator for _of. More...
|
|
ogg_int64_t | op_pcm_tell (const OggOpusFile *_of) OP_ARG_NONNULL(1) |
| Obtain the PCM offset of the next sample to be read. More...
|
|
int op_channel_count |
( |
const OggOpusFile * |
_of, |
|
|
int |
_li |
|
) |
| |
Get the channel count of the given link in a (possibly-chained) Ogg Opus stream.
This is equivalent to op_head(_of,_li)->channel_count
, but is provided for convenience. This function may be called on partially-opened streams, but it will always return the channel count of the Opus stream in the first link.
- Parameters
-
_of | The OggOpusFile from which to retrieve the channel count. |
_li | The index of the link whose channel count should be retrieved. Use a negative number to get the channel count of the current link. |
- Returns
- The channel count of the given link. If _li is greater than the total number of links, this returns the channel count of the last link. If the source is not seekable, this always returns the channel count of the current link.
ogg_int64_t op_pcm_total |
( |
const OggOpusFile * |
_of, |
|
|
int |
_li |
|
) |
| |
Get the total PCM length (number of samples at 48 kHz) of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream.
Users looking for op_time_total()
should use op_pcm_total() instead. Because timestamps in Opus are fixed at 48 kHz, there is no need for a separate function to convert this to seconds (and leaving it out avoids introducing floating point to the API, for those that wish to avoid it).
- Parameters
-
_of | The OggOpusFile from which to retrieve the PCM offset. |
_li | The index of the link whose PCM length should be computed. Use a negative number to get the PCM length of the entire stream. |
- Returns
- The PCM length of the entire stream if _li is negative, the PCM length of link _li if it is non-negative, or a negative value on error.
- Return values
-
OP_EINVAL | The source is not seekable (so we can't know the length), _li wasn't less than the total number of links in the stream, or the stream was only partially open. |
opus_int32 op_bitrate_instant |
( |
OggOpusFile * |
_of | ) |
|
Compute the instantaneous bitrate, measured as the ratio of bits to playable samples decoded since a) the last call to op_bitrate_instant(), b) the last seek, or c) the start of playback, whichever was most recent.
This will spike somewhat after a seek or at the start/end of a chain boundary, as pre-skip, pre-roll, and end-trimming causes samples to be decoded but not played.
- Parameters
-
_of | The OggOpusFile from which to retrieve the bitrate. |
- Returns
- The bitrate, in bits per second, or a negative value on error.
- Return values
-
OP_FALSE | No data has been decoded since any of the events described above. |
OP_EINVAL | The stream was only partially open. |