ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 /* Copyright (C) 2002 Jean-Marc Valin*/
TMBOY 47:9e361da97763 2 /**
TMBOY 47:9e361da97763 3 @file speex_callbacks.h
TMBOY 47:9e361da97763 4 @brief Describes callback handling and in-band signalling
TMBOY 47:9e361da97763 5 */
TMBOY 47:9e361da97763 6 /*
TMBOY 47:9e361da97763 7 Redistribution and use in source and binary forms, with or without
TMBOY 47:9e361da97763 8 modification, are permitted provided that the following conditions
TMBOY 47:9e361da97763 9 are met:
TMBOY 47:9e361da97763 10
TMBOY 47:9e361da97763 11 - Redistributions of source code must retain the above copyright
TMBOY 47:9e361da97763 12 notice, this list of conditions and the following disclaimer.
TMBOY 47:9e361da97763 13
TMBOY 47:9e361da97763 14 - Redistributions in binary form must reproduce the above copyright
TMBOY 47:9e361da97763 15 notice, this list of conditions and the following disclaimer in the
TMBOY 47:9e361da97763 16 documentation and/or other materials provided with the distribution.
TMBOY 47:9e361da97763 17
TMBOY 47:9e361da97763 18 - Neither the name of the Xiph.org Foundation nor the names of its
TMBOY 47:9e361da97763 19 contributors may be used to endorse or promote products derived from
TMBOY 47:9e361da97763 20 this software without specific prior written permission.
TMBOY 47:9e361da97763 21
TMBOY 47:9e361da97763 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
TMBOY 47:9e361da97763 23 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
TMBOY 47:9e361da97763 24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
TMBOY 47:9e361da97763 25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
TMBOY 47:9e361da97763 26 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
TMBOY 47:9e361da97763 27 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
TMBOY 47:9e361da97763 28 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
TMBOY 47:9e361da97763 29 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
TMBOY 47:9e361da97763 30 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
TMBOY 47:9e361da97763 31 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
TMBOY 47:9e361da97763 32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
TMBOY 47:9e361da97763 33
TMBOY 47:9e361da97763 34 */
TMBOY 47:9e361da97763 35
TMBOY 47:9e361da97763 36 #ifndef SPEEX_CALLBACKS_H
TMBOY 47:9e361da97763 37 #define SPEEX_CALLBACKS_H
TMBOY 47:9e361da97763 38 /** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder.
TMBOY 47:9e361da97763 39 * @{
TMBOY 47:9e361da97763 40 */
TMBOY 47:9e361da97763 41
TMBOY 47:9e361da97763 42 #include "speex.h"
TMBOY 47:9e361da97763 43
TMBOY 47:9e361da97763 44 #ifdef __cplusplus
TMBOY 47:9e361da97763 45 extern "C" {
TMBOY 47:9e361da97763 46 #endif
TMBOY 47:9e361da97763 47
TMBOY 47:9e361da97763 48 /** Total number of callbacks */
TMBOY 47:9e361da97763 49 #define SPEEX_MAX_CALLBACKS 16
TMBOY 47:9e361da97763 50
TMBOY 47:9e361da97763 51 /* Describes all the in-band requests */
TMBOY 47:9e361da97763 52
TMBOY 47:9e361da97763 53 /*These are 1-bit requests*/
TMBOY 47:9e361da97763 54 /** Request for perceptual enhancement (1 for on, 0 for off) */
TMBOY 47:9e361da97763 55 #define SPEEX_INBAND_ENH_REQUEST 0
TMBOY 47:9e361da97763 56 /** Reserved */
TMBOY 47:9e361da97763 57 #define SPEEX_INBAND_RESERVED1 1
TMBOY 47:9e361da97763 58
TMBOY 47:9e361da97763 59 /*These are 4-bit requests*/
TMBOY 47:9e361da97763 60 /** Request for a mode change */
TMBOY 47:9e361da97763 61 #define SPEEX_INBAND_MODE_REQUEST 2
TMBOY 47:9e361da97763 62 /** Request for a low mode change */
TMBOY 47:9e361da97763 63 #define SPEEX_INBAND_LOW_MODE_REQUEST 3
TMBOY 47:9e361da97763 64 /** Request for a high mode change */
TMBOY 47:9e361da97763 65 #define SPEEX_INBAND_HIGH_MODE_REQUEST 4
TMBOY 47:9e361da97763 66 /** Request for VBR (1 on, 0 off) */
TMBOY 47:9e361da97763 67 #define SPEEX_INBAND_VBR_QUALITY_REQUEST 5
TMBOY 47:9e361da97763 68 /** Request to be sent acknowledge */
TMBOY 47:9e361da97763 69 #define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6
TMBOY 47:9e361da97763 70 /** Request for VBR (1 for on, 0 for off) */
TMBOY 47:9e361da97763 71 #define SPEEX_INBAND_VBR_REQUEST 7
TMBOY 47:9e361da97763 72
TMBOY 47:9e361da97763 73 /*These are 8-bit requests*/
TMBOY 47:9e361da97763 74 /** Send a character in-band */
TMBOY 47:9e361da97763 75 #define SPEEX_INBAND_CHAR 8
TMBOY 47:9e361da97763 76 /** Intensity stereo information */
TMBOY 47:9e361da97763 77 #define SPEEX_INBAND_STEREO 9
TMBOY 47:9e361da97763 78
TMBOY 47:9e361da97763 79 /*These are 16-bit requests*/
TMBOY 47:9e361da97763 80 /** Transmit max bit-rate allowed */
TMBOY 47:9e361da97763 81 #define SPEEX_INBAND_MAX_BITRATE 10
TMBOY 47:9e361da97763 82
TMBOY 47:9e361da97763 83 /*These are 32-bit requests*/
TMBOY 47:9e361da97763 84 /** Acknowledge packet reception */
TMBOY 47:9e361da97763 85 #define SPEEX_INBAND_ACKNOWLEDGE 12
TMBOY 47:9e361da97763 86
TMBOY 47:9e361da97763 87 /** Callback function type */
TMBOY 47:9e361da97763 88 typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 89
TMBOY 47:9e361da97763 90 /** Callback information */
TMBOY 47:9e361da97763 91 typedef struct SpeexCallback {
TMBOY 47:9e361da97763 92 int callback_id; /**< ID associated to the callback */
TMBOY 47:9e361da97763 93 speex_callback_func func; /**< Callback handler function */
TMBOY 47:9e361da97763 94 void *data; /**< Data that will be sent to the handler */
TMBOY 47:9e361da97763 95 void *reserved1; /**< Reserved for future use */
TMBOY 47:9e361da97763 96 int reserved2; /**< Reserved for future use */
TMBOY 47:9e361da97763 97 } SpeexCallback;
TMBOY 47:9e361da97763 98
TMBOY 47:9e361da97763 99 /** Handle in-band request */
TMBOY 47:9e361da97763 100 int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state);
TMBOY 47:9e361da97763 101
TMBOY 47:9e361da97763 102 /** Standard handler for mode request (change mode, no questions asked) */
TMBOY 47:9e361da97763 103 int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 104
TMBOY 47:9e361da97763 105 /** Standard handler for high mode request (change high mode, no questions asked) */
TMBOY 47:9e361da97763 106 int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 107
TMBOY 47:9e361da97763 108 /** Standard handler for in-band characters (write to stderr) */
TMBOY 47:9e361da97763 109 int speex_std_char_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 110
TMBOY 47:9e361da97763 111 /** Default handler for user-defined requests: in this case, just ignore */
TMBOY 47:9e361da97763 112 int speex_default_user_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 113
TMBOY 47:9e361da97763 114
TMBOY 47:9e361da97763 115
TMBOY 47:9e361da97763 116 /** Standard handler for low mode request (change low mode, no questions asked) */
TMBOY 47:9e361da97763 117 int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 118
TMBOY 47:9e361da97763 119 /** Standard handler for VBR request (Set VBR, no questions asked) */
TMBOY 47:9e361da97763 120 int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 121
TMBOY 47:9e361da97763 122 /** Standard handler for enhancer request (Turn ehnancer on/off, no questions asked) */
TMBOY 47:9e361da97763 123 int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 124
TMBOY 47:9e361da97763 125 /** Standard handler for VBR quality request (Set VBR quality, no questions asked) */
TMBOY 47:9e361da97763 126 int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
TMBOY 47:9e361da97763 127
TMBOY 47:9e361da97763 128
TMBOY 47:9e361da97763 129 #ifdef __cplusplus
TMBOY 47:9e361da97763 130 }
TMBOY 47:9e361da97763 131 #endif
TMBOY 47:9e361da97763 132
TMBOY 47:9e361da97763 133 /** @} */
TMBOY 47:9e361da97763 134 #endif