annotate gui/interface.c @ 23651:604f56414432

Lots of cosmetics for gl2
author reimar
date Tue, 26 Jun 2007 16:33:43 +0000
parents c1221a031ab7
children 1cb14b091f46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
2 #include <inttypes.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
3 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
4 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
5 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
6 #include <sys/types.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
7
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
8 #include "wm/ws.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
9 #include "wm/wsxdnd.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
10 #include "interface.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
11 #include "skin/skin.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
12
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
13 #include "mplayer/gtk/eq.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
14 #include "mplayer/widgets.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
15 #include "mplayer/gmplayer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
16 #include "mplayer/play.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
17
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18 #include "mplayer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
19 #include "access_mpcontext.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20 #include "app.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include "cfg.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22 #include "help_mp.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23 #include "subreader.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include "libvo/x11_common.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include "libvo/video_out.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26 #include "libvo/font_load.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27 #include "libvo/sub.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
28 #include "input/input.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29 #include "libao2/audio_out.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30 #include "mixer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
31 #include "libaf/af.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
32 #include "libaf/equalizer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34 extern af_cfg_t af_cfg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
36 #ifdef USE_ICONV
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
37 #include <iconv.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40 #include "stream/stream.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41 #include "libmpdemux/demuxer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 #include "libmpdemux/stheader.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43 #include "libmpcodecs/dec_video.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46 #include "stream/stream_dvd.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
23603
c1221a031ab7 Add a (almost correct) prototype for vcd_seek_to_track
reimar
parents: 23341
diff changeset
49 int vcd_seek_to_track(void *vcd, int track);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 #include "m_config.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 #include "m_option.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 guiInterface_t guiIntfStruct;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 int guiWinID=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 char * gstrcat( char ** dest,const char * src )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 char * tmp = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 if ( !src ) return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 if ( *dest )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 tmp=malloc( strlen( *dest ) + strlen( src ) + 1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 if ( tmp ) /* TODO: advanced error handling */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 { tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 *dest=tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 return tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 int gstrcmp( const char * a,const char * b )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 if ( !a && !b ) return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 if ( !a || !b ) return -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 return strcmp( a,b );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 int gstrncmp( const char * a,const char * b,int size )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 if ( !a && !b ) return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 if ( !a || !b ) return -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 return strncmp( a,b,size );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 char * gstrdup( const char * str )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 if ( !str ) return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 return strdup( str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 char * gstrchr( char * str,int c )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 if ( !str ) return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 return strchr( str,c );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 void gfree( void ** p )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 if ( *p == NULL ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 free( *p ); *p=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 void gset( char ** str, const char * what )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }}
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 else gstrcat( str,what );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 /**
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118 * \brief this actually creates a new list containing only one element...
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 void gaddlist( char *** list,const char * entry )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 if ( (*list) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 for ( i=0;(*list)[i];i++ ) free( (*list)[i] );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 free( (*list) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 (*list)=malloc( 2 * sizeof(char **) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 (*list)[0]=gstrdup( entry );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 (*list)[1]=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 /**
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 * \brief this replaces a string starting with search by replace.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 * If not found, replace is appended.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 void greplace(char ***list, const char *search, const char *replace)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 int i = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 int len = (search) ? strlen(search) : 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 if (*list) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 for (i = 0; (*list)[i]; i++) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 if (search && (strncmp((*list)[i], search, len) == 0)) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 free((*list)[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 (*list)[i] = gstrdup(replace);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 *list = realloc(*list, (i + 2) * sizeof(char *));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 *list = malloc(2 * sizeof(char *));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 (*list)[i] = gstrdup(replace);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 (*list)[i + 1] = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 #ifdef USE_ICONV
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 char * gconvert_uri_to_filename( char * str )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164 iconv_t d;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 char * out = strdup( str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 char * tmp = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 char * ize;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 size_t inb,outb;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 char * charset = "ISO8859-1";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 char * cs;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 if ( !strchr( str,'%' ) ) return str;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 char * t = calloc( 1,strlen( out ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 int i,c = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 for ( i=0;i < (int)strlen( out );i++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 if ( out[i] != '%' ) t[c++]=out[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 char tmp[5] = "0xXX";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 // if ( out[++i] == '%' ) { t[c++]='%'; continue; };
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 tmp[2]=out[++i]; tmp[3]=out[++i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 t[c++]=(char)strtol( tmp,(char **)NULL,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186 free( out );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 out=t;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190 if ( (cs=getenv( "CHARSET" )) && *cs ) charset=cs;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 inb=outb=strlen( out );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 tmp=calloc( 1,outb + 1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 ize=tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 d=iconv_open( charset,"UTF-8" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 if ( (iconv_t)(-1) == d ) return str;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 iconv( d,&out,&inb,&tmp,&outb );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 iconv_close( d );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 free( out );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 return ize;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 void guiInit( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 guiIntfStruct.Balance=50.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 guiIntfStruct.StreamType=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 memset( &gtkEquChannels,0,sizeof( gtkEquChannels ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 #ifdef HAVE_DXR3
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 if ( stream_cache_size > 0 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 else if ( stream_cache_size == 0 ) gtkCacheOn = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 #ifdef USE_ASS
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 gtkASS.enabled = ass_enabled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 gtkASS.use_margins = ass_use_margins;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 gtkASS.top_margin = ass_top_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 gtkASS.bottom_margin = ass_bottom_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 gtkInit();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 // --- initialize X
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 wsXInit( (void *)mDisplay );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 // --- load skin
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 skinDirInHome=get_path("skins");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 skinDirInHome_obsolete=get_path("Skin");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 skinMPlayerDir=MPLAYER_DATADIR "/skins";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 skinMPlayerDir_obsolete=MPLAYER_DATADIR "/Skin";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1 (obsolete): '%s'\n",skinDirInHome_obsolete);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2 (obsolete): '%s'\n",skinMPlayerDir_obsolete);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 if ( !skinName ) skinName=strdup( "default" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 i = skinRead( skinName );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 if ((i == -1) && strcmp(skinName,"default"))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 skinName=strdup( "default" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245 i = skinRead( skinName );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 switch (i) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251 // --- initialize windows
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 if ( ( mplDrawBuffer = malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 fprintf( stderr,MSGTR_NEMDB );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 exit( 0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 if ( gui_save_pos )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 appMPlayer.main.x = gui_main_pos_x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 appMPlayer.main.y = gui_main_pos_y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 appMPlayer.sub.x = gui_sub_pos_x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 appMPlayer.sub.y = gui_sub_pos_y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 if (WinID>0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 appMPlayer.subWindow.Parent=WinID;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 appMPlayer.sub.x=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
270 appMPlayer.sub.y=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 if (guiWinID>=0) appMPlayer.mainWindow.Parent=guiWinID;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 wsCreateWindow( &appMPlayer.subWindow,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
275 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 wsDestroyImage( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
280 wsXDNDMakeAwareness(&appMPlayer.subWindow);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
281
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 mplMenuInit();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283 mplPBInit();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 // i=wsHideFrame|wsMaxSize|wsHideWindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289 i=wsShowFrame|wsMaxSize|wsHideWindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 wsCreateWindow( &appMPlayer.mainWindow,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
294 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
295 wsXDNDMakeAwareness(&appMPlayer.mainWindow);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 #ifdef DEBUG
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] depth on screen: %d\n",wsDepthOnScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306 appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 appMPlayer.subWindow.ReDraw=(void *)mplSubDraw;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 appMPlayer.subWindow.DandDHandler=mplDandDHandler;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
317 btnModify( evSetVolume,guiIntfStruct.Volume );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 btnModify( evSetBalance,guiIntfStruct.Balance );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 btnModify( evSetMoviePosition,guiIntfStruct.Position );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
320
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324 guiIntfStruct.Playing=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
329 #if 0
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333 XEvent xev;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
334 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
335 appMPlayer.subWindow.Mapped=wsMapped;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339 if ( fullscreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 btnModify( evFullScreen,btnPressed );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 #else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 if ( gtkShowVideoWindow )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 XEvent xev;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352 appMPlayer.subWindow.Mapped=wsMapped;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 if ( fullscreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
357 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358 btnModify( evFullScreen,btnPressed );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 if ( fullscreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 XEvent xev;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 appMPlayer.subWindow.Mapped=wsMapped;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371 wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
373 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 btnModify( evFullScreen,btnPressed );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
376 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
377 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378 mplSubRender=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
379 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387 void guiDone( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
388 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389 mplMainRender=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
390 mp_msg( MSGT_GPLAYER,MSGL_V,"[GUI] done.\n" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
391
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
392 if ( gui_save_pos )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
393 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
394 gui_main_pos_x=appMPlayer.mainWindow.X; gui_main_pos_y=appMPlayer.mainWindow.Y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
395 gui_sub_pos_x=appMPlayer.subWindow.X; gui_sub_pos_y=appMPlayer.subWindow.Y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
396 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
397
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
398 #ifdef USE_ASS
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
399 ass_enabled = gtkASS.enabled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
400 ass_use_margins = gtkASS.use_margins;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 ass_top_margin = gtkASS.top_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402 ass_bottom_margin = gtkASS.bottom_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
403 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405 cfg_write();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406 wsXDone();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
408
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
409 int guiCMDArray[] =
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
410 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
411 evLoadPlay,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
412 evLoadSubtitle,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
413 evAbout,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
414 evPlay,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
415 evStop,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
416 evPlayList,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
417 evPreferences,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 evFullScreen,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 evSkinBrowser
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 };
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
422 extern int frame_dropping;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
423 extern int stream_dump_type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
424 extern int vcd_track;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
425 extern m_obj_settings_t * vf_settings;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
426
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
427 void guiLoadFont( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
428 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
429 #ifdef HAVE_FREETYPE
23341
74f5109611e2 missed part of gui code change while introducing -subfont option (patch by Piotr Kaczuba)
ben
parents: 23158
diff changeset
430 load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
431 #else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
432 if ( vo_font )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
433 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
434 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
435 if ( vo_font->name ) free( vo_font->name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
436 if ( vo_font->fpath ) free( vo_font->fpath );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
437 for ( i=0;i<16;i++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
438 if ( vo_font->pic_a[i] )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
439 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
440 if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
441 if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
442 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443 for ( i=0;i<16;i++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
444 if ( vo_font->pic_b[i] )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
445 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
446 if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
447 if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
448 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
449 free( vo_font ); vo_font=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
450 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
451 if ( font_name )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
452 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
453 vo_font=read_font_desc( font_name,font_factor,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
454 if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
455 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
456 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
457 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 font_name=gstrdup( get_path( "font/font.desc" ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
459 vo_font=read_font_desc( font_name,font_factor,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
460 if ( !vo_font )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
461 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
462 gfree( (void **)&font_name ); font_name=gstrdup(MPLAYER_DATADIR "/font/font.desc" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
463 vo_font=read_font_desc( font_name,font_factor,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
468
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
469 extern mp_osd_obj_t* vo_osd_list;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
470
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
471 extern char **sub_name;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
472
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
473 void guiLoadSubtitle( char * name )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
474 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
475 if ( guiIntfStruct.Playing == 0 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
476 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
477 guiIntfStruct.SubtitleChanged=1; //what is this for? (mw)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
478 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
480 if ( subdata )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
482 mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_DeletingSubtitles );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
483 sub_free( subdata );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 subdata=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485 vo_sub=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
486 if ( vo_osd_list )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
487 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 int len;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
489 mp_osd_obj_t * osd = vo_osd_list;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
490 while ( osd )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
491 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492 if ( osd->type == OSDTYPE_SUBTITLE ) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493 osd=osd->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
494 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495 if ( osd && osd->flags&OSDFLAG_VISIBLE )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
496 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
497 len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
498 memset( osd->bitmap_buffer,0,len );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
499 memset( osd->alpha_buffer,0,len );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
503 if ( name )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
504 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
505 mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_LoadingSubtitles,name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
506 subdata=sub_read_file( name, guiIntfStruct.FPS );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
507 if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
508 sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
509 sub_name[0] = strdup(name); //sub_name[0] will be read
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
510 sub_name[1] = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
511 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
512 update_set_of_subtitles();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
513
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
514 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
515
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 static void add_vf( char * str )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
517 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
518 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
519 if ( vf_settings )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
520 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
521 int i = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { i=-1; break; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523 if ( i != -1 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
524 { vf_settings=realloc( vf_settings,( i + 2 ) * sizeof( m_obj_settings_t ) ); vf_settings[i].name=strdup( str );vf_settings[i].attribs = NULL; vf_settings[i+1].name=NULL; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
525 } else { vf_settings=malloc( 2 * sizeof( m_obj_settings_t ) ); vf_settings[0].name=strdup( str );vf_settings[0].attribs = NULL; vf_settings[1].name=NULL; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
526 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
527
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 static void remove_vf( char * str )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
529 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
530 int n = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
532 if ( !vf_settings ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
533
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
534 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_RemovingVideoFilter,str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
535
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
536 while ( vf_settings[n++].name ); n--;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
537 if ( n > -1 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
538 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
539 int i = 0,m = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
540 while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { m=i - 1; break; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541 i--;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542 if ( m > -1 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
544 if ( n == 1 ) { free( vf_settings[0].name );free( vf_settings[0].attribs ); free( vf_settings ); vf_settings=NULL; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
545 else { free( vf_settings[i].name );free( vf_settings[i].attribs ); memcpy( &vf_settings[i],&vf_settings[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
546 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
547 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
548 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
549
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550 int guiGetEvent( int type,char * arg )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552 ao_functions_t *audio_out = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553 vo_functions_t *video_out = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
554 mixer_t *mixer = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
555
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 stream_t * stream = (stream_t *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
558 dvd_priv_t * dvdp = (dvd_priv_t *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
559 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
560
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
561 if (guiIntfStruct.mpcontext) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562 audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
563 video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
564 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
566
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
567 switch ( type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
568 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 case guiXEvent:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
570 guiIntfStruct.event_struct=(void *)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
571 wsEvents( wsDisplay,(XEvent *)arg,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
572 gtkEventHandling();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
573 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
574 case guiCEvent:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
575 switch ( (int)arg )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
576 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
577 case guiSetPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
578 guiIntfStruct.Playing=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
579 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
580 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
581 case guiSetStop:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
582 guiIntfStruct.Playing=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585 case guiSetPause: guiIntfStruct.Playing=2; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
586 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
587 mplState();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589 case guiSetState:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
590 mplState();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
591 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 case guiSetFileName:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
593 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
594 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
595 case guiSetAudioOnly:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 guiIntfStruct.AudioOnly=(int)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
597 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
598 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
599 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
600 case guiSetContext:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 guiIntfStruct.mpcontext=(void *)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602 case guiSetDemuxer:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
603 guiIntfStruct.demuxer=(void *)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
604 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605 case guiSetAfilter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606 guiIntfStruct.afilter=(void *)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
607 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608 case guiSetShVideo:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
609 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
610 if ( !appMPlayer.subWindow.isFullScreen )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
611 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612 wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
615 guiIntfStruct.MovieWidth=vo_dwidth;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
616 guiIntfStruct.MovieHeight=vo_dheight;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
617 if (guiWinID>=0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618 wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
619 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
620 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
621 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
622 case guiSetDVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
623 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
624 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
625 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
626 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
627 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
628 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
629 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
630 guiIntfStruct.DVD.current_title=dvd_title + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
631 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
632 guiIntfStruct.DVD.current_angle=dvd_angle + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
633 guiIntfStruct.Track=dvd_title + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
634 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
635 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
636 case guiSetStream:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
637 guiIntfStruct.StreamType=stream->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
638 switch( stream->type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
639 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
640 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
641 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
642 guiGetEvent( guiSetDVD,(char *)stream->priv );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
643 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
644 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
645 #ifdef HAVE_VCD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
646 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
647 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
648 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
649
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
650 if (!stream->priv)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
651 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
652 guiIntfStruct.VCDTracks=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
653 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
654 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
655 for ( i=1;i < 100;i++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
656 if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
657 vcd_seek_to_track( stream->priv,vcd_track );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
658 guiIntfStruct.VCDTracks=--i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
659 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
660 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
661 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
662 default: break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
663 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
664 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
665 case guiIEvent:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
666 mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
667 switch( (int)arg )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
668 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
669 case MP_CMD_QUIT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
670 mplEventHandling( evExit,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
671 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672 case MP_CMD_VO_FULLSCREEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
673 mplEventHandling( evFullScreen,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
674 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
675 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
676 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
677 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
678 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
679 case guiReDraw:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
680 mplEventHandling( evRedraw,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
681 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
682 case guiSetVolume:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
683 if ( audio_out )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
685 float l,r;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
686 mixer_getvolume( mixer,&l,&r );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
687 guiIntfStruct.Volume=(r>l?r:l);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
688 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
689 else guiIntfStruct.Balance=50.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
690 btnModify( evSetVolume,guiIntfStruct.Volume );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
691 btnModify( evSetBalance,guiIntfStruct.Balance );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
692 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
693 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
694 case guiSetFileFormat:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
695 guiIntfStruct.FileFormat=(int)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
696 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
697 case guiSetValues:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
698 // -- video
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
699 guiIntfStruct.sh_video=arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
700 if ( arg )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
701 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
702 sh_video_t * sh = (sh_video_t *)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
703 guiIntfStruct.FPS=sh->fps;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
704 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
705
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
706 if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
707
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
708 if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
709 else btnSet( evSetMoviePosition,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
710
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
711 // -- audio
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
712 if ( audio_out )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
713 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
714 float l,r;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
715 mixer_getvolume( mixer,&l,&r );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
716 guiIntfStruct.Volume=(r>l?r:l);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
717 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
718 else guiIntfStruct.Balance=50.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
719 btnModify( evSetVolume,guiIntfStruct.Volume );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
720 btnModify( evSetBalance,guiIntfStruct.Balance );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
721 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
722
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
723 if ( gtkEnableAudioEqualizer )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
724 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
725 equalizer_t eq;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
726 int i,j;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
727 for ( i=0;i<6;i++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
728 for ( j=0;j<10;j++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
729 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
730 eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
731 gtkSet( gtkSetEqualizer,0,&eq );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
732 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
733 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
734 // -- subtitle
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
735 #ifdef HAVE_DXR3
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
736 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
737 #ifdef USE_LIBAVCODEC
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
738 && !gtkVfLAVC
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
739 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
740 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
741 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
742 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVC );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
743 guiIntfStruct.Playing=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
744 return True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
745 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
746 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
747 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
748 case guiSetDefaults:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
749 // if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
750 if ( guiIntfStruct.FilenameChanged )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
751 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
752 audio_id=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
753 video_id=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
754 dvdsub_id=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
755 vobsub_id=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
756 stream_cache_size=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
757 autosync=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
758 vcd_track=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
759 dvd_title=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
760 force_fps=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
761 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
762 guiIntfStruct.demuxer=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
763 guiIntfStruct.sh_video=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
764 wsPostRedisplay( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
765 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
766 case guiSetParameters:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
767 guiGetEvent( guiSetDefaults,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
768 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
769 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
770 case STREAMTYPE_PLAYLIST:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
771 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
772 #ifdef HAVE_VCD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
773 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
774 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
775 char tmp[512];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
776 sprintf( tmp,"vcd://%d",guiIntfStruct.Track + 1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
777 guiSetFilename( guiIntfStruct.Filename,tmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
778 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
779 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
780 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
781 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
782 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
783 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
784 char tmp[512];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
785 sprintf( tmp,"dvd://%d",guiIntfStruct.Title );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
786 guiSetFilename( guiIntfStruct.Filename,tmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
787 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
788 dvd_chapter=guiIntfStruct.Chapter;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
789 dvd_angle=guiIntfStruct.Angle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
790 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
791 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
792 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
793 //if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore!
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
794 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
795 if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
796 else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
797 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
798 // --- video opts
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
799
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
800 if ( !video_driver_list )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
801 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
802 int i = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
803 while ( video_out_drivers[i++] )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
804 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
805 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
806 gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
807 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
808 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
809 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
810
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
811 if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
812
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
813 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
814 int i = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
815 guiIntfStruct.NoWindow=False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
816 while ( video_out_drivers[i++] )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
817 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
818 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
819 if ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
820 { guiIntfStruct.NoWindow=True; break; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
821 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
822 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
823
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
824 #ifdef HAVE_DXR3
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
825 #ifdef USE_LIBAVCODEC
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
826 remove_vf( "lavc" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
827 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
828 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
829 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
830 if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
831 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
832 #ifdef USE_LIBAVCODEC
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
833 if ( gtkVfLAVC ) add_vf( "lavc" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
834 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
835 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
836 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
837 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
838 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
839 if ( gtkVfPP ) add_vf( "pp" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
840 else remove_vf( "pp" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
841
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
842 // --- audio opts
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
843 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
844 if (gtkAONorm)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
845 greplace(&af_cfg.list, "volnorm", "volnorm");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
846 if (gtkEnableAudioEqualizer)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
847 greplace(&af_cfg.list, "equalizer", "equalizer");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
848 if ( gtkAOExtraStereo )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
849 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
850 char *name = malloc(12 + 20 + 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
851 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
852 name[12 + 20] = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
853 greplace(&af_cfg.list, "extrastereo", name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
854 free(name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
855 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
856 #ifdef USE_OSS_AUDIO
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
857 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
858 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
859 char *tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
860 mixer_device = gtkAOOSSMixer;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
861 mixer_channel = gtkAOOSSMixerChannel;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
862 if (gtkAOOSSDevice) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
863 tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
864 sprintf( tmp,"oss:%s",gtkAOOSSDevice );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
865 } else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
866 tmp = strdup("oss");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
867 gaddlist( &audio_driver_list,tmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
868 free(tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
869 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
870 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
871 #if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
872 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
873 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
874 char *tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
875 mixer_device = gtkAOALSAMixer;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
876 mixer_channel = gtkAOALSAMixerChannel;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
877 if (gtkAOALSADevice) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
878 tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
879 sprintf( tmp,"alsa:device=%s",gtkAOALSADevice );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
880 } else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
881 tmp = strdup("alsa");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
882 gaddlist( &audio_driver_list,tmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
883 free(tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
884 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
885 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
886 #ifdef HAVE_SDL
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
887 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
888 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
889 char *tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
890 if (gtkAOSDLDriver) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
891 tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
892 sprintf( tmp,"sdl:%s",gtkAOSDLDriver );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
893 } else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
894 tmp = strdup("sdl");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
895 gaddlist( &audio_driver_list,tmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
896 free(tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
897 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
898 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
899 #ifdef USE_ESD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
900 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"esd",3 ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
901 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
902 char *tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
903 if (gtkAOESDDevice) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
904 tmp = calloc( 1,strlen( gtkAOESDDevice ) + 10 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
905 sprintf( tmp,"esd:%s",gtkAOESDDevice );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
906 } else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
907 tmp = strdup("esd");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
908 gaddlist( &audio_driver_list,tmp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
909 free(tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
910 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
911 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
912 // -- subtitle
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
913 //subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
914 stream_dump_type=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
915 if ( gtkSubDumpMPSub ) stream_dump_type=4;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
916 if ( gtkSubDumpSrt ) stream_dump_type=6;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
917 gtkSubDumpMPSub=gtkSubDumpSrt=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
918 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
919
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
920 // --- misc
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
921 if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
922 if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
923
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
924 if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
925 else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
926 //audio_stream=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
927
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
928 guiIntfStruct.DiskChanged=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
929 guiIntfStruct.FilenameChanged=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
930 guiIntfStruct.NewPlay=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
931
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
932 #ifdef USE_ASS
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
933 ass_enabled = gtkASS.enabled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
934 ass_use_margins = gtkASS.use_margins;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
935 ass_top_margin = gtkASS.top_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
936 ass_bottom_margin = gtkASS.bottom_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
937 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
938
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
939 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
940 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
941 return False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
942 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
943
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
944 void guiEventHandling( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
945 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
946 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
947 gtkEventHandling();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
948 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
949
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
950 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
951
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
952 float gtkEquChannels[6][10];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
953
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
954 plItem * plCurrent = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
955 plItem * plList = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
956 plItem * plLastPlayed = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
957
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
958 URLItem *URLList = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
959
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
960 char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL };
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
961
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
962 #if defined( MP_DEBUG ) && 0
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
963 void list( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
964 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
965 plItem * next = plList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
966 printf( "--- list ---\n" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
967 while( next || next->next )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
968 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
969 printf( "item: %s/%s\n",next->path,next->name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
970 if ( next->next ) next=next->next; else break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
971 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
972 printf( "--- end of list ---\n" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
973 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
974 #else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
975 #define list();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
976 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
977
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
978 void * gtkSet( int cmd,float fparam, void * vparam )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
979 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
980 equalizer_t * eq = (equalizer_t *)vparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
981 plItem * item = (plItem *)vparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
982
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
983 URLItem * url_item = (URLItem *)vparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
984 int is_added = True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
985
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
986 switch ( cmd )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
987 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
988 // --- handle playlist
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
989 case gtkAddPlItem: // add item to playlist
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
990 if ( plList )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
991 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
992 plItem * next = plList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
993 while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
994 next->next=item; item->prev=next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
995 } else { item->prev=item->next=NULL; plCurrent=plList=item; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
996 list();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
997 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
998 case gtkInsertPlItem: // add item into playlist after current
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
999 if ( plCurrent )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1000 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1001 plItem * curr = plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1002 item->next=curr->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1003 if (item->next)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1004 item->next->prev=item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1005 item->prev=curr;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1006 curr->next=item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1007 plCurrent=plCurrent->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1008 return plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1009 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1010 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1011 return gtkSet(gtkAddPlItem,0,(void*)item);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1012 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1013 case gtkGetNextPlItem: // get current item from playlist
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1014 if ( plCurrent && plCurrent->next)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1015 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1016 plCurrent=plCurrent->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1017 /*if ( !plCurrent && plList )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1018 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1019 plItem * next = plList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1020 while ( next->next ) { if ( !next->next ) break; next=next->next; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1021 plCurrent=next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1022 }*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1023 return plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1024 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1025 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1026 case gtkGetPrevPlItem:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1027 if ( plCurrent && plCurrent->prev)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1028 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1029 plCurrent=plCurrent->prev;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1030 //if ( !plCurrent && plList ) plCurrent=plList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1031 return plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1032 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1033 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1034 case gtkSetCurrPlItem: // set current item
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1035 plCurrent=item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1036 return plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1037 case gtkGetCurrPlItem: // get current item
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1038 return plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1039 case gtkDelCurrPlItem: // delete current item
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1040 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1041 plItem * curr = plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1042
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1043 if (!curr)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1044 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1045 if (curr->prev)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1046 curr->prev->next=curr->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1047 if (curr->next)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1048 curr->next->prev=curr->prev;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1049 if (curr==plList)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1050 plList=curr->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1051 plCurrent=curr->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1052 // Free it
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1053 if ( curr->path ) free( curr->path );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1054 if ( curr->name ) free( curr->name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1055 free( curr );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1056 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1057 mplCurr(); // Instead of using mplNext && mplPrev
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1058
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1059 return plCurrent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1060 case gtkDelPl: // delete list
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1061 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1062 plItem * curr = plList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1063 plItem * next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1064 if ( !plList ) return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1065 if ( !curr->next )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1066 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1067 if ( curr->path ) free( curr->path );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1068 if ( curr->name ) free( curr->name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1069 free( curr );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1070 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1071 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1072 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1073 while ( curr->next )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1074 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1075 next=curr->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1076 if ( curr->path ) free( curr->path );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1077 if ( curr->name ) free( curr->name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1078 free( curr );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1079 curr=next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1080 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1081 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1082 plList=NULL; plCurrent=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1083 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1084 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1085 // ----- Handle url
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1086 case gtkAddURLItem:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1087 if ( URLList )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1088 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1089 URLItem * next_url = URLList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1090 is_added = False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1091 while ( next_url->next )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1092 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1093 if ( !gstrcmp( next_url->url,url_item->url ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1094 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1095 is_added=True;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1096 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1097 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1098 next_url=next_url->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1099 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1100 if ( ( !is_added )&&( gstrcmp( next_url->url,url_item->url ) ) ) next_url->next=url_item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1101 } else { url_item->next=NULL; URLList=url_item; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1102 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1103 // --- subtitle
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1104 #ifndef HAVE_FREETYPE
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1105 case gtkSetFontFactor:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1106 font_factor=fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1107 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1108 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1109 #else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1110 case gtkSetFontOutLine:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1111 subtitle_font_thickness=( 8.0f / 100.0f ) * fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1112 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1113 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1114 case gtkSetFontBlur:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1115 subtitle_font_radius=( 8.0f / 100.0f ) * fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1116 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1117 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1118 case gtkSetFontTextScale:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1119 text_font_scale_factor=fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1120 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1121 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1122 case gtkSetFontOSDScale:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1123 osd_font_scale_factor=fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1124 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1125 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1126 case gtkSetFontEncoding:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1127 gfree( (void **)&subtitle_font_encoding );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1128 subtitle_font_encoding=gstrdup( (char *)vparam );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1129 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1130 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1131 case gtkSetFontAutoScale:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1132 subtitle_autoscale=(int)fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1133 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1134 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1135 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1136 #ifdef USE_ICONV
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1137 case gtkSetSubEncoding:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1138 gfree( (void **)&sub_cp );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1139 sub_cp=gstrdup( (char *)vparam );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1140 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1141 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1142 // --- misc
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1143 case gtkClearStruct:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1144 if ( (unsigned int)vparam & guiFilenames )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1145 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1146 gfree( (void **)&guiIntfStruct.Filename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1147 gfree( (void **)&guiIntfStruct.Subtitlename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1148 gfree( (void **)&guiIntfStruct.AudioFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1149 gtkSet( gtkDelPl,0,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1150 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1151 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1152 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1153 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1154 #ifdef HAVE_VCD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1155 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1156 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1157 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1158 case gtkSetExtraStereo:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1159 gtkAOExtraStereoMul=fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1160 if (guiIntfStruct.afilter)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1161 af_control_any_rev(guiIntfStruct.afilter,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1162 AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1163 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1164 case gtkSetPanscan:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1165 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1166 mp_cmd_t * mp_cmd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1167 mp_cmd=calloc( 1,sizeof( *mp_cmd ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1168 mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1169 mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1170 mp_input_queue_cmd( mp_cmd );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1171 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1172 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1173 case gtkSetAutoq:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1174 auto_quality=(int)fparam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1175 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1176 // --- set equalizers
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1177 case gtkSetContrast:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1178 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1179 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1180 case gtkSetBrightness:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1181 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1182 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1183 case gtkSetHue:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1184 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1185 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1186 case gtkSetSaturation:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1187 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1188 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1189 case gtkSetEqualizer:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1190 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1191 af_control_ext_t tmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1192 if ( eq )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1193 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1194 gtkEquChannels[eq->channel][eq->band]=eq->gain;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1195 tmp.ch = eq->channel;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1196 tmp.arg = gtkEquChannels[eq->channel];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1197 if (guiIntfStruct.afilter)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1198 af_control_any_rev(guiIntfStruct.afilter,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1199 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1200 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1201 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1202 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1203 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1204 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1205 if (guiIntfStruct.afilter)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1206 for ( i=0;i<6;i++ )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1207 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1208 tmp.ch = i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1209 tmp.arg = gtkEquChannels[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1210 af_control_any_rev(guiIntfStruct.afilter,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1211 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1212 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1213 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1214 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1215 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1216 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1217 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1218 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1219
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1220 #define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1221
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1222 #include "playtree.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1223
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1224 //This function adds/inserts one file into the gui playlist
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1225
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1226 int import_file_into_gui(char* temp, int insert)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1227 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1228 char *filename, *pathname;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1229 plItem * item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1230
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1231 filename = strdup(mp_basename(temp));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1232 pathname = strdup(temp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1233 if (strlen(pathname)-strlen(filename)>0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1234 pathname[strlen(pathname)-strlen(filename)-1]='\0'; // We have some path so remove / at end
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1235 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1236 pathname[strlen(pathname)-strlen(filename)]='\0';
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1237 mp_msg(MSGT_PLAYTREE,MSGL_V, "Adding filename %s && pathname %s\n",filename,pathname); //FIXME: Change to MSGL_DBG2 ?
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1238 item=calloc( 1,sizeof( plItem ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1239 if (!item)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1240 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1241 item->name=filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1242 item->path=pathname;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1243 if (insert)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1244 gtkSet( gtkInsertPlItem,0,(void*)item ); // Inserts the item after current, and makes current=item
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1245 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1246 gtkSet( gtkAddPlItem,0,(void*)item );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1247 return 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1248 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1249
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1250
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1251 // This function imports the initial playtree (based on cmd-line files) into the gui playlist
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1252 // by either:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1253 // - overwriting gui pl (enqueue=0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1254 // - appending it to gui pl (enqueue=1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1255
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1256 int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1257 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1258 play_tree_iter_t* my_pt_iter=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1259 int result=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1260
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1261 if (!enqueue) // Delete playlist before "appending"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1262 gtkSet(gtkDelPl,0,0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1263
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1264 if((my_pt_iter=pt_iter_create(&my_playtree,config)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1265 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1266 while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1267 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1268 if (import_file_into_gui(filename, 0)) // Add it to end of list
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1269 result=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1270 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1271 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1272
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1273 mplCurr(); // Update filename
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1274 mplGotoTheNext=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1275
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1276 if (!enqueue)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1277 filename=guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1278 // gmplayer does directly start in Play-Mode.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1279 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1280 filename=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1281
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1282 return result;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1283 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1284
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1285 // This function imports and inserts an playtree, that is created "on the fly", for example by
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1286 // parsing some MOV-Reference-File; or by loading an playlist with "File Open"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1287 //
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1288 // The file which contained the playlist is thereby replaced with it's contents.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1289
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1290 int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1291 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1292 play_tree_iter_t* my_pt_iter=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1293 int result=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1294 plItem * save=(plItem*)gtkSet( gtkGetCurrPlItem, 0, 0); // Save current item
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1295
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1296 if((my_pt_iter=pt_iter_create(&my_playtree,config)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1297 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1298 while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1299 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1300 if (import_file_into_gui(filename, 1)) // insert it into the list and set plCurrent=new item
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1301 result=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1302 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1303 pt_iter_destroy(&my_pt_iter);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1304 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1305
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1306 if (save)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1307 gtkSet(gtkSetCurrPlItem, 0, (void*)save);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1308 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1309 gtkSet(gtkSetCurrPlItem, 0, (void*)plList); // go to head, if plList was empty before
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1310
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1311 if (save && result)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1312 gtkSet(gtkDelCurrPlItem, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1313
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1314 mplCurr(); // Update filename
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1315 filename=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1316
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1317 return result;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1318 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1319
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1320 // wrapper function for mp_msg to display a message box for errors and warnings.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1321
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1322 void guiMessageBox(int level, char * str) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1323 switch(level) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1324 case MSGL_FATAL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1325 gtkMessageBox(GTK_MB_FATAL|GTK_MB_SIMPLE, str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1326 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1327 case MSGL_ERR:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1328 gtkMessageBox(GTK_MB_ERROR|GTK_MB_SIMPLE, str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1329 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1330 #if 0
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1331 // WARNING! Do NOT enable this! There are too many non-critical messages with
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1332 // MSGL_WARN, for example: broken SPU packets, codec's bit error messages,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1333 // etc etc, they should not raise up a new window every time.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1334 case MSGL_WARN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1335 gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1336 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1337 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1338 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1339 }