mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
resampler: Make some basic functions for rewinding
The resampler framework just forwards the request to the lfe filter. There are no resampler impl that can rewind yet, so just reset the resampler impl instead of properly rewinding yet. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
defc2b702b
commit
7fb531d936
4 changed files with 22 additions and 5 deletions
|
|
@ -578,6 +578,20 @@ void pa_resampler_reset(pa_resampler *r) {
|
|||
*r->have_leftover = false;
|
||||
}
|
||||
|
||||
void pa_resampler_rewind(pa_resampler *r, size_t out_frames) {
|
||||
pa_assert(r);
|
||||
|
||||
/* For now, we don't have any rewindable resamplers, so we just
|
||||
reset the resampler instead (and hope that nobody hears the difference). */
|
||||
if (r->impl.reset)
|
||||
r->impl.reset(r);
|
||||
|
||||
if (r->lfe_filter)
|
||||
pa_lfe_filter_rewind(r->lfe_filter, out_frames);
|
||||
|
||||
*r->have_leftover = false;
|
||||
}
|
||||
|
||||
pa_resample_method_t pa_resampler_get_method(pa_resampler *r) {
|
||||
pa_assert(r);
|
||||
|
||||
|
|
@ -818,8 +832,8 @@ static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_filter_r
|
|||
} else {
|
||||
|
||||
/* OK, we shall do the full monty: upmixing and downmixing. Our
|
||||
* algorithm is relatively simple, does not do spacialization, delay
|
||||
* elements or apply lowpass filters for LFE. Patches are always
|
||||
* algorithm is relatively simple, does not do spacialization, or delay
|
||||
* elements. LFE filters are done after the remap step. Patches are always
|
||||
* welcome, though. Oh, and it doesn't do any matrix decoding. (Which
|
||||
* probably wouldn't make any sense anyway.)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -145,6 +145,9 @@ void pa_resampler_set_output_rate(pa_resampler *r, uint32_t rate);
|
|||
/* Reinitialize state of the resampler, possibly due to seeking or other discontinuities */
|
||||
void pa_resampler_reset(pa_resampler *r);
|
||||
|
||||
/* Rewind resampler */
|
||||
void pa_resampler_rewind(pa_resampler *r, size_t out_frames);
|
||||
|
||||
/* Return the resampling method of the resampler object */
|
||||
pa_resample_method_t pa_resampler_get_method(pa_resampler *r);
|
||||
|
||||
|
|
|
|||
|
|
@ -1106,9 +1106,9 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
|
|||
if (i->thread_info.rewrite_flush)
|
||||
pa_memblockq_silence(i->thread_info.render_memblockq);
|
||||
|
||||
/* And reset the resampler */
|
||||
/* And rewind the resampler */
|
||||
if (i->thread_info.resampler)
|
||||
pa_resampler_reset(i->thread_info.resampler);
|
||||
pa_resampler_rewind(i->thread_info.resampler, amount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -851,7 +851,7 @@ void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in so
|
|||
o->process_rewind(o, nbytes);
|
||||
|
||||
if (o->thread_info.resampler)
|
||||
pa_resampler_reset(o->thread_info.resampler);
|
||||
pa_resampler_rewind(o->thread_info.resampler, nbytes);
|
||||
|
||||
} else
|
||||
pa_memblockq_rewind(o->thread_info.delay_memblockq, nbytes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue