opus.h   opus.h 
skipping to change at line 595 skipping to change at line 595
/** 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
* @param [in] len <tt>opus_int32</tt>: Length of packet * @param [in] len <tt>opus_int32</tt>: Length of packet
* @returns Number of samples * @returns Number of samples
* @retval OPUS_BAD_ARG Insufficient data was passed to the function * @retval OPUS_BAD_ARG Insufficient data was passed to the function
* @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 OPUS_WARN_UNUSED_RESULT int opus_decoder_get_nb_samples(const O pusDecoder *dec, const unsigned char packet[], opus_int32 len) OPUS_ARG_NON NULL(1) OPUS_ARG_NONNULL(2); OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decoder_get_nb_samples(const O pusDecoder *dec, const unsigned char packet[], opus_int32 len) OPUS_ARG_NON NULL(1) OPUS_ARG_NONNULL(2);
/** Applies soft-clipping to bring a float signal within the [-1,1] range.
If
* the signal is already in that range, nothing is done. If there are valu
es
* outside of [-1,1], then the signal is clipped as smoothly as possible t
o
* both fit in the range and avoid creating excessive distortion in the
* process.
* @param [in,out] pcm <tt>float*</tt>: Input PCM and modified PCM
* @param [in] frame_size <tt>int</tt> Number of samples per channel to pr
ocess
* @param [in] channels <tt>int</tt>: Number of channels
* @param [in,out] softclip_mem <tt>float*</tt>: State memory for the soft
clipping process (one float per channel, initialized to zero)
*/
OPUS_EXPORT void opus_pcm_soft_clip(float *pcm, int frame_size, int channel
s, float *softclip_mem);
/**@}*/ /**@}*/
/** @defgroup opus_repacketizer Repacketizer /** @defgroup opus_repacketizer Repacketizer
* @{ * @{
* *
* The repacketizer can be used to merge multiple Opus packets into a sing le * The repacketizer can be used to merge multiple Opus packets into a sing le
* packet or alternatively to split Opus packets that have previously been * packet or alternatively to split Opus packets that have previously been
* merged. Splitting valid Opus packets is always guaranteed to succeed, * merged. Splitting valid Opus packets is always guaranteed to succeed,
* whereas merging valid packets only succeeds if all frames have the same * whereas merging valid packets only succeeds if all frames have the same
* mode, bandwidth, and frame size, and when the total duration of the mer ged * mode, bandwidth, and frame size, and when the total duration of the mer ged
skipping to change at line 899 skipping to change at line 912
* last call to opus_repacketizer_init( ) or * last call to opus_repacketizer_init( ) or
* opus_repacketizer_create() is also * opus_repacketizer_create() is also
* sufficient, and possibly much smalle r. * sufficient, and possibly much smalle r.
* @returns The total size of the output packet on success, or an error co de * @returns The total size of the output packet on success, or an error co de
* on failure. * on failure.
* @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain th e * @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain th e
* complete output packet. * complete output packet.
*/ */
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRe packetizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1) ; OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRe packetizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1) ;
/** Pads a given Opus packet to a larger size (possibly changing the TOC se
quence).
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containin
g the
* packet to pad.
* @param len <tt>opus_int32</tt>: The size of the packet.
* This must be at least 1.
* @param new_len <tt>opus_int32</tt>: The desired size of the packet afte
r padding.
* This must be at least as large as len.
* @returns an error code
* @retval #OPUS_OK \a on success.
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than l
en.
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packe
t.
*/
OPUS_EXPORT int opus_packet_pad(unsigned char *data, opus_int32 len, opus_i
nt32 new_len);
/** Remove all padding from a given Opus packet and rewrite the TOC sequenc
e to
* minimize space usage.
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containin
g the
* packet to strip.
* @param len <tt>opus_int32</tt>: The size of the packet.
* This must be at least 1.
* @returns The new size of the output packet on success, or an error code
* on failure.
* @retval #OPUS_BAD_ARG \a len was less than 1.
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packe
t.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_packet_unpad(unsigned c
har *data, opus_int32 len);
/** Pads a given Opus multi-stream packet to a larger size (possibly changi
ng the TOC sequence).
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containin
g the
* packet to pad.
* @param len <tt>opus_int32</tt>: The size of the packet.
* This must be at least 1.
* @param new_len <tt>opus_int32</tt>: The desired size of the packet afte
r padding.
* This must be at least 1.
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not chann
els) in the packet.
* This must be at least as large as len.
* @returns an error code
* @retval #OPUS_OK \a on success.
* @retval #OPUS_BAD_ARG \a len was less than 1.
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packe
t.
*/
OPUS_EXPORT int opus_multistream_packet_pad(unsigned char *data, opus_int32
len, opus_int32 new_len, int nb_streams);
/** Remove all padding from a given Opus multi-stream packet and rewrite th
e TOC sequence to
* minimize space usage.
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containin
g the
* packet to strip.
* @param len <tt>opus_int32</tt>: The size of the packet.
* This must be at least 1.
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not chann
els) in the packet.
* This must be at least 1.
* @returns The new size of the output packet on success, or an error code
* on failure.
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than l
en.
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packe
t.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_packet_unpa
d(unsigned char *data, opus_int32 len, int nb_streams);
/**@}*/ /**@}*/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* OPUS_H */ #endif /* OPUS_H */
 End of changes. 2 change blocks. 
