Mercurial > mplayer.hg
comparison Gui/interface.c @ 6996:163f78ece9c2
add uri2filename converter
author | pontscho |
---|---|
date | Wed, 14 Aug 2002 12:17:04 +0000 |
parents | 8cc27ab533b2 |
children | 98bed9e12087 |
comparison
equal
deleted
inserted
replaced
6995:8f92313a0cd5 | 6996:163f78ece9c2 |
---|---|
27 #include "../libao2/eq.h" | 27 #include "../libao2/eq.h" |
28 | 28 |
29 #include <inttypes.h> | 29 #include <inttypes.h> |
30 #include <sys/types.h> | 30 #include <sys/types.h> |
31 | 31 |
32 #ifdef USE_ICONV | |
33 #ifdef __FreeBSD__ | |
34 #include <giconv.h> | |
35 #else | |
36 #include <iconv.h> | |
37 #endif | |
38 #endif | |
39 | |
32 #include "../libmpdemux/stream.h" | 40 #include "../libmpdemux/stream.h" |
33 #include "../libmpdemux/demuxer.h" | 41 #include "../libmpdemux/demuxer.h" |
34 | 42 |
35 guiInterface_t guiIntfStruct; | 43 guiInterface_t guiIntfStruct; |
36 | 44 |
74 { | 82 { |
75 if ( *str ) { if ( !strstr( *str,what ) ) gstrcat( str,"," ); gstrcat( str,what ); } | 83 if ( *str ) { if ( !strstr( *str,what ) ) gstrcat( str,"," ); gstrcat( str,what ); } |
76 else gstrcat( str,what ); | 84 else gstrcat( str,what ); |
77 } | 85 } |
78 | 86 |
87 #ifdef USE_ICONV | |
88 char * gconvert_uri_to_filename( char * str ) | |
89 { | |
90 iconv_t d; | |
91 char * out = strdup( str ); | |
92 char * tmp = NULL; | |
93 char * ize; | |
94 size_t inb,outb; | |
95 char * charset = "ISO8859-1"; | |
96 char * cs; | |
97 | |
98 if ( !strchr( str,'%' ) ) return str; | |
99 | |
100 { | |
101 char * t = calloc( 1,strlen( out ) ); | |
102 int i,c = 0; | |
103 for ( i=0;i < (int)strlen( out );i++ ) | |
104 if ( out[i] != '%' ) t[c++]=out[i]; | |
105 else | |
106 { | |
107 char tmp[4] = "0xXX"; | |
108 // if ( out[++i] == '%' ) { t[c++]='%'; continue; }; | |
109 tmp[2]=out[++i]; tmp[3]=out[++i]; | |
110 t[c++]=(char)strtol( tmp,(char **)NULL,0 ); | |
111 } | |
112 free( out ); | |
113 out=t; | |
114 } | |
115 | |
116 if ( (cs=getenv( "CHARSET" )) && *cs ) charset=cs; | |
117 | |
118 inb=outb=strlen( out ); | |
119 tmp=calloc( 1,outb + 1 ); | |
120 ize=tmp; | |
121 d=iconv_open( charset,"UTF-8" ); | |
122 if ( (iconv_t)(-1) == d ) return str; | |
123 iconv( d,&out,&inb,&tmp,&outb ); | |
124 iconv_close( d ); | |
125 free( out ); | |
126 return ize; | |
127 } | |
128 #endif | |
129 | |
79 void guiInit( void ) | 130 void guiInit( void ) |
80 { | 131 { |
81 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) ); | 132 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) ); |
82 guiIntfStruct.Balance=50.0f; | 133 guiIntfStruct.Balance=50.0f; |
83 guiIntfStruct.StreamType=-1; | 134 guiIntfStruct.StreamType=-1; |