Opus
IETF low-delay audio codec: API and operations manual
1.0.3
 All Files Functions Typedefs Macros Groups Pages
opus_multistream.h
Go to the documentation of this file.
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 
86 #define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
87 
99 #define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
100 
176 
184 
204  int streams,
205  int coupled_streams
206 );
207 
209  int channels,
210  int mapping_family
211 );
212 
213 
258  opus_int32 Fs,
259  int channels,
260  int streams,
261  int coupled_streams,
262  const unsigned char *mapping,
263  int application,
264  int *error
265 ) OPUS_ARG_NONNULL(5);
266 
268  opus_int32 Fs,
269  int channels,
270  int mapping_family,
271  int *streams,
272  int *coupled_streams,
273  unsigned char *mapping,
274  int application,
275  int *error
276 ) OPUS_ARG_NONNULL(5);
277 
326 OPUS_EXPORT int opus_multistream_encoder_init(
327  OpusMSEncoder *st,
328  opus_int32 Fs,
329  int channels,
330  int streams,
331  int coupled_streams,
332  const unsigned char *mapping,
333  int application
334 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
335 
337  OpusMSEncoder *st,
338  opus_int32 Fs,
339  int channels,
340  int mapping_family,
341  int *streams,
342  int *coupled_streams,
343  unsigned char *mapping,
344  int application
345 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
346 
377 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
378  OpusMSEncoder *st,
379  const opus_int16 *pcm,
380  int frame_size,
381  unsigned char *data,
382  opus_int32 max_data_bytes
383 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
384 
422 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
423  OpusMSEncoder *st,
424  const float *pcm,
425  int frame_size,
426  unsigned char *data,
427  opus_int32 max_data_bytes
428 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
429 
434 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
435 
448 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
449 
470 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
471  int streams,
472  int coupled_streams
473 );
474 
504 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
505  opus_int32 Fs,
506  int channels,
507  int streams,
508  int coupled_streams,
509  const unsigned char *mapping,
510  int *error
511 ) OPUS_ARG_NONNULL(5);
512 
547 OPUS_EXPORT int opus_multistream_decoder_init(
548  OpusMSDecoder *st,
549  opus_int32 Fs,
550  int channels,
551  int streams,
552  int coupled_streams,
553  const unsigned char *mapping
554 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
555 
585 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
586  OpusMSDecoder *st,
587  const unsigned char *data,
588  opus_int32 len,
589  opus_int16 *pcm,
590  int frame_size,
591  int decode_fec
592 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
593 
623 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
624  OpusMSDecoder *st,
625  const unsigned char *data,
626  opus_int32 len,
627  float *pcm,
628  int frame_size,
629  int decode_fec
630 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
631 
644 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
645 
650 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
651 
656 #ifdef __cplusplus
657 }
658 #endif
659 
660 #endif /* OPUS_MULTISTREAM_H */
For more information visit the Opus Website.