LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2704|回复: 12

Mplayer不能播放带有中文的流文件,怎么办?

[复制链接]
发表于 2006-4-15 08:03:37 | 显示全部楼层 |阅读模式
Mplayer不能播放带有中文的流文件,怎么办?
发表于 2006-4-15 11:48:59 | 显示全部楼层
不知道能不能用解决字幕的方法解决这个问题
播放时加 -utf8 或者 -unicode 试试
也可能要用 -slang=936 这样的参数, 看看 man 或者搜搜论坛吧
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-15 18:33:34 | 显示全部楼层
最主要是,远断服务器大概是中文的windows,然后我用Mplayer读取他的电影时就出错,他的路径中有空格和gb2312的中文,不知道怎么办
回复 支持 反对

使用道具 举报

发表于 2006-4-16 15:22:23 | 显示全部楼层
加引号, 或者用 \ 的转义序列
回复 支持 反对

使用道具 举报

发表于 2006-4-16 19:22:52 | 显示全部楼层
记得很早时候有个朋友发布过,似乎就是解决该问题的,搜不到原帖了

linuxsir_mms.patch

  1. --- mplayer-1.0pre4/libmpdemux/asf_mmst_streaming.c        2004-04-06 05:31:27.000000000 +0800
  2. +++ MPlayer-1.0pre4/libmpdemux/asf_mmst_streaming.c        2004-05-02 23:41:20.000000000 +0800
  3. @@ -13,7 +13,7 @@
  4. #include <unistd.h>
  5. #include <errno.h>
  6. #include <inttypes.h>
  7. -
  8. +#include <langinfo.h>
  9. #include "config.h"

  10. #ifndef HAVE_WINSOCK2
  11. @@ -490,11 +505,12 @@
  12.    /* prepare for the url encoding conversion */
  13. #ifdef USE_ICONV
  14.    setlocale(LC_CTYPE, "");
  15. -  url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
  16. +  url_conv = iconv_open("UTF-16LE", nl_langinfo(CODESET));
  17. #endif

  18.    snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname);
  19.    string_utf16 (data, str, strlen(str));
  20. // send_command(s, commandno ....)
  21.    send_command (s, 1, 0, 0x0004000b, strlen(str)*2+2, data);

复制代码
回复 支持 反对

使用道具 举报

发表于 2006-4-16 19:53:17 | 显示全部楼层
Post by dato
记得很早时候有个朋友发布过,似乎就是解决该问题的,搜不到原帖了

linuxsir_mms.patch

  1. --- mplayer-1.0pre4/libmpdemux/asf_mmst_streaming.c        2004-04-06 05:31:27.000000000 +0800
  2. +++ MPlayer-1.0pre4/libmpdemux/asf_mmst_streaming.c        2004-05-02 23:41:20.000000000 +0800
  3. @@ -13,7 +13,7 @@
  4. #include <unistd.h>
  5. #include <errno.h>
  6. #include <inttypes.h>
  7. -
  8. +#include <langinfo.h>
  9. #include "config.h"

  10. #ifndef HAVE_WINSOCK2
  11. @@ -490,11 +505,12 @@
  12.    /* prepare for the url encoding conversion */
  13. #ifdef USE_ICONV
  14.    setlocale(LC_CTYPE, "");
  15. -  url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
  16. +  url_conv = iconv_open("UTF-16LE", nl_langinfo(CODESET));
  17. #endif

  18.    snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname);
  19.    string_utf16 (data, str, strlen(str));
  20. // send_command(s, commandno ....)
  21.    send_command (s, 1, 0, 0x0004000b, strlen(str)*2+2, data);

复制代码

印象中这个补丁已经早就被接受了。
回复 支持 反对

使用道具 举报

发表于 2006-6-19 01:24:26 | 显示全部楼层
Post by pupilzeng
印象中这个补丁已经早就被接受了。

