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