Mercurial > mplayer.hg
annotate Gui/interface.c @ 9299:aa26f77e7aae
remove non byte sized stuff
remove more useless startcode emulation prevention stuff
author | michael |
---|---|
date | Thu, 06 Feb 2003 20:18:59 +0000 |
parents | 64b8c5a07c2c |
children | b78cd2e33d2c |
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 if ( stream_cache_size != -1 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; } |
174 if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; } | |
6898 | 175 |
176 gtkInit(); | |
8043 | 177 // --- initialize X |
6912 | 178 wsXInit( (void *)mDisplay ); |
8058 | 179 // --- load skin |
8043 | 180 skinDirInHome=get_path("Skin"); |
181 skinMPlayerDir=DATADIR "/Skin"; | |
182 printf("SKIN dir 1: '%s'\n",skinDirInHome); | |
183 printf("SKIN dir 2: '%s'\n",skinMPlayerDir); | |
184 if ( !skinName ) skinName=strdup( "default" ); | |
185 switch ( skinRead( skinName ) ) | |
186 { | |
187 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 ); | |
188 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 ); | |
189 } | |
8058 | 190 // --- initialize windows |
9088 | 191 if ( ( mplDrawBuffer = (unsigned char *)malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) |
8058 | 192 { |
193 fprintf( stderr,MSGTR_NEMDB ); | |
194 exit( 0 ); | |
195 } | |
9202 | 196 |
8058 | 197 wsCreateWindow( &appMPlayer.subWindow, |
198 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
9202 | 199 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" ); |
8058 | 200 |
201 wsDestroyImage( &appMPlayer.subWindow ); | |
202 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
203 wsXDNDMakeAwareness(&appMPlayer.subWindow); | |
204 | |
8973 | 205 mplMenuInit(); |
206 mplPBInit(); | |
207 | |
8058 | 208 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); |
209 | |
210 // i=wsHideFrame|wsMaxSize|wsHideWindow; | |
211 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; | |
212 i=wsShowFrame|wsMaxSize|wsHideWindow; | |
213 wsCreateWindow( &appMPlayer.mainWindow, | |
214 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
8949 | 215 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); |
8058 | 216 |
217 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
218 wsXDNDMakeAwareness(&appMPlayer.mainWindow); | |
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 | |
8973 | 236 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); |
8058 | 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 ); | |
9202 | 252 #if 0 |
8058 | 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 | |
9088 | 261 if ( !fullscreen ) fullscreen=gtkLoadFullscreen; |
8058 | 262 if ( fullscreen ) |
263 { | |
264 mplFullScreen(); | |
265 btnModify( evFullScreen,btnPressed ); | |
266 } | |
9202 | 267 #else |
268 if ( gtkShowVideoWindow ) | |
269 { | |
270 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
271 { | |
272 XEvent xev; | |
273 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); | |
274 appMPlayer.subWindow.Mapped=wsMapped; | |
275 } | |
276 | |
277 if ( fullscreen ) | |
278 { | |
279 mplFullScreen(); | |
280 btnModify( evFullScreen,btnPressed ); | |
281 } | |
282 } | |
283 else | |
284 { | |
285 if ( fullscreen ) | |
286 { | |
287 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
288 { | |
289 XEvent xev; | |
290 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); | |
291 appMPlayer.subWindow.Mapped=wsMapped; | |
292 } | |
293 wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow ); | |
294 | |
295 mplFullScreen(); | |
296 btnModify( evFullScreen,btnPressed ); | |
297 } | |
298 } | |
8058 | 299 #endif |
300 mplSubRender=1; | |
8043 | 301 // --- |
7538 | 302 |
8423 | 303 if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE ); |
7009 | 304 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); |
6973 | 305 if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name ); |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
306 #if defined( USE_OSD ) || defined( USE_SUB ) |
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
307 guiLoadFont(); |
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
308 #endif |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
309 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
310 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
311 void guiDone( void ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
312 { |
8883 | 313 mplMainRender=0; |
8043 | 314 mp_msg( MSGT_GPLAYER,MSGL_V,"[gui] done.\n" ); |
6794 | 315 cfg_write(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
316 wsXDone(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
317 } |
4798 | 318 |
4858 | 319 int guiCMDArray[] = |
320 { | |
8883 | 321 evLoadPlay, |
4858 | 322 evLoadSubtitle, |
323 evAbout, | |
324 evPlay, | |
325 evStop, | |
326 evPlayList, | |
327 evPreferences, | |
328 evFullScreen, | |
329 evSkinBrowser | |
330 }; | |
331 | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
332 extern ao_functions_t * audio_out; |
6755 | 333 extern vo_functions_t * video_out; |
6794 | 334 extern int frame_dropping; |
335 extern int stream_dump_type; | |
336 extern char ** vo_plugin_args; | |
337 | |
338 #if defined( USE_OSD ) || defined( USE_SUB ) | |
339 void guiLoadFont( void ) | |
340 { | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
341 #ifdef HAVE_FREETYPE |
8635
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
8615
diff
changeset
|
342 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
|
343 #else |
6794 | 344 if ( vo_font ) |
345 { | |
346 int i; | |
347 if ( vo_font->name ) free( vo_font->name ); | |
348 if ( vo_font->fpath ) free( vo_font->fpath ); | |
349 for ( i=0;i<16;i++ ) | |
350 if ( vo_font->pic_a[i] ) | |
351 { | |
352 if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp ); | |
353 if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal ); | |
354 } | |
355 for ( i=0;i<16;i++ ) | |
356 if ( vo_font->pic_b[i] ) | |
357 { | |
358 if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp ); | |
359 if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal ); | |
360 } | |
361 free( vo_font ); vo_font=NULL; | |
362 } | |
7019 | 363 if ( font_name ) |
6794 | 364 { |
7019 | 365 vo_font=read_font_desc( font_name,font_factor,0 ); |
6794 | 366 if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name ); |
367 } | |
368 else | |
369 { | |
7019 | 370 font_name=gstrdup( get_path( "font/font.desc" ) ); |
371 vo_font=read_font_desc( font_name,font_factor,0 ); | |
6794 | 372 if ( !vo_font ) |
373 { | |
7019 | 374 gfree( (void **)&font_name ); font_name=gstrdup( DATADIR"/font/font.desc" ); |
375 vo_font=read_font_desc( font_name,font_factor,0 ); | |
6794 | 376 } |
377 } | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
378 #endif |
6794 | 379 } |
380 #endif | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
381 |
7150 | 382 #ifdef USE_SUB |
7169 | 383 extern mp_osd_obj_t* vo_osd_list; |
384 | |
7150 | 385 void guiLoadSubtitle( char * name ) |
386 { | |
387 if ( guiIntfStruct.Playing == 0 ) | |
388 { | |
389 guiIntfStruct.SubtitleChanged=1; | |
390 return; | |
391 } | |
392 if ( subtitles ) | |
393 { | |
7169 | 394 mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete subtitles.\n" ); |
7150 | 395 sub_free( subtitles ); |
7169 | 396 subtitles=NULL; |
7170 | 397 gfree( (void **)&sub_name ); |
7150 | 398 vo_sub=NULL; |
7169 | 399 if ( vo_osd_list ) |
400 { | |
401 int len; | |
402 mp_osd_obj_t * osd = vo_osd_list; | |
403 while ( osd ) | |
404 { | |
405 if ( osd->type == OSDTYPE_SUBTITLE ) break; | |
406 osd=osd->next; | |
407 } | |
408 if ( osd && osd->flags&OSDFLAG_VISIBLE ) | |
409 { | |
410 len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 ); | |
411 memset( osd->bitmap_buffer,0,len ); | |
412 memset( osd->alpha_buffer,0,len ); | |
413 } | |
414 } | |
7150 | 415 } |
7169 | 416 if ( name ) |
417 { | |
418 mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete Load subtitle: %s\n",name ); | |
419 sub_name=gstrdup( name ); | |
420 subtitles=sub_read_file( sub_name,guiIntfStruct.FPS ); | |
9056 | 421 if ( !subtitles ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name ); |
7169 | 422 } |
7150 | 423 } |
424 #endif | |
425 | |
7009 | 426 static void add_vop( char * str ) |
427 { | |
428 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] add video filter: %s\n",str ); | |
429 if ( vo_plugin_args ) | |
430 { | |
431 int i = 0; | |
432 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { i=-1; break; } | |
433 if ( i != -1 ) | |
434 { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( str ); vo_plugin_args[i+1]=NULL; } | |
435 } else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( str ); vo_plugin_args[1]=NULL; } | |
436 } | |
437 | |
438 static void remove_vop( char * str ) | |
439 { | |
440 int n = 0; | |
441 | |
442 if ( !vo_plugin_args ) return; | |
443 | |
444 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] remove video filter: %s\n",str ); | |
445 | |
446 while ( vo_plugin_args[n++] ); n--; | |
447 if ( n > -1 ) | |
448 { | |
449 int i = 0,m = -1; | |
450 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { m=i - 1; break; } | |
451 i--; | |
452 if ( m > -1 ) | |
453 { | |
454 if ( n == 1 ) { free( vo_plugin_args[0] ); free( vo_plugin_args ); vo_plugin_args=NULL; } | |
455 else memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( char * ) ); | |
456 } | |
457 } | |
458 } | |
459 | |
460 int guiGetEvent( int type,char * arg ) | |
4798 | 461 { |
6280 | 462 stream_t * stream = (stream_t *) arg; |
5672
1f8b34f1e7c0
ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents:
5665
diff
changeset
|
463 #ifdef USE_DVDREAD |
5665 | 464 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
|
465 #endif |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
466 |
4798 | 467 switch ( type ) |
468 { | |
469 case guiXEvent: | |
8973 | 470 guiIntfStruct.event_struct=(void *)arg; |
4798 | 471 wsEvents( wsDisplay,(XEvent *)arg,NULL ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
472 gtkEventHandling(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
473 break; |
4798 | 474 case guiCEvent: |
4963 | 475 switch ( (int)arg ) |
476 { | |
9202 | 477 case guiSetPlay: |
478 guiIntfStruct.Playing=1; | |
479 if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
480 break; | |
481 case guiSetStop: | |
482 guiIntfStruct.Playing=0; | |
483 if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
484 break; | |
8423 | 485 case guiSetPause: guiIntfStruct.Playing=2; break; |
4963 | 486 } |
8423 | 487 mplState(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
488 break; |
5665 | 489 case guiSetState: |
490 mplState(); | |
491 break; | |
492 case guiSetFileName: | |
493 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); | |
494 break; | |
5789 | 495 case guiSetAudioOnly: |
496 guiIntfStruct.AudioOnly=(int)arg; | |
7009 | 497 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } |
5789 | 498 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
499 break; | |
8312
ef8c992672f4
- audio track handling in menu (idea from R«ädiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
500 case guiSetDemuxer: |
ef8c992672f4
- audio track handling in menu (idea from R«ädiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
501 guiIntfStruct.demuxer=(void *)arg; |
ef8c992672f4
- audio track handling in menu (idea from R«ädiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
502 break; |
5789 | 503 case guiSetShVideo: |
504 { | |
5986 | 505 if ( !appMPlayer.subWindow.isFullScreen ) |
506 { | |
507 wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight ); | |
508 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); | |
509 } | |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
510 guiIntfStruct.MovieWidth=vo_dwidth; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
511 guiIntfStruct.MovieHeight=vo_dheight; |
5789 | 512 } |
513 break; | |
5665 | 514 #ifdef USE_DVDREAD |
515 case guiSetDVD: | |
516 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; | |
517 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; | |
518 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; | |
519 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; | |
520 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); | |
521 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; | |
522 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); | |
523 guiIntfStruct.DVD.current_title=dvd_title + 1; | |
524 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; | |
525 guiIntfStruct.DVD.current_angle=dvd_angle + 1; | |
526 guiIntfStruct.Track=dvd_title + 1; | |
527 break; | |
528 #endif | |
6280 | 529 case guiSetStream: |
530 guiIntfStruct.StreamType=stream->type; | |
531 switch( stream->type ) | |
532 { | |
7150 | 533 #ifdef USE_DVDREAD |
6280 | 534 case STREAMTYPE_DVD: |
535 guiGetEvent( guiSetDVD,(char *)stream->priv ); | |
536 break; | |
7150 | 537 #endif |
6280 | 538 #ifdef HAVE_VCD |
539 case STREAMTYPE_VCD: | |
540 { | |
541 int i; | |
542 for ( i=1;i < 100;i++ ) | |
543 if ( vcd_seek_to_track( stream->fd,i ) < 0 ) break; | |
544 vcd_seek_to_track( stream->fd,vcd_track ); | |
545 guiIntfStruct.VCDTracks=--i; | |
546 break; | |
547 } | |
548 #endif | |
7150 | 549 default: break; |
6280 | 550 } |
551 break; | |
4858 | 552 case guiIEvent: |
553 printf( "cmd: %d\n",(int)arg ); | |
554 switch( (int)arg ) | |
555 { | |
556 case MP_CMD_QUIT: | |
557 mplEventHandling( evExit,0 ); | |
558 break; | |
559 case MP_CMD_VO_FULLSCREEN: | |
560 mplEventHandling( evFullScreen,0 ); | |
561 break; | |
562 default: | |
563 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 ); | |
564 } | |
565 break; | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
566 case guiReDraw: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
567 mplEventHandling( evRedraw,0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
568 break; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
569 case guiSetVolume: |
6903 | 570 if ( audio_out ) |
571 { | |
572 float l,r; | |
573 mixer_getvolume( &l,&r ); | |
574 guiIntfStruct.Volume=(r>l?r:l); | |
575 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; | |
576 else guiIntfStruct.Balance=50.0f; | |
577 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
578 btnModify( evSetBalance,guiIntfStruct.Balance ); | |
579 } | |
580 break; | |
7009 | 581 case guiSetFileFormat: |
582 guiIntfStruct.FileFormat=(int)arg; | |
583 break; | |
6903 | 584 case guiSetValues: |
6912 | 585 // -- video |
7217 | 586 guiIntfStruct.sh_video=arg; |
6912 | 587 if ( arg ) |
588 { | |
7217 | 589 sh_video_t * sh = (sh_video_t *)arg; |
7150 | 590 guiIntfStruct.FPS=sh->fps; |
6912 | 591 } |
7009 | 592 |
593 if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8150
diff
changeset
|
594 |
8300 | 595 if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled ); |
596 else btnSet( evSetMoviePosition,btnReleased ); | |
8284 | 597 |
6794 | 598 // -- audio |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
599 if ( audio_out ) |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
600 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
601 float l,r; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
602 mixer_getvolume( &l,&r ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
603 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
|
604 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; |
6627 | 605 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
|
606 btnModify( evSetVolume,guiIntfStruct.Volume ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
607 btnModify( evSetBalance,guiIntfStruct.Balance ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
608 } |
6627 | 609 |
610 if ( gtkEnableAudioEqualizer ) | |
611 { | |
612 equalizer_t eq; | |
613 int i,j; | |
614 for ( i=0;i<6;i++ ) | |
615 for ( j=0;j<10;j++ ) | |
616 { | |
617 eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j]; | |
618 gtkSet( gtkSetEqualizer,0,&eq ); | |
619 } | |
620 } | |
6794 | 621 // -- subtitle |
7009 | 622 #ifdef HAVE_DXR3 |
8043 | 623 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS |
624 #ifdef USE_LIBAVCODEC | |
625 && !gtkVopLAVC | |
626 #endif | |
627 #ifdef USE_LIBFAME | |
628 && !gtkVopFAME | |
629 #endif | |
630 ) | |
7009 | 631 { |
632 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME ); | |
633 guiIntfStruct.Playing=0; | |
634 return True; | |
635 } | |
636 #endif | |
6627 | 637 break; |
638 case guiSetDefaults: | |
9055 | 639 // if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged ) |
640 if ( guiIntfStruct.FilenameChanged ) | |
8423 | 641 { |
642 audio_id=-1; | |
643 video_id=-1; | |
644 dvdsub_id=-1; | |
645 vobsub_id=-1; | |
646 stream_cache_size=-1; | |
647 autosync=0; | |
648 vcd_track=0; | |
649 dvd_title=0; | |
9055 | 650 force_fps=0; |
8423 | 651 } |
652 wsPostRedisplay( &appMPlayer.subWindow ); | |
653 break; | |
654 case guiSetParameters: | |
9055 | 655 guiGetEvent( guiSetDefaults,NULL ); |
8423 | 656 switch ( guiIntfStruct.StreamType ) |
657 { | |
658 case STREAMTYPE_PLAYLIST: | |
659 break; | |
660 #ifdef HAVE_VCD | |
661 case STREAMTYPE_VCD: | |
662 vcd_track=guiIntfStruct.Track; | |
663 break; | |
664 #endif | |
665 #ifdef USE_DVDREAD | |
666 case STREAMTYPE_DVD: | |
667 dvd_title=guiIntfStruct.Title; | |
668 dvd_chapter=guiIntfStruct.Chapter; | |
669 dvd_angle=guiIntfStruct.Angle; | |
670 break; | |
671 #endif | |
6794 | 672 } |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
673 //if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore! |
8423 | 674 { |
675 if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename ); | |
676 else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename ); | |
677 } | |
7009 | 678 // --- video opts |
7019 | 679 |
7582 | 680 if ( !video_driver_list ) |
6794 | 681 { |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
682 int i = 0; |
6903 | 683 while ( video_out_drivers[i++] ) |
684 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
685 { | |
8150 | 686 gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name ); |
6903 | 687 break; |
688 } | |
6794 | 689 } |
690 | |
7582 | 691 if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } |
7009 | 692 |
693 { | |
694 int i = 0; | |
695 guiIntfStruct.NoWindow=False; | |
696 while ( video_out_drivers[i++] ) | |
697 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
6794 | 698 { |
8150 | 699 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 | 700 { guiIntfStruct.NoWindow=True; break; } |
6794 | 701 } |
7009 | 702 } |
703 | |
704 #ifdef HAVE_DXR3 | |
8043 | 705 #ifdef USE_LIBAVCODEC |
7009 | 706 remove_vop( "lavc" ); |
8043 | 707 #endif |
708 #ifdef USE_LIBFAME | |
7009 | 709 remove_vop( "fame" ); |
8043 | 710 #endif |
7582 | 711 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) ) |
7009 | 712 { |
713 if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) ) | |
714 { | |
8043 | 715 #ifdef USE_LIBAVCODEC |
7009 | 716 if ( gtkVopLAVC ) add_vop( "lavc" ); |
8043 | 717 #endif |
718 #ifdef USE_LIBFAME | |
7009 | 719 if ( gtkVopFAME ) add_vop( "fame" ); |
8043 | 720 #endif |
7009 | 721 } |
722 } | |
723 #endif | |
724 // --- | |
7019 | 725 if ( gtkVopPP ) add_vop( "pp" ); |
726 else remove_vop( "pp" ); | |
6794 | 727 |
728 // --- 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
|
729 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } |
6840 | 730 if ( gtkAONorm ) gset( &ao_plugin_cfg.plugin_list,"volnorm" ); |
6794 | 731 if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" ); |
732 if ( gtkAOExtraStereo ) | |
733 { | |
734 gset( &ao_plugin_cfg.plugin_list,"extrastereo" ); | |
735 ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul; | |
736 } | |
8600
54eac4cf587c
Lots of functions and variables specific to OSS audio are used without
arpi
parents:
8484
diff
changeset
|
737 #ifdef USE_OSS_AUDIO |
8484 | 738 mixer_device=gstrdup( gtkAOOSSMixer ); |
7582 | 739 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice ) |
6794 | 740 { |
8423 | 741 char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 ); |
7019 | 742 sprintf( tmp,"oss:%s",gtkAOOSSDevice ); |
7582 | 743 gaddlist( &audio_driver_list,tmp ); |
7019 | 744 } |
8615 | 745 #endif |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
746 #ifdef HAVE_SDL |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
747 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
|
748 { |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
749 char * tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 ); |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
750 sprintf( tmp,"sdl:%s",gtkAOSDLDriver ); |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
751 gaddlist( &audio_driver_list,tmp ); |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
752 } |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
753 #endif |
6794 | 754 // -- subtitle |
755 #ifdef USE_SUB | |
7170 | 756 sub_name=gstrdup( guiIntfStruct.Subtitlename ); |
6794 | 757 stream_dump_type=0; |
758 if ( gtkSubDumpMPSub ) stream_dump_type=4; | |
759 if ( gtkSubDumpSrt ) stream_dump_type=6; | |
760 gtkSubDumpMPSub=gtkSubDumpSrt=0; | |
6627 | 761 #endif |
6794 | 762 #if defined( USE_OSD ) || defined( USE_SUB ) |
763 guiLoadFont(); | |
6627 | 764 #endif |
765 | |
6794 | 766 // --- misc |
8423 | 767 if ( gtkCacheOn ) stream_cache_size=gtkCacheSize; |
8484 | 768 if ( gtkAutoSyncOn ) autosync=gtkAutoSync; |
8423 | 769 |
8484 | 770 if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile ); |
771 else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream ); | |
772 //audio_stream=NULL; | |
6627 | 773 |
8423 | 774 guiIntfStruct.DiskChanged=0; |
775 guiIntfStruct.FilenameChanged=0; | |
776 guiIntfStruct.NewPlay=0; | |
777 | |
6627 | 778 break; |
4798 | 779 } |
7009 | 780 return False; |
4798 | 781 } |
782 | |
783 void guiEventHandling( void ) | |
784 { | |
7009 | 785 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
786 gtkEventHandling(); |
4798 | 787 } |
6627 | 788 |
789 // --- | |
790 | |
791 float gtkEquChannels[6][10]; | |
792 | |
6713 | 793 plItem * plCurrent = NULL; |
794 plItem * plList = NULL; | |
795 plItem * plLastPlayed = NULL; | |
796 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
797 URLItem *URLList = NULL; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
798 |
9055 | 799 char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL }; |
800 | |
6713 | 801 #if defined( MP_DEBUG ) && 0 |
802 void list( void ) | |
6627 | 803 { |
6713 | 804 plItem * next = plList; |
805 printf( "--- list ---\n" ); | |
806 while( next || next->next ) | |
807 { | |
808 printf( "item: %s/%s\n",next->path,next->name ); | |
809 if ( next->next ) next=next->next; else break; | |
810 } | |
811 printf( "--- end of list ---\n" ); | |
812 } | |
813 #else | |
814 #define list(); | |
815 #endif | |
816 | |
817 void * gtkSet( int cmd,float fparam, void * vparam ) | |
818 { | |
6627 | 819 equalizer_t * eq = (equalizer_t *)vparam; |
6713 | 820 plItem * item = (plItem *)vparam; |
6627 | 821 |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
822 URLItem * url_item = (URLItem *)vparam; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
823 int is_added = True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
824 |
6627 | 825 switch ( cmd ) |
826 { | |
6713 | 827 // --- handle playlist |
6755 | 828 case gtkAddPlItem: // add item to playlist |
6713 | 829 if ( plList ) |
830 { | |
831 plItem * next = plList; | |
832 while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; } | |
833 next->next=item; item->prev=next; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
834 } else { item->prev=item->next=NULL; plCurrent=plList=item; } |
6713 | 835 list(); |
836 return NULL; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
837 case gtkInsertPlItem: // add item into playlist after current |
6713 | 838 if ( plCurrent ) |
839 { | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
840 plItem * curr = plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
841 item->next=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
842 if (item->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
843 item->next->prev=item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
844 item->prev=curr; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
845 curr->next=item; |
6713 | 846 plCurrent=plCurrent->next; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
847 return plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
848 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
849 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
850 return gtkSet(gtkAddPlItem,0,(void*)item); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
851 return NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
852 case gtkGetNextPlItem: // get current item from playlist |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
853 if ( plCurrent && plCurrent->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
854 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
855 plCurrent=plCurrent->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
856 /*if ( !plCurrent && plList ) |
6713 | 857 { |
858 plItem * next = plList; | |
859 while ( next->next ) { if ( !next->next ) break; next=next->next; } | |
860 plCurrent=next; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
861 }*/ |
6713 | 862 return plCurrent; |
863 } | |
864 return NULL; | |
865 case gtkGetPrevPlItem: | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
866 if ( plCurrent && plCurrent->prev) |
6713 | 867 { |
868 plCurrent=plCurrent->prev; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
869 //if ( !plCurrent && plList ) plCurrent=plList; |
6713 | 870 return plCurrent; |
871 } | |
6794 | 872 return NULL; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
873 case gtkSetCurrPlItem: // set current item |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
874 plCurrent=item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
875 return plCurrent; |
6713 | 876 case gtkGetCurrPlItem: // get current item |
877 return plCurrent; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
878 case gtkDelCurrPlItem: // delete current item |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
879 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
880 plItem * curr = plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
881 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
882 if (!curr) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
883 return NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
884 if (curr->prev) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
885 curr->prev->next=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
886 if (curr->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
887 curr->next->prev=curr->prev; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
888 if (curr==plList) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
889 plList=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
890 plCurrent=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
891 // Free it |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
892 if ( curr->path ) free( curr->path ); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
893 if ( curr->name ) free( curr->name ); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
894 free( curr ); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
895 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
896 mplCurr(); // Instead of using mplNext && mplPrev |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
897 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
898 return plCurrent; |
6713 | 899 case gtkDelPl: // delete list |
900 { | |
901 plItem * curr = plList; | |
902 plItem * next; | |
903 if ( !plList ) return NULL; | |
904 if ( !curr->next ) | |
905 { | |
906 if ( curr->path ) free( curr->path ); | |
907 if ( curr->name ) free( curr->name ); | |
908 free( curr ); | |
909 } | |
910 else | |
911 { | |
912 while ( curr->next ) | |
913 { | |
914 next=curr->next; | |
915 if ( curr->path ) free( curr->path ); | |
916 if ( curr->name ) free( curr->name ); | |
917 free( curr ); | |
918 curr=next; | |
919 } | |
920 } | |
921 plList=NULL; plCurrent=NULL; | |
922 } | |
923 return NULL; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
924 // ----- Handle url |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
925 case gtkAddURLItem: |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
926 if ( URLList ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
927 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
928 URLItem * next_url = URLList; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
929 is_added = False; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
930 while ( next_url->next ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
931 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
932 if ( !gstrcmp( next_url->url,url_item->url ) ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
933 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
934 is_added=True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
935 break; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
936 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
937 next_url=next_url->next; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
938 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
939 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
|
940 } else { url_item->next=NULL; URLList=url_item; } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
941 return NULL; |
6794 | 942 // --- subtitle |
7139 | 943 #ifndef HAVE_FREETYPE |
6794 | 944 case gtkSetFontFactor: |
7019 | 945 font_factor=fparam; |
6794 | 946 guiLoadFont(); |
947 return NULL; | |
7139 | 948 #else |
949 case gtkSetFontOutLine: | |
950 subtitle_font_thickness=( 8.0f / 100.0f ) * fparam; | |
951 guiLoadFont(); | |
952 return NULL; | |
953 case gtkSetFontBlur: | |
954 subtitle_font_radius=( 8.0f / 100.0f ) * fparam; | |
955 guiLoadFont(); | |
956 return NULL; | |
957 case gtkSetFontTextScale: | |
958 text_font_scale_factor=fparam; | |
959 guiLoadFont(); | |
960 return NULL; | |
961 case gtkSetFontOSDScale: | |
962 osd_font_scale_factor=fparam; | |
963 guiLoadFont(); | |
964 return NULL; | |
965 case gtkSetFontEncoding: | |
9056 | 966 gfree( (void **)&subtitle_font_encoding ); |
7139 | 967 subtitle_font_encoding=gstrdup( (char *)vparam ); |
968 guiLoadFont(); | |
969 return NULL; | |
970 case gtkSetFontAutoScale: | |
971 subtitle_autoscale=(int)fparam; | |
972 guiLoadFont(); | |
973 return NULL; | |
974 #endif | |
9056 | 975 #ifdef USE_ICONV |
976 case gtkSetSubEncoding: | |
977 gfree( (void **)&sub_cp ); | |
978 sub_cp=gstrdup( (char *)vparam ); | |
979 break; | |
6794 | 980 #endif |
981 // --- misc | |
982 case gtkClearStruct: | |
7009 | 983 if ( (unsigned int)vparam & guiFilenames ) |
6794 | 984 { |
985 gfree( (void **)&guiIntfStruct.Filename ); | |
986 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
987 gfree( (void **)&guiIntfStruct.AudioFile ); | |
7009 | 988 gtkSet( gtkDelPl,0,NULL ); |
6794 | 989 } |
990 #ifdef USE_DVDREAD | |
7009 | 991 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) ); |
6794 | 992 #endif |
993 #ifdef HAVE_VCD | |
7009 | 994 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0; |
6794 | 995 #endif |
996 return NULL; | |
997 case gtkSetExtraStereo: | |
998 gtkAOExtraStereoMul=fparam; | |
999 audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)>kAOExtraStereoMul ); | |
1000 return NULL; | |
1001 case gtkSetPanscan: | |
7217 | 1002 { |
1003 mp_cmd_t * mp_cmd; | |
1004 mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); | |
1005 mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" ); | |
1006 mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1; | |
1007 mp_input_queue_cmd( mp_cmd ); | |
1008 } | |
6794 | 1009 return NULL; |
1010 case gtkSetAutoq: | |
7019 | 1011 auto_quality=(int)fparam; |
6794 | 1012 return NULL; |
6713 | 1013 // --- set equalizers |
6627 | 1014 case gtkSetContrast: |
7217 | 1015 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam ); |
1016 return NULL; | |
6627 | 1017 case gtkSetBrightness: |
7217 | 1018 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam ); |
1019 return NULL; | |
6627 | 1020 case gtkSetHue: |
7217 | 1021 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam ); |
1022 return NULL; | |
6627 | 1023 case gtkSetSaturation: |
7217 | 1024 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam ); |
1025 return NULL; | |
6627 | 1026 case gtkSetEqualizer: |
1027 if ( eq ) | |
1028 { | |
1029 gtkEquChannels[eq->channel][eq->band]=eq->gain; | |
1030 audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)eq ); | |
1031 } | |
1032 else | |
1033 { | |
1034 int i,j; equalizer_t tmp; tmp.gain=0.0f; | |
1035 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) ); | |
1036 for ( i=0;i<6;i++ ) | |
1037 for ( j=0;j<10;j++ ) | |
1038 { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); } | |
1039 } | |
6713 | 1040 return NULL; |
6627 | 1041 } |
6713 | 1042 return NULL; |
6627 | 1043 } |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1044 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1045 #define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1)) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1046 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1047 #include "../playtree.h" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1048 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1049 //This function adds/inserts one file into the gui playlist |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1050 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1051 int import_file_into_gui(char* temp, int insert) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1052 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1053 char *filename, *pathname; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1054 plItem * item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1055 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1056 filename = strdup(mp_basename(temp)); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1057 pathname = strdup(temp); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1058 if (strlen(pathname)-strlen(filename)>0) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1059 pathname[strlen(pathname)-strlen(filename)-1]='\0'; // We have some path so remove / at end |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1060 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1061 pathname[strlen(pathname)-strlen(filename)]='\0'; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1062 mp_msg(MSGT_PLAYTREE,MSGL_V, "Adding filename %s && pathname %s\n",filename,pathname); //FIXME: Change to MSGL_DBG2 ? |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1063 item=calloc( 1,sizeof( plItem ) ); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1064 if (!item) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1065 return 0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1066 item->name=filename; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1067 item->path=pathname; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1068 if (insert) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1069 gtkSet( gtkInsertPlItem,0,(void*)item ); // Inserts the item after current, and makes current=item |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1070 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1071 gtkSet( gtkAddPlItem,0,(void*)item ); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1072 return 1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1073 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1074 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1075 #ifdef NEW_CONFIG |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1076 #include "../m_option.h" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1077 #include "../m_config.h" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1078 #else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1079 #include "../cfgparser.h" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1080 #endif |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1081 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1082 // This function imports the initial playtree (based on cmd-line files) into the gui playlist |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1083 // by either: |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1084 // - overwriting gui pl (enqueue=0) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1085 // - appending it to gui pl (enqueue=1) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1086 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1087 int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1088 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1089 play_tree_iter_t* my_pt_iter=NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1090 int result=0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1091 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1092 if (!enqueue) // Delete playlist before "appending" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1093 gtkSet(gtkDelPl,0,0); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1094 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1095 if((my_pt_iter=pt_iter_create(&my_playtree,config))) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1096 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1097 while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1098 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1099 if (import_file_into_gui(filename, 0)) // Add it to end of list |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1100 result=1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1101 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1102 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1103 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1104 mplCurr(); // Update filename |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1105 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1106 if (!enqueue) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1107 filename=guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline, |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1108 // gmplayer does directly start in Play-Mode. |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1109 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1110 filename=NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1111 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1112 return result; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1113 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1114 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1115 // This function imports and inserts an playtree, that is created "on the fly", for example by |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1116 // parsing some MOV-Reference-File; or by loading an playlist with "File Open" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1117 // |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1118 // The file which contained the playlist is thereby replaced with it's contents. |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1119 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1120 int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1121 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1122 play_tree_iter_t* my_pt_iter=NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1123 int result=0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1124 plItem * save=(plItem*)gtkSet( gtkGetCurrPlItem, 0, 0); // Save current item |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1125 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1126 if((my_pt_iter=pt_iter_create(&my_playtree,config))) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1127 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1128 while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1129 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1130 if (import_file_into_gui(filename, 1)) // insert it into the list and set plCurrent=new item |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1131 result=1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1132 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1133 pt_iter_destroy(&my_pt_iter); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1134 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1135 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1136 if (save) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1137 gtkSet(gtkSetCurrPlItem, 0, (void*)save); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1138 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1139 gtkSet(gtkSetCurrPlItem, 0, (void*)plList); // go to head, if plList was empty before |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1140 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1141 if (save && result) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1142 gtkSet(gtkDelCurrPlItem, 0, 0); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1143 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1144 mplCurr(); // Update filename |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1145 filename=NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1146 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1147 return result; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1148 } |