aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/oggvorbis_plugin.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-01 16:24:41 -0700
committerEric Wong <normalperson@yhbt.net>2008-09-01 16:24:41 -0700
commitc36029fc806cf083de3aaf1344d6bd2be8db316f (patch)
treeda88b1f073b8125d764b94b924492d2b05ea4c69 /src/inputPlugins/oggvorbis_plugin.c
parentaa0755f53545fcf343f791f04760f6b934e022e4 (diff)
parent6982a829e22d2bc7cf7c829c4430a4ea6f5bc7fa (diff)
downloadmpd-c36029fc806cf083de3aaf1344d6bd2be8db316f.tar.gz
mpd-c36029fc806cf083de3aaf1344d6bd2be8db316f.tar.xz
mpd-c36029fc806cf083de3aaf1344d6bd2be8db316f.zip
Merge branch 'mk/cleanups'
* mk/cleanups: (60 commits) pass constant pointers const pointers unsigned integers and size_t oggflac: fix GCC warnings include cleanup protect locate.h from double inclusion playlist: eliminate unused fd parameters jack: made "sample_size" static const moved jack configuration to the JackData struct jack: removed unused macros jack: don't set audioOutput->data=NULL jack: initialize JackData in jack_initDriver() jack: added freeJackClient() jack: initialize jd->client after !jd check jack: eliminate superfluous freeJackData() calls mp3: converted the MUTEFRAME_ macros to an enum mp3: converted the DECODE_ constants to an enum wavpack: don't use "isp" before initialization wavpack: moved code to wavpack_open_wvc() simplified code in the ogg decoder plugin ...
Diffstat (limited to 'src/inputPlugins/oggvorbis_plugin.c')
-rw-r--r--src/inputPlugins/oggvorbis_plugin.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c
index 70a0ce2d3..d14ae2bac 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 <vorbis/vorbisfile.h>
@@ -86,7 +80,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;
}
@@ -246,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)
@@ -368,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;
}