summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/input/input_http.c18
-rw-r--r--src/input/mms.c10
2 files changed, 17 insertions, 11 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c
index f180bc292..bcdfde748 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -93,6 +93,11 @@ typedef struct {
int shoutcast_metaint;
off_t shoutcast_pos;
char *shoutcast_songtitle;
+
+ /* scratch buffer for forward seeking */
+
+ char seek_buf[BUFSIZE];
+
} http_input_plugin_t;
@@ -585,16 +590,17 @@ 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)) {
- char *tmp;
- assert((tmp = malloc(1024)) != NULL);
- for (;((int)offset) - 1024 > 0; offset -= 1024) {
- this->curpos += http_plugin_read(this_gen, tmp, 1024);
+
+ for (;((int)offset) - BUFSIZE > 0; offset -= BUFSIZE) {
+ this->curpos += http_plugin_read (this_gen, this->seek_buf, BUFSIZE);
}
- this->curpos += http_plugin_read(this_gen, tmp, offset);
+
+ this->curpos += http_plugin_read (this_gen, this->seek_buf, offset);
}
- /* dummy implementation: don't seek, just return current position */
return this->curpos;
}
diff --git a/src/input/mms.c b/src/input/mms.c
index 02b9b1eef..98f933d86 100644
--- a/src/input/mms.c
+++ b/src/input/mms.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: mms.c,v 1.13 2002/10/28 00:50:01 guenter Exp $
+ * $Id: mms.c,v 1.14 2002/12/01 00:36:00 guenter Exp $
*
* based on work from major mms
* utility functions to handle communication with an mms server
@@ -971,8 +971,8 @@ int mms_read (mms_t *this, char *data, int len) {
bytes_left = this->asf_header_len - this->asf_header_read ;
- if (len < bytes_left)
- n = len;
+ if ((len-total) < bytes_left)
+ n = len-total;
else
n = bytes_left;
@@ -998,8 +998,8 @@ int mms_read (mms_t *this, char *data, int len) {
}
- if (len<bytes_left)
- n = len;
+ if ((len-total)<bytes_left)
+ n = len-total;
else
n = bytes_left;