Mercurial > mplayer.hg
annotate Gui/interface.c @ 8952:2369087bb777
Fix for endianess conversion if input to libaf is float
author | anders |
---|---|
date | Tue, 14 Jan 2003 02:52:10 +0000 |
parents | d07ab8e088a9 |
children | 0a665389cf2b |
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, | |
8949 | 213 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); |
8058 | 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 { |
8883 | 280 mplMainRender=0; |
8043 | 281 mp_msg( MSGT_GPLAYER,MSGL_V,"[gui] done.\n" ); |
6794 | 282 cfg_write(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
283 wsXDone(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
284 } |
4798 | 285 |
4858 | 286 int guiCMDArray[] = |
287 { | |
8883 | 288 evLoadPlay, |
4858 | 289 evLoadSubtitle, |
290 evAbout, | |
291 evPlay, | |
292 evStop, | |
293 evPlayList, | |
294 evPreferences, | |
295 evFullScreen, | |
296 evSkinBrowser | |
297 }; | |
298 | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
299 extern ao_functions_t * audio_out; |
6755 | 300 extern vo_functions_t * video_out; |
6794 | 301 extern int frame_dropping; |
302 extern int stream_dump_type; | |
303 extern char ** vo_plugin_args; | |
304 | |
305 #if defined( USE_OSD ) || defined( USE_SUB ) | |
306 void guiLoadFont( void ) | |
307 { | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
308 #ifdef HAVE_FREETYPE |
8635
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
8615
diff
changeset
|
309 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
|
310 #else |
6794 | 311 if ( vo_font ) |
312 { | |
313 int i; | |
314 if ( vo_font->name ) free( vo_font->name ); | |
315 if ( vo_font->fpath ) free( vo_font->fpath ); | |
316 for ( i=0;i<16;i++ ) | |
317 if ( vo_font->pic_a[i] ) | |
318 { | |
319 if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp ); | |
320 if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal ); | |
321 } | |
322 for ( i=0;i<16;i++ ) | |
323 if ( vo_font->pic_b[i] ) | |
324 { | |
325 if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp ); | |
326 if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal ); | |
327 } | |
328 free( vo_font ); vo_font=NULL; | |
329 } | |
7019 | 330 if ( font_name ) |
6794 | 331 { |
7019 | 332 vo_font=read_font_desc( font_name,font_factor,0 ); |
6794 | 333 if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name ); |
334 } | |
335 else | |
336 { | |
7019 | 337 font_name=gstrdup( get_path( "font/font.desc" ) ); |
338 vo_font=read_font_desc( font_name,font_factor,0 ); | |
6794 | 339 if ( !vo_font ) |
340 { | |
7019 | 341 gfree( (void **)&font_name ); font_name=gstrdup( DATADIR"/font/font.desc" ); |
342 vo_font=read_font_desc( font_name,font_factor,0 ); | |
6794 | 343 } |
344 } | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
345 #endif |
6794 | 346 } |
347 #endif | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
348 |
7150 | 349 #ifdef USE_SUB |
7169 | 350 extern mp_osd_obj_t* vo_osd_list; |
351 | |
7150 | 352 void guiLoadSubtitle( char * name ) |
353 { | |
354 if ( guiIntfStruct.Playing == 0 ) | |
355 { | |
356 guiIntfStruct.SubtitleChanged=1; | |
357 return; | |
358 } | |
359 if ( subtitles ) | |
360 { | |
7169 | 361 mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete subtitles.\n" ); |
7150 | 362 sub_free( subtitles ); |
7169 | 363 subtitles=NULL; |
7170 | 364 gfree( (void **)&sub_name ); |
7150 | 365 vo_sub=NULL; |
7169 | 366 if ( vo_osd_list ) |
367 { | |
368 int len; | |
369 mp_osd_obj_t * osd = vo_osd_list; | |
370 while ( osd ) | |
371 { | |
372 if ( osd->type == OSDTYPE_SUBTITLE ) break; | |
373 osd=osd->next; | |
374 } | |
375 if ( osd && osd->flags&OSDFLAG_VISIBLE ) | |
376 { | |
377 len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 ); | |
378 memset( osd->bitmap_buffer,0,len ); | |
379 memset( osd->alpha_buffer,0,len ); | |
380 } | |
381 } | |
7150 | 382 } |
7169 | 383 if ( name ) |
384 { | |
385 mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete Load subtitle: %s\n",name ); | |
386 sub_name=gstrdup( name ); | |
387 subtitles=sub_read_file( sub_name,guiIntfStruct.FPS ); | |
388 } | |
7150 | 389 } |
390 #endif | |
391 | |
7009 | 392 static void add_vop( char * str ) |
393 { | |
394 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] add video filter: %s\n",str ); | |
395 if ( vo_plugin_args ) | |
396 { | |
397 int i = 0; | |
398 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { i=-1; break; } | |
399 if ( i != -1 ) | |
400 { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( str ); vo_plugin_args[i+1]=NULL; } | |
401 } else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( str ); vo_plugin_args[1]=NULL; } | |
402 } | |
403 | |
404 static void remove_vop( char * str ) | |
405 { | |
406 int n = 0; | |
407 | |
408 if ( !vo_plugin_args ) return; | |
409 | |
410 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] remove video filter: %s\n",str ); | |
411 | |
412 while ( vo_plugin_args[n++] ); n--; | |
413 if ( n > -1 ) | |
414 { | |
415 int i = 0,m = -1; | |
416 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { m=i - 1; break; } | |
417 i--; | |
418 if ( m > -1 ) | |
419 { | |
420 if ( n == 1 ) { free( vo_plugin_args[0] ); free( vo_plugin_args ); vo_plugin_args=NULL; } | |
421 else memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( char * ) ); | |
422 } | |
423 } | |
424 } | |
425 | |
426 int guiGetEvent( int type,char * arg ) | |
4798 | 427 { |
6280 | 428 stream_t * stream = (stream_t *) arg; |
5672
1f8b34f1e7c0
ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents:
5665
diff
changeset
|
429 #ifdef USE_DVDREAD |
5665 | 430 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
|
431 #endif |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
432 |
4798 | 433 switch ( type ) |
434 { | |
435 case guiXEvent: | |
8302 | 436 guiIntfStruct.event_struct=(void *)arg; |
4798 | 437 wsEvents( wsDisplay,(XEvent *)arg,NULL ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
438 gtkEventHandling(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
439 break; |
4798 | 440 case guiCEvent: |
4963 | 441 switch ( (int)arg ) |
442 { | |
8423 | 443 case guiSetPlay: guiIntfStruct.Playing=1; break; |
444 case guiSetStop: guiIntfStruct.Playing=0; break; | |
445 case guiSetPause: guiIntfStruct.Playing=2; break; | |
4963 | 446 } |
8423 | 447 mplState(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
448 break; |
5665 | 449 case guiSetState: |
450 mplState(); | |
451 break; | |
452 case guiSetFileName: | |
453 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); | |
454 break; | |
5789 | 455 case guiSetAudioOnly: |
456 guiIntfStruct.AudioOnly=(int)arg; | |
7009 | 457 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } |
5789 | 458 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
459 break; | |
8312
ef8c992672f4
- audio track handling in menu (idea from R«ädiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
460 case guiSetDemuxer: |
ef8c992672f4
- audio track handling in menu (idea from R«ädiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
461 guiIntfStruct.demuxer=(void *)arg; |
ef8c992672f4
- audio track handling in menu (idea from R«ädiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
462 break; |
5789 | 463 case guiSetShVideo: |
464 { | |
5986 | 465 if ( !appMPlayer.subWindow.isFullScreen ) |
466 { | |
467 wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight ); | |
468 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); | |
469 } | |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
470 guiIntfStruct.MovieWidth=vo_dwidth; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
471 guiIntfStruct.MovieHeight=vo_dheight; |
5789 | 472 } |
473 break; | |
5665 | 474 #ifdef USE_DVDREAD |
475 case guiSetDVD: | |
476 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; | |
477 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; | |
478 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; | |
479 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; | |
480 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); | |
481 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; | |
482 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); | |
483 guiIntfStruct.DVD.current_title=dvd_title + 1; | |
484 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; | |
485 guiIntfStruct.DVD.current_angle=dvd_angle + 1; | |
486 guiIntfStruct.Track=dvd_title + 1; | |
487 break; | |
488 #endif | |
6280 | 489 case guiSetStream: |
490 guiIntfStruct.StreamType=stream->type; | |
491 switch( stream->type ) | |
492 { | |
7150 | 493 #ifdef USE_DVDREAD |
6280 | 494 case STREAMTYPE_DVD: |
495 guiGetEvent( guiSetDVD,(char *)stream->priv ); | |
496 break; | |
7150 | 497 #endif |
6280 | 498 #ifdef HAVE_VCD |
499 case STREAMTYPE_VCD: | |
500 { | |
501 int i; | |
502 for ( i=1;i < 100;i++ ) | |
503 if ( vcd_seek_to_track( stream->fd,i ) < 0 ) break; | |
504 vcd_seek_to_track( stream->fd,vcd_track ); | |
505 guiIntfStruct.VCDTracks=--i; | |
506 break; | |
507 } | |
508 #endif | |
7150 | 509 default: break; |
6280 | 510 } |
511 break; | |
4858 | 512 case guiIEvent: |
513 printf( "cmd: %d\n",(int)arg ); | |
514 switch( (int)arg ) | |
515 { | |
516 case MP_CMD_QUIT: | |
517 mplEventHandling( evExit,0 ); | |
518 break; | |
519 case MP_CMD_VO_FULLSCREEN: | |
520 mplEventHandling( evFullScreen,0 ); | |
521 break; | |
522 default: | |
523 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 ); | |
524 } | |
525 break; | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
526 case guiReDraw: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
527 mplEventHandling( evRedraw,0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
528 break; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
529 case guiSetVolume: |
6903 | 530 if ( audio_out ) |
531 { | |
532 float l,r; | |
533 mixer_getvolume( &l,&r ); | |
534 guiIntfStruct.Volume=(r>l?r:l); | |
535 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; | |
536 else guiIntfStruct.Balance=50.0f; | |
537 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
538 btnModify( evSetBalance,guiIntfStruct.Balance ); | |
539 } | |
540 break; | |
7009 | 541 case guiSetFileFormat: |
542 guiIntfStruct.FileFormat=(int)arg; | |
543 break; | |
6903 | 544 case guiSetValues: |
6912 | 545 // -- video |
7217 | 546 guiIntfStruct.sh_video=arg; |
6912 | 547 if ( arg ) |
548 { | |
7217 | 549 sh_video_t * sh = (sh_video_t *)arg; |
7150 | 550 guiIntfStruct.FPS=sh->fps; |
6912 | 551 } |
7009 | 552 |
553 if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8150
diff
changeset
|
554 |
8300 | 555 if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled ); |
556 else btnSet( evSetMoviePosition,btnReleased ); | |
8284 | 557 |
6794 | 558 // -- audio |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
559 if ( audio_out ) |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
560 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
561 float l,r; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
562 mixer_getvolume( &l,&r ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
563 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
|
564 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; |
6627 | 565 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
|
566 btnModify( evSetVolume,guiIntfStruct.Volume ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
567 btnModify( evSetBalance,guiIntfStruct.Balance ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
568 } |
6627 | 569 |
570 if ( gtkEnableAudioEqualizer ) | |
571 { | |
572 equalizer_t eq; | |
573 int i,j; | |
574 for ( i=0;i<6;i++ ) | |
575 for ( j=0;j<10;j++ ) | |
576 { | |
577 eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j]; | |
578 gtkSet( gtkSetEqualizer,0,&eq ); | |
579 } | |
580 } | |
6794 | 581 // -- subtitle |
7009 | 582 #ifdef HAVE_DXR3 |
8043 | 583 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS |
584 #ifdef USE_LIBAVCODEC | |
585 && !gtkVopLAVC | |
586 #endif | |
587 #ifdef USE_LIBFAME | |
588 && !gtkVopFAME | |
589 #endif | |
590 ) | |
7009 | 591 { |
592 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME ); | |
593 guiIntfStruct.Playing=0; | |
594 return True; | |
595 } | |
596 #endif | |
6627 | 597 break; |
598 case guiSetDefaults: | |
8423 | 599 if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged ) |
600 { | |
601 audio_id=-1; | |
602 video_id=-1; | |
603 dvdsub_id=-1; | |
604 vobsub_id=-1; | |
605 stream_cache_size=-1; | |
606 autosync=0; | |
607 vcd_track=0; | |
608 dvd_title=0; | |
609 } | |
610 wsPostRedisplay( &appMPlayer.subWindow ); | |
611 break; | |
612 case guiSetParameters: | |
613 switch ( guiIntfStruct.StreamType ) | |
614 { | |
615 case STREAMTYPE_PLAYLIST: | |
616 break; | |
617 #ifdef HAVE_VCD | |
618 case STREAMTYPE_VCD: | |
619 vcd_track=guiIntfStruct.Track; | |
620 break; | |
621 #endif | |
622 #ifdef USE_DVDREAD | |
623 case STREAMTYPE_DVD: | |
624 dvd_title=guiIntfStruct.Title; | |
625 dvd_chapter=guiIntfStruct.Chapter; | |
626 dvd_angle=guiIntfStruct.Angle; | |
627 break; | |
628 #endif | |
6794 | 629 } |
8423 | 630 if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) |
631 { | |
632 if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename ); | |
633 else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename ); | |
634 } | |
7009 | 635 // --- video opts |
7019 | 636 |
7582 | 637 if ( !video_driver_list ) |
6794 | 638 { |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
639 int i = 0; |
6903 | 640 while ( video_out_drivers[i++] ) |
641 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
642 { | |
8150 | 643 gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name ); |
6903 | 644 break; |
645 } | |
6794 | 646 } |
647 | |
7582 | 648 if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } |
7009 | 649 |
650 { | |
651 int i = 0; | |
652 guiIntfStruct.NoWindow=False; | |
653 while ( video_out_drivers[i++] ) | |
654 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
6794 | 655 { |
8150 | 656 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 | 657 { guiIntfStruct.NoWindow=True; break; } |
6794 | 658 } |
7009 | 659 } |
660 | |
661 #ifdef HAVE_DXR3 | |
8043 | 662 #ifdef USE_LIBAVCODEC |
7009 | 663 remove_vop( "lavc" ); |
8043 | 664 #endif |
665 #ifdef USE_LIBFAME | |
7009 | 666 remove_vop( "fame" ); |
8043 | 667 #endif |
7582 | 668 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) ) |
7009 | 669 { |
670 if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) ) | |
671 { | |
8043 | 672 #ifdef USE_LIBAVCODEC |
7009 | 673 if ( gtkVopLAVC ) add_vop( "lavc" ); |
8043 | 674 #endif |
675 #ifdef USE_LIBFAME | |
7009 | 676 if ( gtkVopFAME ) add_vop( "fame" ); |
8043 | 677 #endif |
7009 | 678 } |
679 } | |
680 #endif | |
681 // --- | |
7019 | 682 if ( gtkVopPP ) add_vop( "pp" ); |
683 else remove_vop( "pp" ); | |
6794 | 684 |
685 // --- 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
|
686 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } |
6840 | 687 if ( gtkAONorm ) gset( &ao_plugin_cfg.plugin_list,"volnorm" ); |
6794 | 688 if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" ); |
689 if ( gtkAOExtraStereo ) | |
690 { | |
691 gset( &ao_plugin_cfg.plugin_list,"extrastereo" ); | |
692 ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul; | |
693 } | |
8600
54eac4cf587c
Lots of functions and variables specific to OSS audio are used without
arpi
parents:
8484
diff
changeset
|
694 #ifdef USE_OSS_AUDIO |
8484 | 695 mixer_device=gstrdup( gtkAOOSSMixer ); |
7582 | 696 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice ) |
6794 | 697 { |
8423 | 698 char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 ); |
7019 | 699 sprintf( tmp,"oss:%s",gtkAOOSSDevice ); |
7582 | 700 gaddlist( &audio_driver_list,tmp ); |
7019 | 701 } |
8615 | 702 #endif |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
703 #ifdef HAVE_SDL |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
704 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
|
705 { |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
706 char * tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 ); |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
707 sprintf( tmp,"sdl:%s",gtkAOSDLDriver ); |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
708 gaddlist( &audio_driver_list,tmp ); |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
709 } |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
710 #endif |
6794 | 711 // -- subtitle |
712 #ifdef USE_SUB | |
7170 | 713 sub_name=gstrdup( guiIntfStruct.Subtitlename ); |
6794 | 714 stream_dump_type=0; |
715 if ( gtkSubDumpMPSub ) stream_dump_type=4; | |
716 if ( gtkSubDumpSrt ) stream_dump_type=6; | |
717 gtkSubDumpMPSub=gtkSubDumpSrt=0; | |
6627 | 718 #endif |
6794 | 719 #if defined( USE_OSD ) || defined( USE_SUB ) |
720 guiLoadFont(); | |
6627 | 721 #endif |
722 | |
6794 | 723 // --- misc |
8423 | 724 if ( gtkCacheOn ) stream_cache_size=gtkCacheSize; |
8484 | 725 if ( gtkAutoSyncOn ) autosync=gtkAutoSync; |
8423 | 726 |
8484 | 727 if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile ); |
728 else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream ); | |
729 //audio_stream=NULL; | |
6627 | 730 |
8423 | 731 guiIntfStruct.DiskChanged=0; |
732 guiIntfStruct.FilenameChanged=0; | |
733 guiIntfStruct.NewPlay=0; | |
734 | |
6627 | 735 break; |
4798 | 736 } |
7009 | 737 return False; |
4798 | 738 } |
739 | |
740 void guiEventHandling( void ) | |
741 { | |
7009 | 742 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
743 gtkEventHandling(); |
4798 | 744 } |
6627 | 745 |
746 // --- | |
747 | |
748 float gtkEquChannels[6][10]; | |
749 | |
6713 | 750 plItem * plCurrent = NULL; |
751 plItem * plList = NULL; | |
752 plItem * plLastPlayed = NULL; | |
753 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
754 URLItem *URLList = NULL; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
755 |
6713 | 756 #if defined( MP_DEBUG ) && 0 |
757 void list( void ) | |
6627 | 758 { |
6713 | 759 plItem * next = plList; |
760 printf( "--- list ---\n" ); | |
761 while( next || next->next ) | |
762 { | |
763 printf( "item: %s/%s\n",next->path,next->name ); | |
764 if ( next->next ) next=next->next; else break; | |
765 } | |
766 printf( "--- end of list ---\n" ); | |
767 } | |
768 #else | |
769 #define list(); | |
770 #endif | |
771 | |
772 void * gtkSet( int cmd,float fparam, void * vparam ) | |
773 { | |
6627 | 774 equalizer_t * eq = (equalizer_t *)vparam; |
6713 | 775 plItem * item = (plItem *)vparam; |
6627 | 776 |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
777 URLItem * url_item = (URLItem *)vparam; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
778 int is_added = True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
779 |
6627 | 780 switch ( cmd ) |
781 { | |
6713 | 782 // --- handle playlist |
6755 | 783 case gtkAddPlItem: // add item to playlist |
6713 | 784 if ( plList ) |
785 { | |
786 plItem * next = plList; | |
787 while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; } | |
788 next->next=item; item->prev=next; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
789 } else { item->prev=item->next=NULL; plCurrent=plList=item; } |
6713 | 790 list(); |
791 return NULL; | |
792 case gtkGetNextPlItem: // get current item from playlist | |
793 if ( plCurrent ) | |
794 { | |
795 plCurrent=plCurrent->next; | |
796 if ( !plCurrent && plList ) | |
797 { | |
798 plItem * next = plList; | |
799 while ( next->next ) { if ( !next->next ) break; next=next->next; } | |
800 plCurrent=next; | |
801 } | |
802 return plCurrent; | |
803 } | |
804 return NULL; | |
805 case gtkGetPrevPlItem: | |
806 if ( plCurrent ) | |
807 { | |
808 plCurrent=plCurrent->prev; | |
809 if ( !plCurrent && plList ) plCurrent=plList; | |
810 return plCurrent; | |
811 } | |
6794 | 812 return NULL; |
6713 | 813 case gtkGetCurrPlItem: // get current item |
814 return plCurrent; | |
815 case gtkDelPl: // delete list | |
816 { | |
817 plItem * curr = plList; | |
818 plItem * next; | |
819 if ( !plList ) return NULL; | |
820 if ( !curr->next ) | |
821 { | |
822 if ( curr->path ) free( curr->path ); | |
823 if ( curr->name ) free( curr->name ); | |
824 free( curr ); | |
825 } | |
826 else | |
827 { | |
828 while ( curr->next ) | |
829 { | |
830 next=curr->next; | |
831 if ( curr->path ) free( curr->path ); | |
832 if ( curr->name ) free( curr->name ); | |
833 free( curr ); | |
834 curr=next; | |
835 } | |
836 } | |
837 plList=NULL; plCurrent=NULL; | |
838 } | |
839 return NULL; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
840 // ----- Handle url |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
841 case gtkAddURLItem: |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
842 if ( URLList ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
843 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
844 URLItem * next_url = URLList; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
845 is_added = False; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
846 while ( next_url->next ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
847 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
848 if ( !gstrcmp( next_url->url,url_item->url ) ) |
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 is_added=True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
851 break; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
852 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
853 next_url=next_url->next; |
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 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
|
856 } else { url_item->next=NULL; URLList=url_item; } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
857 return NULL; |
6794 | 858 // --- subtitle |
859 #if defined( USE_OSD ) || defined( USE_SUB ) | |
7139 | 860 #ifndef HAVE_FREETYPE |
6794 | 861 case gtkSetFontFactor: |
7019 | 862 font_factor=fparam; |
6794 | 863 guiLoadFont(); |
864 return NULL; | |
7139 | 865 #else |
866 case gtkSetFontOutLine: | |
867 subtitle_font_thickness=( 8.0f / 100.0f ) * fparam; | |
868 guiLoadFont(); | |
869 return NULL; | |
870 case gtkSetFontBlur: | |
871 subtitle_font_radius=( 8.0f / 100.0f ) * fparam; | |
872 guiLoadFont(); | |
873 return NULL; | |
874 case gtkSetFontTextScale: | |
875 text_font_scale_factor=fparam; | |
876 guiLoadFont(); | |
877 return NULL; | |
878 case gtkSetFontOSDScale: | |
879 osd_font_scale_factor=fparam; | |
880 guiLoadFont(); | |
881 return NULL; | |
882 case gtkSetFontEncoding: | |
883 if ( subtitle_font_encoding ) free( subtitle_font_encoding ); | |
884 subtitle_font_encoding=gstrdup( (char *)vparam ); | |
885 guiLoadFont(); | |
886 return NULL; | |
887 case gtkSetFontAutoScale: | |
888 subtitle_autoscale=(int)fparam; | |
889 guiLoadFont(); | |
890 return NULL; | |
891 #endif | |
6794 | 892 #endif |
893 // --- misc | |
894 case gtkClearStruct: | |
7009 | 895 if ( (unsigned int)vparam & guiFilenames ) |
6794 | 896 { |
897 gfree( (void **)&guiIntfStruct.Filename ); | |
898 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
899 gfree( (void **)&guiIntfStruct.AudioFile ); | |
7009 | 900 gtkSet( gtkDelPl,0,NULL ); |
6794 | 901 } |
902 #ifdef USE_DVDREAD | |
7009 | 903 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) ); |
6794 | 904 #endif |
905 #ifdef HAVE_VCD | |
7009 | 906 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0; |
6794 | 907 #endif |
908 return NULL; | |
909 case gtkSetExtraStereo: | |
910 gtkAOExtraStereoMul=fparam; | |
911 audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)>kAOExtraStereoMul ); | |
912 return NULL; | |
913 case gtkSetPanscan: | |
7217 | 914 { |
915 mp_cmd_t * mp_cmd; | |
916 mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); | |
917 mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" ); | |
918 mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1; | |
919 mp_input_queue_cmd( mp_cmd ); | |
920 } | |
6794 | 921 return NULL; |
922 case gtkSetAutoq: | |
7019 | 923 auto_quality=(int)fparam; |
6794 | 924 return NULL; |
6713 | 925 // --- set equalizers |
6627 | 926 case gtkSetContrast: |
7217 | 927 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam ); |
928 return NULL; | |
6627 | 929 case gtkSetBrightness: |
7217 | 930 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam ); |
931 return NULL; | |
6627 | 932 case gtkSetHue: |
7217 | 933 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam ); |
934 return NULL; | |
6627 | 935 case gtkSetSaturation: |
7217 | 936 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam ); |
937 return NULL; | |
6627 | 938 case gtkSetEqualizer: |
939 if ( eq ) | |
940 { | |
941 gtkEquChannels[eq->channel][eq->band]=eq->gain; | |
942 audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)eq ); | |
943 } | |
944 else | |
945 { | |
946 int i,j; equalizer_t tmp; tmp.gain=0.0f; | |
947 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) ); | |
948 for ( i=0;i<6;i++ ) | |
949 for ( j=0;j<10;j++ ) | |
950 { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); } | |
951 } | |
6713 | 952 return NULL; |
6627 | 953 } |
6713 | 954 return NULL; |
6627 | 955 } |