comparison resample2.c @ 2346:424e6b29de74 libavcodec

av_resample_compensate() doxy
author michael
date Fri, 12 Nov 2004 02:05:26 +0000
parents de38526a1f3f
children 6d53608cf2cf
comparison
equal deleted inserted replaced
2345:ada3891b859d 2346:424e6b29de74
157 void av_resample_close(AVResampleContext *c){ 157 void av_resample_close(AVResampleContext *c){
158 av_freep(&c->filter_bank); 158 av_freep(&c->filter_bank);
159 av_freep(&c); 159 av_freep(&c);
160 } 160 }
161 161
162 /**
163 * Compensates samplerate/timestamp drift. The compensation is done by changing
164 * the resampler parameters, so no audible clicks or similar distortions ocur
165 * @param compensation_distance distance in output samples over which the compensation should be performed
166 * @param sample_delta number of output samples which should be output less
167 *
168 * example: av_resample_compensate(c, 10, 500)
169 * here instead of 510 samples only 500 samples would be output
170 *
171 * note, due to rounding the actual compensation might be slightly different,
172 * especially if the compensation_distance is large and the in_rate used during init is small
173 */
162 void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){ 174 void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){
163 // sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr; 175 // sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
164 c->compensation_distance= compensation_distance; 176 c->compensation_distance= compensation_distance;
165 c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance; 177 c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
166 } 178 }