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