[MPlayer-dev-eng] [PATCH] implement the setlocale feature

Fengguang Wu fengguang.wu at gmail.com
Sun Jun 18 04:05:03 CEST 2006


Greetings,

The --enable-iconv and --enable-langinfo features take no effect now,
since the setlocale stuffs have been missing.

The attached patch completes the feature set:
        - implement the missing --disable-setlocale handler
        - call setlocale(LC_ALL, "") if defined USE_SETLOCALE

Thanks,
Fengguang Wu
-------------- next part --------------
--- mplayer.orig/libmpdemux/asf_mmst_streaming.c
+++ mplayer/libmpdemux/asf_mmst_streaming.c
@@ -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 @@ int asf_mmst_streaming_start(stream_t *s
 
   /* 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
--- mplayer.orig/configure
+++ mplayer/configure
@@ -1588,6 +1588,7 @@ _dvbhead=auto
 _dxr2=auto
 _dxr3=auto
 _iconv=auto
+_setlocale=auto
 _langinfo=auto
 _rtc=auto
 _ossaudio=auto
@@ -1775,6 +1776,8 @@ for ac_option do
   --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 @@ else
 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
@@ -7733,6 +7753,9 @@ $_def_select
 /* 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
 


More information about the MPlayer-dev-eng mailing list