opusfile  0.4
Stand-alone decoder library for .opus files.
 All Data Structures Functions Variables Typedefs Groups
opusfile.h
1 /********************************************************************
2  * *
3  * THIS FILE IS PART OF THE libopusfile SOFTWARE CODEC SOURCE CODE. *
4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7  * *
8  * THE libopusfile SOURCE CODE IS (C) COPYRIGHT 1994-2012 *
9  * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
10  * *
11  ********************************************************************
12 
13  function: stdio-based convenience library for opening/seeking/decoding
14  last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
15 
16  ********************************************************************/
17 #if !defined(_opusfile_h)
18 # define _opusfile_h (1)
19 
102 # if defined(__cplusplus)
103 extern "C" {
104 # endif
105 
106 # include <stdarg.h>
107 # include <stdio.h>
108 # include <ogg/ogg.h>
109 # include <opus_multistream.h>
110 
111 /*Enable special features for gcc and gcc-compatible compilers.*/
112 # if !defined(OP_GNUC_PREREQ)
113 # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
114 # define OP_GNUC_PREREQ(_maj,_min) \
115  ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
116 # else
117 # define OP_GNUC_PREREQ(_maj,_min) 0
118 # endif
119 # endif
120 
121 # if OP_GNUC_PREREQ(4,0)
122 # pragma GCC visibility push(default)
123 # endif
124 
125 typedef struct OpusHead OpusHead;
126 typedef struct OpusTags OpusTags;
127 typedef struct OpusPictureTag OpusPictureTag;
128 typedef struct OggOpusFile OggOpusFile;
129 
130 /*Warning attributes for libopusfile functions.*/
131 # if OP_GNUC_PREREQ(3,4)
132 # define OP_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
133 # else
134 # define OP_WARN_UNUSED_RESULT
135 # endif
136 # if OP_GNUC_PREREQ(3,4)
137 # define OP_ARG_NONNULL(_x) __attribute__((__nonnull__(_x)))
138 # else
139 # define OP_ARG_NONNULL(_x)
140 # endif
141 
151 
153 #define OP_FALSE (-1)
154 /*Currently not used externally.*/
155 #define OP_EOF (-2)
156 
158 #define OP_HOLE (-3)
159 
161 #define OP_EREAD (-128)
162 
165 #define OP_EFAULT (-129)
166 
168 #define OP_EIMPL (-130)
169 
170 #define OP_EINVAL (-131)
171 
175 #define OP_ENOTFORMAT (-132)
176 
178 #define OP_EBADHEADER (-133)
179 
180 #define OP_EVERSION (-134)
181 /*Currently not used at all.*/
182 #define OP_ENOTAUDIO (-135)
183 
186 #define OP_EBADPACKET (-136)
187 
190 #define OP_EBADLINK (-137)
191 
192 #define OP_ENOSEEK (-138)
193 
194 #define OP_EBADTIMESTAMP (-139)
195 
198 
201 
203 #define OPUS_CHANNEL_COUNT_MAX (255)
204 
208 struct OpusHead{
218  int version;
223  unsigned pre_skip;
230  opus_uint32 input_sample_rate;
261 };
262 
293 struct OpusTags{
299  int comments;
302  char *vendor;
303 };
304 
307 
310 #define OP_PIC_FORMAT_UNKNOWN (-1)
311 
312 #define OP_PIC_FORMAT_URL (0)
313 
314 #define OP_PIC_FORMAT_JPEG (1)
315 
316 #define OP_PIC_FORMAT_PNG (2)
317 
318 #define OP_PIC_FORMAT_GIF (3)
319 
350  opus_int32 type;
357  char *mime_type;
359  char *description;
361  opus_uint32 width;
363  opus_uint32 height;
366  opus_uint32 depth;
369  opus_uint32 colors;
371  opus_uint32 data_length;
373  unsigned char *data;
383  int format;
384 };
385 
394 
420 OP_WARN_UNUSED_RESULT int opus_head_parse(OpusHead *_head,
421  const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2);
422 
437 ogg_int64_t opus_granule_sample(const OpusHead *_head,ogg_int64_t _gp)
438  OP_ARG_NONNULL(1);
439 
454 OP_WARN_UNUSED_RESULT int opus_tags_parse(OpusTags *_tags,
455  const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2);
456 
461 void opus_tags_init(OpusTags *_tags) OP_ARG_NONNULL(1);
462 
474 int opus_tags_add(OpusTags *_tags,const char *_tag,const char *_value)
475  OP_ARG_NONNULL(1) OP_ARG_NONNULL(2) OP_ARG_NONNULL(3);
476 
487 int opus_tags_add_comment(OpusTags *_tags,const char *_comment)
488  OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
489 
505 const char *opus_tags_query(const OpusTags *_tags,const char *_tag,int _count)
506  OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
507 
515 int opus_tags_query_count(const OpusTags *_tags,const char *_tag)
516  OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
517 
533 int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8)
534  OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
535 
541 void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1);
542 
572 int opus_picture_tag_parse(OpusPictureTag *_pic,const char *_tag)
573  OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
574 
579 void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1);
580 
586 void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1);
587 
591 
603 
604 /*These are the raw numbers used to define the request codes.
605  They should not be used directly.*/
606 #define OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST (6464)
607 #define OP_HTTP_PROXY_HOST_REQUEST (6528)
608 #define OP_HTTP_PROXY_PORT_REQUEST (6592)
609 #define OP_HTTP_PROXY_USER_REQUEST (6656)
610 #define OP_HTTP_PROXY_PASS_REQUEST (6720)
611 
612 #define OP_URL_OPT(_request) ((_request)+(char *)0)
613 
614 /*These macros trigger compilation errors or warnings if the wrong types are
615  provided to one of the URL options.*/
616 #define OP_CHECK_INT(_x) ((void)((_x)==(opus_int32)0),(opus_int32)(_x))
617 #define OP_CHECK_CONST_CHAR_PTR(_x) ((_x)+((_x)-(const char *)(_x)))
618 
625 #define OP_SSL_SKIP_CERTIFICATE_CHECK(_b) \
626  OP_URL_OPT(OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST),OP_CHECK_INT(_b)
627 
636 #define OP_HTTP_PROXY_HOST(_host) \
637  OP_URL_OPT(OP_HTTP_PROXY_HOST_REQUEST),OP_CHECK_CONST_CHAR_PTR(_host)
638 
649 #define OP_HTTP_PROXY_PORT(_port) \
650  OP_URL_OPT(OP_HTTP_PROXY_PORT_REQUEST),OP_CHECK_INT(_port)
651 
662 #define OP_HTTP_PROXY_USER(_user) \
663  OP_URL_OPT(OP_HTTP_PROXY_USER_REQUEST),OP_CHECK_CONST_CHAR_PTR(_host)
664 
675 #define OP_HTTP_PROXY_PASS(_pass) \
676  OP_URL_OPT(OP_HTTP_PROXY_PASS_REQUEST),OP_CHECK_CONST_CHAR_PTR(_host)
677 
680 
692 
693 typedef struct OpusFileCallbacks OpusFileCallbacks;
694 
703 typedef int (*op_read_func)(void *_stream,unsigned char *_ptr,int _nbytes);
704 
714 typedef int (*op_seek_func)(void *_stream,opus_int64 _offset,int _whence);
715 
718 typedef opus_int64 (*op_tell_func)(void *_stream);
719 
724 typedef int (*op_close_func)(void *_stream);
725 
748 };
749 
767 OP_WARN_UNUSED_RESULT void *op_fopen(OpusFileCallbacks *_cb,
768  const char *_path,const char *_mode) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
769  OP_ARG_NONNULL(3);
770 
784 OP_WARN_UNUSED_RESULT void *op_fdopen(OpusFileCallbacks *_cb,
785  int _fd,const char *_mode) OP_ARG_NONNULL(1) OP_ARG_NONNULL(3);
786 
806 OP_WARN_UNUSED_RESULT void *op_freopen(OpusFileCallbacks *_cb,
807  const char *_path,const char *_mode,void *_stream) OP_ARG_NONNULL(1)
808  OP_ARG_NONNULL(2) OP_ARG_NONNULL(3) OP_ARG_NONNULL(4);
809 
820 OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb,
821  const unsigned char *_data,size_t _size) OP_ARG_NONNULL(1);
822 
841 OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb,
842  const char *_url,va_list _ap) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
843 
858 OP_WARN_UNUSED_RESULT void *op_url_stream_create(OpusFileCallbacks *_cb,
859  const char *_url,...) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
860 
863 
873 
904 int op_test(OpusHead *_head,
905  const unsigned char *_initial_data,size_t _initial_bytes);
906 
916 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_file(const char *_path,int *_error)
917  OP_ARG_NONNULL(1);
918 
927 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_memory(const unsigned char *_data,
928  size_t _size,int *_error);
929 
951 OP_WARN_UNUSED_RESULT OggOpusFile *op_vopen_url(const char *_url,
952  int *_error,va_list _ap) OP_ARG_NONNULL(1);
953 
970 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url,
971  int *_error,...) OP_ARG_NONNULL(1);
972 
1050 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_callbacks(void *_source,
1051  const OpusFileCallbacks *_cb,const unsigned char *_initial_data,
1052  size_t _initial_bytes,int *_error) OP_ARG_NONNULL(2);
1053 
1064 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_file(const char *_path,int *_error)
1065  OP_ARG_NONNULL(1);
1066 
1076 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data,
1077  size_t _size,int *_error);
1078 
1102 OP_WARN_UNUSED_RESULT OggOpusFile *op_vtest_url(const char *_url,
1103  int *_error,va_list _ap) OP_ARG_NONNULL(1);
1104 
1121 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_url(const char *_url,
1122  int *_error,...) OP_ARG_NONNULL(1);
1123 
1187 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_callbacks(void *_source,
1188  const OpusFileCallbacks *_cb,const unsigned char *_initial_data,
1189  size_t _initial_bytes,int *_error) OP_ARG_NONNULL(2);
1190 
1217 int op_test_open(OggOpusFile *_of) OP_ARG_NONNULL(1);
1218 
1221 void op_free(OggOpusFile *_of);
1222 
1225 
1243 
1258 int op_seekable(OggOpusFile *_of) OP_ARG_NONNULL(1);
1259 
1268 int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1);
1269 
1283 opus_uint32 op_serialno(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1284 
1300 int op_channel_count(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1301 
1318 opus_int64 op_raw_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1319 
1336 ogg_int64_t op_pcm_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1337 
1352 const OpusHead *op_head(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1353 
1370 const OpusTags *op_tags(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1371 
1387 int op_current_link(OggOpusFile *_of) OP_ARG_NONNULL(1);
1388 
1400 opus_int32 op_bitrate(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1401 
1413 opus_int32 op_bitrate_instant(OggOpusFile *_of) OP_ARG_NONNULL(1);
1414 
1419 opus_int64 op_raw_tell(OggOpusFile *_of) OP_ARG_NONNULL(1);
1420 
1428 ogg_int64_t op_pcm_tell(OggOpusFile *_of) OP_ARG_NONNULL(1);
1429 
1432 
1460 
1474 int op_raw_seek(OggOpusFile *_of,opus_int64 _byte_offset) OP_ARG_NONNULL(1);
1475 
1490 int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1);
1491 
1494 
1535 
1539 #define OP_HEADER_GAIN (0)
1540 
1543 #define OP_TRACK_GAIN (3008)
1544 
1547 #define OP_ABSOLUTE_GAIN (3009)
1548 
1566 int op_set_gain_offset(OggOpusFile *_of,
1567  int _gain_type,opus_int32 _gain_offset_q8);
1568 
1649 OP_WARN_UNUSED_RESULT int op_read(OggOpusFile *_of,
1650  opus_int16 *_pcm,int _buf_size,int *_li) OP_ARG_NONNULL(1);
1651 
1730 OP_WARN_UNUSED_RESULT int op_read_float(OggOpusFile *_of,
1731  float *_pcm,int _buf_size,int *_li) OP_ARG_NONNULL(1);
1732 
1791 OP_WARN_UNUSED_RESULT int op_read_stereo(OggOpusFile *_of,
1792  opus_int16 *_pcm,int _buf_size) OP_ARG_NONNULL(1);
1793 
1852 OP_WARN_UNUSED_RESULT int op_read_float_stereo(OggOpusFile *_of,
1853  float *_pcm,int _buf_size) OP_ARG_NONNULL(1);
1854 
1857 
1858 # if OP_GNUC_PREREQ(4,0)
1859 # pragma GCC visibility pop
1860 # endif
1861 
1862 # if defined(__cplusplus)
1863 }
1864 # endif
1865 
1866 #endif
#define OPUS_CHANNEL_COUNT_MAX
The maximum number of channels in an Ogg Opus stream.
Definition: opusfile.h:203
char ** user_comments
The array of comment string vectors.
Definition: opusfile.h:295
int(* op_close_func)(void *_stream)
Closes the underlying stream.
Definition: opusfile.h:724
int op_test(OpusHead *_head, const unsigned char *_initial_data, size_t _initial_bytes)
Test to see if this is an Opus stream.
int op_set_gain_offset(OggOpusFile *_of, int _gain_type, opus_int32 _gain_offset_q8)
Sets the gain to be used for decoded output.
ogg_int64_t op_pcm_total(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 (...
int coupled_count
The number of coupled Opus streams in each Ogg packet, in the range 0...127.
Definition: opusfile.h:252
op_tell_func tell
Used to return the current read position in the stream.
Definition: opusfile.h:744
int opus_tags_add_comment(OpusTags *_tags, const char *_comment) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Add a comment to an initialized OpusTags structure.
opus_int32 type
The picture type according to the ID3v2 APIC frame:
Definition: opusfile.h:350
OP_WARN_UNUSED_RESULT OggOpusFile * op_open_callbacks(void *_source, const OpusFileCallbacks *_cb, const unsigned char *_initial_data, size_t _initial_bytes, int *_error) OP_ARG_NONNULL(2)
Open a stream using the given set of callbacks to access it.
int comments
The total number of comment streams.
Definition: opusfile.h:299
OP_WARN_UNUSED_RESULT int op_read_stereo(OggOpusFile *_of, opus_int16 *_pcm, int _buf_size) OP_ARG_NONNULL(1)
Reads more samples from the stream and downmixes to stereo, if necessary.
OP_WARN_UNUSED_RESULT OggOpusFile * op_vopen_url(const char *_url, int *_error, va_list _ap) OP_ARG_NONNULL(1)
Open a stream from a URL.
char * vendor
The null-terminated vendor string.
Definition: opusfile.h:302
int opus_tags_get_track_gain(const OpusTags *_tags, int *_gain_q8) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Get the track gain from an R128_TRACK_GAIN tag, if one was specified.
void op_free(OggOpusFile *_of)
Release all memory used by an OggOpusFile.
OP_WARN_UNUSED_RESULT OggOpusFile * op_test_memory(const unsigned char *_data, size_t _size, int *_error)
Partially open a stream from a memory buffer.
const OpusHead * op_head(OggOpusFile *_of, int _li) OP_ARG_NONNULL(1)
Get the ID header information for the given link in a (possibly chained) Ogg Opus stream...
int version
The Ogg Opus format version, in the range 0...255.
Definition: opusfile.h:218
int mapping_family
The channel mapping family, in the range 0...255.
Definition: opusfile.h:243
The metadata from an Ogg Opus stream.
Definition: opusfile.h:293
int op_test_open(OggOpusFile *_of) OP_ARG_NONNULL(1)
Finish opening a stream partially opened with op_test_callbacks() or one of the associated convenienc...
unsigned char mapping[OPUS_CHANNEL_COUNT_MAX]
The mapping from coded stream channels to output channels.
Definition: opusfile.h:260
OP_WARN_UNUSED_RESULT int op_read_float_stereo(OggOpusFile *_of, float *_pcm, int _buf_size) OP_ARG_NONNULL(1)
Reads more samples from the stream and downmixes to stereo, if necessary.
int opus_tags_query_count(const OpusTags *_tags, const char *_tag) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Look up the number of instances of a tag.
void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1)
Initializes an OpusPictureTag structure.
OP_WARN_UNUSED_RESULT OggOpusFile * op_open_memory(const unsigned char *_data, size_t _size, int *_error)
Open a stream from a memory buffer.
const OpusTags * op_tags(OggOpusFile *_of, int _li) OP_ARG_NONNULL(1)
Get the comment header information for the given link in a (possibly chained) Ogg Opus stream...
opus_uint32 op_serialno(OggOpusFile *_of, int _li) OP_ARG_NONNULL(1)
Get the serial number of the given link in a (possibly-chained) Ogg Opus stream.
opus_uint32 depth
The color depth of the picture in bits-per-pixel (not bits-per-channel).
Definition: opusfile.h:366
int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1)
Returns the number of links in this chained stream.
Ogg Opus bitstream information.
Definition: opusfile.h:208
int op_seekable(OggOpusFile *_of) OP_ARG_NONNULL(1)
Returns whether or not the data source being read is seekable.
int output_gain
The gain to apply to the decoded output, in dB, as a Q8 value in the range -32768...32767.
Definition: opusfile.h:236
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)...
int format
The format of the picture data, if known.
Definition: opusfile.h:383
opus_int64(* op_tell_func)(void *_stream)
Obtains the current value of the position indicator for _stream.
Definition: opusfile.h:718
void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1)
Clears the OpusTags structure.
opus_uint32 input_sample_rate
The sampling rate of the original input.
Definition: opusfile.h:230
int(* op_seek_func)(void *_stream, opus_int64 _offset, int _whence)
Sets the position indicator for _stream.
Definition: opusfile.h:714
void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1)
Clears the OpusPictureTag structure.
opus_uint32 height
The height of the picture in pixels.
Definition: opusfile.h:363
opus_uint32 data_length
The length of the picture data in bytes.
Definition: opusfile.h:371
opus_uint32 colors
For indexed-color pictures (e.g., GIF), the number of colors used, or 0 for non-indexed pictures...
Definition: opusfile.h:369
int op_current_link(OggOpusFile *_of) OP_ARG_NONNULL(1)
Retrieve the index of the current link.
OP_WARN_UNUSED_RESULT void * op_url_stream_create(OpusFileCallbacks *_cb, const char *_url,...) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Creates a stream that reads from the given URL using the specified proxy.
opus_uint32 width
The width of the picture in pixels.
Definition: opusfile.h:361
OP_WARN_UNUSED_RESULT void * op_fdopen(OpusFileCallbacks *_cb, int _fd, const char *_mode) OP_ARG_NONNULL(1) OP_ARG_NONNULL(3)
Opens a stream with fdopen() and fills in a set of callbacks that can be used to access it...
int opus_picture_tag_parse(OpusPictureTag *_pic, const char *_tag) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Parse a single METADATA_BLOCK_PICTURE tag.
The contents of a METADATA_BLOCK_PICTURE tag.
Definition: opusfile.h:323
OP_WARN_UNUSED_RESULT void * op_fopen(OpusFileCallbacks *_cb, const char *_path, const char *_mode) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2) OP_ARG_NONNULL(3)
Opens a stream with fopen() and fills in a set of callbacks that can be used to access it...
The callbacks used to access non-FILE stream resources.
Definition: opusfile.h:735
const char * opus_tags_query(const OpusTags *_tags, const char *_tag, int _count) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Look up a comment value by its tag.
opus_int64 op_raw_tell(OggOpusFile *_of) OP_ARG_NONNULL(1)
Obtain the current value of the position indicator for _of.
char * mime_type
The MIME type of the picture, in printable ASCII characters 0x20-0x7E.
Definition: opusfile.h:357
OP_WARN_UNUSED_RESULT OggOpusFile * op_test_url(const char *_url, int *_error,...) OP_ARG_NONNULL(1)
Partially open a stream from a URL.
char * description
The description of the picture, in UTF-8.
Definition: opusfile.h:359
OP_WARN_UNUSED_RESULT OggOpusFile * op_open_file(const char *_path, int *_error) OP_ARG_NONNULL(1)
Open a stream from the given file path.
OP_WARN_UNUSED_RESULT void * op_freopen(OpusFileCallbacks *_cb, const char *_path, const char *_mode, void *_stream) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2) OP_ARG_NONNULL(3) OP_ARG_NONNULL(4)
Opens a stream with freopen() and fills in a set of callbacks that can be used to access it...
int opus_tags_add(OpusTags *_tags, const char *_tag, const char *_value) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2) OP_ARG_NONNULL(3)
Add a (tag, value) pair to an initialized OpusTags structure.
int op_raw_seek(OggOpusFile *_of, opus_int64 _byte_offset) OP_ARG_NONNULL(1)
Seek to a byte offset relative to the compressed data.
OP_WARN_UNUSED_RESULT void * op_url_stream_vcreate(OpusFileCallbacks *_cb, const char *_url, va_list _ap) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Creates a stream that reads from the given URL.
int op_channel_count(OggOpusFile *_of, int _li) OP_ARG_NONNULL(1)
Get the channel count of the given link in a (possibly-chained) Ogg Opus stream.
opus_int64 op_raw_total(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 O...
op_read_func read
Used to read data from the stream.
Definition: opusfile.h:738
ogg_int64_t opus_granule_sample(const OpusHead *_head, ogg_int64_t _gp) OP_ARG_NONNULL(1)
Converts a granule position to a sample offset for a given Ogg Opus stream.
OP_WARN_UNUSED_RESULT OggOpusFile * op_test_file(const char *_path, int *_error) OP_ARG_NONNULL(1)
Partially open a stream from the given file path.
int op_pcm_seek(OggOpusFile *_of, ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1)
Seek to the specified PCM offset, such that decoding will begin at exactly the requested position...
ogg_int64_t op_pcm_tell(OggOpusFile *_of) OP_ARG_NONNULL(1)
Obtain the PCM offset of the next sample to be read.
op_close_func close
Used to close the stream when the decoder is freed.
Definition: opusfile.h:747
op_seek_func seek
Used to seek in the stream.
Definition: opusfile.h:741
OP_WARN_UNUSED_RESULT int opus_head_parse(OpusHead *_head, const unsigned char *_data, size_t _len) OP_ARG_NONNULL(2)
Parses the contents of the ID header packet of an Ogg Opus stream.
OP_WARN_UNUSED_RESULT void * op_mem_stream_create(OpusFileCallbacks *_cb, const unsigned char *_data, size_t _size) OP_ARG_NONNULL(1)
Creates a stream that reads from the given block of memory.
unsigned char * data
The binary picture data.
Definition: opusfile.h:373
opus_int32 op_bitrate(OggOpusFile *_of, int _li) OP_ARG_NONNULL(1)
Computes the bitrate for a given link in a (possibly chained) Ogg Opus stream.
int stream_count
The number of Opus streams in each Ogg packet, in the range 1...255.
Definition: opusfile.h:245
OP_WARN_UNUSED_RESULT int op_read_float(OggOpusFile *_of, float *_pcm, int _buf_size, int *_li) OP_ARG_NONNULL(1)
Reads more samples from the stream.
int(* op_read_func)(void *_stream, unsigned char *_ptr, int _nbytes)
Reads up to _nbytes bytes of data from _stream.
Definition: opusfile.h:703
OP_WARN_UNUSED_RESULT int op_read(OggOpusFile *_of, opus_int16 *_pcm, int _buf_size, int *_li) OP_ARG_NONNULL(1)
Reads more samples from the stream.
int channel_count
The number of channels, in the range 1...255.
Definition: opusfile.h:220
void opus_tags_init(OpusTags *_tags) OP_ARG_NONNULL(1)
Initializes an OpusTags structure.
OP_WARN_UNUSED_RESULT OggOpusFile * op_test_callbacks(void *_source, const OpusFileCallbacks *_cb, const unsigned char *_initial_data, size_t _initial_bytes, int *_error) OP_ARG_NONNULL(2)
Partially open a stream using the given set of callbacks to access it.
OP_WARN_UNUSED_RESULT OggOpusFile * op_vtest_url(const char *_url, int *_error, va_list _ap) OP_ARG_NONNULL(1)
Partially open a stream from a URL.
OP_WARN_UNUSED_RESULT OggOpusFile * op_open_url(const char *_url, int *_error,...) OP_ARG_NONNULL(1)
Open a stream from a URL.
int * comment_lengths
An array of the corresponding length of each vector, in bytes.
Definition: opusfile.h:297
OP_WARN_UNUSED_RESULT int opus_tags_parse(OpusTags *_tags, const unsigned char *_data, size_t _len) OP_ARG_NONNULL(2)
Parses the contents of the &#39;comment&#39; header packet of an Ogg Opus stream.
unsigned pre_skip
The number of samples that should be discarded from the beginning of the stream.
Definition: opusfile.h:223