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