]>
Commit | Line | Data |
---|---|---|
cf18f140 AM |
1 | diff -ur twinkle-1.4.2/configure.in twinkle-1.4.2.ilbc/configure.in |
2 | --- twinkle-1.4.2/configure.in 2012-11-25 17:33:24.559058451 +0100 | |
3 | +++ twinkle-1.4.2.ilbc/configure.in 2012-11-25 17:24:34.305743823 +0100 | |
4 | @@ -247,15 +247,20 @@ | |
5 | # iLBC | |
6 | if test "x$ac_cv_ilbc" = "xyes" | |
7 | then | |
8 | - AC_CHECK_LIB(ilbc, iLBC_decode, [ | |
9 | - AC_CHECK_HEADER(ilbc/iLBC_define.h, [], | |
10 | - [AC_MSG_ERROR([ilbc header files missing])]) | |
11 | + saved_LIBS="$LIBS" | |
12 | + LIBS="-lilbc $LIBS" | |
13 | + AC_LINK_IFELSE([ | |
14 | + #include <stdio.h> | |
15 | + #include <ilbc.h> | |
16 | + int main() { iLBC_decode(NULL, NULL, NULL, 0); return 0; } ], [ | |
17 | AC_DEFINE(HAVE_ILBC, 1, [Define to 1 if you have the <ilbc> library.]) | |
18 | - LIBS="-lilbc $LIBS" | |
19 | echo "LIBS += -lilbc" >> $QT_INCL_PRO | |
20 | have_ilbc="yes" | |
21 | - ], [have_ilbc="no"]) | |
22 | + ], [ | |
23 | + LIBS="$saved_LIBS" | |
24 | + have_ilbc="no" | |
25 | + ]) | |
26 | ||
27 | if test "x$ac_cv_ilbc_cpp" = "xyes" | |
28 | then | |
29 | AC_DEFINE(HAVE_ILBC_CPP, 1, [Define to 1 if you have a C++ ilbc library.]) | |
30 | diff -ur twinkle-1.4.2/src/audio/audio_decoder.cpp twinkle-1.4.2.ilbc/src/audio/audio_decoder.cpp | |
31 | --- twinkle-1.4.2/src/audio/audio_decoder.cpp 2009-01-18 14:38:00.000000000 +0100 | |
32 | +++ twinkle-1.4.2.ilbc/src/audio/audio_decoder.cpp 2012-11-25 17:28:53.519068012 +0100 | |
33 | @@ -25,12 +25,28 @@ | |
34 | #ifndef HAVE_ILBC_CPP | |
35 | extern "C" { | |
36 | #endif | |
37 | -#include <ilbc/iLBC_decode.h> | |
38 | +#include <ilbc.h> | |
39 | #ifndef HAVE_ILBC_CPP | |
40 | } | |
41 | #endif | |
42 | #endif | |
43 | ||
44 | +#ifndef NO_OF_BYTES_20MS | |
45 | +#define NO_OF_BYTES_20MS 38 | |
46 | +#endif | |
47 | + | |
48 | +#ifndef NO_OF_BYTES_30MS | |
49 | +#define NO_OF_BYTES_30MS 50 | |
50 | +#endif | |
51 | + | |
52 | +#ifndef MIN_SAMPLE | |
53 | +#define MIN_SAMPLE -32768 | |
54 | +#endif | |
55 | + | |
56 | +#ifndef MAX_SAMPLE | |
57 | +#define MAX_SAMPLE 32767 | |
58 | +#endif | |
59 | + | |
60 | ////////////////////////////////////////// | |
61 | // class t_audio_decoder | |
62 | ////////////////////////////////////////// | |
63 | @@ -278,19 +294,19 @@ | |
64 | uint16 t_ilbc_audio_decoder::decode(uint8 *payload, uint16 payload_size, | |
65 | int16 *pcm_buf, uint16 pcm_buf_size) | |
66 | { | |
67 | - float sample; | |
68 | - float block[BLOCKL_MAX]; | |
69 | + int16 sample; | |
70 | + int16 block[BLOCKL_MAX]; | |
71 | int block_len; | |
72 | ||
73 | if (get_ptime(payload_size) == 20) { | |
74 | block_len = BLOCKL_20MS; | |
75 | assert(pcm_buf_size >= block_len); | |
76 | - iLBC_decode(block, (unsigned char*)payload, &_ilbc_decoder_20, 1); | |
77 | + iLBC_decode(block, (uint16*)payload, &_ilbc_decoder_20, 1); | |
78 | _last_received_ptime = 20; | |
79 | } else { | |
80 | block_len = BLOCKL_30MS; | |
81 | assert(pcm_buf_size >= block_len); | |
82 | - iLBC_decode(block, (unsigned char*)payload, &_ilbc_decoder_30, 1); | |
83 | + iLBC_decode(block, (uint16*)payload, &_ilbc_decoder_30, 1); | |
84 | _last_received_ptime = 30; | |
85 | } | |
86 | ||
87 | @@ -300,15 +316,15 @@ | |
88 | if (sample < MIN_SAMPLE) sample = MIN_SAMPLE; | |
89 | if (sample > MAX_SAMPLE) sample = MAX_SAMPLE; | |
90 | ||
91 | - pcm_buf[i] = static_cast<int16>(sample); | |
92 | + pcm_buf[i] = sample; | |
93 | } | |
94 | ||
95 | return block_len; | |
96 | } | |
97 | ||
98 | uint16 t_ilbc_audio_decoder::conceal(int16 *pcm_buf, uint16 pcm_buf_size) { | |
99 | - float sample; | |
100 | - float block[BLOCKL_MAX]; | |
101 | + short int sample; | |
102 | + short int block[BLOCKL_MAX]; | |
103 | int block_len; | |
104 | ||
105 | if (_last_received_ptime == 0) return 0; | |
106 | diff -ur twinkle-1.4.2/src/audio/audio_decoder.h twinkle-1.4.2.ilbc/src/audio/audio_decoder.h | |
107 | --- twinkle-1.4.2/src/audio/audio_decoder.h 2012-11-25 17:33:24.559058451 +0100 | |
108 | +++ twinkle-1.4.2.ilbc/src/audio/audio_decoder.h 2012-11-25 17:24:34.305743823 +0100 | |
109 | @@ -40,7 +40,7 @@ | |
110 | #ifndef HAVE_ILBC_CPP | |
111 | extern "C" { | |
112 | #endif | |
113 | -#include <ilbc/iLBC_define.h> | |
114 | +#include <ilbc.h> | |
115 | #ifndef HAVE_ILBC_CPP | |
116 | } | |
117 | #endif | |
118 | diff -ur twinkle-1.4.2/src/audio/audio_encoder.cpp twinkle-1.4.2.ilbc/src/audio/audio_encoder.cpp | |
119 | --- twinkle-1.4.2/src/audio/audio_encoder.cpp 2009-01-18 15:13:46.000000000 +0100 | |
120 | +++ twinkle-1.4.2.ilbc/src/audio/audio_encoder.cpp 2012-11-25 17:30:53.155730458 +0100 | |
121 | @@ -24,12 +24,20 @@ | |
122 | #ifndef HAVE_ILBC_CPP | |
123 | extern "C" { | |
124 | #endif | |
125 | -#include <ilbc/iLBC_encode.h> | |
126 | +#include <ilbc.h> | |
127 | #ifndef HAVE_ILBC_CPP | |
128 | } | |
129 | #endif | |
130 | #endif | |
131 | ||
132 | +#ifndef NO_OF_BYTES_20MS | |
133 | +#define NO_OF_BYTES_20MS 38 | |
134 | +#endif | |
135 | + | |
136 | +#ifndef NO_OF_BYTES_30MS | |
137 | +#define NO_OF_BYTES_30MS 50 | |
138 | +#endif | |
139 | + | |
140 | ////////////////////////////////////////// | |
141 | // class t_audio_encoder | |
142 | ////////////////////////////////////////// | |
143 | @@ -264,13 +272,8 @@ | |
144 | assert(nsamples == _ilbc_encoder.blockl); | |
145 | ||
146 | silence = false; | |
147 | - float block[nsamples]; | |
148 | - | |
149 | - for (int i = 0; i < nsamples; i++) { | |
150 | - block[i] = static_cast<float>(sample_buf[i]); | |
151 | - } | |
152 | ||
153 | - iLBC_encode((unsigned char*)payload, block, &_ilbc_encoder); | |
154 | + iLBC_encode((uint16*)payload, sample_buf, &_ilbc_encoder); | |
155 | ||
156 | return _ilbc_encoder.no_of_bytes; | |
157 | } | |
158 | diff -ur twinkle-1.4.2/src/audio/audio_encoder.h twinkle-1.4.2.ilbc/src/audio/audio_encoder.h | |
159 | --- twinkle-1.4.2/src/audio/audio_encoder.h 2012-11-25 17:33:24.562391784 +0100 | |
160 | +++ twinkle-1.4.2.ilbc/src/audio/audio_encoder.h 2012-11-25 17:24:34.305743823 +0100 | |
161 | @@ -39,7 +39,7 @@ | |
162 | #ifndef HAVE_ILBC_CPP | |
163 | extern "C" { | |
164 | #endif | |
165 | -#include <ilbc/iLBC_define.h> | |
166 | +#include <ilbc.h> | |
167 | #ifndef HAVE_ILBC_CPP | |
168 | } | |
169 | #endif |