Opus
IETF low-delay audio codec: API and operations manual
1.0.2
 All Files Functions Typedefs Defines
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 
00251 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
00252       opus_int32 Fs,
00253       int channels,
00254       int streams,
00255       int coupled_streams,
00256       const unsigned char *mapping,
00257       int application,
00258       int *error
00259 ) OPUS_ARG_NONNULL(5);
00260 
00309 OPUS_EXPORT int opus_multistream_encoder_init(
00310       OpusMSEncoder *st,
00311       opus_int32 Fs,
00312       int channels,
00313       int streams,
00314       int coupled_streams,
00315       const unsigned char *mapping,
00316       int application
00317 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
00318 
00349 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
00350     OpusMSEncoder *st,
00351     const opus_int16 *pcm,
00352     int frame_size,
00353     unsigned char *data,
00354     opus_int32 max_data_bytes
00355 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00356 
00394 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
00395       OpusMSEncoder *st,
00396       const float *pcm,
00397       int frame_size,
00398       unsigned char *data,
00399       opus_int32 max_data_bytes
00400 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00401 
00406 OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
00407 
00420 OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00421 
00442 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
00443       int streams,
00444       int coupled_streams
00445 );
00446 
00476 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
00477       opus_int32 Fs,
00478       int channels,
00479       int streams,
00480       int coupled_streams,
00481       const unsigned char *mapping,
00482       int *error
00483 ) OPUS_ARG_NONNULL(5);
00484 
00519 OPUS_EXPORT int opus_multistream_decoder_init(
00520       OpusMSDecoder *st,
00521       opus_int32 Fs,
00522       int channels,
00523       int streams,
00524       int coupled_streams,
00525       const unsigned char *mapping
00526 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
00527 
00557 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
00558     OpusMSDecoder *st,
00559     const unsigned char *data,
00560     opus_int32 len,
00561     opus_int16 *pcm,
00562     int frame_size,
00563     int decode_fec
00564 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00565 
00595 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
00596     OpusMSDecoder *st,
00597     const unsigned char *data,
00598     opus_int32 len,
00599     float *pcm,
00600     int frame_size,
00601     int decode_fec
00602 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00603 
00616 OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00617 
00622 OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);
00623 
00628 #ifdef __cplusplus
00629 }
00630 #endif
00631 
00632 #endif /* OPUS_MULTISTREAM_H */
For more information visit the Opus Website.