Mercurial > mplayer.hg
comparison libmpcodecs/ad_qtaudio.c @ 8159:8703835345e3
fixed output bits per sample
mace support
author | arpi |
---|---|
date | Tue, 12 Nov 2002 00:04:55 +0000 |
parents | 9fc45fe0d444 |
children | badd24741e4a |
comparison
equal
deleted
inserted
replaced
8158:bffdd162d034 | 8159:8703835345e3 |
---|---|
1 | |
2 #include <stdio.h> | 1 #include <stdio.h> |
3 #include <stdlib.h> | 2 #include <stdlib.h> |
4 #include <unistd.h> | 3 #include <unistd.h> |
5 #include <inttypes.h> | 4 #include <inttypes.h> |
6 | 5 |
7 #include "config.h" | 6 #include "config.h" |
8 | 7 |
9 #ifdef USE_WIN32DLL | 8 #ifdef USE_QTX_CODECS |
10 | 9 |
11 #include "ad_internal.h" | 10 #include "ad_internal.h" |
12 #include "bswap.h" | 11 #include "bswap.h" |
13 | 12 |
14 static ad_info_t info = { | 13 static ad_info_t info = { |
163 if(loader_init()) return 0; // failed to load DLL | 162 if(loader_init()) return 0; // failed to load DLL |
164 | 163 |
165 printf("loader_init DONE!\n"); | 164 printf("loader_init DONE!\n"); |
166 | 165 |
167 #if 1 | 166 #if 1 |
168 error = InitializeQTML(0L); | 167 error = InitializeQTML(6+16); |
169 printf("InitializeQTML:%i\n",error); | 168 printf("InitializeQTML:%i\n",error); |
170 if(error) return 0; | 169 if(error) return 0; |
171 | 170 |
172 OutputFormatInfo.flags = InputFormatInfo.flags = 0; | 171 OutputFormatInfo.flags = InputFormatInfo.flags = 0; |
173 OutputFormatInfo.sampleCount = InputFormatInfo.sampleCount = 0; | 172 OutputFormatInfo.sampleCount = InputFormatInfo.sampleCount = 0; |
174 OutputFormatInfo.buffer = InputFormatInfo.buffer = NULL; | 173 OutputFormatInfo.buffer = InputFormatInfo.buffer = NULL; |
175 OutputFormatInfo.reserved = InputFormatInfo.reserved = 0; | 174 OutputFormatInfo.reserved = InputFormatInfo.reserved = 0; |
176 OutputFormatInfo.numChannels = InputFormatInfo.numChannels = sh->wf->nChannels; | 175 OutputFormatInfo.numChannels = InputFormatInfo.numChannels = sh->wf->nChannels; |
177 OutputFormatInfo.sampleSize = InputFormatInfo.sampleSize = sh->wf->wBitsPerSample; | 176 InputFormatInfo.sampleSize = sh->wf->wBitsPerSample; |
177 OutputFormatInfo.sampleSize = 16; | |
178 OutputFormatInfo.sampleRate = InputFormatInfo.sampleRate = sh->wf->nSamplesPerSec; | 178 OutputFormatInfo.sampleRate = InputFormatInfo.sampleRate = sh->wf->nSamplesPerSec; |
179 InputFormatInfo.format = bswap_32(sh->format); //1363430706;///*1768775988;//*/1902406962;//qdm2//1768775988;//FOUR_CHAR_CODE('ima4'); | 179 InputFormatInfo.format = bswap_32(sh->format); //1363430706;///*1768775988;//*/1902406962;//qdm2//1768775988;//FOUR_CHAR_CODE('ima4'); |
180 OutputFormatInfo.format = 1313820229;// FOUR_CHAR_CODE('NONE'); | 180 OutputFormatInfo.format = 1313820229;// FOUR_CHAR_CODE('NONE'); |
181 | 181 |
182 error = SoundConverterOpen(&InputFormatInfo, &OutputFormatInfo, &myConverter); | 182 error = SoundConverterOpen(&InputFormatInfo, &OutputFormatInfo, &myConverter); |
210 sh->audio_out_minsize=OutputBufferSize; | 210 sh->audio_out_minsize=OutputBufferSize; |
211 sh->audio_in_minsize=InputBufferSize; | 211 sh->audio_in_minsize=InputBufferSize; |
212 | 212 |
213 sh->channels=sh->wf->nChannels; | 213 sh->channels=sh->wf->nChannels; |
214 sh->samplerate=sh->wf->nSamplesPerSec; | 214 sh->samplerate=sh->wf->nSamplesPerSec; |
215 sh->samplesize=(sh->wf->wBitsPerSample+7)/8; | 215 sh->samplesize=2; //(sh->wf->wBitsPerSample+7)/8; |
216 | 216 |
217 sh->i_bps=sh->wf->nAvgBytesPerSec; | 217 sh->i_bps=sh->wf->nAvgBytesPerSec; |
218 //InputBufferSize*WantedBufferSize/OutputBufferSize; | 218 //InputBufferSize*WantedBufferSize/OutputBufferSize; |
219 | 219 |
220 #endif | 220 #endif |
221 | |
222 if(sh->format==0x3343414D){ | |
223 // MACE 3:1 | |
224 sh->ds->ss_div = 2*3; // 1 samples/packet | |
225 sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet | |
226 } else | |
227 if(sh->format==0x3643414D){ | |
228 // MACE 6:1 | |
229 sh->ds->ss_div = 2*6; // 1 samples/packet | |
230 sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet | |
231 } | |
232 | |
221 return 1; // return values: 1=OK 0=ERROR | 233 return 1; // return values: 1=OK 0=ERROR |
222 } | 234 } |
223 | 235 |
224 static int init(sh_audio_t *sh_audio){ | 236 static int init(sh_audio_t *sh_audio){ |
225 | 237 |
254 if(FramesToGet*InFrameSize>sh->a_in_buffer_size) | 266 if(FramesToGet*InFrameSize>sh->a_in_buffer_size) |
255 FramesToGet=sh->a_in_buffer_size/InFrameSize; | 267 FramesToGet=sh->a_in_buffer_size/InFrameSize; |
256 | 268 |
257 InputBufferSize=FramesToGet*InFrameSize; | 269 InputBufferSize=FramesToGet*InFrameSize; |
258 | 270 |
259 printf("FramesToGet = %li (%li -> %li bytes)\n",FramesToGet, | 271 // printf("FramesToGet = %li (%li -> %li bytes)\n",FramesToGet, |
260 InputBufferSize, FramesToGet*OutFrameSize); | 272 // InputBufferSize, FramesToGet*OutFrameSize); |
261 | 273 |
262 if(InputBufferSize>sh->a_in_buffer_len){ | 274 if(InputBufferSize>sh->a_in_buffer_len){ |
263 int x=demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], | 275 int x=demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], |
264 InputBufferSize-sh->a_in_buffer_len); | 276 InputBufferSize-sh->a_in_buffer_len); |
265 if(x>0) sh->a_in_buffer_len+=x; | 277 if(x>0) sh->a_in_buffer_len+=x; |
266 if(InputBufferSize>sh->a_in_buffer_len) | 278 if(InputBufferSize>sh->a_in_buffer_len) |
267 FramesToGet=sh->a_in_buffer_len/InFrameSize; // not enough data! | 279 FramesToGet=sh->a_in_buffer_len/InFrameSize; // not enough data! |
268 } | 280 } |
269 | 281 |
282 // printf("\nSoundConverterConvertBuffer(myConv=%p,inbuf=%p,frames=%d,outbuf=%p,&convframes=%p,&convbytes=%p)\n", | |
283 // myConverter,sh->a_in_buffer,FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); | |
270 error = SoundConverterConvertBuffer(myConverter,sh->a_in_buffer, | 284 error = SoundConverterConvertBuffer(myConverter,sh->a_in_buffer, |
271 FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); | 285 FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); |
272 printf("SoundConverterConvertBuffer:%i\n",error); | 286 // printf("SoundConverterConvertBuffer:%i\n",error); |
273 printf("ConvertedFrames = %li\n",ConvertedFrames); | 287 // printf("ConvertedFrames = %li\n",ConvertedFrames); |
274 printf("ConvertedBytes = %li\n",ConvertedBytes); | 288 // printf("ConvertedBytes = %li\n",ConvertedBytes); |
275 | 289 |
276 InputBufferSize=(ConvertedBytes/OutFrameSize)*InFrameSize; // FIXME!! | 290 InputBufferSize=(ConvertedBytes/OutFrameSize)*InFrameSize; // FIXME!! |
277 sh->a_in_buffer_len-=InputBufferSize; | 291 sh->a_in_buffer_len-=InputBufferSize; |
278 if(sh->a_in_buffer_len<0) sh->a_in_buffer_len=0; // should not happen... | 292 if(sh->a_in_buffer_len<0) sh->a_in_buffer_len=0; // should not happen... |
279 else if(sh->a_in_buffer_len>0){ | 293 else if(sh->a_in_buffer_len>0){ |