Smart Remote 3 nRF52 v1.2
opus_custom.h
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 OPUS_BUILD
50 # define OPUS_CUSTOM_EXPORT_STATIC static OPUS_INLINE
51 # else
52 # define OPUS_CUSTOM_EXPORT_STATIC
53 # endif
54 #endif
55 
97 
104 
112 
122 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error);
123 
128 OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode);
129 
130 
131 #if !defined(OPUS_BUILD) || defined(CELT_ENCODER_C)
132 
133 /* Encoder */
139 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_size(
140  const OpusCustomMode *mode,
141  int channels
142 ) OPUS_ARG_NONNULL(1);
143 
144 # ifdef CUSTOM_MODES
145 
157 OPUS_CUSTOM_EXPORT int opus_custom_encoder_init(
158  OpusCustomEncoder *st,
159  const OpusCustomMode *mode,
160  int channels
161 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
162 # endif
163 #endif
164 
165 
175 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encoder_create(
176  const OpusCustomMode *mode,
177  int channels,
178  int *error
179 ) OPUS_ARG_NONNULL(1);
180 
181 
185 OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st);
186 
204 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode_float(
205  OpusCustomEncoder *st,
206  const float *pcm,
207  int frame_size,
208  unsigned char *compressed,
209  int maxCompressedBytes
210 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
211 
225 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode(
226  OpusCustomEncoder *st,
227  const opus_int16 *pcm,
228  int frame_size,
229  unsigned char *compressed,
230  int maxCompressedBytes
231 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
232 
239 OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
240 
241 
242 #if !defined(OPUS_BUILD) || defined(CELT_DECODER_C)
243 /* Decoder */
244 
250 OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_size(
251  const OpusCustomMode *mode,
252  int channels
253 ) OPUS_ARG_NONNULL(1);
254 
267 OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init(
268  OpusCustomDecoder *st,
269  const OpusCustomMode *mode,
270  int channels
271 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
272 
273 #endif
274 
275 
284 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create(
285  const OpusCustomMode *mode,
286  int channels,
287  int *error
288 ) OPUS_ARG_NONNULL(1);
289 
293 OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st);
294 
304 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode_float(
305  OpusCustomDecoder *st,
306  const unsigned char *data,
307  int len,
308  float *pcm,
309  int frame_size
310 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
311 
321 OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode(
322  OpusCustomDecoder *st,
323  const unsigned char *data,
324  int len,
325  opus_int16 *pcm,
326  int frame_size
327 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
328 
335 OPUS_CUSTOM_EXPORT int opus_custom_decoder_ctl(OpusCustomDecoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
336 
339 #ifdef __cplusplus
340 }
341 #endif
342 
343 #endif /* OPUS_CUSTOM_H */

Documentation feedback | Developer Zone | Subscribe | Updated