aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/flac_decoder_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-11 12:26:45 +0100
committerMax Kellermann <max@duempel.org>2012-02-11 12:37:24 +0100
commita4cbaafd10d0ab0e0b6dc78a2f4444f08f546627 (patch)
tree5b7da040ca2bfdc9c53a9463ca40f36f0879b722 /src/decoder/flac_decoder_plugin.c
parentc5f2cdb82202d86ab2cda4d7f02732cb9fbffd2a (diff)
downloadmpd-a4cbaafd10d0ab0e0b6dc78a2f4444f08f546627.tar.gz
mpd-a4cbaafd10d0ab0e0b6dc78a2f4444f08f546627.tar.xz
mpd-a4cbaafd10d0ab0e0b6dc78a2f4444f08f546627.zip
decoder/flac: use error messages from libFLAC
Diffstat (limited to 'src/decoder/flac_decoder_plugin.c')
-rw-r--r--src/decoder/flac_decoder_plugin.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/src/decoder/flac_decoder_plugin.c b/src/decoder/flac_decoder_plugin.c
index 9279d9e5e..418f00549 100644
--- a/src/decoder/flac_decoder_plugin.c
+++ b/src/decoder/flac_decoder_plugin.c
@@ -117,46 +117,33 @@ static void
flac_error_cb(G_GNUC_UNUSED const FLAC__StreamDecoder *fd,
FLAC__StreamDecoderErrorStatus status, void *fdata)
{
- flac_error_common_cb("flac", status, (struct flac_data *) fdata);
+ flac_error_common_cb(status, (struct flac_data *) fdata);
}
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
static void flacPrintErroredState(FLAC__SeekableStreamDecoderState state)
{
- const char *str = ""; /* "" to silence compiler warning */
switch (state) {
case FLAC__SEEKABLE_STREAM_DECODER_OK:
case FLAC__SEEKABLE_STREAM_DECODER_SEEKING:
case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:
return;
+
case FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
- str = "allocation error";
- break;
case FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR:
- str = "read error";
- break;
case FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR:
- str = "seek error";
- break;
case FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR:
- str = "seekable stream error";
- break;
case FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED:
- str = "decoder already initialized";
- break;
case FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK:
- str = "invalid callback";
- break;
case FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED:
- str = "decoder uninitialized";
+ break;
}
- g_warning("%s\n", str);
+ g_warning("%s\n", FLAC__SeekableStreamDecoderStateString[state]);
}
#else /* FLAC_API_VERSION_CURRENT >= 7 */
static void flacPrintErroredState(FLAC__StreamDecoderState state)
{
- const char *str = ""; /* "" to silence compiler warning */
switch (state) {
case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
case FLAC__STREAM_DECODER_READ_METADATA:
@@ -164,23 +151,16 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state)
case FLAC__STREAM_DECODER_READ_FRAME:
case FLAC__STREAM_DECODER_END_OF_STREAM:
return;
+
case FLAC__STREAM_DECODER_OGG_ERROR:
- str = "error in the Ogg layer";
- break;
case FLAC__STREAM_DECODER_SEEK_ERROR:
- str = "seek error";
- break;
case FLAC__STREAM_DECODER_ABORTED:
- str = "decoder aborted by read";
- break;
case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
- str = "allocation error";
- break;
case FLAC__STREAM_DECODER_UNINITIALIZED:
- str = "decoder uninitialized";
+ break;
}
- g_warning("%s\n", str);
+ g_warning("%s\n", FLAC__StreamDecoderStateString[state]);
}
#endif /* FLAC_API_VERSION_CURRENT >= 7 */