aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/_flac_common.c17
-rw-r--r--src/decoder/_flac_common.h3
-rw-r--r--src/decoder/flac_decoder_plugin.c34
3 files changed, 10 insertions, 44 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index fc42e5913..bab3995f0 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -139,26 +139,13 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
}
}
-void flac_error_common_cb(const char *plugin,
- const FLAC__StreamDecoderErrorStatus status,
+void flac_error_common_cb(const FLAC__StreamDecoderErrorStatus status,
struct flac_data *data)
{
if (decoder_get_command(data->decoder) == DECODE_COMMAND_STOP)
return;
- switch (status) {
- case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
- g_warning("%s lost sync\n", plugin);
- break;
- case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
- g_warning("bad %s header\n", plugin);
- break;
- case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
- g_warning("%s crc mismatch\n", plugin);
- break;
- default:
- g_warning("unknown %s error\n", plugin);
- }
+ g_warning("%s", FLAC__StreamDecoderErrorStatusString[status]);
}
/**
diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h
index 1f4cbb273..0d90ba656 100644
--- a/src/decoder/_flac_common.h
+++ b/src/decoder/_flac_common.h
@@ -94,8 +94,7 @@ flac_data_deinit(struct flac_data *data);
void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
struct flac_data *data);
-void flac_error_common_cb(const char *plugin,
- FLAC__StreamDecoderErrorStatus status,
+void flac_error_common_cb(FLAC__StreamDecoderErrorStatus status,
struct flac_data *data);
FLAC__StreamDecoderWriteStatus
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 */