pcm: use GLib instead of utils.h
This commit is contained in:
parent
962f2407d2
commit
d342e338db
@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include "pcm_channels.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@ -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;
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "pcm_resample.h"
|
||||
#include "conf.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@ -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,
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user