Mercurial > mplayer.hg
comparison libaf/af_format.c @ 24888:b2402b4f0afa
libaf: change filter input/output ratio calculations
Change the audio filters to use a double instead of rationals for the
ratio of output to input size. The rationals could overflow when
calculating the overall ratio of a filter chain and gave no real
advantage compared to doubles.
author | uau |
---|---|
date | Thu, 01 Nov 2007 06:52:01 +0000 |
parents | 90b0691d9709 |
children | f0a89eb49958 |
comparison
equal
deleted
inserted
replaced
24887:484b8eaaf28f | 24888:b2402b4f0afa |
---|---|
102 af_fmt2str(data->format,buf1,256), | 102 af_fmt2str(data->format,buf1,256), |
103 af_fmt2str(af->data->format,buf2,256)); | 103 af_fmt2str(af->data->format,buf2,256)); |
104 | 104 |
105 af->data->rate = data->rate; | 105 af->data->rate = data->rate; |
106 af->data->nch = data->nch; | 106 af->data->nch = data->nch; |
107 af->mul.n = af->data->bps; | 107 af->mul = (double)af->data->bps / data->bps; |
108 af->mul.d = data->bps; | |
109 af_frac_cancel(&af->mul); | |
110 | 108 |
111 af->play = play; // set default | 109 af->play = play; // set default |
112 | 110 |
113 // look whether only endianness differences are there | 111 // look whether only endianness differences are there |
114 if ((af->data->format & ~AF_FORMAT_END_MASK) == | 112 if ((af->data->format & ~AF_FORMAT_END_MASK) == |
307 // Allocate memory and set function pointers | 305 // Allocate memory and set function pointers |
308 static int af_open(af_instance_t* af){ | 306 static int af_open(af_instance_t* af){ |
309 af->control=control; | 307 af->control=control; |
310 af->uninit=uninit; | 308 af->uninit=uninit; |
311 af->play=play; | 309 af->play=play; |
312 af->mul.n=1; | 310 af->mul=1; |
313 af->mul.d=1; | |
314 af->data=calloc(1,sizeof(af_data_t)); | 311 af->data=calloc(1,sizeof(af_data_t)); |
315 if(af->data == NULL) | 312 if(af->data == NULL) |
316 return AF_ERROR; | 313 return AF_ERROR; |
317 return AF_OK; | 314 return AF_OK; |
318 } | 315 } |