Opus  0.9.14
IETFlow-delayaudiocodec
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 typedef struct OpusMSEncoder OpusMSEncoder;
00039 typedef struct OpusMSDecoder OpusMSDecoder;
00040 
00041 #define __opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
00042 #define __opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
00043 
00044 #define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120
00045 #define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122
00046 
00047 #define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
00048 #define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
00049 
00053 OPUS_EXPORT OpusMSEncoder *opus_multistream_encoder_create(
00054       opus_int32 Fs,            
00055       int channels,             
00056       int streams,              
00057       int coupled_streams,      
00058       const unsigned char *mapping, 
00059       int application,          
00060       int *error                
00061 );
00062 
00064 OPUS_EXPORT int opus_multistream_encoder_init(
00065       OpusMSEncoder *st,        
00066       opus_int32 Fs,            
00067       int channels,             
00068       int streams,              
00069       int coupled_streams,      
00070       const unsigned char *mapping, 
00071       int application           
00072 );
00073 
00075 OPUS_EXPORT int opus_multistream_encode(
00076     OpusMSEncoder *st,          
00077     const opus_int16 *pcm,      
00078     int frame_size,             
00079     unsigned char *data,        
00080     opus_int32 max_data_bytes   
00081 );
00082 
00084 OPUS_EXPORT int opus_multistream_encode_float(
00085       OpusMSEncoder *st,        
00086       const float *pcm,         
00087       int frame_size,           
00088       unsigned char *data,      
00089       opus_int32 max_data_bytes 
00090   );
00091 
00095 OPUS_EXPORT opus_int32 opus_multistream_encoder_get_size(
00096       int streams,              
00097       int coupled_streams       
00098 );
00099 
00101 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
00102 
00104 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...);
00105 
00109 OPUS_EXPORT OpusMSDecoder *opus_multistream_decoder_create(
00110       opus_int32 Fs,            
00111       int channels,             
00112       int streams,              
00113       int coupled_streams,      
00114       const unsigned char *mapping, 
00115       int *error                
00116 );
00117 
00119 OPUS_EXPORT int opus_multistream_decoder_init(
00120       OpusMSDecoder *st,        
00121       opus_int32 Fs,            
00122       int channels,             
00123       int streams,              
00124       int coupled_streams,      
00125       const unsigned char *mapping  
00126 );
00127 
00129 OPUS_EXPORT int opus_multistream_decode(
00130     OpusMSDecoder *st,          
00131     const unsigned char *data,  
00132     opus_int32 len,             
00133     opus_int16 *pcm,            
00134     int frame_size,             
00135     int decode_fec              
00137 );
00138 
00140 OPUS_EXPORT int opus_multistream_decode_float(
00141     OpusMSDecoder *st,          
00142     const unsigned char *data,  
00143     opus_int32 len,             
00144     float *pcm,                 
00145     int frame_size,             
00146     int decode_fec              
00148 );
00149 
00153 OPUS_EXPORT opus_int32 opus_multistream_decoder_get_size(
00154       int streams,              
00155       int coupled_streams       
00156 );
00157 
00159 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...);
00160 
00162 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
00163 
00164 #endif /* OPUS_MULTISTREAM_H */
 All Files Functions Typedefs Defines