opus.h   opus.h 
skipping to change at line 31 skipping to change at line 31
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef OPUS_H #ifndef OPUS_H
#define OPUS_H #define OPUS_H
#include "opus_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if defined(__GNUC__) && defined(OPUS_BUILD) #if defined(__GNUC__) && defined(OPUS_BUILD)
#define OPUS_EXPORT __attribute__ ((visibility ("default"))) #define OPUS_EXPORT __attribute__ ((visibility ("default")))
#elif defined(WIN32) #elif defined(WIN32)
#define OPUS_EXPORT __declspec(dllexport) #define OPUS_EXPORT __declspec(dllexport)
#else #else
#define OPUS_EXPORT #define OPUS_EXPORT
skipping to change at line 64 skipping to change at line 66
#define OPUS_INTERNAL_ERROR -3 #define OPUS_INTERNAL_ERROR -3
/** The data passed (e.g. compressed data to decoder) is corrupted */ /** The data passed (e.g. compressed data to decoder) is corrupted */
#define OPUS_CORRUPTED_DATA -4 #define OPUS_CORRUPTED_DATA -4
/** Invalid/unsupported request number */ /** Invalid/unsupported request number */
#define OPUS_UNIMPLEMENTED -5 #define OPUS_UNIMPLEMENTED -5
/** An encoder or decoder structure is invalid or already freed */ /** An encoder or decoder structure is invalid or already freed */
#define OPUS_INVALID_STATE -6 #define OPUS_INVALID_STATE -6
/** Memory allocation has failed */ /** Memory allocation has failed */
#define OPUS_ALLOC_FAIL -7 #define OPUS_ALLOC_FAIL -7
#define OPUS_TEST_RANGE_CODER_STATE 1
#define OPUS_BITRATE_AUTO -1 #define OPUS_BITRATE_AUTO -1
#define OPUS_APPLICATION_VOIP 2000 #define OPUS_APPLICATION_VOIP 2000
#define OPUS_APPLICATION_AUDIO 2001 #define OPUS_APPLICATION_AUDIO 2001
#define OPUS_SIGNAL_AUTO 3000 #define OPUS_SIGNAL_AUTO 3000
#define OPUS_SIGNAL_VOICE 3001 #define OPUS_SIGNAL_VOICE 3001
#define OPUS_SIGNAL_MUSIC 3002 #define OPUS_SIGNAL_MUSIC 3002
#define MODE_SILK_ONLY 1000 #define MODE_SILK_ONLY 1000
skipping to change at line 146 skipping to change at line 146
#define OPUS_SET_FORCE_MONO_REQUEST 22 #define OPUS_SET_FORCE_MONO_REQUEST 22
#define OPUS_SET_FORCE_MONO(x) OPUS_SET_FORCE_MONO_REQUEST, __check_int(x) #define OPUS_SET_FORCE_MONO(x) OPUS_SET_FORCE_MONO_REQUEST, __check_int(x)
#define OPUS_GET_FORCE_MONO_REQUEST 23 #define OPUS_GET_FORCE_MONO_REQUEST 23
#define OPUS_GET_FORCE_MONO(x) OPUS_GET_FORCE_MONO_REQUEST, __check_int_ptr (x) #define OPUS_GET_FORCE_MONO(x) OPUS_GET_FORCE_MONO_REQUEST, __check_int_ptr (x)
#define OPUS_SET_SIGNAL_REQUEST 24 #define OPUS_SET_SIGNAL_REQUEST 24
#define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, __check_int(x) #define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, __check_int(x)
#define OPUS_GET_SIGNAL_REQUEST 25 #define OPUS_GET_SIGNAL_REQUEST 25
#define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __check_int_ptr(x) #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __check_int_ptr(x)
#define OPUS_GET_LOOKAHEAD_REQUEST 27
#define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __check_int_ptr(x
)
typedef struct OpusEncoder OpusEncoder; typedef struct OpusEncoder OpusEncoder;
typedef struct OpusDecoder OpusDecoder; typedef struct OpusDecoder OpusDecoder;
/* /*
* There are two coding modes: * There are two coding modes:
* OPUS_MODE_VOICE gives best quality at a given bitrate for voice signals. * OPUS_APPLICATION_VOIP gives best quality at a given bitrate for voice
It enhances the * signals. It enhances the input signal by high-pass filtering and
* input signal by high-pass filtering and emphasizing formants and harm * emphasizing formants and harmonics. Optionally it includes in-band
onics. Optionally * forward error correction to protect against packet loss. Use this
* it includes in-band forward error correction to protect against packe * mode for typical VoIP applications. Because of the enhancement,
t loss. Use this * even at high bitrates the output may sound different from the input.
* mode for typical VoIP applications. Because of the enhancement, even * OPUS_APPLICATION_AUDIO gives best quality at a given bitrate for most
at high bitrates * non-voice signals like music. Use this mode for music and mixed
* the output may sound different from the input. * (music/voice) content, broadcast, and applications requiring less
* OPUS_MODE_AUDIO gives best quality at a given bitrate for most non-voice
signals like music.
* Use this mode for music and mixed (music/voice) content, and applicat
ions requiring less
* than 15 ms of coding delay. * than 15 ms of coding delay.
*/ */
/* Returns initialized encoder state */ /* Returns initialized encoder state */
OPUS_EXPORT OpusEncoder *opus_encoder_create( OPUS_EXPORT OpusEncoder *opus_encoder_create(
int Fs, /* Sampling rate of input signal (Hz) */ int Fs, /* Sampling rate of input signal (Hz) */
int channels, /* Number of channels (1/2) in input signal */ int channels, /* Number of channels (1/2) in input signal */
int application /* Coding mode (OPUS_APPLICATION_VOI P/OPUS_APPLICATION_AUDIO) */ int application /* Coding mode (OPUS_APPLICATION_VOIP/OPUS_ APPLICATION_AUDIO) */
); );
OPUS_EXPORT OpusEncoder *opus_encoder_init( OPUS_EXPORT OpusEncoder *opus_encoder_init(
OpusEncoder *st, /* Encoder state */ OpusEncoder *st, /* Encoder state */
int Fs, /* Sampling rate of input signal (Hz) */ int Fs, /* Sampling rate of input signal (Hz) */
int channels, /* Number of channels (1/2) in input signal */ int channels, /* Number of channels (1/2) in input signal */
int application /* Coding mode (OPUS_APPLICATION_VOI P/OPUS_APPLICATION_AUDIO) */ int application /* Coding mode (OPUS_APPLICATION_VOIP/OPUS_ APPLICATION_AUDIO) */
); );
/* returns length of data payload (in bytes) */ /* Returns length of the data payload (in bytes) */
OPUS_EXPORT int opus_encode( OPUS_EXPORT int opus_encode(
OpusEncoder *st, /* Encoder state */ OpusEncoder *st, /* Encoder state */
const short *pcm, /* Input signal (interleaved if 2 channels) . length is frame_size*channels */ const opus_int16 *pcm, /* Input signal (interleaved if 2 channels) . length is frame_size*channels */
int frame_size, /* Number of samples per frame of input sig nal */ int frame_size, /* Number of samples per frame of input sig nal */
unsigned char *data, /* Output payload (no more than max_data_by tes long) */ unsigned char *data, /* Output payload (no more than max_data_by tes long) */
int max_data_bytes /* Allocated memory for payload; don't use for controlling bitrate */ int max_data_bytes /* Allocated memory for payload; don't use for controlling bitrate */
); );
OPUS_EXPORT void opus_encoder_destroy(OpusEncoder *st); OPUS_EXPORT void opus_encoder_destroy(OpusEncoder *st);
OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...); OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...);
OPUS_EXPORT OpusDecoder *opus_decoder_create( OPUS_EXPORT OpusDecoder *opus_decoder_create(
int Fs, /* Sampling rate of output signal (Hz) */ int Fs, /* Sampling rate of output signal (Hz) */
int channels /* Number of channels (1/2) in output signa l */ int channels /* Number of channels (1/2) in output signa l */
); );
OPUS_EXPORT OpusDecoder *opus_decoder_init(OpusDecoder *st, OPUS_EXPORT OpusDecoder *opus_decoder_init(OpusDecoder *st,
int Fs, /* Sampling rate of output signal (Hz) */ int Fs, /* Sampling rate of output signal (Hz) */
int channels /* Number of channels (1/2) in output signa l */ int channels /* Number of channels (1/2) in output signa l */
); );
/* returns (CELT) error code */ /* Returns the number of samples decoded or a negative error code */
OPUS_EXPORT int opus_decode( OPUS_EXPORT int opus_decode(
OpusDecoder *st, /* Decoder state */ OpusDecoder *st, /* Decoder state */
const unsigned char *data, /* Input payload. Use a NULL pointer to ind icate packet loss */ const unsigned char *data, /* Input payload. Use a NULL pointer to ind icate packet loss */
int len, /* Number of bytes in payload */ int len, /* Number of bytes in payload */
short *pcm, /* Output signal (interleaved if 2 channels ). length is frame_size*channels */ opus_int16 *pcm, /* Output signal (interleaved if 2 channels ). length is frame_size*channels */
int frame_size, /* Number of samples per frame of input sig nal */ int frame_size, /* Number of samples per frame of input sig nal */
int decode_fec /* Flag (0/1) to request that any in-band f orward error correction data be */ int decode_fec /* Flag (0/1) to request that any in-band f orward error correction data be */
/* decoded. If no such data is available th e frame is decoded as if it were lost. */ /* decoded. If no such data is available th e frame is decoded as if it were lost. */
); );
OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...); OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...);
OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st); OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st);
OPUS_EXPORT int opus_packet_parse(const unsigned char *data, int len,
unsigned char *out_toc, const unsigned char *frames[48],
short size[48], const unsigned char **payload);
OPUS_EXPORT int opus_packet_get_bandwidth(const unsigned char *data); OPUS_EXPORT int opus_packet_get_bandwidth(const unsigned char *data);
OPUS_EXPORT int opus_packet_get_samples_per_frame(const unsigned char *data , int Fs); OPUS_EXPORT int opus_packet_get_samples_per_frame(const unsigned char *data , int Fs);
OPUS_EXPORT int opus_packet_get_nb_channels(const unsigned char *data); OPUS_EXPORT int opus_packet_get_nb_channels(const unsigned char *data);
OPUS_EXPORT int opus_packet_get_nb_frames(const unsigned char packet[], int len); OPUS_EXPORT int opus_packet_get_nb_frames(const unsigned char packet[], int len);
OPUS_EXPORT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const u nsigned char packet[], int len); OPUS_EXPORT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const u nsigned char packet[], int len);
OPUS_EXPORT const char *opus_strerror(int error); OPUS_EXPORT const char *opus_strerror(int error);
/* For testing purposes: the encoder and decoder state should always be ide OPUS_EXPORT const char *opus_get_version_string(void);
ntical after coding a payload */
#if OPUS_TEST_RANGE_CODER_STATE /* For testing purposes: the encoder and decoder state should
always be identical after coding a payload */
OPUS_EXPORT int opus_encoder_get_final_range(OpusEncoder *st); OPUS_EXPORT int opus_encoder_get_final_range(OpusEncoder *st);
OPUS_EXPORT int opus_decoder_get_final_range(OpusDecoder *st); OPUS_EXPORT int opus_decoder_get_final_range(OpusDecoder *st);
#endif
/* Repacketizer */
typedef struct OpusRepacketizer OpusRepacketizer;
OPUS_EXPORT int opus_repacketizer_get_size(void);
OPUS_EXPORT OpusRepacketizer *opus_repacketizer_init(OpusRepacketizer *rp);
OPUS_EXPORT OpusRepacketizer *opus_repacketizer_create(void);
OPUS_EXPORT void opus_repacketizer_destroy(OpusRepacketizer *rp);
OPUS_EXPORT int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned
char *data, int len);
OPUS_EXPORT int opus_repacketizer_out_range(OpusRepacketizer *rp, int begin
, int end, unsigned char *data, int maxlen);
OPUS_EXPORT int opus_repacketizer_get_nb_frames(OpusRepacketizer *rp);
OPUS_EXPORT int opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *
data, int maxlen);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* OPUS_H */ #endif /* OPUS_H */
 End of changes. 13 change blocks. 
25 lines changed or deleted 51 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/