diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/input/input_net.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/input/input_net.c b/src/input/input_net.c index 320b66008..545440644 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -68,6 +68,7 @@ extern int errno; #endif #define NET_BS_LEN 2324 +#define PREBUF_SIZE 100000 typedef struct { input_plugin_t input_plugin; @@ -80,6 +81,8 @@ typedef struct { off_t curpos; + int buffering; + } net_input_plugin_t; /* **************************************************************** */ @@ -196,6 +199,7 @@ static int net_plugin_open (input_plugin_t *this_gen, char *mrl) { this->fh = host_connect(filename, port, this->xine); this->curpos = 0; + this->buffering = 0; if (this->fh == -1) { return 0; @@ -214,6 +218,16 @@ static off_t net_plugin_read (input_plugin_t *this_gen, net_input_plugin_t *this = (net_input_plugin_t *) this_gen; off_t n, total; + if (this->curpos==0) { + this->xine->metronom->set_speed (this->xine->metronom, SPEED_PAUSE); + this->buffering = 1; + printf ("input_net: buffering...\n"); + } else if ((this->curpos>PREBUF_SIZE) && this->buffering) { + this->xine->metronom->set_speed (this->xine->metronom, SPEED_NORMAL); + this->buffering = 0; + printf ("input_net: buffering...finished\n"); + } + total=0; while (total<len){ n = read (this->fh, &buf[total], len-total); @@ -385,10 +399,11 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->input_plugin.get_optional_data = net_plugin_get_optional_data; this->input_plugin.is_branch_possible= NULL; - this->fh = -1; - this->mrl = NULL; - this->config = config; - this->curpos = 0; + this->fh = -1; + this->mrl = NULL; + this->config = config; + this->curpos = 0; + this->buffering = 0; return (input_plugin_t *) this; } |