mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
audioconvert: implement resample_out_len()
This commit is contained in:
parent
a1ecfc8d7f
commit
05c969381d
2 changed files with 21 additions and 0 deletions
|
|
@ -187,6 +187,20 @@ static uint32_t impl_native_in_len(struct resample *r, uint32_t out_len)
|
||||||
return in_len;
|
return in_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t impl_native_out_len(struct resample *r, uint32_t in_len)
|
||||||
|
{
|
||||||
|
struct native_data *data = r->data;
|
||||||
|
uint32_t out_len;
|
||||||
|
|
||||||
|
in_len = in_len - SPA_MIN(in_len, (data->n_taps - data->hist) + 1);
|
||||||
|
out_len = in_len * data->out_rate - data->phase;
|
||||||
|
out_len = (out_len + data->in_rate - 1) / data->in_rate;
|
||||||
|
|
||||||
|
spa_log_trace_fp(r->log, "native %p: hist:%d %d->%d", r, data->hist, in_len, out_len);
|
||||||
|
|
||||||
|
return out_len;
|
||||||
|
}
|
||||||
|
|
||||||
static void impl_native_process(struct resample *r,
|
static void impl_native_process(struct resample *r,
|
||||||
const void * SPA_RESTRICT src[], uint32_t *in_len,
|
const void * SPA_RESTRICT src[], uint32_t *in_len,
|
||||||
void * SPA_RESTRICT dst[], uint32_t *out_len)
|
void * SPA_RESTRICT dst[], uint32_t *out_len)
|
||||||
|
|
@ -309,6 +323,7 @@ int resample_native_init(struct resample *r)
|
||||||
r->free = impl_native_free;
|
r->free = impl_native_free;
|
||||||
r->update_rate = impl_native_update_rate;
|
r->update_rate = impl_native_update_rate;
|
||||||
r->in_len = impl_native_in_len;
|
r->in_len = impl_native_in_len;
|
||||||
|
r->out_len = impl_native_out_len;
|
||||||
r->process = impl_native_process;
|
r->process = impl_native_process;
|
||||||
r->reset = impl_native_reset;
|
r->reset = impl_native_reset;
|
||||||
r->delay = impl_native_delay;
|
r->delay = impl_native_delay;
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,11 @@ static uint32_t impl_peaks_in_len(struct resample *r, uint32_t out_len)
|
||||||
return out_len;
|
return out_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t impl_peaks_out_len(struct resample *r, uint32_t in_len)
|
||||||
|
{
|
||||||
|
return in_len;
|
||||||
|
}
|
||||||
|
|
||||||
static void impl_peaks_reset (struct resample *r)
|
static void impl_peaks_reset (struct resample *r)
|
||||||
{
|
{
|
||||||
struct peaks_data *d = r->data;
|
struct peaks_data *d = r->data;
|
||||||
|
|
@ -119,6 +124,7 @@ int resample_peaks_init(struct resample *r)
|
||||||
r->reset = impl_peaks_reset;
|
r->reset = impl_peaks_reset;
|
||||||
r->delay = impl_peaks_delay;
|
r->delay = impl_peaks_delay;
|
||||||
r->in_len = impl_peaks_in_len;
|
r->in_len = impl_peaks_in_len;
|
||||||
|
r->out_len = impl_peaks_out_len;
|
||||||
|
|
||||||
spa_log_debug(r->log, "peaks %p: in:%d out:%d features:%08x:%08x", r,
|
spa_log_debug(r->log, "peaks %p: in:%d out:%d features:%08x:%08x", r,
|
||||||
r->i_rate, r->o_rate, r->cpu_flags, d->peaks.cpu_flags);
|
r->i_rate, r->o_rate, r->cpu_flags, d->peaks.cpu_flags);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue