Opus
IETF low-delay audio codec: API and operations manual
1.0.2
 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 
203 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size(
204  int streams,
205  int coupled_streams
206 );
207 
251 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
252  opus_int32 Fs,
253  int channels,
254  int streams,
255  int coupled_streams,
256  const unsigned char *mapping,
257  int application,
258  int *error
259 ) OPUS_ARG_NONNULL(5);
260 
309 OPUS_EXPORT int opus_multistream_encoder_init(
310  OpusMSEncoder *st,
311  opus_int32 Fs,
312  int channels,
313  int streams,
314  int coupled_streams,
315  const unsigned char *mapping,
316  int application
317 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
318 
349 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
350  OpusMSEncoder *st,
351  const opus_int16 *pcm,
352  int frame_size,
353  unsigned char *data,
354  opus_int32 max_data_bytes
355 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
356 
394 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
395  OpusMSEncoder *st,
396  const float *pcm,
397  int frame_size,
398  unsigned char *data,
399  opus_int32 max_data_bytes
400 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
401 
406 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
407 
420 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
421 
442 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
443  int streams,
444  int coupled_streams
445 );
446 
476 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
477  opus_int32 Fs,
478  int channels,
479  int streams,
480  int coupled_streams,
481  const unsigned char *mapping,
482  int *error
483 ) OPUS_ARG_NONNULL(5);
484 
519 OPUS_EXPORT int opus_multistream_decoder_init(
520  OpusMSDecoder *st,
521  opus_int32 Fs,
522  int channels,
523  int streams,
524  int coupled_streams,
525  const unsigned char *mapping
526 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
527 
557 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
558  OpusMSDecoder *st,
559  const unsigned char *data,
560  opus_int32 len,
561  opus_int16 *pcm,
562  int frame_size,
563  int decode_fec
564 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
565 
595 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
596  OpusMSDecoder *st,
597  const unsigned char *data,
598  opus_int32 len,
599  float *pcm,
600  int frame_size,
601  int decode_fec
602 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
603 
616 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
617 
622 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
623 
628 #ifdef __cplusplus
629 }
630 #endif
631 
632 #endif /* OPUS_MULTISTREAM_H */
For more information visit the Opus Website.