Opus
IETF low-delay audio codec: API and operations manual
1.0.1
 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 
44 
45 #define __opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
46 #define __opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
47 
48 #define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120
49 #define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122
50 
51 #define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
52 #define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
53 
57 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
58  opus_int32 Fs,
59  int channels,
60  int streams,
61  int coupled_streams,
62  const unsigned char *mapping,
63  int application,
64  int *error
65 ) OPUS_ARG_NONNULL(5);
66 
68 OPUS_EXPORT int opus_multistream_encoder_init(
69  OpusMSEncoder *st,
70  opus_int32 Fs,
71  int channels,
72  int streams,
73  int coupled_streams,
74  const unsigned char *mapping,
75  int application
76 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
77 
79 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
80  OpusMSEncoder *st,
81  const opus_int16 *pcm,
82  int frame_size,
83  unsigned char *data,
84  opus_int32 max_data_bytes
85 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
86 
88 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
89  OpusMSEncoder *st,
90  const float *pcm,
91  int frame_size,
92  unsigned char *data,
93  opus_int32 max_data_bytes
94 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
95 
99 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size(
100  int streams,
101  int coupled_streams
102 );
103 
105 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
106 
108 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
109 
113 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
114  opus_int32 Fs,
115  int channels,
116  int streams,
117  int coupled_streams,
118  const unsigned char *mapping,
119  int *error
120 ) OPUS_ARG_NONNULL(5);
121 
123 OPUS_EXPORT int opus_multistream_decoder_init(
124  OpusMSDecoder *st,
125  opus_int32 Fs,
126  int channels,
127  int streams,
128  int coupled_streams,
129  const unsigned char *mapping
130 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
131 
133 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
134  OpusMSDecoder *st,
135  const unsigned char *data,
136  opus_int32 len,
137  opus_int16 *pcm,
138  int frame_size,
139  int decode_fec
141 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
142 
144 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
145  OpusMSDecoder *st,
146  const unsigned char *data,
147  opus_int32 len,
148  float *pcm,
149  int frame_size,
150  int decode_fec
152 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
153 
157 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
158  int streams,
159  int coupled_streams
160 );
161 
163 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
164 
166 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* OPUS_MULTISTREAM_H */
For more information visit the Opus Website.