00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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