Opus
IETF low-delay audio codec: API and operations manual
1.0.1-rc2
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 
00042 typedef struct OpusMSEncoder OpusMSEncoder;
00043 typedef struct OpusMSDecoder OpusMSDecoder;
00044 
00045 #define __opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
00046 #define __opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
00047 
00048 #define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120
00049 #define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122
00050 
00051 #define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
00052 #define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
00053 
00057 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
00058       opus_int32 Fs,            
00059       int channels,             
00060       int streams,              
00061       int coupled_streams,      
00062       const unsigned char *mapping, 
00063       int application,          
00064       int *error                
00065 ) OPUS_ARG_NONNULL(5);
00066 
00068 OPUS_EXPORT int opus_multistream_encoder_init(
00069       OpusMSEncoder *st,        
00070       opus_int32 Fs,            
00071       int channels,             
00072       int streams,              
00073       int coupled_streams,      
00074       const unsigned char *mapping, 
00075       int application           
00076 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
00077 
00079 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
00080     OpusMSEncoder *st,          
00081     const opus_int16 *pcm,      
00082     int frame_size,             
00083     unsigned char *data,        
00084     opus_int32 max_data_bytes   
00085 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00086 
00088 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
00089       OpusMSEncoder *st,        
00090       const float *pcm,         
00091       int frame_size,           
00092       unsigned char *data,      
00093       opus_int32 max_data_bytes 
00094 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00095 
00099 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size(
00100       int streams,              
00101       int coupled_streams       
00102 );
00103 
00105 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
00106 
00108 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00109 
00113 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
00114       opus_int32 Fs,            
00115       int channels,             
00116       int streams,              
00117       int coupled_streams,      
00118       const unsigned char *mapping, 
00119       int *error                
00120 ) OPUS_ARG_NONNULL(5);
00121 
00123 OPUS_EXPORT int opus_multistream_decoder_init(
00124       OpusMSDecoder *st,        
00125       opus_int32 Fs,            
00126       int channels,             
00127       int streams,              
00128       int coupled_streams,      
00129       const unsigned char *mapping  
00130 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
00131 
00133 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
00134     OpusMSDecoder *st,          
00135     const unsigned char *data,  
00136     opus_int32 len,             
00137     opus_int16 *pcm,            
00138     int frame_size,             
00139     int decode_fec              
00141 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00142 
00144 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
00145     OpusMSDecoder *st,          
00146     const unsigned char *data,  
00147     opus_int32 len,             
00148     float *pcm,                 
00149     int frame_size,             
00150     int decode_fec              
00152 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00153 
00157 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
00158       int streams,              
00159       int coupled_streams       
00160 );
00161 
00163 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00164 
00166 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
00167 
00168 #ifdef __cplusplus
00169 }
00170 #endif
00171 
00172 #endif /* OPUS_MULTISTREAM_H */
 All Files Functions Typedefs Defines
For more information visit the Opus Website.