From d342e338db085e8e8f6eded2aef48c7ca41239ae Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Jan 2009 14:52:13 +0100 Subject: pcm: use GLib instead of utils.h --- src/pcm_channels.c | 5 ++--- src/pcm_resample_libsamplerate.c | 9 ++++----- src/pcm_utils.c | 17 ++++++++--------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/pcm_channels.c b/src/pcm_channels.c index 327f46aac..13fe81cb4 100644 --- a/src/pcm_channels.c +++ b/src/pcm_channels.c @@ -17,7 +17,6 @@ */ #include "pcm_channels.h" -#include "utils.h" #include @@ -84,7 +83,7 @@ pcm_convert_channels_16(int8_t dest_channels, if (dest_size > len) { len = dest_size; - buf = xrealloc(buf, len); + buf = g_realloc(buf, len); } *dest_size_r = dest_size; @@ -163,7 +162,7 @@ pcm_convert_channels_24(int8_t dest_channels, if (dest_size > len) { len = dest_size; - buf = xrealloc(buf, len); + buf = g_realloc(buf, len); } *dest_size_r = dest_size; diff --git a/src/pcm_resample_libsamplerate.c b/src/pcm_resample_libsamplerate.c index 1a3656cc4..95d7e5d7f 100644 --- a/src/pcm_resample_libsamplerate.c +++ b/src/pcm_resample_libsamplerate.c @@ -19,7 +19,6 @@ #include "pcm_resample.h" #include "conf.h" -#include "utils.h" #include @@ -131,14 +130,14 @@ pcm_resample_16(uint8_t channels, data_in_size = data->input_frames * sizeof(float) * channels; if (data_in_size > state->data_in_size) { state->data_in_size = data_in_size; - data->data_in = xrealloc(data->data_in, data_in_size); + data->data_in = g_realloc(data->data_in, data_in_size); } data->output_frames = dest_size / sizeof(*dest_buffer) / channels; data_out_size = data->output_frames * sizeof(float) * channels; if (data_out_size > state->data_out_size) { state->data_out_size = data_out_size; - data->data_out = xrealloc(data->data_out, data_out_size); + data->data_out = g_realloc(data->data_out, data_out_size); } src_short_to_float_array(src_buffer, data->data_in, @@ -204,14 +203,14 @@ pcm_resample_24(uint8_t channels, data_in_size = data->input_frames * sizeof(float) * channels; if (data_in_size > state->data_in_size) { state->data_in_size = data_in_size; - data->data_in = xrealloc(data->data_in, data_in_size); + data->data_in = g_realloc(data->data_in, data_in_size); } data->output_frames = dest_size / sizeof(*dest_buffer) / channels; data_out_size = data->output_frames * sizeof(float) * channels; if (data_out_size > state->data_out_size) { state->data_out_size = data_out_size; - data->data_out = xrealloc(data->data_out, data_out_size); + data->data_out = g_realloc(data->data_out, data_out_size); } src_int_to_float_array(src_buffer, data->data_in, diff --git a/src/pcm_utils.c b/src/pcm_utils.c index a7e7a3990..b1178c7a2 100644 --- a/src/pcm_utils.c +++ b/src/pcm_utils.c @@ -19,7 +19,6 @@ #include "pcm_utils.h" #include "pcm_channels.h" #include "pcm_prng.h" -#include "utils.h" #include "conf.h" #include "audio_format.h" @@ -259,7 +258,7 @@ pcm_convert_to_16(struct pcm_convert_state *convert, *dest_size_r = src_size << 1; if (*dest_size_r > len) { len = *dest_size_r; - buf = xrealloc(buf, len); + buf = g_realloc(buf, len); } pcm_convert_8_to_16((int16_t *)buf, @@ -276,7 +275,7 @@ pcm_convert_to_16(struct pcm_convert_state *convert, *dest_size_r = num_samples * 2; if (*dest_size_r > len) { len = *dest_size_r; - buf = xrealloc(buf, len); + buf = g_realloc(buf, len); } pcm_convert_24_to_16(&convert->dither, @@ -324,7 +323,7 @@ pcm_convert_to_24(uint8_t bits, const void *src, *dest_size_r = src_size * 4; if (*dest_size_r > len) { len = *dest_size_r; - buf = xrealloc(buf, len); + buf = g_realloc(buf, len); } pcm_convert_8_to_24(buf, (const int8_t *)src, @@ -336,7 +335,7 @@ pcm_convert_to_24(uint8_t bits, const void *src, *dest_size_r = num_samples * 4; if (*dest_size_r > len) { len = *dest_size_r; - buf = xrealloc(buf, len); + buf = g_realloc(buf, len); } pcm_convert_16_to_24(buf, (const int16_t *)src, @@ -368,14 +367,14 @@ pcm_convert_16(const struct audio_format *src_format, buf = pcm_convert_to_16(state, src_format->bits, src_buffer, src_size, &len); if (!buf) - exit(EXIT_FAILURE); + g_error("pcm_convert_to_16() failed"); if (src_format->channels != dest_format->channels) { buf = pcm_convert_channels_16(dest_format->channels, src_format->channels, buf, len, &len); if (!buf) - exit(EXIT_FAILURE); + g_error("pcm_convert_channels_16() failed"); } if (src_format->sample_rate == dest_format->sample_rate) { @@ -408,14 +407,14 @@ pcm_convert_24(const struct audio_format *src_format, buf = pcm_convert_to_24(src_format->bits, src_buffer, src_size, &len); if (!buf) - exit(EXIT_FAILURE); + g_error("pcm_convert_to_24() failed"); if (src_format->channels != dest_format->channels) { buf = pcm_convert_channels_24(dest_format->channels, src_format->channels, buf, len, &len); if (!buf) - exit(EXIT_FAILURE); + g_error("pcm_convert_channels_24() failed"); } if (src_format->sample_rate == dest_format->sample_rate) { -- cgit v1.2.3