pcm_resample: add internal function _lsr_init()

Let the libsamplerate code initialize itself.
This commit is contained in:
Max Kellermann 2011-10-08 12:40:03 +02:00
parent 2b3fd0d4d3
commit 14424281a0
4 changed files with 26 additions and 8 deletions

View File

@ -58,16 +58,12 @@ pcm_resample_global_init(GError **error_r)
void pcm_resample_init(struct pcm_resample_state *state)
{
memset(state, 0, sizeof(*state));
#ifdef HAVE_LIBSAMPLERATE
if (pcm_resample_lsr_enabled()) {
pcm_buffer_init(&state->in);
pcm_buffer_init(&state->out);
}
if (pcm_resample_lsr_enabled())
pcm_resample_lsr_init(state);
else
#endif
pcm_buffer_init(&state->buffer);
pcm_resample_fallback_init(state);
}
void pcm_resample_deinit(struct pcm_resample_state *state)

View File

@ -22,6 +22,12 @@
#include <assert.h>
void
pcm_resample_fallback_init(struct pcm_resample_state *state)
{
pcm_buffer_init(&state->buffer);
}
void
pcm_resample_fallback_deinit(struct pcm_resample_state *state)
{

View File

@ -35,6 +35,9 @@
bool
pcm_resample_lsr_global_init(const char *converter, GError **error_r);
void
pcm_resample_lsr_init(struct pcm_resample_state *state);
void
pcm_resample_lsr_deinit(struct pcm_resample_state *state);
@ -57,6 +60,9 @@ pcm_resample_lsr_32(struct pcm_resample_state *state,
#endif
void
pcm_resample_fallback_init(struct pcm_resample_state *state);
void
pcm_resample_fallback_deinit(struct pcm_resample_state *state);

View File

@ -83,6 +83,16 @@ pcm_resample_lsr_global_init(const char *converter, GError **error_r)
return true;
}
void
pcm_resample_lsr_init(struct pcm_resample_state *state)
{
memset(state, 0, sizeof(*state));
pcm_buffer_init(&state->in);
pcm_buffer_init(&state->out);
pcm_buffer_init(&state->buffer);
}
void
pcm_resample_lsr_deinit(struct pcm_resample_state *state)
{