Opus audio codec (RFC 6716): API and operations manual
1.1-beta
Main Page
Modules
Files
File List
Globals
All
Files
Functions
Typedefs
Macros
Groups
Pages
include
opus_defines.h
Go to the documentation of this file.
1
/* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited
2
Written by Jean-Marc Valin and Koen Vos */
3
/*
4
Redistribution and use in source and binary forms, with or without
5
modification, are permitted provided that the following conditions
6
are met:
7
8
- Redistributions of source code must retain the above copyright
9
notice, this list of conditions and the following disclaimer.
10
11
- Redistributions in binary form must reproduce the above copyright
12
notice, this list of conditions and the following disclaimer in the
13
documentation and/or other materials provided with the distribution.
14
15
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
19
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
33
#ifndef OPUS_DEFINES_H
34
#define OPUS_DEFINES_H
35
36
#include "
opus_types.h
"
37
38
#ifdef __cplusplus
39
extern
"C"
{
40
#endif
41
46
#define OPUS_OK 0
47
48
#define OPUS_BAD_ARG -1
49
50
#define OPUS_BUFFER_TOO_SMALL -2
51
52
#define OPUS_INTERNAL_ERROR -3
53
54
#define OPUS_INVALID_PACKET -4
55
56
#define OPUS_UNIMPLEMENTED -5
57
58
#define OPUS_INVALID_STATE -6
59
60
#define OPUS_ALLOC_FAIL -7
61
66
#ifndef OPUS_EXPORT
67
# if defined(WIN32)
68
# ifdef OPUS_BUILD
69
# define OPUS_EXPORT __declspec(dllexport)
70
# else
71
# define OPUS_EXPORT
72
# endif
73
# elif defined(__GNUC__) && defined(OPUS_BUILD)
74
# define OPUS_EXPORT __attribute__ ((visibility ("default")))
75
# else
76
# define OPUS_EXPORT
77
# endif
78
#endif
79
80
# if !defined(OPUS_GNUC_PREREQ)
81
# if defined(__GNUC__)&&defined(__GNUC_MINOR__)
82
# define OPUS_GNUC_PREREQ(_maj,_min) \
83
((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
84
# else
85
# define OPUS_GNUC_PREREQ(_maj,_min) 0
86
# endif
87
# endif
88
89
#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
90
# if OPUS_GNUC_PREREQ(3,0)
91
# define OPUS_RESTRICT __restrict__
92
# elif (defined(_MSC_VER) && _MSC_VER >= 1400)
93
# define OPUS_RESTRICT __restrict
94
# else
95
# define OPUS_RESTRICT
96
# endif
97
#else
98
# define OPUS_RESTRICT restrict
99
#endif
100
104
#if defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
105
# define OPUS_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
106
#else
107
# define OPUS_WARN_UNUSED_RESULT
108
#endif
109
#if !defined(OPUS_BUILD) && defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
110
# define OPUS_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x)))
111
#else
112
# define OPUS_ARG_NONNULL(_x)
113
#endif
114
118
#define OPUS_SET_APPLICATION_REQUEST 4000
119
#define OPUS_GET_APPLICATION_REQUEST 4001
120
#define OPUS_SET_BITRATE_REQUEST 4002
121
#define OPUS_GET_BITRATE_REQUEST 4003
122
#define OPUS_SET_MAX_BANDWIDTH_REQUEST 4004
123
#define OPUS_GET_MAX_BANDWIDTH_REQUEST 4005
124
#define OPUS_SET_VBR_REQUEST 4006
125
#define OPUS_GET_VBR_REQUEST 4007
126
#define OPUS_SET_BANDWIDTH_REQUEST 4008
127
#define OPUS_GET_BANDWIDTH_REQUEST 4009
128
#define OPUS_SET_COMPLEXITY_REQUEST 4010
129
#define OPUS_GET_COMPLEXITY_REQUEST 4011
130
#define OPUS_SET_INBAND_FEC_REQUEST 4012
131
#define OPUS_GET_INBAND_FEC_REQUEST 4013
132
#define OPUS_SET_PACKET_LOSS_PERC_REQUEST 4014
133
#define OPUS_GET_PACKET_LOSS_PERC_REQUEST 4015
134
#define OPUS_SET_DTX_REQUEST 4016
135
#define OPUS_GET_DTX_REQUEST 4017
136
#define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
137
#define OPUS_GET_VBR_CONSTRAINT_REQUEST 4021
138
#define OPUS_SET_FORCE_CHANNELS_REQUEST 4022
139
#define OPUS_GET_FORCE_CHANNELS_REQUEST 4023
140
#define OPUS_SET_SIGNAL_REQUEST 4024
141
#define OPUS_GET_SIGNAL_REQUEST 4025
142
#define OPUS_GET_LOOKAHEAD_REQUEST 4027
143
/* #define OPUS_RESET_STATE 4028 */
144
#define OPUS_GET_SAMPLE_RATE_REQUEST 4029
145
#define OPUS_GET_FINAL_RANGE_REQUEST 4031
146
#define OPUS_GET_PITCH_REQUEST 4033
147
#define OPUS_SET_GAIN_REQUEST 4034
148
#define OPUS_GET_GAIN_REQUEST 4045
/* Should have been 4035 */
149
#define OPUS_SET_LSB_DEPTH_REQUEST 4036
150
#define OPUS_GET_LSB_DEPTH_REQUEST 4037
151
#define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
152
#define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
153
#define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
154
155
/* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
156
157
/* Macros to trigger compilation errors when the wrong types are provided to a CTL */
158
#define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
159
#define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
160
#define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr)))
161
#define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr)))
162
168
/* Values for the various encoder CTLs */
169
#define OPUS_AUTO -1000
170
#define OPUS_BITRATE_MAX -1
174
#define OPUS_APPLICATION_VOIP 2048
175
177
#define OPUS_APPLICATION_AUDIO 2049
178
180
#define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051
181
182
#define OPUS_SIGNAL_VOICE 3001
183
#define OPUS_SIGNAL_MUSIC 3002
184
#define OPUS_BANDWIDTH_NARROWBAND 1101
185
#define OPUS_BANDWIDTH_MEDIUMBAND 1102
186
#define OPUS_BANDWIDTH_WIDEBAND 1103
187
#define OPUS_BANDWIDTH_SUPERWIDEBAND 1104
188
#define OPUS_BANDWIDTH_FULLBAND 1105
190
#define OPUS_FRAMESIZE_ARG 5000
191
#define OPUS_FRAMESIZE_2_5_MS 5001
192
#define OPUS_FRAMESIZE_5_MS 5002
193
#define OPUS_FRAMESIZE_10_MS 5003
194
#define OPUS_FRAMESIZE_20_MS 5004
195
#define OPUS_FRAMESIZE_40_MS 5005
196
#define OPUS_FRAMESIZE_60_MS 5006
197
#define OPUS_FRAMESIZE_VARIABLE 5010
232
#define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, __opus_check_int(x)
233
238
#define OPUS_GET_COMPLEXITY(x) OPUS_GET_COMPLEXITY_REQUEST, __opus_check_int_ptr(x)
239
251
#define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, __opus_check_int(x)
252
259
#define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, __opus_check_int_ptr(x)
260
275
#define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, __opus_check_int(x)
276
286
#define OPUS_GET_VBR(x) OPUS_GET_VBR_REQUEST, __opus_check_int_ptr(x)
287
304
#define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, __opus_check_int(x)
305
314
#define OPUS_GET_VBR_CONSTRAINT(x) OPUS_GET_VBR_CONSTRAINT_REQUEST, __opus_check_int_ptr(x)
315
329
#define OPUS_SET_FORCE_CHANNELS(x) OPUS_SET_FORCE_CHANNELS_REQUEST, __opus_check_int(x)
330
339
#define OPUS_GET_FORCE_CHANNELS(x) OPUS_GET_FORCE_CHANNELS_REQUEST, __opus_check_int_ptr(x)
340
357
#define OPUS_SET_MAX_BANDWIDTH(x) OPUS_SET_MAX_BANDWIDTH_REQUEST, __opus_check_int(x)
358
370
#define OPUS_GET_MAX_BANDWIDTH(x) OPUS_GET_MAX_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
371
389
#define OPUS_SET_BANDWIDTH(x) OPUS_SET_BANDWIDTH_REQUEST, __opus_check_int(x)
390
401
#define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, __opus_check_int(x)
402
411
#define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __opus_check_int_ptr(x)
412
413
428
#define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, __opus_check_int(x)
429
442
#define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_ptr(x)
443
450
#define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_ptr(x)
451
465
#define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __opus_check_int_ptr(x)
466
476
#define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x)
477
485
#define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x)
486
494
#define OPUS_SET_PACKET_LOSS_PERC(x) OPUS_SET_PACKET_LOSS_PERC_REQUEST, __opus_check_int(x)
495
500
#define OPUS_GET_PACKET_LOSS_PERC(x) OPUS_GET_PACKET_LOSS_PERC_REQUEST, __opus_check_int_ptr(x)
501
511
#define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x)
512
520
#define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x)
521
527
#define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x)
528
533
#define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
534
538
#define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST, __opus_check_int_ptr(x)
539
561
#define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int(x)
562
576
#define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)
577
619
#define OPUS_RESET_STATE 4028
620
629
#define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_uint_ptr(x)
630
641
#define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x)
642
655
#define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
656
674
#define OPUS_SET_GAIN(x) OPUS_SET_GAIN_REQUEST, __opus_check_int(x)
675
679
#define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x)
680
692
OPUS_EXPORT
const
char
*
opus_strerror
(
int
error);
693
698
OPUS_EXPORT
const
char
*
opus_get_version_string
(
void
);
701
#ifdef __cplusplus
702
}
703
#endif
704
705
#endif
/* OPUS_DEFINES_H */
For more information visit the
Opus Website
.
©2014
Generated on Wed Jun 18 2014 17:23:03 for Opus by
doxygen
1.8.1.2