summaryrefslogtreecommitdiff
path: root/src/input/input_http.c
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2003-02-21 02:22:15 +0000
committerMike Melanson <mike@multimedia.cx>2003-02-21 02:22:15 +0000
commit91735c7565ac88117e0bd743d335bf76d6e16e0d (patch)
treec3b9fa8c9c65b29b7c19d370e9e40f659b7ec758 /src/input/input_http.c
parentd5ae7af71e4ea62f4a9845441b6ca43d9701ae03 (diff)
downloadxine-lib-91735c7565ac88117e0bd743d335bf76d6e16e0d.tar.gz
xine-lib-91735c7565ac88117e0bd743d335bf76d6e16e0d.tar.bz2
support seeking from the start of the stream (if requested offset >=
current offset) CVS patchset: 4227 CVS date: 2003/02/21 02:22:15
Diffstat (limited to 'src/input/input_http.c')
-rw-r--r--src/input/input_http.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c
index 05919863d..64a2c7045 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -600,8 +600,6 @@ static off_t http_plugin_get_current_pos (input_plugin_t *this_gen){
static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) {
http_input_plugin_t *this = (http_input_plugin_t *) this_gen;
- /* only realtive forward-seeking is implemented */
-
if ((origin == SEEK_CUR) && (offset >= 0)) {
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
@@ -611,6 +609,21 @@ static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin
http_plugin_read (this_gen, this->seek_buf, offset);
}
+ if (origin == SEEK_SET) {
+
+ if (offset < this->curpos)
+ printf ("http: cannot seek back! (%lld > %lld)\n", this->curpos, offset);
+ else {
+ offset -= this->curpos;
+
+ for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
+ http_plugin_read (this_gen, this->seek_buf, BUFSIZE);
+ }
+
+ http_plugin_read (this_gen, this->seek_buf, offset);
+ }
+ }
+
return this->curpos;
}