| OLD | NEW |
| 1 /* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited | 1 /* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited |
| 2 Written by Jean-Marc Valin and Koen Vos */ | 2 Written by Jean-Marc Valin and Koen Vos */ |
| 3 /* | 3 /* |
| 4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
| 6 are met: | 6 are met: |
| 7 | 7 |
| 8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
| 9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 /** An encoder or decoder structure is invalid or already freed @hideinitializer
*/ | 57 /** An encoder or decoder structure is invalid or already freed @hideinitializer
*/ |
| 58 #define OPUS_INVALID_STATE -6 | 58 #define OPUS_INVALID_STATE -6 |
| 59 /** Memory allocation has failed @hideinitializer*/ | 59 /** Memory allocation has failed @hideinitializer*/ |
| 60 #define OPUS_ALLOC_FAIL -7 | 60 #define OPUS_ALLOC_FAIL -7 |
| 61 /**@}*/ | 61 /**@}*/ |
| 62 | 62 |
| 63 /** @cond OPUS_INTERNAL_DOC */ | 63 /** @cond OPUS_INTERNAL_DOC */ |
| 64 /**Export control for opus functions */ | 64 /**Export control for opus functions */ |
| 65 | 65 |
| 66 #ifndef OPUS_EXPORT | 66 #ifndef OPUS_EXPORT |
| 67 # if defined(__GNUC__) && defined(OPUS_BUILD) | 67 # if defined(WIN32) |
| 68 # define OPUS_EXPORT __attribute__ ((visibility ("default"))) | |
| 69 # elif defined(WIN32) && !defined(__MINGW32__) | |
| 70 # ifdef OPUS_BUILD | 68 # ifdef OPUS_BUILD |
| 71 # define OPUS_EXPORT __declspec(dllexport) | 69 # define OPUS_EXPORT __declspec(dllexport) |
| 72 # else | 70 # else |
| 73 # define OPUS_EXPORT | 71 # define OPUS_EXPORT |
| 74 # endif | 72 # endif |
| 73 # elif defined(__GNUC__) && defined(OPUS_BUILD) |
| 74 # define OPUS_EXPORT __attribute__ ((visibility ("default"))) |
| 75 # else | 75 # else |
| 76 # define OPUS_EXPORT | 76 # define OPUS_EXPORT |
| 77 # endif | 77 # endif |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 # if !defined(OPUS_GNUC_PREREQ) | 80 # if !defined(OPUS_GNUC_PREREQ) |
| 81 # if defined(__GNUC__)&&defined(__GNUC_MINOR__) | 81 # if defined(__GNUC__)&&defined(__GNUC_MINOR__) |
| 82 # define OPUS_GNUC_PREREQ(_maj,_min) \ | 82 # define OPUS_GNUC_PREREQ(_maj,_min) \ |
| 83 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) | 83 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) |
| 84 # else | 84 # else |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #define OPUS_GET_SIGNAL_REQUEST 4025 | 141 #define OPUS_GET_SIGNAL_REQUEST 4025 |
| 142 #define OPUS_GET_LOOKAHEAD_REQUEST 4027 | 142 #define OPUS_GET_LOOKAHEAD_REQUEST 4027 |
| 143 /* #define OPUS_RESET_STATE 4028 */ | 143 /* #define OPUS_RESET_STATE 4028 */ |
| 144 #define OPUS_GET_SAMPLE_RATE_REQUEST 4029 | 144 #define OPUS_GET_SAMPLE_RATE_REQUEST 4029 |
| 145 #define OPUS_GET_FINAL_RANGE_REQUEST 4031 | 145 #define OPUS_GET_FINAL_RANGE_REQUEST 4031 |
| 146 #define OPUS_GET_PITCH_REQUEST 4033 | 146 #define OPUS_GET_PITCH_REQUEST 4033 |
| 147 #define OPUS_SET_GAIN_REQUEST 4034 | 147 #define OPUS_SET_GAIN_REQUEST 4034 |
| 148 #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */ | 148 #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */ |
| 149 #define OPUS_SET_LSB_DEPTH_REQUEST 4036 | 149 #define OPUS_SET_LSB_DEPTH_REQUEST 4036 |
| 150 #define OPUS_GET_LSB_DEPTH_REQUEST 4037 | 150 #define OPUS_GET_LSB_DEPTH_REQUEST 4037 |
| 151 | |
| 152 #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039 | 151 #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039 |
| 152 #define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040 |
| 153 #define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041 |
| 153 | 154 |
| 154 /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */ | 155 /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */ |
| 155 | 156 |
| 156 /* Macros to trigger compilation errors when the wrong types are provided to a C
TL */ | 157 /* Macros to trigger compilation errors when the wrong types are provided to a C
TL */ |
| 157 #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) | 158 #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) |
| 158 #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) | 159 #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) |
| 159 #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) | 160 #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) |
| 161 #define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr))) |
| 160 /** @endcond */ | 162 /** @endcond */ |
| 161 | 163 |
| 162 /** @defgroup opus_ctlvalues Pre-defined values for CTL interface | 164 /** @defgroup opus_ctlvalues Pre-defined values for CTL interface |
| 163 * @see opus_genericctls, opus_encoderctls | 165 * @see opus_genericctls, opus_encoderctls |
| 164 * @{ | 166 * @{ |
| 165 */ | 167 */ |
| 166 /* Values for the various encoder CTLs */ | 168 /* Values for the various encoder CTLs */ |
| 167 #define OPUS_AUTO -1000 /**<Auto/default setting @hide
initializer*/ | 169 #define OPUS_AUTO -1000 /**<Auto/default setting @hide
initializer*/ |
| 168 #define OPUS_BITRATE_MAX -1 /**<Maximum bitrate @hideiniti
alizer*/ | 170 #define OPUS_BITRATE_MAX -1 /**<Maximum bitrate @hideiniti
alizer*/ |
| 169 | 171 |
| 170 /** Best for most VoIP/videoconference applications where listening quality and
intelligibility matter most | 172 /** Best for most VoIP/videoconference applications where listening quality and
intelligibility matter most |
| 171 * @hideinitializer */ | 173 * @hideinitializer */ |
| 172 #define OPUS_APPLICATION_VOIP 2048 | 174 #define OPUS_APPLICATION_VOIP 2048 |
| 173 /** Best for broadcast/high-fidelity application where the decoded audio should
be as close as possible to the input | 175 /** Best for broadcast/high-fidelity application where the decoded audio should
be as close as possible to the input |
| 174 * @hideinitializer */ | 176 * @hideinitializer */ |
| 175 #define OPUS_APPLICATION_AUDIO 2049 | 177 #define OPUS_APPLICATION_AUDIO 2049 |
| 176 /** Only use when lowest-achievable latency is what matters most. Voice-optimize
d modes cannot be used. | 178 /** Only use when lowest-achievable latency is what matters most. Voice-optimize
d modes cannot be used. |
| 177 * @hideinitializer */ | 179 * @hideinitializer */ |
| 178 #define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051 | 180 #define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051 |
| 179 | 181 |
| 180 #define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is v
oice */ | 182 #define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is v
oice */ |
| 181 #define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is m
usic */ | 183 #define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is m
usic */ |
| 182 #define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4 kHz bandpass @hideiniti
alizer*/ | 184 #define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4 kHz bandpass @hideiniti
alizer*/ |
| 183 #define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass @hideiniti
alizer*/ | 185 #define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass @hideiniti
alizer*/ |
| 184 #define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpass @hideiniti
alizer*/ | 186 #define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpass @hideiniti
alizer*/ |
| 185 #define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideiniti
alizer*/ | 187 #define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideiniti
alizer*/ |
| 186 #define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideiniti
alizer*/ | 188 #define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideiniti
alizer*/ |
| 187 | 189 |
| 190 #define OPUS_FRAMESIZE_ARG 5000 /**< Select frame size from th
e argument (default) */ |
| 191 #define OPUS_FRAMESIZE_2_5_MS 5001 /**< Use 2.5 ms frames */ |
| 192 #define OPUS_FRAMESIZE_5_MS 5002 /**< Use 5 ms frames */ |
| 193 #define OPUS_FRAMESIZE_10_MS 5003 /**< Use 10 ms frames */ |
| 194 #define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */ |
| 195 #define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */ |
| 196 #define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */ |
| 197 #define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size d
ynamically */ |
| 198 |
| 188 /**@}*/ | 199 /**@}*/ |
| 189 | 200 |
| 190 | 201 |
| 191 /** @defgroup opus_encoderctls Encoder related CTLs | 202 /** @defgroup opus_encoderctls Encoder related CTLs |
| 192 * | 203 * |
| 193 * These are convenience macros for use with the \c opus_encode_ctl | 204 * These are convenience macros for use with the \c opus_encode_ctl |
| 194 * interface. They are used to generate the appropriate series of | 205 * interface. They are used to generate the appropriate series of |
| 195 * arguments for that call, passing the correct type, size and so | 206 * arguments for that call, passing the correct type, size and so |
| 196 * on as expected for each particular request. | 207 * on as expected for each particular request. |
| 197 * | 208 * |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 * @see OPUS_SET_LSB_DEPTH | 529 * @see OPUS_SET_LSB_DEPTH |
| 519 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and | 530 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and |
| 520 * 24 (default: 24). | 531 * 24 (default: 24). |
| 521 * @hideinitializer */ | 532 * @hideinitializer */ |
| 522 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x
) | 533 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x
) |
| 523 | 534 |
| 524 /** Gets the duration (in samples) of the last packet successfully decoded or co
ncealed. | 535 /** Gets the duration (in samples) of the last packet successfully decoded or co
ncealed. |
| 525 * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling
rate). | 536 * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling
rate). |
| 526 * @hideinitializer */ | 537 * @hideinitializer */ |
| 527 #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST,
__opus_check_int_ptr(x) | 538 #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST,
__opus_check_int_ptr(x) |
| 539 |
| 540 /** Configures the encoder's use of variable duration frames. |
| 541 * When variable duration is enabled, the encoder is free to use a shorter fram
e |
| 542 * size than the one requested in the opus_encode*() call. |
| 543 * It is then the user's responsibility |
| 544 * to verify how much audio was encoded by checking the ToC byte of the encoded |
| 545 * packet. The part of the audio that was not encoded needs to be resent to the |
| 546 * encoder for the next call. Do not use this option unless you <b>really</b> |
| 547 * know what you are doing. |
| 548 * @see OPUS_GET_EXPERT_VARIABLE_DURATION |
| 549 * @param[in] x <tt>opus_int32</tt>: Allowed values: |
| 550 * <dl> |
| 551 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default)
.</dd> |
| 552 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd> |
| 553 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd> |
| 554 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd> |
| 555 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd> |
| 556 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd> |
| 557 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd> |
| 558 * <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd
> |
| 559 * </dl> |
| 560 * @hideinitializer */ |
| 561 #define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST
, __opus_check_int(x) |
| 562 /** Gets the encoder's configured use of variable duration frames. |
| 563 * @see OPUS_SET_EXPERT_VARIABLE_DURATION |
| 564 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: |
| 565 * <dl> |
| 566 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default)
.</dd> |
| 567 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd> |
| 568 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd> |
| 569 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd> |
| 570 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd> |
| 571 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd> |
| 572 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd> |
| 573 * <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd
> |
| 574 * </dl> |
| 575 * @hideinitializer */ |
| 576 #define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST
, __opus_check_int_ptr(x) |
| 577 |
| 528 /**@}*/ | 578 /**@}*/ |
| 529 | 579 |
| 530 /** @defgroup opus_genericctls Generic CTLs | 580 /** @defgroup opus_genericctls Generic CTLs |
| 531 * | 581 * |
| 532 * These macros are used with the \c opus_decoder_ctl and | 582 * These macros are used with the \c opus_decoder_ctl and |
| 533 * \c opus_encoder_ctl calls to generate a particular | 583 * \c opus_encoder_ctl calls to generate a particular |
| 534 * request. | 584 * request. |
| 535 * | 585 * |
| 536 * When called on an \c OpusDecoder they apply to that | 586 * When called on an \c OpusDecoder they apply to that |
| 537 * particular decoder instance. When called on an | 587 * particular decoder instance. When called on an |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 * @returns Version string | 696 * @returns Version string |
| 647 */ | 697 */ |
| 648 OPUS_EXPORT const char *opus_get_version_string(void); | 698 OPUS_EXPORT const char *opus_get_version_string(void); |
| 649 /**@}*/ | 699 /**@}*/ |
| 650 | 700 |
| 651 #ifdef __cplusplus | 701 #ifdef __cplusplus |
| 652 } | 702 } |
| 653 #endif | 703 #endif |
| 654 | 704 |
| 655 #endif /* OPUS_DEFINES_H */ | 705 #endif /* OPUS_DEFINES_H */ |
| OLD | NEW |