resampler: Change interface, resampler may return the number of leftover frames

some resampler implementations (e.g. libsamplerate and ffmpeg) do not consume
the entire input buffer; the impl_resample() function now has a return value
returning the number of frames in the input buffer not processed

these frames must be saved in appropriate buffer and presented together with
new input data

also change the parameter names from in_samples, out_samples to in_n_frames,
out_n_frames, respectively (n_frames = samples / channels)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
Peter Meerwald 2013-07-21 23:14:40 +02:00 committed by Tanu Kaskinen
parent 6d61c7779d
commit 79b237ca02
2 changed files with 22 additions and 7 deletions

View file

@ -33,7 +33,10 @@ typedef struct pa_resampler_impl pa_resampler_impl;
struct pa_resampler_impl {
void (*free)(pa_resampler *r);
void (*update_rates)(pa_resampler *r);
void (*resample)(pa_resampler *r, const pa_memchunk *in, unsigned in_samples, pa_memchunk *out, unsigned *out_samples);
/* Returns the number of leftover frames in the input buffer. */
unsigned (*resample)(pa_resampler *r, const pa_memchunk *in, unsigned in_n_frames, pa_memchunk *out, unsigned *out_n_frames);
void (*reset)(pa_resampler *r);
void *data;
};