replay_gain: use GLib instead of utils.h/log.h

Eliminated deprecated libraries.
This commit is contained in:
Max Kellermann 2008-11-11 16:38:26 +01:00
parent 8a40e0b495
commit bc1999f815

View File

@ -18,9 +18,6 @@
*/ */
#include "replay_gain.h" #include "replay_gain.h"
#include "utils.h"
#include "log.h"
#include "conf.h" #include "conf.h"
#include "audio_format.h" #include "audio_format.h"
#include "pcm_utils.h" #include "pcm_utils.h"
@ -49,7 +46,7 @@ void replay_gain_global_init(void)
} else if (strcmp(param->value, "album") == 0) { } else if (strcmp(param->value, "album") == 0) {
replay_gain_mode = REPLAY_GAIN_ALBUM; replay_gain_mode = REPLAY_GAIN_ALBUM;
} else { } else {
FATAL("replaygain value \"%s\" at line %i is invalid\n", g_error("replaygain value \"%s\" at line %i is invalid\n",
param->value, param->line); param->value, param->line);
} }
@ -60,12 +57,12 @@ void replay_gain_global_init(void)
float f = strtod(param->value, &test); float f = strtod(param->value, &test);
if (*test != '\0') { if (*test != '\0') {
FATAL("Replaygain preamp \"%s\" is not a number at " g_error("Replaygain preamp \"%s\" is not a number at "
"line %i\n", param->value, param->line); "line %i\n", param->value, param->line);
} }
if (f < -15 || f > 15) { if (f < -15 || f > 15) {
FATAL("Replaygain preamp \"%s\" is not between -15 and" g_error("Replaygain preamp \"%s\" is not between -15 and"
"15 at line %i\n", param->value, param->line); "15 at line %i\n", param->value, param->line);
} }
@ -92,7 +89,7 @@ static float calc_replay_gain_scale(float gain, float peak)
struct replay_gain_info *replay_gain_info_new(void) struct replay_gain_info *replay_gain_info_new(void)
{ {
struct replay_gain_info *ret = xmalloc(sizeof(*ret)); struct replay_gain_info *ret = g_new(struct replay_gain_info, 1);
for (unsigned i = 0; i < G_N_ELEMENTS(ret->tuples); ++i) { for (unsigned i = 0; i < G_N_ELEMENTS(ret->tuples); ++i) {
ret->tuples[i].gain = 0.0; ret->tuples[i].gain = 0.0;
@ -107,7 +104,7 @@ struct replay_gain_info *replay_gain_info_new(void)
void replay_gain_info_free(struct replay_gain_info *info) void replay_gain_info_free(struct replay_gain_info *info)
{ {
free(info); g_free(info);
} }
void void
@ -121,7 +118,7 @@ replay_gain_apply(struct replay_gain_info *info, char *buffer, int size,
const struct replay_gain_tuple *tuple = const struct replay_gain_tuple *tuple =
&info->tuples[replay_gain_mode]; &info->tuples[replay_gain_mode];
DEBUG("computing ReplayGain %s scale with gain %f, peak %f\n", g_debug("computing ReplayGain %s scale with gain %f, peak %f\n",
replay_gain_mode_names[replay_gain_mode], replay_gain_mode_names[replay_gain_mode],
tuple->gain, tuple->peak); tuple->gain, tuple->peak);