Opus
IETF low-delay audio codec: API and operations manual
1.0.2
 All Files Functions Typedefs Macros Groups Pages
opus_custom.h
Go to the documentation of this file.
1 /* Copyright (c) 2007-2008 CSIRO
2  Copyright (c) 2007-2009 Xiph.Org Foundation
3  Copyright (c) 2008-2012 Gregory Maxwell
4  Written by Jean-Marc Valin and Gregory Maxwell */
5 /*
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions
8  are met:
9 
10  - Redistributions of source code must retain the above copyright
11  notice, this list of conditions and the following disclaimer.
12 
13  - Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in the
15  documentation and/or other materials provided with the distribution.
16 
17  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29 
35 #ifndef OPUS_CUSTOM_H
36 #define OPUS_CUSTOM_H
37 
38 #include "opus_defines.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #ifdef CUSTOM_MODES
45 #define OPUS_CUSTOM_EXPORT OPUS_EXPORT
46 #define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT
47 #else
48 #define OPUS_CUSTOM_EXPORT
49 #ifdef CELT_C
50 #define OPUS_CUSTOM_EXPORT_STATIC static inline
51 #else
52 #define OPUS_CUSTOM_EXPORT_STATIC
53 #endif
54 #endif
55 
96 
103 
111 
121 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error);
122 
128 
129 /* Encoder */
135 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_size(
136  const OpusCustomMode *mode,
137  int channels
138 ) OPUS_ARG_NONNULL(1);
139 
150  const OpusCustomMode *mode,
151  int channels,
152  int *error
153 ) OPUS_ARG_NONNULL(1);
154 
168  OpusCustomEncoder *st,
169  const OpusCustomMode *mode,
170  int channels
171 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
172 
177 
195 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode_float(
196  OpusCustomEncoder *st,
197  const float *pcm,
198  int frame_size,
199  unsigned char *compressed,
200  int maxCompressedBytes
201 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
202 
216 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode(
217  OpusCustomEncoder *st,
218  const opus_int16 *pcm,
219  int frame_size,
220  unsigned char *compressed,
221  int maxCompressedBytes
222 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
223 
230 OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
231 
232 /* Decoder */
233 
239 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_size(
240  const OpusCustomMode *mode,
241  int channels
242 ) OPUS_ARG_NONNULL(1);
243 
253  const OpusCustomMode *mode,
254  int channels,
255  int *error
256 ) OPUS_ARG_NONNULL(1);
257 
271  OpusCustomDecoder *st,
272  const OpusCustomMode *mode,
273  int channels
274 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
275 
280 
290 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode_float(
291  OpusCustomDecoder *st,
292  const unsigned char *data,
293  int len,
294  float *pcm,
295  int frame_size
296 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
297 
307 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode(
308  OpusCustomDecoder *st,
309  const unsigned char *data,
310  int len,
311  opus_int16 *pcm,
312  int frame_size
313 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
314 
321 OPUS_CUSTOM_EXPORT int opus_custom_decoder_ctl(OpusCustomDecoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
322 
325 #ifdef __cplusplus
326 }
327 #endif
328 
329 #endif /* OPUS_CUSTOM_H */
For more information visit the Opus Website.