[MPlayer-dev-eng] mms patch

Shixin Zeng shixinzeng at sjtu.edu.cn
Sat May 22 13:22:51 CEST 2004


the patch only affects the file asf_mmst_streaming.c.
There are three changes.
The first one:
 - url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
+ url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET));
this solve the problem with multi-byte url, especially for CJK users.
setlocale(LC_CTYPE, NULL)) returns something likes "zh_CN.GBK", while 
charset should be like "GBK".

The second one and the third one:
when mplayer cant' connect to the mms server(or the server can't provide 
more stream), or the file is missing on the server. it will fall into a 
dead loop in the function get_data(), for recv will always return 0.
the patch solved this problem. when this occurred, get_data() return and 
the mplayer exit.

BTW: Any reply on this, please cc to me, for i don't subscribe this 
mailling list.

--- MPlayer-1.0pre4/libmpdemux/asf_mmst_streaming.c	2004-05-22 18:34:18.000000000 +0800
+++ MPlayer-1.0pre4/libmpdemux/asf_mmst_streaming.c	2004-05-22 18:26:47.000000000 +0800
@@ -23,6 +23,7 @@
 #endif
 
 #ifdef USE_ICONV
+#include <langinfo.h>
 #include <locale.h>
 #include <iconv.h>
 #endif
@@ -175,6 +176,8 @@
       perror ("read error:");
       return 0;
     }
+	if (len == 0)
+		return 0;
 
     total += len;
 
@@ -490,7 +493,7 @@
   /* prepare for the url encoding conversion */
 #ifdef USE_ICONV
   setlocale(LC_CTYPE, "");
-  url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
+  url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET));
 #endif
 
   snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname);
@@ -537,6 +540,8 @@
   /* get_headers(s, asf_header);  */
 
   asf_header_len = get_header (s, asf_header, stream->streaming_ctrl);
+  if(asf_header_len == 0)
+	  return -1;
 //  printf("---------------------------------- asf_header %d\n",asf_header);
   packet_length = interp_header (asf_header, asf_header_len);
 

-- 
Best regards
Shixin Zeng




More information about the MPlayer-dev-eng mailing list