Opus
IETF low-delay audio codec: API and operations manual
1.0.3
opus_multistream.h
Go to the documentation of this file.
00001 /* Copyright (c) 2011 Xiph.Org Foundation
00002    Written by Jean-Marc Valin */
00003 /*
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions
00006    are met:
00007 
00008    - Redistributions of source code must retain the above copyright
00009    notice, this list of conditions and the following disclaimer.
00010 
00011    - Redistributions in binary form must reproduce the above copyright
00012    notice, this list of conditions and the following disclaimer in the
00013    documentation and/or other materials provided with the distribution.
00014 
00015    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00016    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00017    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00018    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00019    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00020    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00021    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00022    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00023    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00024    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 */
00027 
00033 #ifndef OPUS_MULTISTREAM_H
00034 #define OPUS_MULTISTREAM_H
00035 
00036 #include "opus.h"
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00047 #define __opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
00048 #define __opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
00049 
00055 #define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120
00056 #define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122
00057 
00086 #define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
00087 
00099 #define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
00100 
00175 typedef struct OpusMSEncoder OpusMSEncoder;
00176 
00183 typedef struct OpusMSDecoder OpusMSDecoder;
00184 
00203 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size(
00204       int streams,
00205       int coupled_streams
00206 );
00207 
00208 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_surround_encoder_get_size(
00209       int channels,
00210       int mapping_family
00211 );
00212 
00213 
00257 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
00258       opus_int32 Fs,
00259       int channels,
00260       int streams,
00261       int coupled_streams,
00262       const unsigned char *mapping,
00263       int application,
00264       int *error
00265 ) OPUS_ARG_NONNULL(5);
00266 
00267 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_surround_encoder_create(
00268       opus_int32 Fs,
00269       int channels,
00270       int mapping_family,
00271       int *streams,
00272       int *coupled_streams,
00273       unsigned char *mapping,
00274       int application,
00275       int *error
00276 ) OPUS_ARG_NONNULL(5);
00277 
00326 OPUS_EXPORT int opus_multistream_encoder_init(
00327       OpusMSEncoder *st,
00328       opus_int32 Fs,
00329       int channels,
00330       int streams,
00331       int coupled_streams,
00332       const unsigned char *mapping,
00333       int application
00334 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
00335 
00336 OPUS_EXPORT int opus_multistream_surround_encoder_init(
00337       OpusMSEncoder *st,
00338       opus_int32 Fs,
00339       int channels,
00340       int mapping_family,
00341       int *streams,
00342       int *coupled_streams,
00343       unsigned char *mapping,
00344       int application
00345 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
00346 
00377 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
00378     OpusMSEncoder *st,
00379     const opus_int16 *pcm,
00380     int frame_size,
00381     unsigned char *data,
00382     opus_int32 max_data_bytes
00383 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00384 
00422 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
00423       OpusMSEncoder *st,
00424       const float *pcm,
00425       int frame_size,
00426       unsigned char *data,
00427       opus_int32 max_data_bytes
00428 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00429 
00434 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
00435 
00448 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00449 
00470 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
00471       int streams,
00472       int coupled_streams
00473 );
00474 
00504 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
00505       opus_int32 Fs,
00506       int channels,
00507       int streams,
00508       int coupled_streams,
00509       const unsigned char *mapping,
00510       int *error
00511 ) OPUS_ARG_NONNULL(5);
00512 
00547 OPUS_EXPORT int opus_multistream_decoder_init(
00548       OpusMSDecoder *st,
00549       opus_int32 Fs,
00550       int channels,
00551       int streams,
00552       int coupled_streams,
00553       const unsigned char *mapping
00554 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
00555 
00585 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
00586     OpusMSDecoder *st,
00587     const unsigned char *data,
00588     opus_int32 len,
00589     opus_int16 *pcm,
00590     int frame_size,
00591     int decode_fec
00592 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00593 
00623 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
00624     OpusMSDecoder *st,
00625     const unsigned char *data,
00626     opus_int32 len,
00627     float *pcm,
00628     int frame_size,
00629     int decode_fec
00630 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00631 
00644 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00645 
00650 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
00651 
00656 #ifdef __cplusplus
00657 }
00658 #endif
00659 
00660 #endif /* OPUS_MULTISTREAM_H */
 All Files Functions Typedefs Defines
For more information visit the Opus Website.