aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/oggvorbis_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:14 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:14 +0200
commitaf58de65436ea93299edf58248a68b62d9610164 (patch)
tree391bf442bbfcd60882f7617a90cd8ff9b35ad18f /src/inputPlugins/oggvorbis_plugin.c
parent940ecf5345f339b9d3ec3e8029e345540358fa4c (diff)
downloadmpd-af58de65436ea93299edf58248a68b62d9610164.tar.gz
mpd-af58de65436ea93299edf58248a68b62d9610164.tar.xz
mpd-af58de65436ea93299edf58248a68b62d9610164.zip
simplified code in the ogg decoder plugin
Return early when the player thread sent us a command. This saves one level of indentation.
Diffstat (limited to 'src/inputPlugins/oggvorbis_plugin.c')
-rw-r--r--src/inputPlugins/oggvorbis_plugin.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c
index 6a6ecbd98..b2aa8bf60 100644
--- a/src/inputPlugins/oggvorbis_plugin.c
+++ b/src/inputPlugins/oggvorbis_plugin.c
@@ -232,32 +232,32 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream)
callbacks.close_func = ogg_close_cb;
callbacks.tell_func = ogg_tell_cb;
if ((ret = ov_open_callbacks(&data, &vf, NULL, 0, callbacks)) < 0) {
- if (decoder_get_command(decoder) != DECODE_COMMAND_STOP) {
- switch (ret) {
- case OV_EREAD:
- errorStr = "read error";
- break;
- case OV_ENOTVORBIS:
- errorStr = "not vorbis stream";
- break;
- case OV_EVERSION:
- errorStr = "vorbis version mismatch";
- break;
- case OV_EBADHEADER:
- errorStr = "invalid vorbis header";
- break;
- case OV_EFAULT:
- errorStr = "internal logic error";
- break;
- default:
- errorStr = "unknown error";
- break;
- }
- ERROR("Error decoding Ogg Vorbis stream: %s\n",
- errorStr);
- return -1;
+ if (decoder_get_command(decoder) != DECODE_COMMAND_NONE)
+ return 0;
+
+ switch (ret) {
+ case OV_EREAD:
+ errorStr = "read error";
+ break;
+ case OV_ENOTVORBIS:
+ errorStr = "not vorbis stream";
+ break;
+ case OV_EVERSION:
+ errorStr = "vorbis version mismatch";
+ break;
+ case OV_EBADHEADER:
+ errorStr = "invalid vorbis header";
+ break;
+ case OV_EFAULT:
+ errorStr = "internal logic error";
+ break;
+ default:
+ errorStr = "unknown error";
+ break;
}
- return 0;
+ ERROR("Error decoding Ogg Vorbis stream: %s\n",
+ errorStr);
+ return -1;
}
audio_format.bits = 16;