Smart Remote 3 nRF52 v1.2
opus_multistream.h
1 /* Copyright (c) 2011 Xiph.Org Foundation
2  Written by Jean-Marc Valin */
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_MULTISTREAM_H
34 #define OPUS_MULTISTREAM_H
35 
36 #include "opus.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
47 #define __opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
48 #define __opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
49 
55 #define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120
56 #define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122
57 
87 #define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
88 
100 #define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
101 
178 
186 
205 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size(
206  int streams,
207  int coupled_streams
208 );
209 
210 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_surround_encoder_get_size(
211  int channels,
212  int mapping_family
213 );
214 
215 
259 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
260  opus_int32 Fs,
261  int channels,
262  int streams,
263  int coupled_streams,
264  const unsigned char *mapping,
265  int application,
266  int *error
267 ) OPUS_ARG_NONNULL(5);
268 
269 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_surround_encoder_create(
270  opus_int32 Fs,
271  int channels,
272  int mapping_family,
273  int *streams,
274  int *coupled_streams,
275  unsigned char *mapping,
276  int application,
277  int *error
278 ) OPUS_ARG_NONNULL(4) OPUS_ARG_NONNULL(5) OPUS_ARG_NONNULL(6);
279 
328 OPUS_EXPORT int opus_multistream_encoder_init(
329  OpusMSEncoder *st,
330  opus_int32 Fs,
331  int channels,
332  int streams,
333  int coupled_streams,
334  const unsigned char *mapping,
335  int application
336 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
337 
338 OPUS_EXPORT int opus_multistream_surround_encoder_init(
339  OpusMSEncoder *st,
340  opus_int32 Fs,
341  int channels,
342  int mapping_family,
343  int *streams,
344  int *coupled_streams,
345  unsigned char *mapping,
346  int application
347 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(5) OPUS_ARG_NONNULL(6) OPUS_ARG_NONNULL(7);
348 
379 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
380  OpusMSEncoder *st,
381  const opus_int16 *pcm,
382  int frame_size,
383  unsigned char *data,
384  opus_int32 max_data_bytes
385 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
386 
424 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
425  OpusMSEncoder *st,
426  const float *pcm,
427  int frame_size,
428  unsigned char *data,
429  opus_int32 max_data_bytes
430 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
431 
436 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
437 
450 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
451 
472 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
473  int streams,
474  int coupled_streams
475 );
476 
506 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
507  opus_int32 Fs,
508  int channels,
509  int streams,
510  int coupled_streams,
511  const unsigned char *mapping,
512  int *error
513 ) OPUS_ARG_NONNULL(5);
514 
549 OPUS_EXPORT int opus_multistream_decoder_init(
550  OpusMSDecoder *st,
551  opus_int32 Fs,
552  int channels,
553  int streams,
554  int coupled_streams,
555  const unsigned char *mapping
556 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
557 
587 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
588  OpusMSDecoder *st,
589  const unsigned char *data,
590  opus_int32 len,
591  opus_int16 *pcm,
592  int frame_size,
593  int decode_fec
594 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
595 
625 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
626  OpusMSDecoder *st,
627  const unsigned char *data,
628  opus_int32 len,
629  float *pcm,
630  int frame_size,
631  int decode_fec
632 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
633 
646 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
647 
652 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
653 
658 #ifdef __cplusplus
659 }
660 #endif
661 
662 #endif /* OPUS_MULTISTREAM_H */

Documentation feedback | Developer Zone | Subscribe | Updated