From 63c3ebee46c8adbb477829090961a386391de276 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 21 Nov 2008 20:15:50 +0100 Subject: flac, oggflac: use GLib instead of utils.h/log.h --- src/decoder/_flac_common.c | 9 ++++----- src/decoder/_flac_common.h | 5 +++++ src/decoder/flac_plugin.c | 25 ++++++++++--------------- src/decoder/oggflac_plugin.c | 23 ++++++++++------------- 4 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c index 200b6fee6..5fea91734 100644 --- a/src/decoder/_flac_common.c +++ b/src/decoder/_flac_common.c @@ -20,7 +20,6 @@ */ #include "_flac_common.h" -#include "../log.h" #include #include @@ -177,16 +176,16 @@ void flac_error_common_cb(const char *plugin, switch (status) { case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC: - ERROR("%s lost sync\n", plugin); + g_warning("%s lost sync\n", plugin); break; case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER: - ERROR("bad %s header\n", plugin); + g_warning("bad %s header\n", plugin); break; case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH: - ERROR("%s crc mismatch\n", plugin); + g_warning("%s crc mismatch\n", plugin); break; default: - ERROR("unknown %s error\n", plugin); + g_warning("unknown %s error\n", plugin); } } diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h index 37465a216..c2e1f4315 100644 --- a/src/decoder/_flac_common.h +++ b/src/decoder/_flac_common.h @@ -24,6 +24,11 @@ #include "../decoder_api.h" +#include + +#undef G_LOG_DOMAIN +#define G_LOG_DOMAIN "flac" + #include #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7 # include diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 289fada0b..4767e35b0 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -17,8 +17,6 @@ */ #include "_flac_common.h" -#include "../utils.h" -#include "../log.h" #include @@ -128,7 +126,8 @@ static void flacPrintErroredState(FLAC__SeekableStreamDecoderState state) case FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED: str = "decoder uninitialized"; } - ERROR("flac %s\n", str); + + g_warning("%s\n", str); } static int flac_init(FLAC__SeekableStreamDecoder *dec, @@ -186,7 +185,8 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state) case FLAC__STREAM_DECODER_UNINITIALIZED: str = "decoder uninitialized"; } - ERROR("flac %s\n", str); + + g_warning("%s\n", str); } #endif /* FLAC_API_VERSION_CURRENT >= 7 */ @@ -251,9 +251,8 @@ flacMetadataDup(const char *file, bool *vorbisCommentFound) default: err = FLAC__Metadata_SimpleIteratorStatusString[s]; } - DEBUG("flacMetadataDup: Reading '%s' " - "metadata gave the following error: %s\n", - file, err); + g_debug("Reading '%s' metadata gave the following error: %s\n", + file, err); FLAC__metadata_simple_iterator_delete(it); return ret; } @@ -288,8 +287,7 @@ static struct tag *flacTagDup(const char *file) ret = flacMetadataDup(file, &foundVorbisComment); if (!ret) { - DEBUG("flacTagDup: Failed to grab information from: %s\n", - file); + g_debug("Failed to grab information from: %s\n", file); return NULL; } if (!foundVorbisComment) { @@ -319,7 +317,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream, #if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 if(!FLAC__stream_decoder_set_metadata_respond(flacDec, FLAC__METADATA_TYPE_VORBIS_COMMENT)) { - DEBUG(__FILE__": Failed to set metadata respond\n"); + g_debug("Failed to set metadata respond\n"); } #endif @@ -376,11 +374,8 @@ fail: if (flacDec) flac_delete(flacDec); - if (err) { - ERROR("flac %s\n", err); - return; - } - return; + if (err) + g_warning("%s\n", err); } static void diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c index 7550005d9..637a611a3 100644 --- a/src/decoder/oggflac_plugin.c +++ b/src/decoder/oggflac_plugin.c @@ -22,9 +22,6 @@ #include "_flac_common.h" #include "_ogg_common.h" -#include "../utils.h" -#include "../log.h" - #include static void oggflac_cleanup(FlacData * data, @@ -120,25 +117,25 @@ static void oggflacPrintErroredState(OggFLAC__SeekableStreamDecoderState state) { switch (state) { case OggFLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR: - ERROR("oggflac allocation error\n"); + g_warning("oggflac allocation error\n"); break; case OggFLAC__SEEKABLE_STREAM_DECODER_READ_ERROR: - ERROR("oggflac read error\n"); + g_warning("oggflac read error\n"); break; case OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR: - ERROR("oggflac seek error\n"); + g_warning("oggflac seek error\n"); break; case OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR: - ERROR("oggflac seekable stream error\n"); + g_warning("oggflac seekable stream error\n"); break; case OggFLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED: - ERROR("oggflac decoder already initialized\n"); + g_warning("oggflac decoder already initialized\n"); break; case OggFLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK: - ERROR("invalid oggflac callback\n"); + g_warning("invalid oggflac callback\n"); break; case OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED: - ERROR("oggflac decoder uninitialized\n"); + g_warning("oggflac decoder uninitialized\n"); break; case OggFLAC__SEEKABLE_STREAM_DECODER_OK: case OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING: @@ -233,17 +230,17 @@ static OggFLAC__SeekableStreamDecoder (void *)data); if (!s) { - ERROR("oggflac problem before init()\n"); + g_warning("oggflac problem before init()\n"); goto fail; } if (OggFLAC__seekable_stream_decoder_init(decoder) != OggFLAC__SEEKABLE_STREAM_DECODER_OK) { - ERROR("oggflac problem doing init()\n"); + g_warning("oggflac problem doing init()\n"); goto fail; } if (!OggFLAC__seekable_stream_decoder_process_until_end_of_metadata (decoder)) { - ERROR("oggflac problem reading metadata\n"); + g_warning("oggflac problem reading metadata\n"); goto fail; } -- cgit v1.2.3