0 lines changed or deleted 99 lines changed or added


 opus_defines.h   opus_defines.h 
skipping to change at line 101 skipping to change at line 101
# define OPUS_RESTRICT __restrict__ # define OPUS_RESTRICT __restrict__
# elif (defined(_MSC_VER) && _MSC_VER >= 1400) # elif (defined(_MSC_VER) && _MSC_VER >= 1400)
# define OPUS_RESTRICT __restrict # define OPUS_RESTRICT __restrict
# else # else
# define OPUS_RESTRICT # define OPUS_RESTRICT
# endif # endif
#else #else
# define OPUS_RESTRICT restrict # define OPUS_RESTRICT restrict
#endif #endif
#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
# if OPUS_GNUC_PREREQ(2,7)
# define OPUS_INLINE __inline__
# elif (defined(_MSC_VER))
# define OPUS_INLINE __inline
# else
# define OPUS_INLINE
# endif
#else
# define OPUS_INLINE inline
#endif
/**Warning attributes for opus functions /**Warning attributes for opus functions
* NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
* some paranoid null checks. */ * some paranoid null checks. */
#if defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4) #if defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
# define OPUS_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) # define OPUS_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
#else #else
# define OPUS_WARN_UNUSED_RESULT # define OPUS_WARN_UNUSED_RESULT
#endif #endif
#if !defined(OPUS_BUILD) && defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4) #if !defined(OPUS_BUILD) && defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
# define OPUS_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x))) # define OPUS_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x)))
skipping to change at line 151 skipping to change at line 163
#define OPUS_GET_SIGNAL_REQUEST 4025 #define OPUS_GET_SIGNAL_REQUEST 4025
#define OPUS_GET_LOOKAHEAD_REQUEST 4027 #define OPUS_GET_LOOKAHEAD_REQUEST 4027
/* #define OPUS_RESET_STATE 4028 */ /* #define OPUS_RESET_STATE 4028 */
#define OPUS_GET_SAMPLE_RATE_REQUEST 4029 #define OPUS_GET_SAMPLE_RATE_REQUEST 4029
#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
#define OPUS_SET_GAIN_REQUEST 4034 #define OPUS_SET_GAIN_REQUEST 4034
#define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */ #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */
#define OPUS_SET_LSB_DEPTH_REQUEST 4036 #define OPUS_SET_LSB_DEPTH_REQUEST 4036
#define OPUS_GET_LSB_DEPTH_REQUEST 4037 #define OPUS_GET_LSB_DEPTH_REQUEST 4037
#define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039 #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
#define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
#define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
#define OPUS_SET_PREDICTION_DISABLED_REQUEST 4042
#define OPUS_GET_PREDICTION_DISABLED_REQUEST 4043
/* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */ /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
/* 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)))
#define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr)))
/** @endcond */ /** @endcond */
/** @defgroup opus_ctlvalues Pre-defined values for CTL interface /** @defgroup opus_ctlvalues Pre-defined values for CTL interface
* @see opus_genericctls, opus_encoderctls * @see opus_genericctls, opus_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*/
skipping to change at line 188 skipping to change at line 204
#define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051 #define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051
#define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is voice */ #define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is voice */
#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 /**< 4 kHz bandpass @hide initializer*/ #define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4 kHz bandpass @hide initializer*/
#define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass @hide initializer*/ #define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass @hide initializer*/
#define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpass @hide initializer*/ #define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpass @hide initializer*/
#define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hide initializer*/ #define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hide initializer*/
#define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hide initializer*/ #define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hide initializer*/
#define OPUS_FRAMESIZE_ARG 5000 /**< Select frame size fr
om the argument (default) */
#define OPUS_FRAMESIZE_2_5_MS 5001 /**< Use 2.5 ms frames */
#define OPUS_FRAMESIZE_5_MS 5002 /**< Use 5 ms frames */
#define OPUS_FRAMESIZE_10_MS 5003 /**< Use 10 ms frames */
#define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */
#define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */
#define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */
/**@}*/ /**@}*/
/** @defgroup opus_encoderctls Encoder related CTLs /** @defgroup opus_encoderctls Encoder related CTLs
* *
* These are convenience macros for use with the \c opus_encode_ctl * These are convenience macros for use with the \c opus_encode_ctl
* interface. They are used to generate the appropriate series of * interface. They are used to generate the appropriate series of
* arguments for that call, passing the correct type, size and so * arguments for that call, passing the correct type, size and so
* on as expected for each particular request. * on as expected for each particular request.
* *
* Some usage examples: * Some usage examples:
skipping to change at line 526 skipping to change at line 550
* @see OPUS_SET_LSB_DEPTH * @see OPUS_SET_LSB_DEPTH
* @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and
* 24 (default: 24). * 24 (default: 24).
* @hideinitializer */ * @hideinitializer */
#define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ ptr(x) #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ ptr(x)
/** Gets the duration (in samples) of the last packet successfully decoded or concealed. /** Gets the duration (in samples) of the last packet successfully decoded or concealed.
* @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current samp ling rate). * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current samp ling rate).
* @hideinitializer */ * @hideinitializer */
#define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQU EST, __opus_check_int_ptr(x) #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQU EST, __opus_check_int_ptr(x)
/** Configures the encoder's use of variable duration frames.
* When variable duration is enabled, the encoder is free to use a shorter
frame
* size than the one requested in the opus_encode*() call.
* It is then the user's responsibility
* to verify how much audio was encoded by checking the ToC byte of the en
coded
* packet. The part of the audio that was not encoded needs to be resent t
o the
* encoder for the next call. Do not use this option unless you <b>really<
/b>
* know what you are doing.
* @see OPUS_GET_EXPERT_VARIABLE_DURATION
* @param[in] x <tt>opus_int32</tt>: Allowed values:
* <dl>
* <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (def
ault).</dd>
* <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically
.</dd>
* </dl>
* @hideinitializer */
#define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_RE
QUEST, __opus_check_int(x)
/** Gets the encoder's configured use of variable duration frames.
* @see OPUS_SET_EXPERT_VARIABLE_DURATION
* @param[out] x <tt>opus_int32 *</tt>: Returns one of the following value
s:
* <dl>
* <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (def
ault).</dd>
* <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
* <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically
.</dd>
* </dl>
* @hideinitializer */
#define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_RE
QUEST, __opus_check_int_ptr(x)
/** If set to 1, disables almost all use of prediction, making frames almos
t
completely independent. This reduces quality. (default : 0)
* @hideinitializer */
#define OPUS_SET_PREDICTION_DISABLED(x) OPUS_SET_PREDICTION_DISABLED_REQUES
T, __opus_check_int(x)
/** Gets the encoder's configured prediction status.
* @hideinitializer */
#define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUES
T, __opus_check_int_ptr(x)
/**@}*/ /**@}*/
/** @defgroup opus_genericctls Generic CTLs /** @defgroup opus_genericctls Generic CTLs
* *
* These macros are used with the \c opus_decoder_ctl and * These macros are used with the \c opus_decoder_ctl and
* \c opus_encoder_ctl calls to generate a particular * \c opus_encoder_ctl calls to generate a particular
* request. * request.
* *
* When called on an \c OpusDecoder they apply to that * When called on an \c OpusDecoder they apply to that
* particular decoder instance. When called on an * particular decoder instance. When called on an
 End of changes. 6 change blocks. 
1 lines changed or deleted 87 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/