diff options
author | 2001-05-20 13:06:33 +0000 | |
---|---|---|
committer | 2001-05-20 13:06:33 +0000 | |
commit | b1a568cb75a52007c0ca9bf0e37586fb00d2c06a (patch) | |
tree | 7677faeb41d1f79ce559eddda43871e751220fe9 /mplayer.c | |
parent | d0970ce743caabb185362728cefcc0ef4b49712d (diff) |
Now Check if the 'filename' is an URL and connect to the server.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@843 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 39 |
1 files changed, 34 insertions, 5 deletions
@@ -89,6 +89,12 @@ extern int errno; #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 @@ if(vcd_track){ 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 } } |