summaryrefslogtreecommitdiff
path: root/src/input/input_http.c
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-04-13 17:31:40 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-04-13 17:31:40 +0000
commit70ec3636ceec0b89c8667a5863b9264ff214f41d (patch)
tree14ef85b45b7c58cf98c7caf38b21c5fc3a3c39b7 /src/input/input_http.c
parent4dd9081bc428424c784470bb7ec0437b76937129 (diff)
downloadxine-lib-70ec3636ceec0b89c8667a5863b9264ff214f41d.tar.gz
xine-lib-70ec3636ceec0b89c8667a5863b9264ff214f41d.tar.bz2
- some cleanups
- may seek back inside preview_size - use xine_read_abort at stdin_fifo CVS patchset: 4602 CVS date: 2003/04/13 17:31:40
Diffstat (limited to 'src/input/input_http.c')
-rw-r--r--src/input/input_http.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c
index e67bc43ef..ef190fccd 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -83,7 +83,6 @@ typedef struct {
char preview[MAX_PREVIEW_SIZE];
off_t preview_size;
- off_t preview_pos;
/* ShoutCast */
int shoutcast_mode;
@@ -395,9 +394,9 @@ static off_t http_plugin_read (input_plugin_t *this_gen,
http_plugin_read_metainf(this_gen);
}
- if (this->preview_pos < this->preview_size) {
+ if (this->curpos < this->preview_size) {
- n = this->preview_size - this->preview_pos;
+ n = this->preview_size - this->curpos;
if (n > (nlen - num_bytes))
n = nlen - num_bytes;
@@ -409,9 +408,8 @@ static off_t http_plugin_read (input_plugin_t *this_gen,
if (this->shoutcast_mode) {
if ((this->shoutcast_pos + n) >= this->shoutcast_metaint) {
int i = this->shoutcast_metaint - this->shoutcast_pos;
- memcpy (&buf[num_bytes], &this->preview[this->preview_pos], i);
+ memcpy (&buf[num_bytes], &this->preview[this->curpos], i);
this->shoutcast_pos += i;
- this->preview_pos += i;
num_bytes += i;
this->curpos += i;
n -= i;
@@ -421,9 +419,8 @@ static off_t http_plugin_read (input_plugin_t *this_gen,
this->shoutcast_pos += n;
}
- memcpy (&buf[num_bytes], &this->preview[this->preview_pos], n);
+ memcpy (&buf[num_bytes], &this->preview[this->curpos], n);
- this->preview_pos += n;
num_bytes += n;
this->curpos += n;
}
@@ -593,9 +590,14 @@ static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin
if (origin == SEEK_SET) {
- if (offset < this->curpos)
- printf ("http: cannot seek back! (%lld > %lld)\n", this->curpos, offset);
- else {
+ if (offset < this->curpos) {
+
+ if( this->curpos <= this->preview_size )
+ this->curpos = offset;
+ else
+ printf ("http: cannot seek back! (%lld > %lld)\n", this->curpos, offset);
+
+ } else {
offset -= this->curpos;
for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
@@ -878,7 +880,6 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
this->preview_size = http_plugin_read (&this->input_plugin, this->preview,
MAX_PREVIEW_SIZE);
- this->preview_pos = 0;
this->curpos = 0;
/* Trivial shoutcast detection */