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