[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.54,1.55
Bertrand Baudet
bertrand at mplayerhq.hu
Fri Jul 5 04:37:58 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv24413
Modified Files:
network.c
Log Message:
Retreive the bandwidth option from the command line.
Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- network.c 25 Jun 2002 23:56:33 -0000 1.54
+++ network.c 5 Jul 2002 02:37:56 -0000 1.55
@@ -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;
More information about the MPlayer-cvslog
mailing list