summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2002-03-19 17:48:59 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2002-03-19 17:48:59 +0000
commit0dcf0cd885c0d2c52406708bd720f0f1e8116004 (patch)
treee7c6f723158dd59c67977dba901c0c1a6bb110a4
parent36940723965b3ac4ab5c1e21bcf4d880d8a7e268 (diff)
downloadxine-lib-0dcf0cd885c0d2c52406708bd720f0f1e8116004.tar.gz
xine-lib-0dcf0cd885c0d2c52406708bd720f0f1e8116004.tar.bz2
dynamic water mark adaption, small fixes
CVS patchset: 1593 CVS date: 2002/03/19 17:48:59
-rw-r--r--src/input/asxparser.c4
-rw-r--r--src/input/input_mms.c39
-rw-r--r--src/liba52/xine_decoder.c6
3 files changed, 31 insertions, 18 deletions
diff --git a/src/input/asxparser.c b/src/input/asxparser.c
index b094b5f49..9cdd8cdcf 100644
--- a/src/input/asxparser.c
+++ b/src/input/asxparser.c
@@ -20,11 +20,11 @@ void first_request(char *buff, char *host, char *file, int *len) {
ptr=buff;
ptr+=sprintf(ptr,"GET %s HTTP/1.0\r\n",file);
ptr+=sprintf(ptr,"Accept: */*\r\n");
- ptr+=sprintf(ptr,"User-Agent: xine/0.9.8\r\n");
+ ptr+=sprintf(ptr,"User-Agent: NSPlayer/7.0.0.1956\r\n");
ptr+=sprintf(ptr,"Host: %s\r\n", host);
ptr+=sprintf(ptr,"Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=1,max-duration=0\r\n");
ptr+=sprintf(ptr,"Pragma: xClientGUID=%s\r\n", "{33715801-BAB3-9D85-24E9-03B90328270A}");
- ptr+=sprintf(ptr,"Connection: Close\r\n\r\n");
+ ptr+=sprintf(ptr,"Connection: Keep-Alive\r\n\r\n");
*len =(int)ptr-(int)buff;
}
diff --git a/src/input/input_mms.c b/src/input/input_mms.c
index 7f56b65d3..507155584 100644
--- a/src/input/input_mms.c
+++ b/src/input/input_mms.c
@@ -50,6 +50,8 @@ extern int errno;
#define FNDELAY O_NDELAY
#endif
+#define DEFAULT_LOW_WATER_MARK 1
+#define DEFAULT_HIGH_WATER_MARK 5
typedef struct {
input_plugin_t input_plugin;
@@ -64,6 +66,8 @@ typedef struct {
off_t curpos;
int buffering;
+ int low_water_mark;
+ int high_water_mark;
strictscr_t *scr;
@@ -108,9 +112,10 @@ static int mms_plugin_open (input_plugin_t *this_gen, char *mrl) {
return 0;
}
- this->curpos = 0;
- this->buffering = 0;
-
+ this->curpos = 0;
+ this->buffering = 0;
+ this->low_water_mark = DEFAULT_LOW_WATER_MARK;
+ this->high_water_mark = DEFAULT_HIGH_WATER_MARK;
/* register our scr plugin */
this->scr->scr.start (&this->scr->scr, this->xine->metronom->get_current_time (this->xine->metronom));
@@ -118,9 +123,6 @@ static int mms_plugin_open (input_plugin_t *this_gen, char *mrl) {
return 1;
}
-#define LOW_WATER_MARK 25
-#define HIGH_WATER_MARK 50
-
static off_t mms_plugin_read (input_plugin_t *this_gen,
char *buf, off_t len) {
mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen;
@@ -139,18 +141,27 @@ static off_t mms_plugin_read (input_plugin_t *this_gen,
if (this->buffering) {
xine_log (this->xine, XINE_LOG_MSG,
- "input_mms: buffering (%d/%d)...\n", fifo_fill, HIGH_WATER_MARK);
+ "input_mms: buffering (%d/%d)...\n", fifo_fill, this->high_water_mark);
}
- if (fifo_fill<LOW_WATER_MARK) {
+ if (fifo_fill<this->low_water_mark) {
if (!this->buffering) {
+
this->xine->osd_renderer->filled_rect (this->xine->osd, 0, 0, 299, 99, 0);
this->xine->osd_renderer->render_text (this->xine->osd, 5, 30, "mms: buffering...", OSD_TEXT1);
this->xine->osd_renderer->show (this->xine->osd, 0);
/* give video_out time to display osd before pause */
sleep (1);
+
+ if (this->high_water_mark<150) {
+
+ /* increase marks to adapt to stream/network needs */
+
+ this->high_water_mark += 10;
+ this->low_water_mark = this->high_water_mark/4;
+ }
}
this->xine->metronom->set_speed (this->xine->metronom, SPEED_PAUSE);
@@ -158,7 +169,7 @@ static off_t mms_plugin_read (input_plugin_t *this_gen,
this->buffering = 1;
this->scr->adjustable = 0;
- } else if ( (fifo_fill>HIGH_WATER_MARK) && (this->buffering)) {
+ } else if ( (fifo_fill>this->high_water_mark) && (this->buffering)) {
this->xine->metronom->set_speed (this->xine->metronom, SPEED_NORMAL);
this->xine->audio_out->audio_paused = 0;
this->buffering = 0;
@@ -378,10 +389,12 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_optional_data = mms_plugin_get_optional_data;
this->input_plugin.is_branch_possible= NULL;
- this->mrl = NULL;
- this->config = config;
- this->curpos = 0;
- this->buffering = 0;
+ this->mrl = NULL;
+ this->config = config;
+ this->curpos = 0;
+ this->buffering = 0;
+ this->low_water_mark = DEFAULT_LOW_WATER_MARK;
+ this->high_water_mark = DEFAULT_HIGH_WATER_MARK;
this->scr = strictscr_init ();
diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c
index 530a2c9eb..a8db3fb4f 100644
--- a/src/liba52/xine_decoder.c
+++ b/src/liba52/xine_decoder.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2000-2001 the xine project
+ * Copyright (C) 2000-2002 the xine project
*
- * This file is part of xine, a unix video player.
+ * This file is part of xine, a free video player.
*
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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: xine_decoder.c,v 1.18 2002/03/11 12:31:25 guenter Exp $
+ * $Id: xine_decoder.c,v 1.19 2002/03/19 17:48:59 guenter Exp $
*
* stuff needed to turn liba52 into a xine decoder plugin
*/