虽然这个补丁被接受了,但是好像还有问题。默认没有使的那个补丁起作用。
以下是真对最新1.0-pre8的中文mms rul补丁:
diff -Nur MPlayer-1.0pre8.orig/configure MPlayer-1.0pre8/configure
--- MPlayer-1.0pre8.orig/configure        2006-06-18 22:12:35.000000000 +0800
+++ MPlayer-1.0pre8/configure        2006-06-18 23:20:50.000000000 +0800
@@ -1585,6 +1585,7 @@
_dxr2=auto
_dxr3=auto
_iconv=auto
+_setlocale=auto
_langinfo=auto
_rtc=auto
_ossaudio=auto
@@ -1773,6 +1774,8 @@
   --disable-dxr3)        _dxr3=no        ;;
   --enable-iconv)        _iconv=yes        ;;
   --disable-iconv)        _iconv=no        ;;
+  --enable-setlocale)  _setlocale=yes  ;;
+  --disable-setlocale) _setlocale=no   ;;
   --enable-langinfo)        _langinfo=yes        ;;
   --disable-langinfo)        _langinfo=no        ;;
   --enable-rtc)                _rtc=yes        ;;
@@ -2469,6 +2472,23 @@
fi


+echocheck "setlocale"
+if test "$_setlocale" = auto ; then
+  cat > $TMPC <<EOF
+#include <locale.h>
+int main(void) { setlocale(LC_ALL, ""); return 0; }
+EOF
+  _setlocale=no
+  cc_check && _setlocale=yes
+fi
+if test "$_setlocale" = yes ; then
+  _def_setlocale='#define USE_SETLOCALE 1'
+else
+  _def_setlocale='#undef USE_SETLOCALE'
+fi
+echores "$_setlocale"
+
+
echocheck "langinfo"
if test "$_langinfo" = auto ; then
   cat > $TMPC <<EOF
@@ -7725,6 +7745,9 @@
/* define this to use iconv(3) function to codepage conversions */
$_def_iconv

+/* define this to use setlocale function */
+$_def_setlocale
+
/* define this to use nl_langinfo function */
$_def_langinfo

diff -Nur MPlayer-1.0pre8.orig/libmpdemux/asf_mmst_streaming.c MPlayer-1.0pre8/libmpdemux/asf_mmst_streaming.c
--- MPlayer-1.0pre8.orig/libmpdemux/asf_mmst_streaming.c        2006-06-18 22:12:35.000000000 +0800
+++ MPlayer-1.0pre8/libmpdemux/asf_mmst_streaming.c        2006-06-18 23:19:15.000000000 +0800
@@ -25,12 +25,11 @@
#include <winsock2.h>
#endif

-#ifndef USE_SETLOCALE
-#undef USE_ICONV
-#endif
-
#ifdef USE_ICONV
#include <iconv.h>
+#ifdef USE_SETLOCALE
+#include <locale.h>
+#endif
#ifdef USE_LANGINFO
#include <langinfo.h>
#endif
@@ -552,8 +551,11 @@

   /* prepare for the url encoding conversion */
#ifdef USE_ICONV
+#ifdef USE_SETLOCALE
+  setlocale(LC_ALL, "" );
+#endif
#ifdef USE_LANGINFO
-  url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET));
+  url_conv = iconv_open("UTF-16LE", nl_langinfo(CODESET));
#else
   url_conv = iconv_open("UTF-16LE", NULL);
#endif
回复 支持 反对

使用道具 举报

发表于 2006-6-19 03:49:47 | 显示全部楼层
不知道为啥,copy楼上的总是出错误。
依照楼上的提示,手动 diff 后重新生成文件。

patch 见附件。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2006-9-22 11:17:02 | 显示全部楼层

这个补丁只是解决url里中文的问题吧

Post by 终极幻想
不知道为啥,copy楼上的总是出错误。
依照楼上的提示,手动 diff 后重新生成文件。

patch 见附件。


~~~~~~~~~~~~~~~~~~~~~~~~~~
我用mplayer来放mms的源
有几个源老放不了
一放mplayer就崩
搞了n久都没解决
原来以为是这个问题
把补丁装上
make clean
./configure .....
make
还是不行
回复 支持 反对

使用道具 举报

发表于 2006-9-22 13:54:16 | 显示全部楼层
你这个崩的问题确实不是中文url的问题
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表