summaryrefslogtreecommitdiff
path: root/src/input/input_mms.c
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 /src/input/input_mms.c
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
Diffstat (limited to 'src/input/input_mms.c')
-rw-r--r--src/input/input_mms.c39
1 files changed, 26 insertions, 13 deletions
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 ();