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 
00028 
00029 
00030 
00031 
00032 
00038 #ifndef OPUS_H
00039 #define OPUS_H
00040 
00041 #include "opus_types.h"
00042 #include "opus_defines.h"
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00163 typedef struct OpusEncoder OpusEncoder;
00164 
00165 OPUS_EXPORT int opus_encoder_get_size(int channels);
00166 
00198 OPUS_EXPORT OpusEncoder *opus_encoder_create(
00199     opus_int32 Fs,
00200     int channels,
00201     int application,
00202     int *error
00203 );
00204 
00216 OPUS_EXPORT int opus_encoder_init(
00217     OpusEncoder *st,
00218     opus_int32 Fs,
00219     int channels,
00220     int application
00221 );
00222 
00235 OPUS_EXPORT int opus_encode(
00236     OpusEncoder *st,
00237     const opus_int16 *pcm,
00238     int frame_size,
00239     unsigned char *data,
00240     int max_data_bytes
00241 );
00242 
00255 OPUS_EXPORT int opus_encode_float(
00256     OpusEncoder *st,
00257     const float *pcm,
00258     int frame_size,
00259     unsigned char *data,
00260     int max_data_bytes
00261 );
00262 
00266 OPUS_EXPORT void opus_encoder_destroy(OpusEncoder *st);
00267 
00274 OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...);
00332 typedef struct OpusDecoder OpusDecoder;
00333 
00338 OPUS_EXPORT int opus_decoder_get_size(int channels);
00339 
00345 OPUS_EXPORT OpusDecoder *opus_decoder_create(
00346     opus_int32 Fs,
00347     int channels,
00348     int *error
00349 );
00350 
00360 OPUS_EXPORT int opus_decoder_init(
00361     OpusDecoder *st,
00362     opus_int32 Fs,
00363     int channels
00364 );
00365 
00378 OPUS_EXPORT int opus_decode(
00379     OpusDecoder *st,
00380     const unsigned char *data,
00381     int len,
00382     opus_int16 *pcm,
00383     int frame_size,
00384     int decode_fec
00385 );
00386 
00399 OPUS_EXPORT int opus_decode_float(
00400     OpusDecoder *st,
00401     const unsigned char *data,
00402     int len,
00403     float *pcm,
00404     int frame_size,
00405     int decode_fec
00406 );
00407 
00414 OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...);
00415 
00419 OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st);
00420 
00434 OPUS_EXPORT int opus_packet_parse(
00435    const unsigned char *data,
00436    int len,
00437    unsigned char *out_toc,
00438    const unsigned char *frames[48],
00439    short size[48],
00440    int *payload_offset
00441 );
00442 
00452 OPUS_EXPORT int opus_packet_get_bandwidth(const unsigned char *data);
00453 
00460 OPUS_EXPORT int opus_packet_get_samples_per_frame(const unsigned char *data, opus_int32 Fs);
00461 
00467 OPUS_EXPORT int opus_packet_get_nb_channels(const unsigned char *data);
00468 
00475 OPUS_EXPORT int opus_packet_get_nb_frames(const unsigned char packet[], int len);
00476 
00484 OPUS_EXPORT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const unsigned char packet[], int len);
00495 typedef struct OpusRepacketizer OpusRepacketizer;
00496 
00497 OPUS_EXPORT int opus_repacketizer_get_size(void);
00498 
00499 OPUS_EXPORT OpusRepacketizer *opus_repacketizer_init(OpusRepacketizer *rp);
00500 
00501 OPUS_EXPORT OpusRepacketizer *opus_repacketizer_create(void);
00502 
00503 OPUS_EXPORT void opus_repacketizer_destroy(OpusRepacketizer *rp);
00504 
00505 OPUS_EXPORT int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, int len);
00506 
00507 OPUS_EXPORT opus_int32 opus_repacketizer_out_range(OpusRepacketizer *rp, int begin, int end, unsigned char *data, int maxlen);
00508 
00509 OPUS_EXPORT int opus_repacketizer_get_nb_frames(OpusRepacketizer *rp);
00510 
00511 OPUS_EXPORT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, int maxlen);
00512 
00515 #ifdef __cplusplus
00516 }
00517 #endif
00518 
00519 #endif