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