comparison mplayer.c @ 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 e34052fd9633
children 8a99c95b0f56
comparison
equal deleted inserted replaced
841:c906b7600fc6 842:80698f8030b9
86 #ifdef HAVE_LIRC 86 #ifdef HAVE_LIRC
87 #include "lirc_mp.h" 87 #include "lirc_mp.h"
88 #endif 88 #endif
89 89
90 #include "help_mp.h" 90 #include "help_mp.h"
91
92 #ifdef STREAMING
93 #include "url.h"
94 #include "network.h"
95 static URL_t* url;
96 #endif
91 97
92 #define DEBUG if(0) 98 #define DEBUG if(0)
93 #ifdef HAVE_GUI 99 #ifdef HAVE_GUI
94 int nogui=1; 100 int nogui=1;
95 #endif 101 #endif
646 // read from stdin 652 // read from stdin
647 printf("Reading from stdin...\n"); 653 printf("Reading from stdin...\n");
648 f=0; // 0=stdin 654 f=0; // 0=stdin
649 stream=new_stream(f,STREAMTYPE_STREAM); 655 stream=new_stream(f,STREAMTYPE_STREAM);
650 } else { 656 } else {
651 f=open(filename,O_RDONLY); 657 #ifdef STREAMING
652 if(f<0){ printf("File not found: '%s'\n",filename);return 1; } 658 url = set_url(filename);
653 len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET); 659 if(url==NULL) {
654 stream=new_stream(f,STREAMTYPE_FILE); 660 #endif
655 stream->end_pos=len; 661 f=open(filename,O_RDONLY);
662 if(f<0){ printf("File not found: '%s'\n",filename);return 1; }
663 len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
664 stream=new_stream(f,STREAMTYPE_FILE);
665 stream->end_pos=len;
666 #ifdef STREAMING
667 } else {
668 if(url->port==0) {
669 if( (!strcasecmp(url->protocol, "mms")) ||
670 (!strcasecmp(url->protocol, "http")) ){
671 url->port=80;
672 }
673 }
674 f=connect2Server(url->hostname, url->port);
675 if( f<0 ) {
676 printf("Unable to open URL: %s\n", filename);
677 free_url(url);
678 return 1;
679 } else {
680 printf("Connected to server: %s\n", url->hostname );
681 }
682 stream=new_stream(f,STREAMTYPE_STREAM);
683 }
684 #endif
656 } 685 }
657 } 686 }
658 687
659 #ifdef HAVE_LIBCSS 688 #ifdef HAVE_LIBCSS
660 if (dvdimportkey) { 689 if (dvdimportkey) {