From ac5ec35a6e222f635912f6a7eaf3c036c71367b6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:02 +0200 Subject: enable -Wpointer-arith, -Wstrict-prototypes Also enable -Wunused-parameter - this forces us to add the gcc "unused" attribute to a lot of parameters (mostly library callback functions), but it's worth it during code refactorizations. --- src/inputPlugins/oggvorbis_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/inputPlugins/oggvorbis_plugin.c') diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index cb6eed28e..567515d23 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -86,7 +86,7 @@ static int ogg_seek_cb(void *vdata, ogg_int64_t offset, int whence) } /* TODO: check Ogg libraries API and see if we can just not have this func */ -static int ogg_close_cb(void *vdata) +static int ogg_close_cb(mpd_unused void *vdata) { return 0; } -- cgit v1.2.3 From 27ce02fa9146601ab4a0210cc85c2d5f50b833f4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:03 +0200 Subject: clean up CPP includes Include only headers which are really required. This speeds up compilation and helps detect cross-layer accesses. [ew: minor fixups to not break on new core] --- src/inputPlugins/oggvorbis_plugin.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/inputPlugins/oggvorbis_plugin.c') diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 567515d23..7612b1db5 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -25,13 +25,7 @@ #include "_ogg_common.h" #include "../utils.h" -#include "../audio.h" #include "../log.h" -#include "../pcm_utils.h" -#include "../inputStream.h" -#include "../outputBuffer.h" -#include "../replayGain.h" -#include "../os_compat.h" #ifndef HAVE_TREMOR #include -- cgit v1.2.3 From 5136928aef27ae6e81ef56b7f005e04455d35c2f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:13 +0200 Subject: oggvorbis: don't detect OGG header if stream is not seekable If the input stream is not seekable, the try_decode() function consumes valuable data, which is not available to the decode() function anymore. This means that the decode() function does not parse the header correctly. Better skip the detection if we cannot seek. Or implement better buffering, something like unread() or buffered rewind(). --- src/inputPlugins/oggvorbis_plugin.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/inputPlugins/oggvorbis_plugin.c') diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 7612b1db5..a28bbc737 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -362,6 +362,11 @@ static MpdTag *oggvorbis_TagDup(char *file) static unsigned int oggvorbis_try_decode(InputStream * inStream) { + if (!inStream->seekable) + /* we cannot seek after the detection, so don't bother + checking */ + return 1; + return (ogg_stream_type_detect(inStream) == VORBIS) ? 1 : 0; } -- cgit v1.2.3 From d855b25b96aba8ca883e886ad229e83c0b31005c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:14 +0200 Subject: simplified code in the ogg decoder plugin Return early when the player thread sent us a command. This saves one level of indentation. --- src/inputPlugins/oggvorbis_plugin.c | 50 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/inputPlugins/oggvorbis_plugin.c') diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index a28bbc737..75c52dab4 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -240,32 +240,32 @@ static int oggvorbis_decode(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 (!dc_intr()) { - 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 (dc_intr()) + 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; } dc.total_time = ov_time_total(&vf, -1); if (dc.total_time < 0) -- cgit v1.2.3