aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQball Cow <qball@qballcow.nl>2007-11-28 14:06:03 +0000
committerQball Cow <qball@qballcow.nl>2007-11-28 14:06:03 +0000
commite1571cc70590929eedce2a6f7ae045f78484435f (patch)
treef7f8d44895a1034d3df2acc880db11094a29ff89 /src
parent4447ce5065620b9b9a2a095dc8f9536fbf2dfbd7 (diff)
downloadmpd-e1571cc70590929eedce2a6f7ae045f78484435f.tar.gz
mpd-e1571cc70590929eedce2a6f7ae045f78484435f.tar.xz
mpd-e1571cc70590929eedce2a6f7ae045f78484435f.zip
Re-enable seeking in http streams.
Fixing stopping mpd from block when trying to stop a ogg stream that is buffering. git-svn-id: https://svn.musicpd.org/mpd/trunk@7053 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/inputPlugins/oggvorbis_plugin.c9
-rw-r--r--src/inputStream_http.c2
2 files changed, 4 insertions, 7 deletions
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c
index 6631aef68..066071aba 100644
--- a/src/inputPlugins/oggvorbis_plugin.c
+++ b/src/inputPlugins/oggvorbis_plugin.c
@@ -87,7 +87,8 @@ static size_t ogg_read_cb(void *ptr, size_t size, size_t nmemb, void *vdata)
static int ogg_seek_cb(void *vdata, ogg_int64_t offset, int whence)
{
OggCallbackData *data = (OggCallbackData *) vdata;
-
+ if(data->dc->stop)
+ return -1;
return seekInputStream(data->inStream, offset, whence);
}
@@ -251,7 +252,6 @@ static int oggvorbis_decode(OutputBuffer * cb, DecoderControl * dc,
callbacks.seek_func = ogg_seek_cb;
callbacks.close_func = ogg_close_cb;
callbacks.tell_func = ogg_tell_cb;
-
if ((ret = ov_open_callbacks(&data, &vf, NULL, 0, callbacks)) < 0) {
closeInputStream(inStream);
if (!dc->stop) {
@@ -284,14 +284,12 @@ static int oggvorbis_decode(OutputBuffer * cb, DecoderControl * dc,
}
return 0;
}
-
dc->totalTime = ov_time_total(&vf, -1);
if (dc->totalTime < 0)
dc->totalTime = 0;
-
dc->audioFormat.bits = 16;
- while (!eof) {
+ while (!eof && !dc->stop) {
if (dc->seek) {
if (0 == ov_time_seek_page(&vf, dc->seekWhere)) {
clearOutputBuffer(cb);
@@ -303,7 +301,6 @@ static int oggvorbis_decode(OutputBuffer * cb, DecoderControl * dc,
ret = ov_read(&vf, chunk + chunkpos,
OGG_CHUNK_SIZE - chunkpos,
OGG_DECODE_USE_BIGENDIAN, 2, 1, &current_section);
-
if (current_section != prev_section) {
/*printf("new song!\n"); */
vorbis_info *vi = ov_info(&vf, -1);
diff --git a/src/inputStream_http.c b/src/inputStream_http.c
index 71f4a6f45..80b908a2e 100644
--- a/src/inputStream_http.c
+++ b/src/inputStream_http.c
@@ -558,7 +558,7 @@ static int getHTTPHello(InputStream * inStream)
inStream->seekable = 0;
rc = atoi(cur + 9);
} else if (0 == strncmp(cur, "HTTP/1.1 ", 9)) {
- inStream->seekable = 0;
+ inStream->seekable = 1;
rc = atoi(cur + 9);
} else if (0 == strncmp(cur, "ICY 200 OK", 10)) {
inStream->seekable = 0;