Mercurial > mplayer.hg
annotate Gui/interface.c @ 8256:cde8aaad8198
This file gets created during the wine/svq3 build process.
author | diego |
---|---|
date | Sat, 23 Nov 2002 11:45:44 +0000 |
parents | 851e974e6eaa |
children | 72700fefd3dc |
rev | line source |
---|---|
8058 | 1 |
4845 | 2 #include <inttypes.h> |
3 #include <stdlib.h> | |
4 #include <stdio.h> | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
5 #include <string.h> |
8058 | 6 #include <sys/types.h> |
4798 | 7 |
8058 | 8 #include "wm/ws.h" |
9 #include "wm/wsxdnd.h" | |
4798 | 10 #include "interface.h" |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
11 #include "skin/skin.h" |
8058 | 12 |
6627 | 13 #include "mplayer/gtk/eq.h" |
8058 | 14 #include "mplayer/widgets.h" |
15 #include "mplayer/mplayer.h" | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
16 |
4798 | 17 #include "../mplayer.h" |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
18 #include "app.h" |
6794 | 19 #include "cfg.h" |
20 #include "../help_mp.h" | |
21 #include "../subreader.h" | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
22 #include "../libvo/x11_common.h" |
5789 | 23 #include "../libvo/video_out.h" |
6794 | 24 #include "../libvo/font_load.h" |
7169 | 25 #include "../libvo/sub.h" |
4858 | 26 #include "../input/input.h" |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
27 #include "../libao2/audio_out.h" |
6627 | 28 #include "../mixer.h" |
29 #include "../libao2/audio_plugin.h" | |
30 #include "../libao2/eq.h" | |
5789 | 31 |
6996 | 32 #ifdef USE_ICONV |
7128 | 33 #include <iconv.h> |
6996 | 34 #endif |
35 | |
5665 | 36 #include "../libmpdemux/stream.h" |
5789 | 37 #include "../libmpdemux/demuxer.h" |
7217 | 38 #include "../libmpdemux/stheader.h" |
39 #include "../libmpcodecs/dec_video.h" | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
40 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
41 guiInterface_t guiIntfStruct; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
42 |
6627 | 43 char * gstrcat( char ** dest,char * src ) |
44 { | |
45 char * tmp = NULL; | |
46 | |
47 if ( !src ) return NULL; | |
48 | |
49 if ( *dest ) | |
50 { | |
51 tmp=malloc( strlen( *dest ) + strlen( src ) + 1 ); | |
52 strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest ); | |
53 } | |
54 else | |
55 { tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); } | |
56 *dest=tmp; | |
57 return tmp; | |
58 } | |
59 | |
6794 | 60 int gstrcmp( char * a,char * b ) |
61 { | |
62 if ( !a && !b ) return 0; | |
63 if ( !a || !b ) return -1; | |
64 return strcmp( a,b ); | |
65 } | |
66 | |
7019 | 67 int gstrncmp( char * a,char * b,int size ) |
68 { | |
69 if ( !a && !b ) return 0; | |
70 if ( !a || !b ) return -1; | |
71 return strncmp( a,b,size ); | |
72 } | |
73 | |
6794 | 74 char * gstrdup( char * str ) |
75 { | |
76 if ( !str ) return NULL; | |
77 return strdup( str ); | |
78 } | |
79 | |
80 void gfree( void ** p ) | |
81 { | |
82 if ( *p == NULL ) return; | |
83 free( *p ); *p=NULL; | |
84 } | |
85 | |
86 void gset( char ** str,char * what ) | |
87 { | |
7887
0e5544951425
A small patch to Gui/interface.c; the first fix is a plain bug, the second is
arpi
parents:
7707
diff
changeset
|
88 if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }} |
6794 | 89 else gstrcat( str,what ); |
90 } | |
91 | |
7582 | 92 void gaddlist( char *** list,char * entry ) |
93 { | |
94 int i; | |
95 | |
96 if ( (*list) ) | |
97 { | |
98 for ( i=0;(*list)[i];i++ ) free( (*list)[i] ); | |
99 free( (*list) ); | |
100 } | |
101 | |
102 (*list)=malloc( 8 ); | |
103 (*list)[0]=gstrdup( entry ); | |
104 (*list)[1]=NULL; | |
105 } | |
106 | |
6996 | 107 #ifdef USE_ICONV |
108 char * gconvert_uri_to_filename( char * str ) | |
109 { | |
110 iconv_t d; | |
111 char * out = strdup( str ); | |
112 char * tmp = NULL; | |
113 char * ize; | |
114 size_t inb,outb; | |
115 char * charset = "ISO8859-1"; | |
116 char * cs; | |
117 | |
118 if ( !strchr( str,'%' ) ) return str; | |
119 | |
120 { | |
121 char * t = calloc( 1,strlen( out ) ); | |
122 int i,c = 0; | |
123 for ( i=0;i < (int)strlen( out );i++ ) | |
124 if ( out[i] != '%' ) t[c++]=out[i]; | |
125 else | |
126 { | |
127 char tmp[4] = "0xXX"; | |
128 // if ( out[++i] == '%' ) { t[c++]='%'; continue; }; | |
129 tmp[2]=out[++i]; tmp[3]=out[++i]; | |
130 t[c++]=(char)strtol( tmp,(char **)NULL,0 ); | |
131 } | |
132 free( out ); | |
133 out=t; | |
134 } | |
135 | |
136 if ( (cs=getenv( "CHARSET" )) && *cs ) charset=cs; | |
137 | |
138 inb=outb=strlen( out ); | |
139 tmp=calloc( 1,outb + 1 ); | |
140 ize=tmp; | |
141 d=iconv_open( charset,"UTF-8" ); | |
142 if ( (iconv_t)(-1) == d ) return str; | |
143 iconv( d,&out,&inb,&tmp,&outb ); | |
144 iconv_close( d ); | |
145 free( out ); | |
146 return ize; | |
147 } | |
148 #endif | |
149 | |
6218 | 150 void guiInit( void ) |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
151 { |
8058 | 152 int i; |
153 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
154 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) ); |
6898 | 155 guiIntfStruct.Balance=50.0f; |
156 guiIntfStruct.StreamType=-1; | |
157 | |
6627 | 158 memset( >kEquChannels,0,sizeof( gtkEquChannels ) ); |
7706 | 159 if ( !gtkAOOSSMixer ) gtkAOOSSMixer=strdup( PATH_DEV_MIXER ); |
160 if ( !gtkAOOSSDevice ) gtkAOOSSDevice=strdup( PATH_DEV_DSP ); | |
7707 | 161 #ifdef HAVE_DXR3 |
7706 | 162 if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" ); |
7707 | 163 #endif |
7538 | 164 fullscreen=gtkLoadFullscreen; |
6898 | 165 |
166 gtkInit(); | |
8043 | 167 // --- initialize X |
6912 | 168 wsXInit( (void *)mDisplay ); |
8058 | 169 // --- load skin |
8043 | 170 skinDirInHome=get_path("Skin"); |
171 skinMPlayerDir=DATADIR "/Skin"; | |
172 printf("SKIN dir 1: '%s'\n",skinDirInHome); | |
173 printf("SKIN dir 2: '%s'\n",skinMPlayerDir); | |
174 if ( !skinName ) skinName=strdup( "default" ); | |
175 switch ( skinRead( skinName ) ) | |
176 { | |
177 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 ); | |
178 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 ); | |
179 } | |
8058 | 180 // --- initialize windows |
181 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
182 { | |
183 fprintf( stderr,MSGTR_NEMDB ); | |
184 exit( 0 ); | |
185 } | |
186 | |
187 wsCreateWindow( &appMPlayer.subWindow, | |
188 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
189 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" ); | |
190 | |
191 wsDestroyImage( &appMPlayer.subWindow ); | |
192 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
193 wsXDNDMakeAwareness(&appMPlayer.subWindow); | |
194 | |
195 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); | |
196 | |
197 // i=wsHideFrame|wsMaxSize|wsHideWindow; | |
198 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; | |
199 i=wsShowFrame|wsMaxSize|wsHideWindow; | |
200 wsCreateWindow( &appMPlayer.mainWindow, | |
201 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
202 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| | |
203 | |
204 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
205 wsXDNDMakeAwareness(&appMPlayer.mainWindow); | |
206 | |
207 mplMenuInit(); | |
208 | |
209 #ifdef DEBUG | |
210 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen ); | |
211 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); | |
212 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
213 #endif | |
214 | |
215 appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; | |
216 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
217 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
218 appMPlayer.mainWindow.DandDHandler=mplDandDHandler; | |
219 | |
220 appMPlayer.subWindow.ReDraw=(void *)mplSubDraw; | |
221 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
222 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
223 appMPlayer.subWindow.DandDHandler=mplDandDHandler; | |
224 | |
225 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); | |
226 wsClearWindow( appMPlayer.subWindow ); | |
227 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); | |
228 | |
229 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
230 btnModify( evSetBalance,guiIntfStruct.Balance ); | |
231 btnModify( evSetMoviePosition,guiIntfStruct.Position ); | |
232 | |
233 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); | |
234 wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask ); | |
235 | |
236 guiIntfStruct.Playing=0; | |
237 | |
238 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); | |
239 | |
240 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); | |
241 #if 1 | |
242 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
243 | |
244 { | |
245 XEvent xev; | |
246 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); | |
247 appMPlayer.subWindow.Mapped=wsMapped; | |
248 } | |
249 | |
250 if ( fullscreen ) | |
251 { | |
252 mplFullScreen(); | |
253 btnModify( evFullScreen,btnPressed ); | |
254 } | |
255 #endif | |
256 mplSubRender=1; | |
8043 | 257 // --- |
7538 | 258 |
7009 | 259 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); |
6973 | 260 if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name ); |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
261 #if defined( USE_OSD ) || defined( USE_SUB ) |
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
262 guiLoadFont(); |
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
263 #endif |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
264 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
265 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
266 void guiDone( void ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
267 { |
8043 | 268 mp_msg( MSGT_GPLAYER,MSGL_V,"[gui] done.\n" ); |
6794 | 269 cfg_write(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
270 wsXDone(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
271 } |
4798 | 272 |
4858 | 273 int guiCMDArray[] = |
274 { | |
275 evLoad, | |
276 evLoadSubtitle, | |
277 evAbout, | |
278 evPlay, | |
279 evStop, | |
280 evPlayList, | |
281 evPreferences, | |
282 evFullScreen, | |
283 evSkinBrowser | |
284 }; | |
285 | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
286 extern ao_functions_t * audio_out; |
6755 | 287 extern vo_functions_t * video_out; |
6794 | 288 extern int frame_dropping; |
289 extern int stream_dump_type; | |
290 extern char ** vo_plugin_args; | |
291 | |
292 #if defined( USE_OSD ) || defined( USE_SUB ) | |
293 void guiLoadFont( void ) | |
294 { | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
295 #ifdef HAVE_FREETYPE |
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
296 load_font(vo_image_width, vo_image_height); |
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
297 #else |
6794 | 298 if ( vo_font ) |
299 { | |
300 int i; | |
301 if ( vo_font->name ) free( vo_font->name ); | |
302 if ( vo_font->fpath ) free( vo_font->fpath ); | |
303 for ( i=0;i<16;i++ ) | |
304 if ( vo_font->pic_a[i] ) | |
305 { | |
306 if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp ); | |
307 if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal ); | |
308 } | |
309 for ( i=0;i<16;i++ ) | |
310 if ( vo_font->pic_b[i] ) | |
311 { | |
312 if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp ); | |
313 if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal ); | |
314 } | |
315 free( vo_font ); vo_font=NULL; | |
316 } | |
7019 | 317 if ( font_name ) |
6794 | 318 { |
7019 | 319 vo_font=read_font_desc( font_name,font_factor,0 ); |
6794 | 320 if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name ); |
321 } | |
322 else | |
323 { | |
7019 | 324 font_name=gstrdup( get_path( "font/font.desc" ) ); |
325 vo_font=read_font_desc( font_name,font_factor,0 ); | |
6794 | 326 if ( !vo_font ) |
327 { | |
7019 | 328 gfree( (void **)&font_name ); font_name=gstrdup( DATADIR"/font/font.desc" ); |
329 vo_font=read_font_desc( font_name,font_factor,0 ); | |
6794 | 330 } |
331 } | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
332 #endif |
6794 | 333 } |
334 #endif | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
335 |
7150 | 336 #ifdef USE_SUB |
7169 | 337 extern mp_osd_obj_t* vo_osd_list; |
338 | |
7150 | 339 void guiLoadSubtitle( char * name ) |
340 { | |
341 if ( guiIntfStruct.Playing == 0 ) | |
342 { | |
343 guiIntfStruct.SubtitleChanged=1; | |
344 return; | |
345 } | |
346 if ( subtitles ) | |
347 { | |
7169 | 348 mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete subtitles.\n" ); |
7150 | 349 sub_free( subtitles ); |
7169 | 350 subtitles=NULL; |
7170 | 351 gfree( (void **)&sub_name ); |
7150 | 352 vo_sub=NULL; |
7169 | 353 if ( vo_osd_list ) |
354 { | |
355 int len; | |
356 mp_osd_obj_t * osd = vo_osd_list; | |
357 while ( osd ) | |
358 { | |
359 if ( osd->type == OSDTYPE_SUBTITLE ) break; | |
360 osd=osd->next; | |
361 } | |
362 if ( osd && osd->flags&OSDFLAG_VISIBLE ) | |
363 { | |
364 len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 ); | |
365 memset( osd->bitmap_buffer,0,len ); | |
366 memset( osd->alpha_buffer,0,len ); | |
367 } | |
368 } | |
7150 | 369 } |
7169 | 370 if ( name ) |
371 { | |
372 mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete Load subtitle: %s\n",name ); | |
373 sub_name=gstrdup( name ); | |
374 subtitles=sub_read_file( sub_name,guiIntfStruct.FPS ); | |
375 } | |
7150 | 376 } |
377 #endif | |
378 | |
7009 | 379 static void add_vop( char * str ) |
380 { | |
381 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] add video filter: %s\n",str ); | |
382 if ( vo_plugin_args ) | |
383 { | |
384 int i = 0; | |
385 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { i=-1; break; } | |
386 if ( i != -1 ) | |
387 { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( str ); vo_plugin_args[i+1]=NULL; } | |
388 } else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( str ); vo_plugin_args[1]=NULL; } | |
389 } | |
390 | |
391 static void remove_vop( char * str ) | |
392 { | |
393 int n = 0; | |
394 | |
395 if ( !vo_plugin_args ) return; | |
396 | |
397 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] remove video filter: %s\n",str ); | |
398 | |
399 while ( vo_plugin_args[n++] ); n--; | |
400 if ( n > -1 ) | |
401 { | |
402 int i = 0,m = -1; | |
403 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { m=i - 1; break; } | |
404 i--; | |
405 if ( m > -1 ) | |
406 { | |
407 if ( n == 1 ) { free( vo_plugin_args[0] ); free( vo_plugin_args ); vo_plugin_args=NULL; } | |
408 else memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( char * ) ); | |
409 } | |
410 } | |
411 } | |
412 | |
413 int guiGetEvent( int type,char * arg ) | |
4798 | 414 { |
6280 | 415 stream_t * stream = (stream_t *) arg; |
5672
1f8b34f1e7c0
ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents:
5665
diff
changeset
|
416 #ifdef USE_DVDREAD |
5665 | 417 dvd_priv_t * dvdp = (dvd_priv_t *) arg; |
5672
1f8b34f1e7c0
ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents:
5665
diff
changeset
|
418 #endif |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
419 |
4798 | 420 switch ( type ) |
421 { | |
422 case guiXEvent: | |
423 wsEvents( wsDisplay,(XEvent *)arg,NULL ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
424 gtkEventHandling(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
425 break; |
4798 | 426 case guiCEvent: |
4963 | 427 switch ( (int)arg ) |
428 { | |
429 case guiSetPlay: guiIntfStruct.Playing=1; mplState(); break; | |
430 case guiSetStop: guiIntfStruct.Playing=0; mplState(); break; | |
431 case guiSetPause: guiIntfStruct.Playing=2; mplState(); break; | |
432 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
433 break; |
5665 | 434 case guiSetState: |
435 mplState(); | |
436 break; | |
437 case guiSetFileName: | |
438 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); | |
439 break; | |
5789 | 440 case guiSetAudioOnly: |
441 guiIntfStruct.AudioOnly=(int)arg; | |
7009 | 442 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } |
5789 | 443 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
444 break; | |
445 case guiReDrawSubWindow: | |
446 wsPostRedisplay( &appMPlayer.subWindow ); | |
447 break; | |
448 case guiSetShVideo: | |
449 { | |
5986 | 450 if ( !appMPlayer.subWindow.isFullScreen ) |
451 { | |
452 wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight ); | |
453 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); | |
454 } | |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
455 guiIntfStruct.MovieWidth=vo_dwidth; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
456 guiIntfStruct.MovieHeight=vo_dheight; |
5789 | 457 } |
458 break; | |
5665 | 459 #ifdef USE_DVDREAD |
460 case guiSetDVD: | |
461 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; | |
462 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; | |
463 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; | |
464 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; | |
465 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); | |
466 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; | |
467 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); | |
468 guiIntfStruct.DVD.current_title=dvd_title + 1; | |
469 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; | |
470 guiIntfStruct.DVD.current_angle=dvd_angle + 1; | |
471 guiIntfStruct.Track=dvd_title + 1; | |
472 break; | |
473 #endif | |
6280 | 474 case guiSetStream: |
475 guiIntfStruct.StreamType=stream->type; | |
476 switch( stream->type ) | |
477 { | |
7150 | 478 #ifdef USE_DVDREAD |
6280 | 479 case STREAMTYPE_DVD: |
480 guiGetEvent( guiSetDVD,(char *)stream->priv ); | |
481 break; | |
7150 | 482 #endif |
6280 | 483 #ifdef HAVE_VCD |
484 case STREAMTYPE_VCD: | |
485 { | |
486 int i; | |
487 for ( i=1;i < 100;i++ ) | |
488 if ( vcd_seek_to_track( stream->fd,i ) < 0 ) break; | |
489 vcd_seek_to_track( stream->fd,vcd_track ); | |
490 guiIntfStruct.VCDTracks=--i; | |
8043 | 491 mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] vcd tracks: %d\n",guiIntfStruct.VCDTracks ); |
6280 | 492 guiIntfStruct.Track=vcd_track; |
493 break; | |
494 } | |
495 #endif | |
7150 | 496 default: break; |
6280 | 497 } |
498 break; | |
4858 | 499 case guiIEvent: |
500 printf( "cmd: %d\n",(int)arg ); | |
501 switch( (int)arg ) | |
502 { | |
503 case MP_CMD_QUIT: | |
504 mplEventHandling( evExit,0 ); | |
505 break; | |
506 case MP_CMD_VO_FULLSCREEN: | |
507 mplEventHandling( evFullScreen,0 ); | |
508 break; | |
509 default: | |
510 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 ); | |
511 } | |
512 break; | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
513 case guiReDraw: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
514 mplEventHandling( evRedraw,0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
515 break; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
516 case guiSetVolume: |
6903 | 517 if ( audio_out ) |
518 { | |
519 float l,r; | |
520 mixer_getvolume( &l,&r ); | |
521 guiIntfStruct.Volume=(r>l?r:l); | |
522 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; | |
523 else guiIntfStruct.Balance=50.0f; | |
524 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
525 btnModify( evSetBalance,guiIntfStruct.Balance ); | |
526 } | |
527 break; | |
7009 | 528 case guiSetFileFormat: |
529 guiIntfStruct.FileFormat=(int)arg; | |
530 break; | |
6903 | 531 case guiSetValues: |
6912 | 532 // -- video |
7217 | 533 guiIntfStruct.sh_video=arg; |
6912 | 534 if ( arg ) |
535 { | |
7217 | 536 sh_video_t * sh = (sh_video_t *)arg; |
7150 | 537 guiIntfStruct.FPS=sh->fps; |
6912 | 538 } |
7009 | 539 |
540 if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
541 | |
6794 | 542 // -- audio |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
543 if ( audio_out ) |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
544 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
545 float l,r; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
546 mixer_getvolume( &l,&r ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
547 guiIntfStruct.Volume=(r>l?r:l); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
548 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; |
6627 | 549 else guiIntfStruct.Balance=50.0f; |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
550 btnModify( evSetVolume,guiIntfStruct.Volume ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
551 btnModify( evSetBalance,guiIntfStruct.Balance ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
552 } |
6627 | 553 |
6794 | 554 if ( gtkAONoSound ) { if ( !muted ) mixer_mute(); } |
555 else if ( muted ) mixer_mute(); | |
556 | |
6627 | 557 if ( gtkEnableAudioEqualizer ) |
558 { | |
559 equalizer_t eq; | |
560 int i,j; | |
561 for ( i=0;i<6;i++ ) | |
562 for ( j=0;j<10;j++ ) | |
563 { | |
564 eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j]; | |
565 gtkSet( gtkSetEqualizer,0,&eq ); | |
566 } | |
567 } | |
6794 | 568 // -- subtitle |
7009 | 569 #ifdef HAVE_DXR3 |
8043 | 570 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS |
571 #ifdef USE_LIBAVCODEC | |
572 && !gtkVopLAVC | |
573 #endif | |
574 #ifdef USE_LIBFAME | |
575 && !gtkVopFAME | |
576 #endif | |
577 ) | |
7009 | 578 { |
579 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME ); | |
580 guiIntfStruct.Playing=0; | |
581 return True; | |
582 } | |
583 #endif | |
6627 | 584 break; |
585 case guiSetDefaults: | |
6857 | 586 if ( filename && !guiIntfStruct.Filename ) |
6794 | 587 { |
588 gtkSet( gtkDelPl,0,NULL ); guiIntfStruct.StreamType=STREAMTYPE_FILE; | |
589 guiSetFilename( guiIntfStruct.Filename,filename ); | |
590 } | |
591 | |
592 guiIntfStruct.DiskChanged=0; | |
593 | |
7009 | 594 // --- video opts |
7019 | 595 |
7582 | 596 if ( !video_driver_list ) |
6794 | 597 { |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
598 int i = 0; |
6903 | 599 while ( video_out_drivers[i++] ) |
600 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
601 { | |
8150 | 602 gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name ); |
6903 | 603 break; |
604 } | |
6794 | 605 } |
606 | |
7582 | 607 if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } |
7009 | 608 |
609 { | |
610 int i = 0; | |
611 guiIntfStruct.NoWindow=False; | |
612 while ( video_out_drivers[i++] ) | |
613 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
6794 | 614 { |
8150 | 615 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 ) ) |
7009 | 616 { guiIntfStruct.NoWindow=True; break; } |
6794 | 617 } |
7009 | 618 } |
619 | |
620 #ifdef HAVE_DXR3 | |
8043 | 621 #ifdef USE_LIBAVCODEC |
7009 | 622 remove_vop( "lavc" ); |
8043 | 623 #endif |
624 #ifdef USE_LIBFAME | |
7009 | 625 remove_vop( "fame" ); |
8043 | 626 #endif |
7582 | 627 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) ) |
7009 | 628 { |
629 if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) ) | |
630 { | |
8043 | 631 #ifdef USE_LIBAVCODEC |
7009 | 632 if ( gtkVopLAVC ) add_vop( "lavc" ); |
8043 | 633 #endif |
634 #ifdef USE_LIBFAME | |
7009 | 635 if ( gtkVopFAME ) add_vop( "fame" ); |
8043 | 636 #endif |
7009 | 637 } |
638 } | |
639 #endif | |
640 // --- | |
7019 | 641 if ( gtkVopPP ) add_vop( "pp" ); |
642 else remove_vop( "pp" ); | |
6794 | 643 |
644 // --- audio opts | |
7887
0e5544951425
A small patch to Gui/interface.c; the first fix is a plain bug, the second is
arpi
parents:
7707
diff
changeset
|
645 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } |
6840 | 646 if ( gtkAONorm ) gset( &ao_plugin_cfg.plugin_list,"volnorm" ); |
6794 | 647 if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" ); |
648 if ( gtkAOExtraStereo ) | |
649 { | |
650 gset( &ao_plugin_cfg.plugin_list,"extrastereo" ); | |
651 ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul; | |
652 } | |
653 mixer_device=gtkAOOSSMixer; | |
7582 | 654 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice ) |
6794 | 655 { |
7019 | 656 char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 5 ); |
657 sprintf( tmp,"oss:%s",gtkAOOSSDevice ); | |
7582 | 658 gaddlist( &audio_driver_list,tmp ); |
7019 | 659 } |
6794 | 660 |
661 // -- subtitle | |
662 #ifdef USE_SUB | |
7170 | 663 sub_name=gstrdup( guiIntfStruct.Subtitlename ); |
6794 | 664 stream_dump_type=0; |
665 if ( gtkSubDumpMPSub ) stream_dump_type=4; | |
666 if ( gtkSubDumpSrt ) stream_dump_type=6; | |
667 gtkSubDumpMPSub=gtkSubDumpSrt=0; | |
6627 | 668 #endif |
6794 | 669 #if defined( USE_OSD ) || defined( USE_SUB ) |
670 guiLoadFont(); | |
6627 | 671 #endif |
672 | |
6794 | 673 // --- misc |
6627 | 674 if ( guiIntfStruct.AudioFile ) audio_stream=guiIntfStruct.AudioFile; |
675 else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL; | |
676 | |
677 break; | |
4798 | 678 } |
7009 | 679 return False; |
4798 | 680 } |
681 | |
682 void guiEventHandling( void ) | |
683 { | |
7009 | 684 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
685 gtkEventHandling(); |
4798 | 686 } |
6627 | 687 |
688 // --- | |
689 | |
690 float gtkEquChannels[6][10]; | |
691 | |
6713 | 692 plItem * plCurrent = NULL; |
693 plItem * plList = NULL; | |
694 plItem * plLastPlayed = NULL; | |
695 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
696 URLItem *URLList = NULL; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
697 |
6713 | 698 #if defined( MP_DEBUG ) && 0 |
699 void list( void ) | |
6627 | 700 { |
6713 | 701 plItem * next = plList; |
702 printf( "--- list ---\n" ); | |
703 while( next || next->next ) | |
704 { | |
705 printf( "item: %s/%s\n",next->path,next->name ); | |
706 if ( next->next ) next=next->next; else break; | |
707 } | |
708 printf( "--- end of list ---\n" ); | |
709 } | |
710 #else | |
711 #define list(); | |
712 #endif | |
713 | |
714 void * gtkSet( int cmd,float fparam, void * vparam ) | |
715 { | |
6627 | 716 equalizer_t * eq = (equalizer_t *)vparam; |
6713 | 717 plItem * item = (plItem *)vparam; |
6627 | 718 |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
719 URLItem * url_item = (URLItem *)vparam; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
720 int is_added = True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
721 |
6627 | 722 switch ( cmd ) |
723 { | |
6713 | 724 // --- handle playlist |
6755 | 725 case gtkAddPlItem: // add item to playlist |
6713 | 726 if ( plList ) |
727 { | |
728 plItem * next = plList; | |
729 while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; } | |
730 next->next=item; item->prev=next; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
731 } else { item->prev=item->next=NULL; plCurrent=plList=item; } |
6713 | 732 list(); |
733 return NULL; | |
734 case gtkGetNextPlItem: // get current item from playlist | |
735 if ( plCurrent ) | |
736 { | |
737 plCurrent=plCurrent->next; | |
738 if ( !plCurrent && plList ) | |
739 { | |
740 plItem * next = plList; | |
741 while ( next->next ) { if ( !next->next ) break; next=next->next; } | |
742 plCurrent=next; | |
743 } | |
744 return plCurrent; | |
745 } | |
746 return NULL; | |
747 case gtkGetPrevPlItem: | |
748 if ( plCurrent ) | |
749 { | |
750 plCurrent=plCurrent->prev; | |
751 if ( !plCurrent && plList ) plCurrent=plList; | |
752 return plCurrent; | |
753 } | |
6794 | 754 return NULL; |
6713 | 755 case gtkGetCurrPlItem: // get current item |
756 return plCurrent; | |
757 case gtkDelPl: // delete list | |
758 { | |
759 plItem * curr = plList; | |
760 plItem * next; | |
761 if ( !plList ) return NULL; | |
762 if ( !curr->next ) | |
763 { | |
764 if ( curr->path ) free( curr->path ); | |
765 if ( curr->name ) free( curr->name ); | |
766 free( curr ); | |
767 } | |
768 else | |
769 { | |
770 while ( curr->next ) | |
771 { | |
772 next=curr->next; | |
773 if ( curr->path ) free( curr->path ); | |
774 if ( curr->name ) free( curr->name ); | |
775 free( curr ); | |
776 curr=next; | |
777 } | |
778 } | |
779 plList=NULL; plCurrent=NULL; | |
780 } | |
781 return NULL; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
782 // ----- Handle url |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
783 case gtkAddURLItem: |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
784 if ( URLList ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
785 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
786 URLItem * next_url = URLList; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
787 is_added = False; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
788 while ( next_url->next ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
789 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
790 if ( !gstrcmp( next_url->url,url_item->url ) ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
791 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
792 is_added=True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
793 break; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
794 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
795 next_url=next_url->next; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
796 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
797 if ( ( !is_added )&&( gstrcmp( next_url->url,url_item->url ) ) ) next_url->next=url_item; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
798 } else { url_item->next=NULL; URLList=url_item; } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
799 return NULL; |
6794 | 800 // --- subtitle |
801 #if defined( USE_OSD ) || defined( USE_SUB ) | |
7139 | 802 #ifndef HAVE_FREETYPE |
6794 | 803 case gtkSetFontFactor: |
7019 | 804 font_factor=fparam; |
6794 | 805 guiLoadFont(); |
806 return NULL; | |
7139 | 807 #else |
808 case gtkSetFontOutLine: | |
809 subtitle_font_thickness=( 8.0f / 100.0f ) * fparam; | |
810 guiLoadFont(); | |
811 return NULL; | |
812 case gtkSetFontBlur: | |
813 subtitle_font_radius=( 8.0f / 100.0f ) * fparam; | |
814 guiLoadFont(); | |
815 return NULL; | |
816 case gtkSetFontTextScale: | |
817 text_font_scale_factor=fparam; | |
818 guiLoadFont(); | |
819 return NULL; | |
820 case gtkSetFontOSDScale: | |
821 osd_font_scale_factor=fparam; | |
822 guiLoadFont(); | |
823 return NULL; | |
824 case gtkSetFontEncoding: | |
825 if ( subtitle_font_encoding ) free( subtitle_font_encoding ); | |
826 subtitle_font_encoding=gstrdup( (char *)vparam ); | |
827 guiLoadFont(); | |
828 return NULL; | |
829 case gtkSetFontAutoScale: | |
830 subtitle_autoscale=(int)fparam; | |
831 guiLoadFont(); | |
832 return NULL; | |
833 #endif | |
6794 | 834 #endif |
835 // --- misc | |
836 case gtkClearStruct: | |
7009 | 837 if ( (unsigned int)vparam & guiFilenames ) |
6794 | 838 { |
839 gfree( (void **)&guiIntfStruct.Filename ); | |
840 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
841 gfree( (void **)&guiIntfStruct.AudioFile ); | |
7009 | 842 gtkSet( gtkDelPl,0,NULL ); |
6794 | 843 } |
844 #ifdef USE_DVDREAD | |
7009 | 845 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) ); |
6794 | 846 #endif |
847 #ifdef HAVE_VCD | |
7009 | 848 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0; |
6794 | 849 #endif |
850 return NULL; | |
851 case gtkSetExtraStereo: | |
852 gtkAOExtraStereoMul=fparam; | |
853 audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)>kAOExtraStereoMul ); | |
854 return NULL; | |
855 case gtkSetPanscan: | |
7217 | 856 { |
857 mp_cmd_t * mp_cmd; | |
858 mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); | |
859 mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" ); | |
860 mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1; | |
861 mp_input_queue_cmd( mp_cmd ); | |
862 } | |
6794 | 863 return NULL; |
864 case gtkSetAutoq: | |
7019 | 865 auto_quality=(int)fparam; |
6794 | 866 return NULL; |
6713 | 867 // --- set equalizers |
6627 | 868 case gtkSetContrast: |
7217 | 869 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam ); |
870 return NULL; | |
6627 | 871 case gtkSetBrightness: |
7217 | 872 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam ); |
873 return NULL; | |
6627 | 874 case gtkSetHue: |
7217 | 875 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam ); |
876 return NULL; | |
6627 | 877 case gtkSetSaturation: |
7217 | 878 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam ); |
879 return NULL; | |
6627 | 880 case gtkSetEqualizer: |
881 if ( eq ) | |
882 { | |
883 gtkEquChannels[eq->channel][eq->band]=eq->gain; | |
884 audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)eq ); | |
885 } | |
886 else | |
887 { | |
888 int i,j; equalizer_t tmp; tmp.gain=0.0f; | |
889 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) ); | |
890 for ( i=0;i<6;i++ ) | |
891 for ( j=0;j<10;j++ ) | |
892 { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); } | |
893 } | |
6713 | 894 return NULL; |
6627 | 895 } |
6713 | 896 return NULL; |
6627 | 897 } |