diff options
author | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-05-23 19:41:37 +0000 |
---|---|---|
committer | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-05-23 19:41:37 +0000 |
commit | ceda9eac3dfbb02aaf0f196463ea8933c0029a60 (patch) | |
tree | 211c405bfc66176ee1d10d88382e78e1180ee8e8 /libmpdemux | |
parent | 8b1d077bf4452f9e19b54e9af67f442d9f78da83 (diff) |
Recognize ra and rm extensions even with query strings,
eg: rstp://www.addr.com/file.rm?var=123
Based on an idea by Felix Buenemann
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10172 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/network.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libmpdemux/network.c b/libmpdemux/network.c index deda8f7e74..6969f6f8f4 100644 --- a/libmpdemux/network.c +++ b/libmpdemux/network.c @@ -528,7 +528,7 @@ http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) { int autodetectProtocol(streaming_ctrl_t *streaming_ctrl, int *fd_out, int *file_format) { HTTP_header_t *http_hdr; - unsigned int i; + unsigned int i, j; int fd=-1; int redirect; int auth_retry=0; @@ -586,17 +586,28 @@ extension=NULL; // Checking for Real rtsp:// // Extension based detection, should be replaced with something based on server answer extension = NULL; - if( url->file!=NULL ) - for( i=strlen(url->file) ; i>0 ; i-- ) + if( url->file!=NULL ) { + j = strlen(url->file); + for( i=j; i>0 ; i-- ) { + if( url->file[i]=='?' ) + j = i; if( url->file[i]=='.' ) { - extension=(url->file)+i+1; + extension = calloc(j-i, 1); + for ( i++; i < j; i++) + extension[strlen(extension)]=url->file[i]; + extension[strlen(extension)]=0; break; + } + } } if (extension != NULL && (!strcasecmp(extension, "rm") || !strcasecmp(extension, "ra"))) { *file_format = DEMUXER_TYPE_REAL; + free(extension); return 0; } + if (extension != NULL) + free(extension); mp_msg(MSGT_NETWORK,MSGL_INFO,"Not a Realmedia rtsp url. Trying standard rtsp protocol.\n"); #ifdef STREAMING_LIVE_DOT_COM *file_format = DEMUXER_TYPE_RTP; |