Mercurial > mplayer.hg
annotate libmpcodecs/ad_qtaudio.c @ 19492:c8daf3471201
SSA/ASS parser reworked, with 2 main results:
support for script embedded fonts (fonts, uuencoded directly into script) added;
matroska interface functions have got more sensible names.
author | eugeni |
---|---|
date | Tue, 22 Aug 2006 22:11:01 +0000 |
parents | a1807995e2ab |
children | ed01090d1192 |
rev | line source |
---|---|
8008 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <unistd.h> | |
4 #include <inttypes.h> | |
5 | |
6 #include "config.h" | |
17012 | 7 #include "mp_msg.h" |
8008 | 8 |
12356
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12193
diff
changeset
|
9 #include "wine/windef.h" |
8008 | 10 |
11 #include "ad_internal.h" | |
12 #include "bswap.h" | |
13 | |
9405
a4444e7ee56a
real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents:
8632
diff
changeset
|
14 #ifdef WIN32_LOADER |
8451 | 15 #include "ldt_keeper.h" |
16 #endif | |
17 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
18 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
19 #include <QuickTime/QuickTimeComponents.h> |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
20 #endif |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
21 |
8008 | 22 static ad_info_t info = { |
23 "QuickTime Audio Decoder", | |
24 "qtaudio", | |
25 "A'rpi", | |
26 "Sascha Sommer", | |
27 "uses win32 quicktime DLLs" | |
28 }; | |
29 | |
30 LIBAD_EXTERN(qtaudio) | |
31 | |
18771
a1807995e2ab
Move #ifdefs around complete files into the build system.
diego
parents:
17012
diff
changeset
|
32 #if !defined(MACOSX) |
8008 | 33 typedef struct OpaqueSoundConverter* SoundConverter; |
34 typedef unsigned long OSType; | |
35 typedef unsigned long UnsignedFixed; | |
36 typedef uint8_t Byte; | |
37 typedef struct SoundComponentData { | |
38 long flags; | |
39 OSType format; | |
40 short numChannels; | |
41 short sampleSize; | |
42 UnsignedFixed sampleRate; | |
43 long sampleCount; | |
44 Byte * buffer; | |
45 long reserved; | |
46 }SoundComponentData; | |
47 | |
48 typedef int (__cdecl* LPFUNC1)(long flag); | |
49 typedef int (__cdecl* LPFUNC2)(const SoundComponentData *, const SoundComponentData *,SoundConverter *); | |
50 typedef int (__cdecl* LPFUNC3)(SoundConverter sc); | |
51 typedef int (__cdecl* LPFUNC4)(void); | |
52 typedef int (__cdecl* LPFUNC5)(SoundConverter sc, OSType selector,void * infoPtr); | |
53 typedef int (__cdecl* LPFUNC6)(SoundConverter sc, | |
54 unsigned long inputBytesTarget, | |
55 unsigned long *inputFrames, | |
56 unsigned long *inputBytes, | |
57 unsigned long *outputBytes ); | |
58 typedef int (__cdecl* LPFUNC7)(SoundConverter sc, | |
59 const void *inputPtr, | |
60 unsigned long inputFrames, | |
61 void *outputPtr, | |
62 unsigned long *outputFrames, | |
63 unsigned long *outputBytes ); | |
64 typedef int (__cdecl* LPFUNC8)(SoundConverter sc, | |
65 void *outputPtr, | |
66 unsigned long *outputFrames, | |
67 unsigned long *outputBytes); | |
68 typedef int (__cdecl* LPFUNC9)(SoundConverter sc) ; | |
69 | |
14528
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
70 static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts |
8008 | 71 static HINSTANCE qtml_dll; |
72 static LPFUNC1 InitializeQTML; | |
73 static LPFUNC2 SoundConverterOpen; | |
74 static LPFUNC3 SoundConverterClose; | |
75 static LPFUNC4 TerminateQTML; | |
76 static LPFUNC5 SoundConverterSetInfo; | |
77 static LPFUNC6 SoundConverterGetBufferSizes; | |
78 static LPFUNC7 SoundConverterConvertBuffer; | |
79 static LPFUNC8 SoundConverterEndConversion; | |
80 static LPFUNC9 SoundConverterBeginConversion; | |
81 | |
82 #define siDecompressionParams 2002876005 // siDecompressionParams = FOUR_CHAR_CODE('wave') | |
83 | |
84 HMODULE WINAPI LoadLibraryA(LPCSTR); | |
85 FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); | |
86 int WINAPI FreeLibrary(HMODULE); | |
87 | |
88 static int loader_init() | |
89 { | |
90 | |
9405
a4444e7ee56a
real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents:
8632
diff
changeset
|
91 #ifdef WIN32_LOADER |
8270 | 92 Setup_LDT_Keeper(); |
93 #endif | |
14528
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
94 //preload quicktime.qts to avoid the problems caused by the hardcoded path inside the dll |
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
95 qtime_qts = LoadLibraryA("QuickTime.qts"); |
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
96 if( qtime_qts == (HMODULE)NULL ) |
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
97 { |
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
98 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed loading QuickTime.qts\n" ); |
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
99 return 1; |
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
100 } |
8008 | 101 qtml_dll = LoadLibraryA("qtmlClient.dll"); |
13188 | 102 if( qtml_dll == (HMODULE)NULL ) |
8008 | 103 { |
14528
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
104 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed loading qtmlClient.dll\n" ); |
8008 | 105 return 1; |
106 } | |
107 #if 1 | |
108 InitializeQTML = (LPFUNC1)GetProcAddress(qtml_dll,"InitializeQTML"); | |
109 if ( InitializeQTML == NULL ) | |
110 { | |
12193 | 111 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed geting proc address InitializeQTML\n"); |
8008 | 112 return 1; |
113 } | |
114 SoundConverterOpen = (LPFUNC2)GetProcAddress(qtml_dll,"SoundConverterOpen"); | |
115 if ( SoundConverterOpen == NULL ) | |
116 { | |
12193 | 117 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterOpen\n"); |
8008 | 118 return 1; |
119 } | |
120 SoundConverterClose = (LPFUNC3)GetProcAddress(qtml_dll,"SoundConverterClose"); | |
121 if ( SoundConverterClose == NULL ) | |
122 { | |
12193 | 123 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterClose\n"); |
8008 | 124 return 1; |
125 } | |
126 TerminateQTML = (LPFUNC4)GetProcAddress(qtml_dll,"TerminateQTML"); | |
127 if ( TerminateQTML == NULL ) | |
128 { | |
12193 | 129 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address TerminateQTML\n"); |
8008 | 130 return 1; |
131 } | |
132 SoundConverterSetInfo = (LPFUNC5)GetProcAddress(qtml_dll,"SoundConverterSetInfo"); | |
133 if ( SoundConverterSetInfo == NULL ) | |
134 { | |
12193 | 135 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterSetInfo\n"); |
8008 | 136 return 1; |
137 } | |
138 SoundConverterGetBufferSizes = (LPFUNC6)GetProcAddress(qtml_dll,"SoundConverterGetBufferSizes"); | |
139 if ( SoundConverterGetBufferSizes == NULL ) | |
140 { | |
12193 | 141 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterGetBufferSizes\n"); |
8008 | 142 return 1; |
143 } | |
144 SoundConverterConvertBuffer = (LPFUNC7)GetProcAddress(qtml_dll,"SoundConverterConvertBuffer"); | |
145 if ( SoundConverterConvertBuffer == NULL ) | |
146 { | |
12193 | 147 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterConvertBuffer1\n"); |
8008 | 148 return 1; |
149 } | |
150 SoundConverterEndConversion = (LPFUNC8)GetProcAddress(qtml_dll,"SoundConverterEndConversion"); | |
151 if ( SoundConverterEndConversion == NULL ) | |
152 { | |
12193 | 153 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterEndConversion\n"); |
8008 | 154 return 1; |
155 } | |
156 SoundConverterBeginConversion = (LPFUNC9)GetProcAddress(qtml_dll,"SoundConverterBeginConversion"); | |
157 if ( SoundConverterBeginConversion == NULL ) | |
158 { | |
12193 | 159 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterBeginConversion\n"); |
8008 | 160 return 1; |
161 } | |
162 #endif | |
12193 | 163 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"loader_init DONE???\n"); |
8008 | 164 return 0; |
165 } | |
18771
a1807995e2ab
Move #ifdefs around complete files into the build system.
diego
parents:
17012
diff
changeset
|
166 #endif /* #if !defined(MACOSX) */ |
8008 | 167 |
168 static SoundConverter myConverter = NULL; | |
169 static SoundComponentData InputFormatInfo,OutputFormatInfo; | |
170 | |
171 static int InFrameSize; | |
172 static int OutFrameSize; | |
173 | |
174 static int preinit(sh_audio_t *sh){ | |
175 int error; | |
176 unsigned long FramesToGet=0; //how many frames the demuxer has to get | |
177 unsigned long InputBufferSize=0; //size of the input buffer | |
178 unsigned long OutputBufferSize=0; //size of the output buffer | |
179 unsigned long WantedBufferSize=0; //the size you want your buffers to be | |
180 | |
181 | |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
182 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
183 EnterMovies(); |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
184 #else |
8008 | 185 if(loader_init()) return 0; // failed to load DLL |
186 | |
12193 | 187 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"loader_init DONE!\n"); |
8008 | 188 |
8159 | 189 error = InitializeQTML(6+16); |
13008 | 190 if(error){ |
191 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"InitializeQTML:%i\n",error); | |
192 return 0; | |
193 } | |
9694 | 194 #endif |
8008 | 195 |
9694 | 196 #if 1 |
8008 | 197 OutputFormatInfo.flags = InputFormatInfo.flags = 0; |
198 OutputFormatInfo.sampleCount = InputFormatInfo.sampleCount = 0; | |
199 OutputFormatInfo.buffer = InputFormatInfo.buffer = NULL; | |
200 OutputFormatInfo.reserved = InputFormatInfo.reserved = 0; | |
201 OutputFormatInfo.numChannels = InputFormatInfo.numChannels = sh->wf->nChannels; | |
8159 | 202 InputFormatInfo.sampleSize = sh->wf->wBitsPerSample; |
203 OutputFormatInfo.sampleSize = 16; | |
8008 | 204 OutputFormatInfo.sampleRate = InputFormatInfo.sampleRate = sh->wf->nSamplesPerSec; |
205 InputFormatInfo.format = bswap_32(sh->format); //1363430706;///*1768775988;//*/1902406962;//qdm2//1768775988;//FOUR_CHAR_CODE('ima4'); | |
206 OutputFormatInfo.format = 1313820229;// FOUR_CHAR_CODE('NONE'); | |
207 | |
208 error = SoundConverterOpen(&InputFormatInfo, &OutputFormatInfo, &myConverter); | |
12193 | 209 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterOpen:%i\n",error); |
8008 | 210 if(error) return 0; |
211 | |
212 if(sh->codecdata){ | |
213 error = SoundConverterSetInfo(myConverter,siDecompressionParams,sh->codecdata); | |
12193 | 214 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterSetInfo:%i\n",error); |
8632
9cecfb883d85
don't abort if setparams failed - fixes some Qclp files
arpi
parents:
8451
diff
changeset
|
215 // if(error) return 0; |
8008 | 216 } |
217 | |
218 WantedBufferSize=OutputFormatInfo.numChannels*OutputFormatInfo.sampleRate*2; | |
219 error = SoundConverterGetBufferSizes(myConverter, | |
220 WantedBufferSize,&FramesToGet,&InputBufferSize,&OutputBufferSize); | |
12193 | 221 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterGetBufferSizes:%i\n",error); |
222 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"WantedBufferSize = %li\n",WantedBufferSize); | |
223 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"InputBufferSize = %li\n",InputBufferSize); | |
224 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"OutputBufferSize = %li\n",OutputBufferSize); | |
225 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FramesToGet = %li\n",FramesToGet); | |
8008 | 226 |
8389
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
227 InFrameSize=(InputBufferSize+FramesToGet-1)/FramesToGet; |
8008 | 228 OutFrameSize=OutputBufferSize/FramesToGet; |
229 | |
12193 | 230 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FrameSize: %i -> %i\n",InFrameSize,OutFrameSize); |
8008 | 231 |
232 error = SoundConverterBeginConversion(myConverter); | |
12193 | 233 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterBeginConversion:%i\n",error); |
8008 | 234 if(error) return 0; |
235 | |
236 sh->audio_out_minsize=OutputBufferSize; | |
237 sh->audio_in_minsize=InputBufferSize; | |
238 | |
239 sh->channels=sh->wf->nChannels; | |
240 sh->samplerate=sh->wf->nSamplesPerSec; | |
8159 | 241 sh->samplesize=2; //(sh->wf->wBitsPerSample+7)/8; |
8008 | 242 |
243 sh->i_bps=sh->wf->nAvgBytesPerSec; | |
244 //InputBufferSize*WantedBufferSize/OutputBufferSize; | |
245 | |
246 #endif | |
8159 | 247 |
248 if(sh->format==0x3343414D){ | |
249 // MACE 3:1 | |
250 sh->ds->ss_div = 2*3; // 1 samples/packet | |
251 sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet | |
252 } else | |
253 if(sh->format==0x3643414D){ | |
254 // MACE 6:1 | |
255 sh->ds->ss_div = 2*6; // 1 samples/packet | |
256 sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet | |
257 } | |
258 | |
8008 | 259 return 1; // return values: 1=OK 0=ERROR |
260 } | |
261 | |
262 static int init(sh_audio_t *sh_audio){ | |
263 | |
264 return 1; // return values: 1=OK 0=ERROR | |
265 } | |
266 | |
267 static void uninit(sh_audio_t *sh){ | |
268 int error; | |
269 unsigned long ConvertedFrames=0; | |
270 unsigned long ConvertedBytes=0; | |
271 error=SoundConverterEndConversion(myConverter,NULL,&ConvertedFrames,&ConvertedBytes); | |
12193 | 272 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterEndConversion:%i\n",error); |
8008 | 273 error = SoundConverterClose(myConverter); |
12193 | 274 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterClose:%i\n",error); |
8389
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
275 // error = TerminateQTML(); |
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
276 // printf("TerminateQTML:%i\n",error); |
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
277 // FreeLibrary( qtml_dll ); |
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
278 // qtml_dll = NULL; |
14528
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
279 // FreeLibrary( qtime_qts ); |
860f06087aac
preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents:
13606
diff
changeset
|
280 // qtime_qts = NULL; |
8389
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
281 // printf("qt dll loader uninit done\n"); |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
282 #ifdef MACOSX |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
283 ExitMovies(); |
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
284 #endif |
8008 | 285 } |
286 | |
287 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){ | |
288 int error; | |
289 unsigned long FramesToGet=0; //how many frames the demuxer has to get | |
290 unsigned long InputBufferSize=0; //size of the input buffer | |
291 unsigned long ConvertedFrames=0; | |
292 unsigned long ConvertedBytes=0; | |
293 | |
294 FramesToGet=minlen/OutFrameSize; | |
295 if(FramesToGet*OutFrameSize<minlen && | |
296 (FramesToGet+1)*OutFrameSize<=maxlen) ++FramesToGet; | |
297 if(FramesToGet*InFrameSize>sh->a_in_buffer_size) | |
298 FramesToGet=sh->a_in_buffer_size/InFrameSize; | |
299 | |
300 InputBufferSize=FramesToGet*InFrameSize; | |
301 | |
8159 | 302 // printf("FramesToGet = %li (%li -> %li bytes)\n",FramesToGet, |
303 // InputBufferSize, FramesToGet*OutFrameSize); | |
8008 | 304 |
305 if(InputBufferSize>sh->a_in_buffer_len){ | |
306 int x=demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], | |
307 InputBufferSize-sh->a_in_buffer_len); | |
308 if(x>0) sh->a_in_buffer_len+=x; | |
309 if(InputBufferSize>sh->a_in_buffer_len) | |
310 FramesToGet=sh->a_in_buffer_len/InFrameSize; // not enough data! | |
311 } | |
312 | |
8159 | 313 // printf("\nSoundConverterConvertBuffer(myConv=%p,inbuf=%p,frames=%d,outbuf=%p,&convframes=%p,&convbytes=%p)\n", |
314 // myConverter,sh->a_in_buffer,FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); | |
8008 | 315 error = SoundConverterConvertBuffer(myConverter,sh->a_in_buffer, |
316 FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); | |
8159 | 317 // printf("SoundConverterConvertBuffer:%i\n",error); |
318 // printf("ConvertedFrames = %li\n",ConvertedFrames); | |
319 // printf("ConvertedBytes = %li\n",ConvertedBytes); | |
8008 | 320 |
8389
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
321 // InputBufferSize=(ConvertedBytes/OutFrameSize)*InFrameSize; // FIXME!! |
e8c51ec86340
fixed in/out framesize rounding bug (causing low-rate QCLP hangup/looping)
arpi
parents:
8270
diff
changeset
|
322 InputBufferSize=FramesToGet*InFrameSize; |
8008 | 323 sh->a_in_buffer_len-=InputBufferSize; |
324 if(sh->a_in_buffer_len<0) sh->a_in_buffer_len=0; // should not happen... | |
325 else if(sh->a_in_buffer_len>0){ | |
326 memcpy(sh->a_in_buffer,&sh->a_in_buffer[InputBufferSize],sh->a_in_buffer_len); | |
327 } | |
328 | |
329 return ConvertedBytes; | |
330 } | |
331 | |
332 static int control(sh_audio_t *sh,int cmd,void* arg, ...){ | |
333 // various optional functions you MAY implement: | |
334 return CONTROL_UNKNOWN; | |
335 } |