aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-11 21:12:10 +0100
committerMax Kellermann <max@duempel.org>2009-11-11 21:12:10 +0100
commit4f38cc9cae29429f838e88463e16526397b69ccd (patch)
treeadaa0c309b06fe75386cb6aaa4806200bcfadc89 /src/decoder
parentdfc09a37c914829c150ad902fc5f18fc555e7a60 (diff)
downloadmpd-4f38cc9cae29429f838e88463e16526397b69ccd.tar.gz
mpd-4f38cc9cae29429f838e88463e16526397b69ccd.tar.xz
mpd-4f38cc9cae29429f838e88463e16526397b69ccd.zip
decoder/vorbis: moved error strings to vorbis_strerror()
Diffstat (limited to 'src/decoder')
-rwxr-xr-xsrc/decoder/vorbis_plugin.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/decoder/vorbis_plugin.c b/src/decoder/vorbis_plugin.c
index 25be96971..e97522edc 100755
--- a/src/decoder/vorbis_plugin.c
+++ b/src/decoder/vorbis_plugin.c
@@ -101,6 +101,30 @@ static long ogg_tell_cb(void *vdata)
}
static const char *
+vorbis_strerror(int code)
+{
+ switch (code) {
+ case OV_EREAD:
+ return "read error";
+
+ case OV_ENOTVORBIS:
+ return "not vorbis stream";
+
+ case OV_EVERSION:
+ return "vorbis version mismatch";
+
+ case OV_EBADHEADER:
+ return "invalid vorbis header";
+
+ case OV_EFAULT:
+ return "internal logic error";
+
+ default:
+ return "unknown error";
+ }
+}
+
+static const char *
vorbis_comment_value(const char *comment, const char *needle)
{
size_t len = strlen(needle);
@@ -274,33 +298,11 @@ vorbis_stream_decode(struct decoder *decoder,
callbacks.close_func = ogg_close_cb;
callbacks.tell_func = ogg_tell_cb;
if ((ret = ov_open_callbacks(&data, &vf, NULL, 0, callbacks)) < 0) {
- const char *error;
-
if (decoder_get_command(decoder) != DECODE_COMMAND_NONE)
return;
- switch (ret) {
- case OV_EREAD:
- error = "read error";
- break;
- case OV_ENOTVORBIS:
- error = "not vorbis stream";
- break;
- case OV_EVERSION:
- error = "vorbis version mismatch";
- break;
- case OV_EBADHEADER:
- error = "invalid vorbis header";
- break;
- case OV_EFAULT:
- error = "internal logic error";
- break;
- default:
- error = "unknown error";
- break;
- }
-
- g_warning("Error decoding Ogg Vorbis stream: %s", error);
+ g_warning("Error decoding Ogg Vorbis stream: %s",
+ vorbis_strerror(ret));
return;
}