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_H
00034 #define OPUS_H
00035
00036 #include "opus_types.h"
00037 #include "opus_defines.h"
00038
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042
00162 typedef struct OpusEncoder OpusEncoder;
00163
00164 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_encoder_get_size(int channels);
00165
00199 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusEncoder *opus_encoder_create(
00200 opus_int32 Fs,
00201 int channels,
00202 int application,
00203 int *error
00204 );
00205
00217 OPUS_EXPORT int opus_encoder_init(
00218 OpusEncoder *st,
00219 opus_int32 Fs,
00220 int channels,
00221 int application
00222 ) OPUS_ARG_NONNULL(1);
00223
00236 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode(
00237 OpusEncoder *st,
00238 const opus_int16 *pcm,
00239 int frame_size,
00240 unsigned char *data,
00241 opus_int32 max_data_bytes
00242 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00243
00261 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode_float(
00262 OpusEncoder *st,
00263 const float *pcm,
00264 int frame_size,
00265 unsigned char *data,
00266 opus_int32 max_data_bytes
00267 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
00268
00272 OPUS_EXPORT void opus_encoder_destroy(OpusEncoder *st);
00273
00280 OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00351 typedef struct OpusDecoder OpusDecoder;
00352
00357 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decoder_get_size(int channels);
00358
00372 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusDecoder *opus_decoder_create(
00373 opus_int32 Fs,
00374 int channels,
00375 int *error
00376 );
00377
00387 OPUS_EXPORT int opus_decoder_init(
00388 OpusDecoder *st,
00389 opus_int32 Fs,
00390 int channels
00391 ) OPUS_ARG_NONNULL(1);
00392
00405 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode(
00406 OpusDecoder *st,
00407 const unsigned char *data,
00408 opus_int32 len,
00409 opus_int16 *pcm,
00410 int frame_size,
00411 int decode_fec
00412 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00413
00426 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode_float(
00427 OpusDecoder *st,
00428 const unsigned char *data,
00429 opus_int32 len,
00430 float *pcm,
00431 int frame_size,
00432 int decode_fec
00433 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00434
00441 OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
00442
00446 OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st);
00447
00461 OPUS_EXPORT int opus_packet_parse(
00462 const unsigned char *data,
00463 opus_int32 len,
00464 unsigned char *out_toc,
00465 const unsigned char *frames[48],
00466 short size[48],
00467 int *payload_offset
00468 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00469
00479 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_bandwidth(const unsigned char *data) OPUS_ARG_NONNULL(1);
00480
00487 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_samples_per_frame(const unsigned char *data, opus_int32 Fs) OPUS_ARG_NONNULL(1);
00488
00494 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_channels(const unsigned char *data) OPUS_ARG_NONNULL(1);
00495
00502 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_frames(const unsigned char packet[], opus_int32 len) OPUS_ARG_NONNULL(1);
00503
00511 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const unsigned char packet[], opus_int32 len) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
00522 typedef struct OpusRepacketizer OpusRepacketizer;
00523
00524 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_size(void);
00525
00526 OPUS_EXPORT OpusRepacketizer *opus_repacketizer_init(OpusRepacketizer *rp) OPUS_ARG_NONNULL(1);
00527
00528 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusRepacketizer *opus_repacketizer_create(void);
00529
00530 OPUS_EXPORT void opus_repacketizer_destroy(OpusRepacketizer *rp);
00531
00532 OPUS_EXPORT int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, opus_int32 len) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
00533
00534 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out_range(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
00535
00536 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_nb_frames(OpusRepacketizer *rp) OPUS_ARG_NONNULL(1);
00537
00538 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1);
00539
00542 #ifdef __cplusplus
00543 }
00544 #endif
00545
00546 #endif