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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #define OPUS_UNIMPLEMENTED -5 | 56 #define OPUS_UNIMPLEMENTED -5 |
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 #if !defined(OPUS_EXPORT) | 66 #ifndef OPUS_EXPORT |
67 | 67 # if defined(__GNUC__) && defined(OPUS_BUILD) |
68 #if defined(__GNUC__) && defined(OPUS_BUILD) | 68 # define OPUS_EXPORT __attribute__ ((visibility ("default"))) |
69 # define OPUS_EXPORT __attribute__ ((visibility ("default"))) | 69 # elif defined(WIN32) && !defined(__MINGW32__) |
70 #elif defined(WIN32) && !defined(__MINGW32__) | 70 # ifdef OPUS_BUILD |
71 # ifdef OPUS_BUILD | |
72 # define OPUS_EXPORT __declspec(dllexport) | 71 # define OPUS_EXPORT __declspec(dllexport) |
| 72 # else |
| 73 # define OPUS_EXPORT |
| 74 # endif |
73 # else | 75 # else |
74 # define OPUS_EXPORT | 76 # define OPUS_EXPORT |
75 # endif | 77 # endif |
76 #else | |
77 # define OPUS_EXPORT | |
78 #endif | |
79 | |
80 #endif | 78 #endif |
81 | 79 |
82 # if !defined(OPUS_GNUC_PREREQ) | 80 # if !defined(OPUS_GNUC_PREREQ) |
83 # if defined(__GNUC__)&&defined(__GNUC_MINOR__) | 81 # if defined(__GNUC__)&&defined(__GNUC_MINOR__) |
84 # define OPUS_GNUC_PREREQ(_maj,_min) \ | 82 # define OPUS_GNUC_PREREQ(_maj,_min) \ |
85 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) | 83 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) |
86 # else | 84 # else |
87 # define OPUS_GNUC_PREREQ(_maj,_min) 0 | 85 # define OPUS_GNUC_PREREQ(_maj,_min) 0 |
88 # endif | 86 # endif |
89 # endif | 87 # endif |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 #define OPUS_SET_FORCE_CHANNELS_REQUEST 4022 | 138 #define OPUS_SET_FORCE_CHANNELS_REQUEST 4022 |
141 #define OPUS_GET_FORCE_CHANNELS_REQUEST 4023 | 139 #define OPUS_GET_FORCE_CHANNELS_REQUEST 4023 |
142 #define OPUS_SET_SIGNAL_REQUEST 4024 | 140 #define OPUS_SET_SIGNAL_REQUEST 4024 |
143 #define OPUS_GET_SIGNAL_REQUEST 4025 | 141 #define OPUS_GET_SIGNAL_REQUEST 4025 |
144 #define OPUS_GET_LOOKAHEAD_REQUEST 4027 | 142 #define OPUS_GET_LOOKAHEAD_REQUEST 4027 |
145 /* #define OPUS_RESET_STATE 4028 */ | 143 /* #define OPUS_RESET_STATE 4028 */ |
146 #define OPUS_GET_SAMPLE_RATE_REQUEST 4029 | 144 #define OPUS_GET_SAMPLE_RATE_REQUEST 4029 |
147 #define OPUS_GET_FINAL_RANGE_REQUEST 4031 | 145 #define OPUS_GET_FINAL_RANGE_REQUEST 4031 |
148 #define OPUS_GET_PITCH_REQUEST 4033 | 146 #define OPUS_GET_PITCH_REQUEST 4033 |
149 #define OPUS_SET_GAIN_REQUEST 4034 | 147 #define OPUS_SET_GAIN_REQUEST 4034 |
150 #define OPUS_GET_GAIN_REQUEST 4045 | 148 #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */ |
151 #define OPUS_SET_LSB_DEPTH_REQUEST 4036 | 149 #define OPUS_SET_LSB_DEPTH_REQUEST 4036 |
152 #define OPUS_GET_LSB_DEPTH_REQUEST 4037 | 150 #define OPUS_GET_LSB_DEPTH_REQUEST 4037 |
153 | 151 |
| 152 #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039 |
| 153 |
| 154 /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */ |
| 155 |
154 /* Macros to trigger compilation errors when the wrong types are provided to a C
TL */ | 156 /* Macros to trigger compilation errors when the wrong types are provided to a C
TL */ |
155 #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) | 157 #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) |
156 #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) | 158 #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) |
157 #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) | 159 #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) |
158 /** @endcond */ | 160 /** @endcond */ |
159 | 161 |
160 /** @defgroup opus_ctlvalues Pre-defined values for CTL interface | 162 /** @defgroup opus_ctlvalues Pre-defined values for CTL interface |
161 * @see opus_genericctls, opus_encoderctls | 163 * @see opus_genericctls, opus_encoderctls |
162 * @{ | 164 * @{ |
163 */ | 165 */ |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 #define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x) | 500 #define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x) |
499 /** Gets encoder's configured use of discontinuous transmission. | 501 /** Gets encoder's configured use of discontinuous transmission. |
500 * @see OPUS_SET_DTX | 502 * @see OPUS_SET_DTX |
501 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: | 503 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: |
502 * <dl> | 504 * <dl> |
503 * <dt>0</dt><dd>DTX disabled (default).</dd> | 505 * <dt>0</dt><dd>DTX disabled (default).</dd> |
504 * <dt>1</dt><dd>DTX enabled.</dd> | 506 * <dt>1</dt><dd>DTX enabled.</dd> |
505 * </dl> | 507 * </dl> |
506 * @hideinitializer */ | 508 * @hideinitializer */ |
507 #define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x) | 509 #define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x) |
| 510 /** Configures the depth of signal being encoded. |
| 511 * This is a hint which helps the encoder identify silence and near-silence. |
| 512 * @see OPUS_GET_LSB_DEPTH |
| 513 * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24 |
| 514 * (default: 24). |
| 515 * @hideinitializer */ |
| 516 #define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x) |
| 517 /** Gets the encoder's configured signal depth. |
| 518 * @see OPUS_SET_LSB_DEPTH |
| 519 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and |
| 520 * 24 (default: 24). |
| 521 * @hideinitializer */ |
| 522 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x
) |
| 523 |
| 524 /** 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). |
| 526 * @hideinitializer */ |
| 527 #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST,
__opus_check_int_ptr(x) |
508 /**@}*/ | 528 /**@}*/ |
509 | 529 |
510 /** @defgroup opus_genericctls Generic CTLs | 530 /** @defgroup opus_genericctls Generic CTLs |
511 * | 531 * |
512 * These macros are used with the \c opus_decoder_ctl and | 532 * These macros are used with the \c opus_decoder_ctl and |
513 * \c opus_encoder_ctl calls to generate a particular | 533 * \c opus_encoder_ctl calls to generate a particular |
514 * request. | 534 * request. |
515 * | 535 * |
516 * When called on an \c OpusDecoder they apply to that | 536 * When called on an \c OpusDecoder they apply to that |
517 * particular decoder instance. When called on an | 537 * particular decoder instance. When called on an |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> | 597 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> |
578 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> | 598 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> |
579 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> | 599 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> |
580 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> | 600 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> |
581 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> | 601 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> |
582 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd> | 602 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd> |
583 * </dl> | 603 * </dl> |
584 * @hideinitializer */ | 604 * @hideinitializer */ |
585 #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x
) | 605 #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x
) |
586 | 606 |
587 /** Configures the depth of signal being encoded. | |
588 * This is a hint which helps the encoder identify silence and near-silence. | |
589 * @see OPUS_GET_LSB_DEPTH | |
590 * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24 | |
591 * (default: 24). | |
592 * @hideinitializer */ | |
593 #define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x) | |
594 /** Gets the encoder's configured signal depth. | |
595 * @see OPUS_SET_LSB_DEPTH | |
596 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and | |
597 * 24 (default: 24). | |
598 * @hideinitializer */ | |
599 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x
) | |
600 /**@}*/ | 607 /**@}*/ |
601 | 608 |
602 /** @defgroup opus_decoderctls Decoder related CTLs | 609 /** @defgroup opus_decoderctls Decoder related CTLs |
603 * @see opus_genericctls, opus_encoderctls, opus_decoder | 610 * @see opus_genericctls, opus_encoderctls, opus_decoder |
604 * @{ | 611 * @{ |
605 */ | 612 */ |
606 | 613 |
607 /** Configures decoder gain adjustment. | 614 /** Configures decoder gain adjustment. |
608 * Scales the decoded output by a factor specified in Q8 dB units. | 615 * Scales the decoded output by a factor specified in Q8 dB units. |
609 * This has a maximum range of -32768 to 32767 inclusive, and returns | 616 * This has a maximum range of -32768 to 32767 inclusive, and returns |
(...skipping 29 matching lines...) Expand all Loading... |
639 * @returns Version string | 646 * @returns Version string |
640 */ | 647 */ |
641 OPUS_EXPORT const char *opus_get_version_string(void); | 648 OPUS_EXPORT const char *opus_get_version_string(void); |
642 /**@}*/ | 649 /**@}*/ |
643 | 650 |
644 #ifdef __cplusplus | 651 #ifdef __cplusplus |
645 } | 652 } |
646 #endif | 653 #endif |
647 | 654 |
648 #endif /* OPUS_DEFINES_H */ | 655 #endif /* OPUS_DEFINES_H */ |
OLD | NEW |