From 060814daa83f6a94f5934464ae42a406c5c7e947 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 27 Sep 2013 22:31:24 +0200 Subject: Log: new logging library API Prepare to migrate away from GLib. Currently, we're still using GLib as a backend. --- src/decoder/MpcdecDecoderPlugin.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/decoder/MpcdecDecoderPlugin.cxx') diff --git a/src/decoder/MpcdecDecoderPlugin.cxx b/src/decoder/MpcdecDecoderPlugin.cxx index 252fe92e6..c0785accc 100644 --- a/src/decoder/MpcdecDecoderPlugin.cxx +++ b/src/decoder/MpcdecDecoderPlugin.cxx @@ -24,6 +24,8 @@ #include "CheckAudioFormat.hxx" #include "tag/TagHandler.hxx" #include "util/Error.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include @@ -32,14 +34,13 @@ #include #include -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "mpcdec" - struct mpc_decoder_data { struct input_stream *is; struct decoder *decoder; }; +static constexpr Domain mpcdec_domain("mpcdec"); + static mpc_int32_t mpc_read_cb(mpc_reader *reader, void *ptr, mpc_int32_t size) { @@ -148,7 +149,8 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) mpc_demux *demux = mpc_demux_init(&reader); if (demux == nullptr) { if (decoder_get_command(mpd_decoder) != DecoderCommand::STOP) - g_warning("Not a valid musepack stream"); + LogWarning(mpcdec_domain, + "Not a valid musepack stream"); return; } @@ -160,7 +162,7 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) if (!audio_format_init_checked(audio_format, info.sample_freq, SampleFormat::S24_P32, info.channels, error)) { - g_warning("%s", error.GetMessage()); + LogError(error); mpc_demux_exit(demux); return; } @@ -199,7 +201,8 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) frame.buffer = (MPC_SAMPLE_FORMAT *)sample_buffer; mpc_status status = mpc_demux_decode(demux, &frame); if (status != MPC_STATUS_OK) { - g_warning("Failed to decode sample"); + LogWarning(mpcdec_domain, + "Failed to decode sample"); break; } -- cgit v1.2.3