Mercurial > mplayer.hg
comparison mplayer.c @ 906:8eca9b7aafae
Changed streaming functions call.
author | bertrand |
---|---|
date | Tue, 29 May 2001 17:16:15 +0000 |
parents | 11bcf34c0a3e |
children | da072473937a |
comparison
equal
deleted
inserted
replaced
905:4b6f81dbb2da | 906:8eca9b7aafae |
---|---|
655 printf("Reading from stdin...\n"); | 655 printf("Reading from stdin...\n"); |
656 f=0; // 0=stdin | 656 f=0; // 0=stdin |
657 stream=new_stream(f,STREAMTYPE_STREAM); | 657 stream=new_stream(f,STREAMTYPE_STREAM); |
658 } else { | 658 } else { |
659 #ifdef STREAMING | 659 #ifdef STREAMING |
660 url = set_url(filename); | 660 url = url_new(filename); |
661 if(url==NULL) { | 661 if(url==NULL) { |
662 // failed to create a new URL, so it's not an URL (or a malformed URL) | |
662 #endif | 663 #endif |
663 f=open(filename,O_RDONLY); | 664 f=open(filename,O_RDONLY); |
664 if(f<0){ printf("File not found: '%s'\n",filename);return 1; } | 665 if(f<0){ printf("File not found: '%s'\n",filename);return 1; } |
665 len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET); | 666 len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET); |
666 stream=new_stream(f,STREAMTYPE_FILE); | 667 stream=new_stream(f,STREAMTYPE_FILE); |
667 stream->end_pos=len; | 668 stream->end_pos=len; |
668 #ifdef STREAMING | 669 #ifdef STREAMING |
669 } else { | 670 } else { |
670 if(url->port==0) { | 671 int streaming_protocol; |
671 if( (!strcasecmp(url->protocol, "mms")) || | 672 streaming_protocol=autodetectProtocol( url, &f ); |
672 (!strcasecmp(url->protocol, "http")) ){ | 673 if( streaming_protocol==STREAMING_TYPE_UNKNOWN ) { |
673 url->port=80; | |
674 } | |
675 } | |
676 f=connect2Server(url->hostname, url->port); | |
677 if( f<0 ) { | |
678 printf("Unable to open URL: %s\n", filename); | 674 printf("Unable to open URL: %s\n", filename); |
679 free_url(url); | 675 url_free(url); |
680 return 1; | 676 return 1; |
681 } else { | 677 } else { |
678 f=streaming_start( &url, f, streaming_protocol ); | |
679 if(f<0){ printf("Unable to open URL: %s\n", url->url); return 1; } | |
682 printf("Connected to server: %s\n", url->hostname ); | 680 printf("Connected to server: %s\n", url->hostname ); |
683 } | 681 } |
684 stream=new_stream(f,STREAMTYPE_STREAM); | 682 stream=new_stream(f,STREAMTYPE_STREAM); |
685 } | 683 } |
686 #endif | 684 #endif |