# HG changeset patch # User bertrand # Date 990363993 0 # Node ID 80698f8030b9bedfd363ec8dc93782baf8bbb766 # Parent c906b7600fc6ae4fa3cb84864796fa907d334069 Now Check if the 'filename' is an URL and connect to the server. diff -r c906b7600fc6 -r 80698f8030b9 mplayer.c --- a/mplayer.c Sun May 20 12:58:41 2001 +0000 +++ b/mplayer.c Sun May 20 13:06:33 2001 +0000 @@ -89,6 +89,12 @@ #include "help_mp.h" +#ifdef STREAMING +#include "url.h" +#include "network.h" +static URL_t* url; +#endif + #define DEBUG if(0) #ifdef HAVE_GUI int nogui=1; @@ -648,11 +654,34 @@ f=0; // 0=stdin stream=new_stream(f,STREAMTYPE_STREAM); } else { - f=open(filename,O_RDONLY); - if(f<0){ printf("File not found: '%s'\n",filename);return 1; } - len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET); - stream=new_stream(f,STREAMTYPE_FILE); - stream->end_pos=len; +#ifdef STREAMING + url = set_url(filename); + if(url==NULL) { +#endif + f=open(filename,O_RDONLY); + if(f<0){ printf("File not found: '%s'\n",filename);return 1; } + len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET); + stream=new_stream(f,STREAMTYPE_FILE); + stream->end_pos=len; +#ifdef STREAMING + } else { + if(url->port==0) { + if( (!strcasecmp(url->protocol, "mms")) || + (!strcasecmp(url->protocol, "http")) ){ + url->port=80; + } + } + f=connect2Server(url->hostname, url->port); + if( f<0 ) { + printf("Unable to open URL: %s\n", filename); + free_url(url); + return 1; + } else { + printf("Connected to server: %s\n", url->hostname ); + } + stream=new_stream(f,STREAMTYPE_STREAM); + } +#endif } }