Mercurial > mplayer.hg
changeset 842:80698f8030b9
Now Check if the 'filename' is an URL and connect to the server.
author | bertrand |
---|---|
date | Sun, 20 May 2001 13:06:33 +0000 |
parents | c906b7600fc6 |
children | a88b87750b8a |
files | mplayer.c |
diffstat | 1 files changed, 34 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 } }