opusfile: /usr/src/ports/opusfile/opusfile-0.8-1.x86_64/src/opusfile-0.8/include/opusfile.h Source File

| opusfile 0.8 Stand-alone decoder library for .opus files.

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
103 # if defined(__cplusplus)
104 extern "C" {
105 # endif
106
107 # include <stdarg.h>
108 # include <stdio.h>
109 # include <ogg/ogg.h>
110 # include <opus_multistream.h>
111
114 /*Enable special features for gcc and gcc-compatible compilers.*/
115 # if !defined(OP_GNUC_PREREQ)
116 # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
117 # define OP_GNUC_PREREQ(_maj,_min) \
118 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
119 # else
120 # define OP_GNUC_PREREQ(_maj,_min) 0
121 # endif
122 # endif
123
124 # if OP_GNUC_PREREQ(4,0)
125 # pragma GCC visibility push(default)
126 # endif
127
128 typedef struct OpusHead OpusHead;
129 typedef struct OpusTags OpusTags;
130 typedef struct OpusPictureTag OpusPictureTag;
131 typedef struct OpusServerInfo OpusServerInfo;
132 typedef struct OpusFileCallbacks OpusFileCallbacks;
133 typedef struct OggOpusFile OggOpusFile;
134
135 /*Warning attributes for libopusfile functions.*/
136 # if OP_GNUC_PREREQ(3,4)
137 # define OP_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
138 # else
139 # define OP_WARN_UNUSED_RESULT
140 # endif
141 # if OP_GNUC_PREREQ(3,4)
142 # define OP_ARG_NONNULL(_x) __attribute__((__nonnull__(_x)))
143 # else
144 # define OP_ARG_NONNULL(_x)
145 # endif
146
158
160 #define OP_FALSE (-1)
161 /*Currently not used externally.*/
162 #define OP_EOF (-2)
163
165 #define OP_HOLE (-3)
166
168 #define OP_EREAD (-128)
169
172 #define OP_EFAULT (-129)
173
175 #define OP_EIMPL (-130)
176
177 #define OP_EINVAL (-131)
178
182 #define OP_ENOTFORMAT (-132)
183
185 #define OP_EBADHEADER (-133)
186
187 #define OP_EVERSION (-134)
188 /*Currently not used at all.*/
189 #define OP_ENOTAUDIO (-135)
190
193 #define OP_EBADPACKET (-136)
194
197 #define OP_EBADLINK (-137)
198
199 #define OP_ENOSEEK (-138)
200
201 #define OP_EBADTIMESTAMP (-139)
202
205
208
210 #define OPUS_CHANNEL_COUNT_MAX (255)
211
215 struct OpusHead{
225 int version;
227 int channel_count;
230 unsigned pre_skip;
237 opus_uint32 input_sample_rate;
243 int output_gain;
250 int mapping_family;
252 int stream_count;
259 int coupled_count;
267 unsigned char mapping[OPUS_CHANNEL_COUNT_MAX];
268 };
269
300 struct OpusTags{
302 char **user_comments;
304 int *comment_lengths;
306 int comments;
309 char *vendor;
310 };
311
314
317 #define OP_PIC_FORMAT_UNKNOWN (-1)
318
319 #define OP_PIC_FORMAT_URL (0)
320
321 #define OP_PIC_FORMAT_JPEG (1)
322
323 #define OP_PIC_FORMAT_PNG (2)
324
325 #define OP_PIC_FORMAT_GIF (3)
326
330 struct OpusPictureTag{
357 opus_int32 type;
364 char *mime_type;
366 char *description;
368 opus_uint32 width;
370 opus_uint32 height;
373 opus_uint32 depth;
376 opus_uint32 colors;
378 opus_uint32 data_length;
380 unsigned char *data;
390 int format;
391 };
392
401
427 OP_WARN_UNUSED_RESULT int opus_head_parse(OpusHead *_head,
428 const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2);
429
444 ogg_int64_t opus_granule_sample(const OpusHead *_head,ogg_int64_t _gp)
445 OP_ARG_NONNULL(1);
446
461 OP_WARN_UNUSED_RESULT int opus_tags_parse(OpusTags *_tags,
462 const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2);
463
471 int opus_tags_copy(OpusTags *_dst,const OpusTags *_src) OP_ARG_NONNULL(1);
472
477 void opus_tags_init(OpusTags *_tags) OP_ARG_NONNULL(1);
478
490 int opus_tags_add(OpusTags *_tags,const char *_tag,const char *_value)
491 OP_ARG_NONNULL(1) OP_ARG_NONNULL(2) OP_ARG_NONNULL(3);
492
503 int opus_tags_add_comment(OpusTags *_tags,const char *_comment)
504 OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
505
519 int opus_tags_set_binary_suffix(OpusTags *_tags,
520 const unsigned char *_data,int _len) OP_ARG_NONNULL(1);
521
537 const char *opus_tags_query(const OpusTags *_tags,const char *_tag,int _count)
538 OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
539
547 int opus_tags_query_count(const OpusTags *_tags,const char *_tag)
548 OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
549
555 const unsigned char *opus_tags_get_binary_suffix(const OpusTags *_tags,
556 int *_len) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
557
573 int opus_tags_get_album_gain(const OpusTags *_tags,int *_gain_q8)
574 OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
575
591 int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8)
592 OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
593
599 void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1);
600
610 int opus_tagcompare(const char *_tag_name,const char *_comment);
611
625 int opus_tagncompare(const char *_tag_name,int _tag_len,const char *_comment);
626
657 OP_WARN_UNUSED_RESULT int opus_picture_tag_parse(OpusPictureTag *_pic,
658 const char *_tag) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
659
664 void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1);
665
671 void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1);
672
676
688
691 /*These are the raw numbers used to define the request codes.
692 They should not be used directly.*/
693 #define OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST (6464)
694 #define OP_HTTP_PROXY_HOST_REQUEST (6528)
695 #define OP_HTTP_PROXY_PORT_REQUEST (6592)
696 #define OP_HTTP_PROXY_USER_REQUEST (6656)
697 #define OP_HTTP_PROXY_PASS_REQUEST (6720)
698 #define OP_GET_SERVER_INFO_REQUEST (6784)
699
700 #define OP_URL_OPT(_request) ((_request)+(char *)0)
701
702 /*These macros trigger compilation errors or warnings if the wrong types are
703 provided to one of the URL options.*/
704 #define OP_CHECK_INT(_x) ((void)((_x)==(opus_int32)0),(opus_int32)(_x))
705 #define OP_CHECK_CONST_CHAR_PTR(_x) ((_x)+((_x)-(const char *)(_x)))
706 #define OP_CHECK_SERVER_INFO_PTR(_x) ((_x)+((_x)-(OpusServerInfo *)(_x)))
707
711 struct OpusServerInfo{
715 char *name;
719 char *description;
723 char *genre;
727 char *url;
730 char *server;
734 char *content_type;
738 opus_int32 bitrate_kbps;
743 int is_public;
748 int is_ssl;
749 };
750
755 void opus_server_info_init(OpusServerInfo *_info) OP_ARG_NONNULL(1);
756
763 void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1);
764
771 #define OP_SSL_SKIP_CERTIFICATE_CHECK(_b) \
772 OP_URL_OPT(OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST),OP_CHECK_INT(_b)
773
782 #define OP_HTTP_PROXY_HOST(_host) \
783 OP_URL_OPT(OP_HTTP_PROXY_HOST_REQUEST),OP_CHECK_CONST_CHAR_PTR(_host)
784
795 #define OP_HTTP_PROXY_PORT(_port) \
796 OP_URL_OPT(OP_HTTP_PROXY_PORT_REQUEST),OP_CHECK_INT(_port)
797
808 #define OP_HTTP_PROXY_USER(_user) \
809 OP_URL_OPT(OP_HTTP_PROXY_USER_REQUEST),OP_CHECK_CONST_CHAR_PTR(_user)
810
821 #define OP_HTTP_PROXY_PASS(_pass) \
822 OP_URL_OPT(OP_HTTP_PROXY_PASS_REQUEST),OP_CHECK_CONST_CHAR_PTR(_pass)
823
842 #define OP_GET_SERVER_INFO(_info) \
843 OP_URL_OPT(OP_GET_SERVER_INFO_REQUEST),OP_CHECK_SERVER_INFO_PTR(_info)
844
847
859
868 typedef int (*op_read_func)(void *_stream,unsigned char *_ptr,int _nbytes);
869
879 typedef int (*op_seek_func)(void *_stream,opus_int64 _offset,int _whence);
880
883 typedef opus_int64 (*op_tell_func)(void *_stream);
884
889 typedef int (*op_close_func)(void *_stream);
890
900 struct OpusFileCallbacks{
903 op_read_func read;
906 op_seek_func seek;
909 op_tell_func tell;
912 op_close_func close;
913 };
914
932 OP_WARN_UNUSED_RESULT void *op_fopen(OpusFileCallbacks *_cb,
933 const char *_path,const char *_mode) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
934 OP_ARG_NONNULL(3);
935
949 OP_WARN_UNUSED_RESULT void *op_fdopen(OpusFileCallbacks *_cb,
950 int _fd,const char *_mode) OP_ARG_NONNULL(1) OP_ARG_NONNULL(3);
951
971 OP_WARN_UNUSED_RESULT void *op_freopen(OpusFileCallbacks *_cb,
972 const char *_path,const char *_mode,void *_stream) OP_ARG_NONNULL(1)
973 OP_ARG_NONNULL(2) OP_ARG_NONNULL(3) OP_ARG_NONNULL(4);
974
985 OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb,
986 const unsigned char *_data,size_t _size) OP_ARG_NONNULL(1);
987
1011 OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb,
1012 const char *_url,va_list _ap) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
1013
1033 OP_WARN_UNUSED_RESULT void *op_url_stream_create(OpusFileCallbacks *_cb,
1034 const char *_url,...) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
1035
1038
1048
1079 int op_test(OpusHead *_head,
1080 const unsigned char *_initial_data,size_t _initial_bytes);
1081
1091 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_file(const char *_path,int *_error)
1092 OP_ARG_NONNULL(1);
1093
1102 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_memory(const unsigned char *_data,
1103 size_t _size,int *_error);
1104
1131 OP_WARN_UNUSED_RESULT OggOpusFile *op_vopen_url(const char *_url,
1132 int *_error,va_list _ap) OP_ARG_NONNULL(1);
1133
1153 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url,
1154 int *_error,...) OP_ARG_NONNULL(1);
1155
1233 OP_WARN_UNUSED_RESULT OggOpusFile *op_open_callbacks(void *_source,
1234 const OpusFileCallbacks *_cb,const unsigned char *_initial_data,
1235 size_t _initial_bytes,int *_error) OP_ARG_NONNULL(2);
1236
1247 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_file(const char *_path,int *_error)
1248 OP_ARG_NONNULL(1);
1249
1259 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data,
1260 size_t _size,int *_error);
1261
1290 OP_WARN_UNUSED_RESULT OggOpusFile *op_vtest_url(const char *_url,
1291 int *_error,va_list _ap) OP_ARG_NONNULL(1);
1292
1314 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_url(const char *_url,
1315 int *_error,...) OP_ARG_NONNULL(1);
1316
1380 OP_WARN_UNUSED_RESULT OggOpusFile *op_test_callbacks(void *_source,
1381 const OpusFileCallbacks *_cb,const unsigned char *_initial_data,
1382 size_t _initial_bytes,int *_error) OP_ARG_NONNULL(2);
1383
1410 int op_test_open(OggOpusFile *_of) OP_ARG_NONNULL(1);
1411
1414 void op_free(OggOpusFile *_of);
1415
1418
1436
1451 int op_seekable(const OggOpusFile *_of) OP_ARG_NONNULL(1);
1452
1461 int op_link_count(const OggOpusFile *_of) OP_ARG_NONNULL(1);
1462
1476 opus_uint32 op_serialno(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1477
1493 int op_channel_count(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1494
1515 opus_int64 op_raw_total(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1516
1533 ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1534
1549 const OpusHead *op_head(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1550
1567 const OpusTags *op_tags(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1568
1584 int op_current_link(const OggOpusFile *_of) OP_ARG_NONNULL(1);
1585
1606 opus_int32 op_bitrate(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
1607
1619 opus_int32 op_bitrate_instant(OggOpusFile *_of) OP_ARG_NONNULL(1);
1620
1625 opus_int64 op_raw_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1);
1626
1634 ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1);
1635
1638
1666
1680 int op_raw_seek(OggOpusFile *_of,opus_int64 _byte_offset) OP_ARG_NONNULL(1);
1681
1696 int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1);
1697
1700
1741
1744 #define OP_DEC_FORMAT_SHORT (7008)
1745
1747 #define OP_DEC_FORMAT_FLOAT (7040)
1748
1751 #define OP_DEC_USE_DEFAULT (6720)
1752
1784 typedef int (*op_decode_cb_func)(void *_ctx,OpusMSDecoder *_decoder,void *_pcm,
1785 const ogg_packet *_op,int _nsamples,int _nchannels,int _format,int _li);
1786
1808 void op_set_decode_callback(OggOpusFile *_of,
1809 op_decode_cb_func _decode_cb,void *_ctx) OP_ARG_NONNULL(1);
1810
1814 #define OP_HEADER_GAIN (0)
1815
1818 #define OP_ALBUM_GAIN (3007)
1819
1822 #define OP_TRACK_GAIN (3008)
1823
1826 #define OP_ABSOLUTE_GAIN (3009)
1827
1845 int op_set_gain_offset(OggOpusFile *_of,
1846 int _gain_type,opus_int32 _gain_offset_q8) OP_ARG_NONNULL(1);
1847
1858 void op_set_dither_enabled(OggOpusFile *_of,int _enabled) OP_ARG_NONNULL(1);
1859
1940 OP_WARN_UNUSED_RESULT int op_read(OggOpusFile *_of,
1941 opus_int16 *_pcm,int _buf_size,int *_li) OP_ARG_NONNULL(1);
1942
2021 OP_WARN_UNUSED_RESULT int op_read_float(OggOpusFile *_of,
2022 float *_pcm,int _buf_size,int *_li) OP_ARG_NONNULL(1);
2023
2082 OP_WARN_UNUSED_RESULT int op_read_stereo(OggOpusFile *_of,
2083 opus_int16 *_pcm,int _buf_size) OP_ARG_NONNULL(1);
2084
2143 OP_WARN_UNUSED_RESULT int op_read_float_stereo(OggOpusFile *_of,
2144 float *_pcm,int _buf_size) OP_ARG_NONNULL(1);
2145
2148
2149 # if OP_GNUC_PREREQ(4,0)
2150 # pragma GCC visibility pop
2151 # endif
2152
2153 # if defined(__cplusplus)
2154 }
2155 # endif
2156
2157 #endif
OPUS_CHANNEL_COUNT_MAX
#define OPUS_CHANNEL_COUNT_MAX
The maximum number of channels in an Ogg Opus stream.
Definition: opusfile.h:210
OpusTags::user_comments
char ** user_comments
The array of comment string vectors.
Definition: opusfile.h:302
op_test
int op_test(OpusHead *_head, const unsigned char *_initial_data, size_t _initial_bytes)
Test to see if this is an Opus stream.
OpusHead::coupled_count
int coupled_count
The number of coupled Opus streams in each Ogg packet, in the range 0...127.
Definition: opusfile.h:259
OpusFileCallbacks::tell
op_tell_func tell
Used to return the current read position in the stream.
Definition: opusfile.h:909
op_pcm_tell
ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1)
Obtain the PCM offset of the next sample to be read.
OpusServerInfo::bitrate_kbps
opus_int32 bitrate_kbps
The nominal stream bitrate in kbps (icy-br/ice-bitrate).
Definition: opusfile.h:738
OpusServerInfo::genre
char * genre
The genre the server falls under (icy-genre/ice-genre).
Definition: opusfile.h:723
op_seek_func
int(* op_seek_func)(void *_stream, opus_int64 _offset, int _whence)
Sets the position indicator for _stream.
Definition: opusfile.h:879
opus_tags_copy
int opus_tags_copy(OpusTags *_dst, const OpusTags *_src) OP_ARG_NONNULL(1)
Performs a deep copy of an OpusTags structure.
opus_tags_add_comment
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.
OpusPictureTag::type
opus_int32 type
The picture type according to the ID3v2 APIC frame:
Definition: opusfile.h:357
op_channel_count
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.
op_open_callbacks
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.
op_decode_cb_func
int(* op_decode_cb_func)(void *_ctx, OpusMSDecoder *_decoder, void *_pcm, const ogg_packet *_op, int _nsamples, int _nchannels, int _format, int _li)
Called to decode an Opus packet.
Definition: opusfile.h:1784
opus_picture_tag_parse
OP_WARN_UNUSED_RESULT 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.
OpusTags::comments
int comments
The total number of comment streams.
Definition: opusfile.h:306
op_read_stereo
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_vopen_url
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.
OpusTags::vendor
char * vendor
The null-terminated vendor string.
Definition: opusfile.h:309
opus_tags_get_track_gain
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.
op_free
void op_free(OggOpusFile *_of)
Release all memory used by an OggOpusFile.
op_test_memory
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.
OpusServerInfo
HTTP/Shoutcast/Icecast server information associated with a URL.
Definition: opusfile.h:711
OpusHead::version
int version
The Ogg Opus format version, in the range 0...255.
Definition: opusfile.h:225
OpusHead::mapping_family
int mapping_family
The channel mapping family, in the range 0...255.
Definition: opusfile.h:250
op_head
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...
op_current_link
int op_current_link(const OggOpusFile *_of) OP_ARG_NONNULL(1)
Retrieve the index of the current link.
OpusTags
The metadata from an Ogg Opus stream.
Definition: opusfile.h:300
op_test_open
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...
OpusHead::mapping
unsigned char mapping[OPUS_CHANNEL_COUNT_MAX]
The mapping from coded stream channels to output channels.
Definition: opusfile.h:267
op_read_float_stereo
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.
opus_tags_query_count
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.
opus_picture_tag_init
void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1)
Initializes an OpusPictureTag structure.
op_open_memory
OP_WARN_UNUSED_RESULT OggOpusFile * op_open_memory(const unsigned char *_data, size_t _size, int *_error)
Open a stream from a memory buffer.
OpusPictureTag::depth
opus_uint32 depth
The color depth of the picture in bits-per-pixel (not bits-per-channel).
Definition: opusfile.h:373
OpusServerInfo::url
char * url
The homepage for the server (icy-url/ice-url).
Definition: opusfile.h:727
op_raw_total
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 O...
op_serialno
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.
opus_tagcompare
int opus_tagcompare(const char *_tag_name, const char *_comment)
Check if _comment is an instance of a _tag_name tag.
OpusHead
Ogg Opus bitstream information.
Definition: opusfile.h:215
opus_tags_set_binary_suffix
int opus_tags_set_binary_suffix(OpusTags *_tags, const unsigned char *_data, int _len) OP_ARG_NONNULL(1)
Replace the binary suffix data at the end of the packet (if any).
OpusHead::output_gain
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:243
op_bitrate_instant
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)...
OpusPictureTag::format
int format
The format of the picture data, if known.
Definition: opusfile.h:390
op_tags
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...
OpusServerInfo::is_public
int is_public
Flag indicating whether the server is public (1) or not (0) (icy-pub/ice-public). ...
Definition: opusfile.h:743
opus_tags_clear
void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1)
Clears the OpusTags structure.
OpusHead::input_sample_rate
opus_uint32 input_sample_rate
The sampling rate of the original input.
Definition: opusfile.h:237
op_pcm_total
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 (...
opus_picture_tag_clear
void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1)
Clears the OpusPictureTag structure.
OpusPictureTag::height
opus_uint32 height
The height of the picture in pixels.
Definition: opusfile.h:370
OpusServerInfo::server
char * server
The software used by the origin server (Server).
Definition: opusfile.h:730
OpusPictureTag::data_length
opus_uint32 data_length
The length of the picture data in bytes.
Definition: opusfile.h:378
OpusPictureTag::colors
opus_uint32 colors
For indexed-color pictures (e.g., GIF), the number of colors used, or 0 for non-indexed pictures...
Definition: opusfile.h:376
opus_server_info_clear
void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1)
Clears the OpusServerInfo structure.
op_raw_tell
opus_int64 op_raw_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1)
Obtain the current value of the position indicator for _of.
op_url_stream_create
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.
OpusPictureTag::width
opus_uint32 width
The width of the picture in pixels.
Definition: opusfile.h:368
op_fdopen
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...
opus_server_info_init
void opus_server_info_init(OpusServerInfo *_info) OP_ARG_NONNULL(1)
Initializes an OpusServerInfo structure.
OpusPictureTag
The contents of a METADATA_BLOCK_PICTURE tag.
Definition: opusfile.h:330
op_fopen
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...
op_set_gain_offset
int op_set_gain_offset(OggOpusFile *_of, int _gain_type, opus_int32 _gain_offset_q8) OP_ARG_NONNULL(1)
Sets the gain to be used for decoded output.
OpusFileCallbacks
The callbacks used to access non-FILE stream resources.
Definition: opusfile.h:900
opus_tags_query
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_tags_get_album_gain
int opus_tags_get_album_gain(const OpusTags *_tags, int *_gain_q8) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Get the album gain from an R128_ALBUM_GAIN tag, if one was specified.
OpusPictureTag::mime_type
char * mime_type
The MIME type of the picture, in printable ASCII characters 0x20-0x7E.
Definition: opusfile.h:364
op_test_url
OP_WARN_UNUSED_RESULT OggOpusFile * op_test_url(const char *_url, int *_error,...) OP_ARG_NONNULL(1)
Partially open a stream from a URL.
op_seekable
int op_seekable(const OggOpusFile *_of) OP_ARG_NONNULL(1)
Returns whether or not the data source being read is seekable.
OpusPictureTag::description
char * description
The description of the picture, in UTF-8.
Definition: opusfile.h:366
op_open_file
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_freopen
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...
op_read_func
int(* op_read_func)(void *_stream, unsigned char *_ptr, int _nbytes)
Reads up to _nbytes bytes of data from _stream.
Definition: opusfile.h:868
opus_tags_add
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.
op_raw_seek
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_url_stream_vcreate
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.
op_set_decode_callback
void op_set_decode_callback(OggOpusFile *_of, op_decode_cb_func _decode_cb, void *_ctx) OP_ARG_NONNULL(1)
Sets the packet decode callback function.
OpusFileCallbacks::read
op_read_func read
Used to read data from the stream.
Definition: opusfile.h:903
op_set_dither_enabled
void op_set_dither_enabled(OggOpusFile *_of, int _enabled) OP_ARG_NONNULL(1)
Sets whether or not dithering is enabled for 16-bit decoding.
opus_granule_sample
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_test_file
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.
op_pcm_seek
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...
OpusFileCallbacks::close
op_close_func close
Used to close the stream when the decoder is freed.
Definition: opusfile.h:912
OpusFileCallbacks::seek
op_seek_func seek
Used to seek in the stream.
Definition: opusfile.h:906
opus_head_parse
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.
OpusServerInfo::content_type
char * content_type
The media type of the entity sent to the recepient (Content-Type).
Definition: opusfile.h:734
op_mem_stream_create
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.
OpusPictureTag::data
unsigned char * data
The binary picture data.
Definition: opusfile.h:380
op_bitrate
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...
OpusHead::stream_count
int stream_count
The number of Opus streams in each Ogg packet, in the range 1...255.
Definition: opusfile.h:252
op_read_float
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.
op_close_func
int(* op_close_func)(void *_stream)
Closes the underlying stream.
Definition: opusfile.h:889
op_tell_func
opus_int64(* op_tell_func)(void *_stream)
Obtains the current value of the position indicator for _stream.
Definition: opusfile.h:883
OpusServerInfo::is_ssl
int is_ssl
Flag indicating whether the server is using HTTPS instead of HTTP.
Definition: opusfile.h:748
OpusServerInfo::name
char * name
The name of the server (icy-name/ice-name).
Definition: opusfile.h:715
op_read
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.
opus_tagncompare
int opus_tagncompare(const char *_tag_name, int _tag_len, const char *_comment)
Check if _comment is an instance of a _tag_name tag.
OpusHead::channel_count
int channel_count
The number of channels, in the range 1...255.
Definition: opusfile.h:227
opus_tags_init
void opus_tags_init(OpusTags *_tags) OP_ARG_NONNULL(1)
Initializes an OpusTags structure.
op_test_callbacks
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.
opus_tags_get_binary_suffix
const unsigned char * opus_tags_get_binary_suffix(const OpusTags *_tags, int *_len) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2)
Retrieve the binary suffix data at the end of the packet (if any).
op_vtest_url
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_open_url
OP_WARN_UNUSED_RESULT OggOpusFile * op_open_url(const char *_url, int *_error,...) OP_ARG_NONNULL(1)
Open a stream from a URL.
OpusServerInfo::description
char * description
A short description of the server (icy-description/ice-description).
Definition: opusfile.h:719
OpusTags::comment_lengths
int * comment_lengths
An array of the corresponding length of each vector, in bytes.
Definition: opusfile.h:304
op_link_count
int op_link_count(const OggOpusFile *_of) OP_ARG_NONNULL(1)
Returns the number of links in this chained stream.
opus_tags_parse
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.
OpusHead::pre_skip
unsigned pre_skip
The number of samples that should be discarded from the beginning of the stream.
Definition: opusfile.h:230