Mercurial > mplayer.hg
changeset 6642:e47d54a2cfff
Retreive the bandwidth option from the command line.
author | bertrand |
---|---|
date | Fri, 05 Jul 2002 02:37:56 +0000 |
parents | 2cdaadd779ac |
children | 01eaf5358176 |
files | libmpdemux/network.c |
diffstat | 1 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/network.c Fri Jul 05 02:35:19 2002 +0000 +++ b/libmpdemux/network.c Fri Jul 05 02:37:56 2002 +0000 @@ -32,9 +32,10 @@ extern int verbose; extern m_config_t *mconfig; -/* Variables for the command line option -user & -passwd */ +/* Variables for the command line option -user, -passwd & -bandwidth */ char *network_username; char *network_password; +int network_bandwidth; static struct { @@ -791,7 +792,7 @@ int streaming_start(stream_t *stream, int *demuxer_type, URL_t *url) { - int ret; + int ret, val; if( stream==NULL ) return -1; stream->streaming_ctrl = streaming_ctrl_new(); @@ -805,6 +806,20 @@ } ret = -1; + // Get the bandwidth available + ret = m_config_is_option_set(mconfig,"bandwidth"); + if(ret < 0) { + mp_msg(MSGT_NETWORK,MSGL_ERR,"Unable to know if the bandwidth limit was set\n"); + } else { + val = m_config_get_int( mconfig, "bandwidth", NULL); + if( val<0 ) { + mp_msg(MSGT_NETWORK,MSGL_ERR,"Unable to retrieve the bandwidth option value\n"); + stream->streaming_ctrl->bandwidth = 0; // Don't limit bandwidth + } else { + stream->streaming_ctrl->bandwidth = val; + } + } + // For RTP streams, we usually don't know the stream type until we open it. if( !strcasecmp( stream->streaming_ctrl->url->protocol, "rtp")) { if(stream->fd >= 0) { @@ -857,11 +872,11 @@ stream->streaming_ctrl = NULL; } else if( stream->streaming_ctrl->buffering ) { int cache_size = 0; - int ret, val; - ret = m_config_is_option_set(mconfig,"cache"); - if(ret < 0) { + int cache_opt, val; + cache_opt = m_config_is_option_set(mconfig,"cache"); + if(cache_opt < 0) { mp_msg(MSGT_NETWORK,MSGL_ERR,"Unable to know if cache size option was set\n"); - } else if(!ret) { + } else if(!cache_opt) { // cache option not set, will use our computed value. // buffer in KBytes, *5 because the prefill is 20% of the buffer. val = (stream->streaming_ctrl->prebuffer_size/1024)*5;