opus.h | opus.h | |||
---|---|---|---|---|
skipping to change at line 264 | skipping to change at line 264 | |||
unsigned char *data, | unsigned char *data, | |||
int max_data_bytes | int max_data_bytes | |||
); | ); | |||
/** Frees an OpusEncoder allocated by opus_encoder_create. | /** Frees an OpusEncoder allocated by opus_encoder_create. | |||
* @param[in] st <tt>OpusEncoder*</tt>: State to be freed. | * @param[in] st <tt>OpusEncoder*</tt>: State to be freed. | |||
*/ | */ | |||
OPUS_EXPORT void opus_encoder_destroy(OpusEncoder *st); | OPUS_EXPORT void opus_encoder_destroy(OpusEncoder *st); | |||
/** Perform a CTL function on an Opus encoder. | /** Perform a CTL function on an Opus encoder. | |||
* | ||||
* Generally the request and subsequent arguments are generated | ||||
* by a convenience macro. | ||||
* @see encoderctls | * @see encoderctls | |||
*/ | */ | |||
OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...); | OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...); | |||
/**@}*/ | /**@}*/ | |||
/** @defgroup opusdecoder Opus Decoder | /** @defgroup opusdecoder Opus Decoder | |||
* @{ | * @{ | |||
* | * | |||
* | * | |||
* The decoding process also starts with creating a decoder | * The decoding process also starts with creating a decoder | |||
skipping to change at line 401 | skipping to change at line 404 | |||
OPUS_EXPORT int opus_decode_float( | OPUS_EXPORT int opus_decode_float( | |||
OpusDecoder *st, | OpusDecoder *st, | |||
const unsigned char *data, | const unsigned char *data, | |||
int len, | int len, | |||
float *pcm, | float *pcm, | |||
int frame_size, | int frame_size, | |||
int decode_fec | int decode_fec | |||
); | ); | |||
/** Perform a CTL function on an Opus decoder. | /** Perform a CTL function on an Opus decoder. | |||
* @see decoderctls | * | |||
* Generally the request and subsequent arguments are generated | ||||
* by a convenience macro. | ||||
* @see genericctls | ||||
*/ | */ | |||
OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...); | OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...); | |||
/** Frees an OpusDecoder allocated by opus_decoder_create. | /** Frees an OpusDecoder allocated by opus_decoder_create. | |||
* @param[in] st <tt>OpusDecoder*</tt>: State to be freed. | * @param[in] st <tt>OpusDecoder*</tt>: State to be freed. | |||
*/ | */ | |||
OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st); | OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st); | |||
/** Parse an opus packet into one or more frames. | /** Parse an opus packet into one or more frames. | |||
* Opus_decode will perform this operation internally so most applications do | * Opus_decode will perform this operation internally so most applications do | |||
skipping to change at line 458 | skipping to change at line 464 | |||
*/ | */ | |||
OPUS_EXPORT int opus_packet_get_samples_per_frame(const unsigned char *data , opus_int32 Fs); | OPUS_EXPORT int opus_packet_get_samples_per_frame(const unsigned char *data , opus_int32 Fs); | |||
/** Gets the number of channels from an Opus packet. | /** Gets the number of channels from an Opus packet. | |||
* @param [in] data <tt>char*</tt>: Opus packet | * @param [in] data <tt>char*</tt>: Opus packet | |||
* @returns Number of channels | * @returns Number of channels | |||
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type | |||
*/ | */ | |||
OPUS_EXPORT int opus_packet_get_nb_channels(const unsigned char *data); | OPUS_EXPORT int opus_packet_get_nb_channels(const unsigned char *data); | |||
/** Gets the number of frame in an Opus packet. | /** Gets the number of frames in an Opus packet. | |||
* @param [in] packet <tt>char*</tt>: Opus packet | * @param [in] packet <tt>char*</tt>: Opus packet | |||
* @param [in] len <tt>int</tt>: Length of packet | * @param [in] len <tt>int</tt>: Length of packet | |||
* @returns Number of frames | * @returns Number of frames | |||
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type | |||
*/ | */ | |||
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); | |||
/** Gets the number of samples of an Opus packet. | /** Gets the number of samples of an Opus packet. | |||
* @param [in] dec <tt>OpusDecoder*</tt>: Decoder state | * @param [in] dec <tt>OpusDecoder*</tt>: Decoder state | |||
* @param [in] packet <tt>char*</tt>: Opus packet | * @param [in] packet <tt>char*</tt>: Opus packet | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 8 lines changed or added | |||
opus_defines.h | opus_defines.h | |||
---|---|---|---|---|
skipping to change at line 116 | skipping to change at line 116 | |||
#define OPUS_GET_FINAL_RANGE_REQUEST 4031 | #define OPUS_GET_FINAL_RANGE_REQUEST 4031 | |||
#define OPUS_GET_PITCH_REQUEST 4033 | #define OPUS_GET_PITCH_REQUEST 4033 | |||
/* Macros to trigger compilation errors when the wrong types are provided t o a CTL */ | /* Macros to trigger compilation errors when the wrong types are provided t o a CTL */ | |||
#define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x )) | #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x )) | |||
#define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) | #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) | |||
#define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) | #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) | |||
/** @endcond */ | /** @endcond */ | |||
/** @defgroup ctlvalues Pre-defined values for CTL interface | /** @defgroup ctlvalues Pre-defined values for CTL interface | |||
* @see genericctls,encoderctls | * @see genericctls, encoderctls | |||
* @{ | * @{ | |||
*/ | */ | |||
/* Values for the various encoder CTLs */ | /* Values for the various encoder CTLs */ | |||
#define OPUS_AUTO -1000 /**<Auto/default setting @hideinitializer*/ | #define OPUS_AUTO -1000 /**<Auto/default setting @hideinitializer*/ | |||
#define OPUS_BITRATE_MAX -1 /**<Maximum bitrate @hide initializer*/ | #define OPUS_BITRATE_MAX -1 /**<Maximum bitrate @hide initializer*/ | |||
/** Best for "standard" VoIP/videoconference applications where listening q uality and intelligibility matter most | /** Best for "standard" VoIP/videoconference applications where listening q uality and intelligibility matter most | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_APPLICATION_VOIP 2048 | #define OPUS_APPLICATION_VOIP 2048 | |||
/** Best for broadcast/high-fidelity application where the decoded audio sh ould be as close as possible to the input | /** Best for broadcast/high-fidelity application where the decoded audio sh ould be as close as possible to the input | |||
skipping to change at line 144 | skipping to change at line 144 | |||
#define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is music */ | #define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is music */ | |||
#define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4kHz bandpass @hidei nitializer*/ | #define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4kHz bandpass @hidei nitializer*/ | |||
#define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6kHz bandpass @hidei nitializer*/ | #define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6kHz bandpass @hidei nitializer*/ | |||
#define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8kHz bandpass @hidei nitializer*/ | #define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8kHz bandpass @hidei nitializer*/ | |||
#define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12kHz bandpass @hidei nitializer*/ | #define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12kHz bandpass @hidei nitializer*/ | |||
#define OPUS_BANDWIDTH_FULLBAND 1105 /**<20kHz bandpass @hidei nitializer*/ | #define OPUS_BANDWIDTH_FULLBAND 1105 /**<20kHz bandpass @hidei nitializer*/ | |||
/**@}*/ | /**@}*/ | |||
/** @defgroup encoderctls Encoder related CTLs | /** @defgroup encoderctls Encoder related CTLs | |||
* @see genericctls,opusencoder | * | |||
* These are convenience macros for use with the \c opus_encode_ctl | ||||
* interface. They are used to generate the appropriate series of | ||||
* arguments for that call, passing the correct type, size and so | ||||
* on as expected for each particular request. | ||||
* | ||||
* Some usage examples: | ||||
* | ||||
* @code | ||||
* int ret; | ||||
* ret = opus_encoder_ctl(enc_ctx, OPUS_SET_BANDWIDTH(OPUS_AUTO)); | ||||
* if (ret != OPUS_OK) return ret; | ||||
* | ||||
* int rate; | ||||
* opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&rate)); | ||||
* | ||||
* opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE); | ||||
* @endcode | ||||
* | ||||
* @see genericctls, opusencoder | ||||
* @{ | * @{ | |||
*/ | */ | |||
/** Configures the encoder's computational complexity. | /** Configures the encoder's computational complexity. | |||
* The supported range is 0-10 inclusive with 10 representing the highest complexity. | * The supported range is 0-10 inclusive with 10 representing the highest complexity. | |||
* The default value is 10. | * The default value is 10. | |||
* @param[in] x <tt>int</tt>: 0-10, inclusive | * @param[in] x <tt>int</tt>: 0-10, inclusive | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, __opus_check_in t(x) | #define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, __opus_check_in t(x) | |||
/** Gets the encoder's complexity configuration, @see OPUS_SET_COMPLEXITY | /** Gets the encoder's complexity configuration, @see OPUS_SET_COMPLEXITY | |||
skipping to change at line 264 | skipping to change at line 283 | |||
* | * | |||
* @param[out] x <tt>int*</tt>: Signal type | * @param[out] x <tt>int*</tt>: Signal type | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __opus_check_int_ptr(x) | #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __opus_check_int_ptr(x) | |||
/** Configures the encoder's intended application. | /** Configures the encoder's intended application. | |||
* The initial value is a mandatory argument to the encoder_create functio n. | * The initial value is a mandatory argument to the encoder_create functio n. | |||
* The supported values are: | * The supported values are: | |||
* - OPUS_APPLICATION_VOIP Process signal for improved speech intelligibi lity | * - OPUS_APPLICATION_VOIP Process signal for improved speech intelligibi lity | |||
* - OPUS_APPLICATION_AUDIO Favor faithfulness to the original input | * - OPUS_APPLICATION_AUDIO Favor faithfulness to the original input | |||
* - OPUS_APPLICATION_RESTRICTED_LOWDELAY Configure the minimum possible | ||||
coding delay | ||||
* | ||||
* @param[in] x <tt>int</tt>: Application value | * @param[in] x <tt>int</tt>: Application value | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, __opus_check_ int(x) | #define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, __opus_check_ int(x) | |||
/** Gets the encoder's configured application, @see OPUS_SET_APPLICATION | /** Gets the encoder's configured application, @see OPUS_SET_APPLICATION | |||
* | * | |||
* @param[out] x <tt>int*</tt>: Application value | * @param[out] x <tt>int*</tt>: Application value | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_ int_ptr(x) | #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_ int_ptr(x) | |||
/** Gets the total samples of delay added by the entire codec. | /** Gets the total samples of delay added by the entire codec. | |||
skipping to change at line 328 | skipping to change at line 349 | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x) | #define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x) | |||
/** Gets encoder's configured use of discontinuous transmission, @see OPUS_ SET_DTX | /** Gets encoder's configured use of discontinuous transmission, @see OPUS_ SET_DTX | |||
* | * | |||
* @param[out] x <tt>int*</tt>: DTX flag | * @param[out] x <tt>int*</tt>: DTX flag | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x) | #define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x) | |||
/**@}*/ | /**@}*/ | |||
/** @defgroup genericctls Generic CTLs | /** @defgroup genericctls Generic CTLs | |||
* @see opus_encoder_ctl,opusencoder,opusdecoder | * | |||
* These macros are used with the \c opus_decoder_ctl and | ||||
* \c opus_encoder_ctl calls to generate a particular | ||||
* request. | ||||
* | ||||
* When called on an \c OpusDecoder they apply to that | ||||
* particular decoder instance. When called on an | ||||
* \c OpusEncoder they apply to the corresponding setting | ||||
* on that encoder instance, if present. | ||||
* | ||||
* Some usage examples: | ||||
* | ||||
* @code | ||||
* int ret; | ||||
* opus_int32 pitch; | ||||
* ret = opus_decoder_ctl(dec_ctx, OPUS_GET_PITCH(&pitch)); | ||||
* if (ret == OPUS_OK) return ret; | ||||
* | ||||
* opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE); | ||||
* opus_decoder_ctl(dec_ctx, OPUS_RESET_STATE); | ||||
* | ||||
* opus_int32 enc_bw, dec_bw; | ||||
* opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&enc_bw)); | ||||
* opus_decoder_ctl(dec_ctx, OPUS_GET_BANDWIDTH(&dec_bw)); | ||||
* if (enc_bw != dec_bw) { | ||||
* printf("packet bandwidth mismatch!\n"); | ||||
* } | ||||
* @endcode | ||||
* | ||||
* @see opusencoder, opus_decoder_ctl, opus_encoder_ctl | ||||
* @{ | * @{ | |||
*/ | */ | |||
/** Resets the codec state to be equivalent to a freshly initialized state. | /** Resets the codec state to be equivalent to a freshly initialized state. | |||
* This should be called when switching streams in order to prevent | * This should be called when switching streams in order to prevent | |||
* the back to back decoding from giving different results from | * the back to back decoding from giving different results from | |||
* one at a time decoding. | * one at a time decoding. | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_RESET_STATE 4028 | #define OPUS_RESET_STATE 4028 | |||
skipping to change at line 354 | skipping to change at line 404 | |||
* @param[out] x <tt>opus_uint32*</tt>: Entropy coder state | * @param[out] x <tt>opus_uint32*</tt>: Entropy coder state | |||
* | * | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_ uint_ptr(x) | #define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_ uint_ptr(x) | |||
/** Gets the pitch of the last decoded frame, if available. | /** Gets the pitch of the last decoded frame, if available. | |||
* This can be used for any post-processing algorithm requiring the use of pitch, | * This can be used for any post-processing algorithm requiring the use of pitch, | |||
* e.g. time stretching/shortening. If the last frame was not voiced, or i f the | * e.g. time stretching/shortening. If the last frame was not voiced, or i f the | |||
* pitch was not coded in the frame, then zero is returned. | * pitch was not coded in the frame, then zero is returned. | |||
* | * | |||
* This CTL is only implemented for decoder instances. | ||||
* | ||||
* @param[out] x <tt>opus_int32*</tt>: pitch period at 48 kHz (or 0 if not available) | * @param[out] x <tt>opus_int32*</tt>: pitch period at 48 kHz (or 0 if not available) | |||
* | * | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x) | #define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x) | |||
/** Gets the encoder's configured bandpass or the decoder's last bandpass, @see OPUS_SET_BANDWIDTH | /** Gets the encoder's configured bandpass or the decoder's last bandpass, @see OPUS_SET_BANDWIDTH | |||
* @param[out] x <tt>int*</tt>: Bandwidth value | * @param[out] x <tt>int*</tt>: Bandwidth value | |||
* @hideinitializer */ | * @hideinitializer */ | |||
#define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ ptr(x) | #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ ptr(x) | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 56 lines changed or added | |||
opus_types.h | opus_types.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
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. | |||
*/ | */ | |||
/* opus_types.h taken from libogg */ | /* opus_types.h taken from libogg */ | |||
/** | /** | |||
@file opus_types.h | @file opus_types.h | |||
@brief Opus reference implementation types | @brief Opus reference implementation types | |||
*/ | */ | |||
#ifndef _OPUS_TYPES_H | #ifndef OPUS_TYPES_H | |||
#define _OPUS_TYPES_H | #define OPUS_TYPES_H | |||
/* Use the real stdint.h if it's there (taken from Paul Hsieh's pstdint.h) */ | /* Use the real stdint.h if it's there (taken from Paul Hsieh's pstdint.h) */ | |||
#if (defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defi ned(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) || defined (HA VE_STDINT_H)) | #if (defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defi ned(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) || defined (HA VE_STDINT_H)) | |||
#include <stdint.h> | #include <stdint.h> | |||
typedef int16_t opus_int16; | typedef int16_t opus_int16; | |||
typedef uint16_t opus_uint16; | typedef uint16_t opus_uint16; | |||
typedef int32_t opus_int32; | typedef int32_t opus_int32; | |||
typedef uint32_t opus_uint32; | typedef uint32_t opus_uint32; | |||
#elif defined(_WIN32) | #elif defined(_WIN32) | |||
skipping to change at line 159 | skipping to change at line 159 | |||
#endif | #endif | |||
#define opus_int int /* used for counters etc; at least 16 bits */ | #define opus_int int /* used for counters etc; at least 16 bits */ | |||
#define opus_int64 long long | #define opus_int64 long long | |||
#define opus_int8 signed char | #define opus_int8 signed char | |||
#define opus_uint unsigned int /* used for counters etc; at least 16 bits */ | #define opus_uint unsigned int /* used for counters etc; at least 16 bits */ | |||
#define opus_uint64 unsigned long long | #define opus_uint64 unsigned long long | |||
#define opus_uint8 unsigned char | #define opus_uint8 unsigned char | |||
#endif /* _OPUS_TYPES_H */ | #endif /* OPUS_TYPES_H */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||