Mercurial > mplayer.hg
annotate Gui/interface.c @ 14391:62614fd2336a
RTC check should no longer be Linux-only.
author | diego |
---|---|
date | Thu, 06 Jan 2005 12:06:57 +0000 |
parents | 21e72b6d8d11 |
children | db75b76c11b2 |
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" |
14254 | 30 #include "../libaf/af.h" |
6627 | 31 #include "../libao2/eq.h" |
5789 | 32 |
14254 | 33 extern af_cfg_t af_cfg; |
34 | |
6996 | 35 #ifdef USE_ICONV |
7128 | 36 #include <iconv.h> |
6996 | 37 #endif |
38 | |
5665 | 39 #include "../libmpdemux/stream.h" |
5789 | 40 #include "../libmpdemux/demuxer.h" |
7217 | 41 #include "../libmpdemux/stheader.h" |
42 #include "../libmpcodecs/dec_video.h" | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
43 |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
10272
diff
changeset
|
44 #include "../m_config.h" |
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
10272
diff
changeset
|
45 #include "../m_option.h" |
9623
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
46 |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
12646
diff
changeset
|
47 extern mixer_t mixer; // mixer from mplayer.c |
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
12646
diff
changeset
|
48 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
49 guiInterface_t guiIntfStruct; |
9314
f38fe55d0e05
this patch adds the option -guiwid to gmplayer. I think its a more clean
arpi
parents:
9306
diff
changeset
|
50 int guiWinID=-1; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
51 |
6627 | 52 char * gstrcat( char ** dest,char * src ) |
53 { | |
54 char * tmp = NULL; | |
55 | |
56 if ( !src ) return NULL; | |
57 | |
58 if ( *dest ) | |
59 { | |
60 tmp=malloc( strlen( *dest ) + strlen( src ) + 1 ); | |
12646 | 61 |
62 if ( tmp ) /* TODO: advanced error handling */ | |
63 { | |
64 strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest ); | |
65 } | |
66 } | |
6627 | 67 else |
68 { tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); } | |
69 *dest=tmp; | |
70 return tmp; | |
71 } | |
72 | |
6794 | 73 int gstrcmp( char * a,char * b ) |
74 { | |
75 if ( !a && !b ) return 0; | |
76 if ( !a || !b ) return -1; | |
77 return strcmp( a,b ); | |
78 } | |
79 | |
7019 | 80 int gstrncmp( char * a,char * b,int size ) |
81 { | |
82 if ( !a && !b ) return 0; | |
83 if ( !a || !b ) return -1; | |
84 return strncmp( a,b,size ); | |
85 } | |
86 | |
6794 | 87 char * gstrdup( char * str ) |
88 { | |
89 if ( !str ) return NULL; | |
90 return strdup( str ); | |
91 } | |
92 | |
8284 | 93 char * gstrchr( char * str,int c ) |
94 { | |
95 if ( !str ) return NULL; | |
96 return strchr( str,c ); | |
97 } | |
98 | |
6794 | 99 void gfree( void ** p ) |
100 { | |
101 if ( *p == NULL ) return; | |
102 free( *p ); *p=NULL; | |
103 } | |
104 | |
105 void gset( char ** str,char * what ) | |
106 { | |
7887
0e5544951425
A small patch to Gui/interface.c; the first fix is a plain bug, the second is
arpi
parents:
7707
diff
changeset
|
107 if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }} |
6794 | 108 else gstrcat( str,what ); |
109 } | |
110 | |
14254 | 111 /** |
112 * \brief this actually creates a new list containing only one element... | |
113 */ | |
7582 | 114 void gaddlist( char *** list,char * entry ) |
115 { | |
116 int i; | |
117 | |
118 if ( (*list) ) | |
119 { | |
120 for ( i=0;(*list)[i];i++ ) free( (*list)[i] ); | |
121 free( (*list) ); | |
122 } | |
123 | |
14177
b8ba18471f4a
Somebody obviously took a course "coding non-portable".
reimar
parents:
14156
diff
changeset
|
124 (*list)=malloc( 2 * sizeof(char **) ); |
7582 | 125 (*list)[0]=gstrdup( entry ); |
126 (*list)[1]=NULL; | |
127 } | |
128 | |
14254 | 129 /** |
130 * \brief this replaces a string starting with search by replace. | |
131 * If not found, replace is appended. | |
132 */ | |
133 void greplace(char ***list, char *search, char *replace) | |
134 { | |
135 int i = 0; | |
136 int len = (search) ? strlen(search) : 0; | |
137 | |
138 if (*list) { | |
139 for (i = 0; (*list)[i]; i++) { | |
140 if (search && (strncmp((*list)[i], search, len) == 0)) { | |
141 free((*list)[i]); | |
142 (*list)[i] = gstrdup(replace); | |
143 return; | |
144 } | |
145 } | |
146 *list = realloc(*list, (i + 2) * sizeof(char *)); | |
147 } | |
148 else | |
149 *list = malloc(2 * sizeof(char *)); | |
150 | |
151 (*list)[i] = gstrdup(replace); | |
152 (*list)[i + 1] = NULL; | |
153 } | |
154 | |
6996 | 155 #ifdef USE_ICONV |
156 char * gconvert_uri_to_filename( char * str ) | |
157 { | |
158 iconv_t d; | |
159 char * out = strdup( str ); | |
160 char * tmp = NULL; | |
161 char * ize; | |
162 size_t inb,outb; | |
163 char * charset = "ISO8859-1"; | |
164 char * cs; | |
165 | |
166 if ( !strchr( str,'%' ) ) return str; | |
167 | |
168 { | |
169 char * t = calloc( 1,strlen( out ) ); | |
170 int i,c = 0; | |
171 for ( i=0;i < (int)strlen( out );i++ ) | |
172 if ( out[i] != '%' ) t[c++]=out[i]; | |
173 else | |
174 { | |
12068 | 175 char tmp[5] = "0xXX"; |
6996 | 176 // if ( out[++i] == '%' ) { t[c++]='%'; continue; }; |
177 tmp[2]=out[++i]; tmp[3]=out[++i]; | |
178 t[c++]=(char)strtol( tmp,(char **)NULL,0 ); | |
179 } | |
180 free( out ); | |
181 out=t; | |
182 } | |
183 | |
184 if ( (cs=getenv( "CHARSET" )) && *cs ) charset=cs; | |
185 | |
186 inb=outb=strlen( out ); | |
187 tmp=calloc( 1,outb + 1 ); | |
188 ize=tmp; | |
189 d=iconv_open( charset,"UTF-8" ); | |
190 if ( (iconv_t)(-1) == d ) return str; | |
191 iconv( d,&out,&inb,&tmp,&outb ); | |
192 iconv_close( d ); | |
193 free( out ); | |
194 return ize; | |
195 } | |
196 #endif | |
197 | |
6218 | 198 void guiInit( void ) |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
199 { |
8058 | 200 int i; |
201 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
202 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) ); |
6898 | 203 guiIntfStruct.Balance=50.0f; |
204 guiIntfStruct.StreamType=-1; | |
205 | |
6627 | 206 memset( >kEquChannels,0,sizeof( gtkEquChannels ) ); |
7707 | 207 #ifdef HAVE_DXR3 |
7706 | 208 if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" ); |
7707 | 209 #endif |
14181
6ecf5fca82e2
Fixes the bug that after opening the preferences panel gmplayer plays files
reimar
parents:
14177
diff
changeset
|
210 if ( stream_cache_size > 0 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; } |
6ecf5fca82e2
Fixes the bug that after opening the preferences panel gmplayer plays files
reimar
parents:
14177
diff
changeset
|
211 else gtkCacheOn = 0; |
8311 | 212 if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; } |
6898 | 213 |
214 gtkInit(); | |
8043 | 215 // --- initialize X |
6912 | 216 wsXInit( (void *)mDisplay ); |
8058 | 217 // --- load skin |
8043 | 218 skinDirInHome=get_path("Skin"); |
10272
7b0bc557987b
renames: DATADIR->MPLAYER_DATADIR, CONFDIR->MPLAYER_CONFDIR, LIBDIR->MPLAYER_LIBDIR
arpi
parents:
10193
diff
changeset
|
219 skinMPlayerDir=MPLAYER_DATADIR "/Skin"; |
14156 | 220 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome); |
221 mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir); | |
8043 | 222 if ( !skinName ) skinName=strdup( "default" ); |
10607
a17ebe817e33
Fixed a long standing issue: if configured a not available (not existing, permission denied, ...) skin, the gui never ever started again. Now it reverts to 'default' if it can't open the selected skin, if 'default' fails too, the gui exits with error.
alex
parents:
10594
diff
changeset
|
223 i = skinRead( skinName ); |
a17ebe817e33
Fixed a long standing issue: if configured a not available (not existing, permission denied, ...) skin, the gui never ever started again. Now it reverts to 'default' if it can't open the selected skin, if 'default' fails too, the gui exits with error.
alex
parents:
10594
diff
changeset
|
224 if ((i == -1) && strcmp(skinName,"default")) |
a17ebe817e33
Fixed a long standing issue: if configured a not available (not existing, permission denied, ...) skin, the gui never ever started again. Now it reverts to 'default' if it can't open the selected skin, if 'default' fails too, the gui exits with error.
alex
parents:
10594
diff
changeset
|
225 { |
14156 | 226 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName); |
10607
a17ebe817e33
Fixed a long standing issue: if configured a not available (not existing, permission denied, ...) skin, the gui never ever started again. Now it reverts to 'default' if it can't open the selected skin, if 'default' fails too, the gui exits with error.
alex
parents:
10594
diff
changeset
|
227 skinName=strdup( "default" ); |
a17ebe817e33
Fixed a long standing issue: if configured a not available (not existing, permission denied, ...) skin, the gui never ever started again. Now it reverts to 'default' if it can't open the selected skin, if 'default' fails too, the gui exits with error.
alex
parents:
10594
diff
changeset
|
228 i = skinRead( skinName ); |
a17ebe817e33
Fixed a long standing issue: if configured a not available (not existing, permission denied, ...) skin, the gui never ever started again. Now it reverts to 'default' if it can't open the selected skin, if 'default' fails too, the gui exits with error.
alex
parents:
10594
diff
changeset
|
229 } |
a17ebe817e33
Fixed a long standing issue: if configured a not available (not existing, permission denied, ...) skin, the gui never ever started again. Now it reverts to 'default' if it can't open the selected skin, if 'default' fails too, the gui exits with error.
alex
parents:
10594
diff
changeset
|
230 switch (i) { |
8043 | 231 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 ); |
232 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 ); | |
233 } | |
8058 | 234 // --- initialize windows |
9088 | 235 if ( ( mplDrawBuffer = (unsigned char *)malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) |
8058 | 236 { |
237 fprintf( stderr,MSGTR_NEMDB ); | |
238 exit( 0 ); | |
239 } | |
9306 | 240 |
9625 | 241 if ( gui_save_pos ) |
242 { | |
243 appMPlayer.main.x = gui_main_pos_x; | |
244 appMPlayer.main.y = gui_main_pos_y; | |
245 appMPlayer.sub.x = gui_sub_pos_x; | |
246 appMPlayer.sub.y = gui_sub_pos_y; | |
247 } | |
248 | |
9306 | 249 if (WinID>0) |
9625 | 250 { |
9306 | 251 appMPlayer.subWindow.Parent=WinID; |
252 appMPlayer.sub.x=0; | |
253 appMPlayer.sub.y=0; | |
9625 | 254 } |
255 if (guiWinID>=0) appMPlayer.mainWindow.Parent=guiWinID; | |
9202 | 256 |
8058 | 257 wsCreateWindow( &appMPlayer.subWindow, |
258 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
9202 | 259 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" ); |
8058 | 260 |
261 wsDestroyImage( &appMPlayer.subWindow ); | |
262 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
263 wsXDNDMakeAwareness(&appMPlayer.subWindow); | |
264 | |
8973 | 265 mplMenuInit(); |
266 mplPBInit(); | |
267 | |
8058 | 268 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); |
269 | |
270 // i=wsHideFrame|wsMaxSize|wsHideWindow; | |
271 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; | |
272 i=wsShowFrame|wsMaxSize|wsHideWindow; | |
273 wsCreateWindow( &appMPlayer.mainWindow, | |
274 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
8949 | 275 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); |
8058 | 276 |
277 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
278 wsXDNDMakeAwareness(&appMPlayer.mainWindow); | |
279 | |
280 #ifdef DEBUG | |
14156 | 281 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] depth on screen: %d\n",wsDepthOnScreen ); |
8058 | 282 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); |
283 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
284 #endif | |
285 | |
286 appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; | |
287 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
288 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
289 appMPlayer.mainWindow.DandDHandler=mplDandDHandler; | |
290 | |
291 appMPlayer.subWindow.ReDraw=(void *)mplSubDraw; | |
292 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
293 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
294 appMPlayer.subWindow.DandDHandler=mplDandDHandler; | |
295 | |
8973 | 296 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); |
8058 | 297 wsClearWindow( appMPlayer.subWindow ); |
298 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); | |
299 | |
300 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
301 btnModify( evSetBalance,guiIntfStruct.Balance ); | |
302 btnModify( evSetMoviePosition,guiIntfStruct.Position ); | |
303 | |
304 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); | |
305 wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask ); | |
306 | |
307 guiIntfStruct.Playing=0; | |
308 | |
309 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); | |
310 | |
311 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); | |
9202 | 312 #if 0 |
8058 | 313 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
314 | |
315 { | |
316 XEvent xev; | |
317 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); | |
318 appMPlayer.subWindow.Mapped=wsMapped; | |
319 } | |
320 | |
9088 | 321 if ( !fullscreen ) fullscreen=gtkLoadFullscreen; |
8058 | 322 if ( fullscreen ) |
323 { | |
324 mplFullScreen(); | |
325 btnModify( evFullScreen,btnPressed ); | |
326 } | |
9202 | 327 #else |
11874 | 328 if ( !fullscreen ) fullscreen=gtkLoadFullscreen; |
9202 | 329 if ( gtkShowVideoWindow ) |
330 { | |
331 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
332 { | |
333 XEvent xev; | |
334 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); | |
335 appMPlayer.subWindow.Mapped=wsMapped; | |
336 } | |
337 | |
338 if ( fullscreen ) | |
339 { | |
340 mplFullScreen(); | |
341 btnModify( evFullScreen,btnPressed ); | |
342 } | |
343 } | |
344 else | |
345 { | |
346 if ( fullscreen ) | |
347 { | |
348 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
349 { | |
350 XEvent xev; | |
351 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); | |
352 appMPlayer.subWindow.Mapped=wsMapped; | |
353 } | |
354 wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow ); | |
355 | |
356 mplFullScreen(); | |
357 btnModify( evFullScreen,btnPressed ); | |
358 } | |
359 } | |
8058 | 360 #endif |
361 mplSubRender=1; | |
8043 | 362 // --- |
7538 | 363 |
8423 | 364 if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE ); |
7009 | 365 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
366 if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename ); |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
367 #if defined( USE_OSD ) || defined( USE_SUB ) |
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
368 guiLoadFont(); |
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
369 #endif |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
370 } |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
371 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
372 void guiDone( void ) |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
373 { |
8883 | 374 mplMainRender=0; |
14156 | 375 mp_msg( MSGT_GPLAYER,MSGL_V,"[GUI] done.\n" ); |
9625 | 376 |
377 if ( gui_save_pos ) | |
378 { | |
379 gui_main_pos_x=appMPlayer.mainWindow.X; gui_main_pos_y=appMPlayer.mainWindow.Y; | |
380 gui_sub_pos_x=appMPlayer.subWindow.X; gui_sub_pos_y=appMPlayer.subWindow.Y; | |
381 } | |
382 | |
6794 | 383 cfg_write(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
384 wsXDone(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
385 } |
4798 | 386 |
4858 | 387 int guiCMDArray[] = |
388 { | |
8883 | 389 evLoadPlay, |
4858 | 390 evLoadSubtitle, |
391 evAbout, | |
392 evPlay, | |
393 evStop, | |
394 evPlayList, | |
395 evPreferences, | |
396 evFullScreen, | |
397 evSkinBrowser | |
398 }; | |
399 | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
400 extern ao_functions_t * audio_out; |
6755 | 401 extern vo_functions_t * video_out; |
6794 | 402 extern int frame_dropping; |
403 extern int stream_dump_type; | |
9812
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
404 extern int vcd_track; |
9623
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
405 extern m_obj_settings_t*vo_plugin_args; |
6794 | 406 |
407 #if defined( USE_OSD ) || defined( USE_SUB ) | |
408 void guiLoadFont( void ) | |
409 { | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
410 #ifdef HAVE_FREETYPE |
8635
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
8615
diff
changeset
|
411 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
|
412 #else |
6794 | 413 if ( vo_font ) |
414 { | |
415 int i; | |
416 if ( vo_font->name ) free( vo_font->name ); | |
417 if ( vo_font->fpath ) free( vo_font->fpath ); | |
418 for ( i=0;i<16;i++ ) | |
419 if ( vo_font->pic_a[i] ) | |
420 { | |
421 if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp ); | |
422 if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal ); | |
423 } | |
424 for ( i=0;i<16;i++ ) | |
425 if ( vo_font->pic_b[i] ) | |
426 { | |
427 if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp ); | |
428 if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal ); | |
429 } | |
430 free( vo_font ); vo_font=NULL; | |
431 } | |
7019 | 432 if ( font_name ) |
6794 | 433 { |
7019 | 434 vo_font=read_font_desc( font_name,font_factor,0 ); |
6794 | 435 if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name ); |
436 } | |
437 else | |
438 { | |
7019 | 439 font_name=gstrdup( get_path( "font/font.desc" ) ); |
440 vo_font=read_font_desc( font_name,font_factor,0 ); | |
6794 | 441 if ( !vo_font ) |
442 { | |
10272
7b0bc557987b
renames: DATADIR->MPLAYER_DATADIR, CONFDIR->MPLAYER_CONFDIR, LIBDIR->MPLAYER_LIBDIR
arpi
parents:
10193
diff
changeset
|
443 gfree( (void **)&font_name ); font_name=gstrdup(MPLAYER_DATADIR "/font/font.desc" ); |
7019 | 444 vo_font=read_font_desc( font_name,font_factor,0 ); |
6794 | 445 } |
446 } | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
7111
diff
changeset
|
447 #endif |
6794 | 448 } |
449 #endif | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
450 |
7150 | 451 #ifdef USE_SUB |
7169 | 452 extern mp_osd_obj_t* vo_osd_list; |
453 | |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
454 extern char **sub_name; |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
455 |
7150 | 456 void guiLoadSubtitle( char * name ) |
457 { | |
458 if ( guiIntfStruct.Playing == 0 ) | |
459 { | |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
460 guiIntfStruct.SubtitleChanged=1; //what is this for? (mw) |
7150 | 461 return; |
462 } | |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
463 if ( subdata ) |
7150 | 464 { |
14156 | 465 mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_DeletingSubtitles ); |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
466 sub_free( subdata ); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
467 subdata=NULL; |
7150 | 468 vo_sub=NULL; |
7169 | 469 if ( vo_osd_list ) |
470 { | |
471 int len; | |
472 mp_osd_obj_t * osd = vo_osd_list; | |
473 while ( osd ) | |
474 { | |
475 if ( osd->type == OSDTYPE_SUBTITLE ) break; | |
476 osd=osd->next; | |
477 } | |
478 if ( osd && osd->flags&OSDFLAG_VISIBLE ) | |
479 { | |
480 len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 ); | |
481 memset( osd->bitmap_buffer,0,len ); | |
482 memset( osd->alpha_buffer,0,len ); | |
483 } | |
484 } | |
7150 | 485 } |
7169 | 486 if ( name ) |
487 { | |
14156 | 488 mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_LoadingSubtitles,name ); |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
489 subdata=sub_read_file( gstrdup( name ), guiIntfStruct.FPS ); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
490 if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name ); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
491 sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
492 sub_name[0] = strdup(name); //sub_name[0] will be read |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
493 sub_name[1] = NULL; |
7169 | 494 } |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
495 update_set_of_subtitles(); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
496 |
7150 | 497 } |
498 #endif | |
499 | |
7009 | 500 static void add_vop( char * str ) |
501 { | |
14156 | 502 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str ); |
7009 | 503 if ( vo_plugin_args ) |
504 { | |
505 int i = 0; | |
9623
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
506 while ( vo_plugin_args[i].name ) if ( !gstrcmp( vo_plugin_args[i++].name,str ) ) { i=-1; break; } |
7009 | 507 if ( i != -1 ) |
9623
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
508 { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( m_obj_settings_t ) ); vo_plugin_args[i].name=strdup( str );vo_plugin_args[i].attribs = NULL; vo_plugin_args[i+1].name=NULL; } |
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
509 } else { vo_plugin_args=malloc( 2 * sizeof( m_obj_settings_t ) ); vo_plugin_args[0].name=strdup( str );vo_plugin_args[0].attribs = NULL; vo_plugin_args[1].name=NULL; } |
7009 | 510 } |
511 | |
512 static void remove_vop( char * str ) | |
513 { | |
514 int n = 0; | |
515 | |
516 if ( !vo_plugin_args ) return; | |
517 | |
14156 | 518 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_RemovingVideoFilter,str ); |
7009 | 519 |
9623
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
520 while ( vo_plugin_args[n++].name ); n--; |
7009 | 521 if ( n > -1 ) |
522 { | |
523 int i = 0,m = -1; | |
9623
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
524 while ( vo_plugin_args[i].name ) if ( !gstrcmp( vo_plugin_args[i++].name,str ) ) { m=i - 1; break; } |
7009 | 525 i--; |
526 if ( m > -1 ) | |
527 { | |
9623
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
528 if ( n == 1 ) { free( vo_plugin_args[0].name );free( vo_plugin_args[0].attribs ); free( vo_plugin_args ); vo_plugin_args=NULL; } |
20f0a254142d
bugfix from Raindel Shachar <raindel@techunix.technion.ac.il>
pontscho
parents:
9314
diff
changeset
|
529 else { free( vo_plugin_args[i].name );free( vo_plugin_args[i].attribs ); memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); } |
7009 | 530 } |
531 } | |
532 } | |
533 | |
534 int guiGetEvent( int type,char * arg ) | |
4798 | 535 { |
6280 | 536 stream_t * stream = (stream_t *) arg; |
5672
1f8b34f1e7c0
ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents:
5665
diff
changeset
|
537 #ifdef USE_DVDREAD |
5665 | 538 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
|
539 #endif |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
540 |
4798 | 541 switch ( type ) |
542 { | |
543 case guiXEvent: | |
8973 | 544 guiIntfStruct.event_struct=(void *)arg; |
4798 | 545 wsEvents( wsDisplay,(XEvent *)arg,NULL ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
546 gtkEventHandling(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
547 break; |
4798 | 548 case guiCEvent: |
4963 | 549 switch ( (int)arg ) |
550 { | |
9202 | 551 case guiSetPlay: |
552 guiIntfStruct.Playing=1; | |
11918
634a2b279b1a
'video window vanishes after pause' bugfix, based on Andr Khne's (andre.kuehne@gmx.net) bugreport
pontscho
parents:
11874
diff
changeset
|
553 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); |
9202 | 554 break; |
555 case guiSetStop: | |
556 guiIntfStruct.Playing=0; | |
12068 | 557 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); |
9202 | 558 break; |
8423 | 559 case guiSetPause: guiIntfStruct.Playing=2; break; |
4963 | 560 } |
8423 | 561 mplState(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
562 break; |
5665 | 563 case guiSetState: |
564 mplState(); | |
565 break; | |
566 case guiSetFileName: | |
567 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); | |
568 break; | |
5789 | 569 case guiSetAudioOnly: |
570 guiIntfStruct.AudioOnly=(int)arg; | |
7009 | 571 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } |
5789 | 572 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
573 break; | |
8312
ef8c992672f4
- audio track handling in menu (idea from Rdiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
574 case guiSetDemuxer: |
ef8c992672f4
- audio track handling in menu (idea from Rdiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
575 guiIntfStruct.demuxer=(void *)arg; |
ef8c992672f4
- audio track handling in menu (idea from Rdiger Kuhlmann)
pontscho
parents:
8311
diff
changeset
|
576 break; |
14254 | 577 case guiSetAfilter: |
578 guiIntfStruct.afilter=(void *)arg; | |
579 break; | |
5789 | 580 case guiSetShVideo: |
581 { | |
5986 | 582 if ( !appMPlayer.subWindow.isFullScreen ) |
583 { | |
584 wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight ); | |
585 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); | |
586 } | |
5955
caac20b1ca79
fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents:
5945
diff
changeset
|
587 guiIntfStruct.MovieWidth=vo_dwidth; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
588 guiIntfStruct.MovieHeight=vo_dheight; |
9314
f38fe55d0e05
this patch adds the option -guiwid to gmplayer. I think its a more clean
arpi
parents:
9306
diff
changeset
|
589 if (guiWinID>=0) |
9306 | 590 wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight); |
5789 | 591 } |
592 break; | |
5665 | 593 #ifdef USE_DVDREAD |
594 case guiSetDVD: | |
595 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; | |
596 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; | |
597 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; | |
598 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; | |
599 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); | |
600 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; | |
601 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); | |
602 guiIntfStruct.DVD.current_title=dvd_title + 1; | |
603 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; | |
604 guiIntfStruct.DVD.current_angle=dvd_angle + 1; | |
605 guiIntfStruct.Track=dvd_title + 1; | |
606 break; | |
607 #endif | |
6280 | 608 case guiSetStream: |
609 guiIntfStruct.StreamType=stream->type; | |
610 switch( stream->type ) | |
611 { | |
7150 | 612 #ifdef USE_DVDREAD |
6280 | 613 case STREAMTYPE_DVD: |
614 guiGetEvent( guiSetDVD,(char *)stream->priv ); | |
615 break; | |
7150 | 616 #endif |
6280 | 617 #ifdef HAVE_VCD |
618 case STREAMTYPE_VCD: | |
619 { | |
620 int i; | |
10696
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
621 |
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
622 if (!stream->priv) |
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
623 { |
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
624 guiIntfStruct.VCDTracks=0; |
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
625 break; |
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
626 } |
6280 | 627 for ( i=1;i < 100;i++ ) |
10696
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
628 if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break; |
73702d2f93ab
1000l. The vcd api changed and nobody updated the gui..
alex
parents:
10607
diff
changeset
|
629 vcd_seek_to_track( stream->priv,vcd_track ); |
6280 | 630 guiIntfStruct.VCDTracks=--i; |
631 break; | |
632 } | |
633 #endif | |
7150 | 634 default: break; |
6280 | 635 } |
636 break; | |
4858 | 637 case guiIEvent: |
14148 | 638 mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg ); |
4858 | 639 switch( (int)arg ) |
640 { | |
641 case MP_CMD_QUIT: | |
642 mplEventHandling( evExit,0 ); | |
643 break; | |
644 case MP_CMD_VO_FULLSCREEN: | |
645 mplEventHandling( evFullScreen,0 ); | |
646 break; | |
647 default: | |
648 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 ); | |
649 } | |
650 break; | |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
651 case guiReDraw: |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
652 mplEventHandling( evRedraw,0 ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
653 break; |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
654 case guiSetVolume: |
6903 | 655 if ( audio_out ) |
656 { | |
657 float l,r; | |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
12646
diff
changeset
|
658 mixer_getvolume( &mixer,&l,&r ); |
6903 | 659 guiIntfStruct.Volume=(r>l?r:l); |
660 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; | |
661 else guiIntfStruct.Balance=50.0f; | |
662 btnModify( evSetVolume,guiIntfStruct.Volume ); | |
663 btnModify( evSetBalance,guiIntfStruct.Balance ); | |
664 } | |
665 break; | |
7009 | 666 case guiSetFileFormat: |
667 guiIntfStruct.FileFormat=(int)arg; | |
668 break; | |
6903 | 669 case guiSetValues: |
6912 | 670 // -- video |
7217 | 671 guiIntfStruct.sh_video=arg; |
6912 | 672 if ( arg ) |
673 { | |
7217 | 674 sh_video_t * sh = (sh_video_t *)arg; |
7150 | 675 guiIntfStruct.FPS=sh->fps; |
6912 | 676 } |
7009 | 677 |
678 if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8150
diff
changeset
|
679 |
8300 | 680 if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled ); |
681 else btnSet( evSetMoviePosition,btnReleased ); | |
8284 | 682 |
6794 | 683 // -- audio |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
684 if ( audio_out ) |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
685 { |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
686 float l,r; |
12691
0230544f52a1
Fix GUI compilation, patch by Reimar Dffinger and Alexander Strasser.
diego
parents:
12646
diff
changeset
|
687 mixer_getvolume( &mixer,&l,&r ); |
6619
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
688 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
|
689 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f; |
6627 | 690 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
|
691 btnModify( evSetVolume,guiIntfStruct.Volume ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
692 btnModify( evSetBalance,guiIntfStruct.Balance ); |
f554e7271587
fix volume handling ( step 2 ) -- add balance support and some code cleanup and fix
pontscho
parents:
6280
diff
changeset
|
693 } |
6627 | 694 |
695 if ( gtkEnableAudioEqualizer ) | |
696 { | |
697 equalizer_t eq; | |
698 int i,j; | |
699 for ( i=0;i<6;i++ ) | |
700 for ( j=0;j<10;j++ ) | |
701 { | |
702 eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j]; | |
703 gtkSet( gtkSetEqualizer,0,&eq ); | |
704 } | |
705 } | |
6794 | 706 // -- subtitle |
7009 | 707 #ifdef HAVE_DXR3 |
8043 | 708 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS |
709 #ifdef USE_LIBAVCODEC | |
710 && !gtkVopLAVC | |
711 #endif | |
712 #ifdef USE_LIBFAME | |
713 && !gtkVopFAME | |
714 #endif | |
715 ) | |
7009 | 716 { |
717 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME ); | |
718 guiIntfStruct.Playing=0; | |
719 return True; | |
720 } | |
721 #endif | |
6627 | 722 break; |
723 case guiSetDefaults: | |
9055 | 724 // if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged ) |
725 if ( guiIntfStruct.FilenameChanged ) | |
8423 | 726 { |
727 audio_id=-1; | |
728 video_id=-1; | |
729 dvdsub_id=-1; | |
730 vobsub_id=-1; | |
731 stream_cache_size=-1; | |
732 autosync=0; | |
733 vcd_track=0; | |
734 dvd_title=0; | |
9055 | 735 force_fps=0; |
8423 | 736 } |
737 wsPostRedisplay( &appMPlayer.subWindow ); | |
738 break; | |
739 case guiSetParameters: | |
9055 | 740 guiGetEvent( guiSetDefaults,NULL ); |
8423 | 741 switch ( guiIntfStruct.StreamType ) |
742 { | |
743 case STREAMTYPE_PLAYLIST: | |
744 break; | |
745 #ifdef HAVE_VCD | |
746 case STREAMTYPE_VCD: | |
9812
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
747 { |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
748 char tmp[512]; |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
749 sprintf( tmp,"vcd://%d",guiIntfStruct.Track + 1 ); |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
750 guiSetFilename( guiIntfStruct.Filename,tmp ); |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
751 } |
8423 | 752 break; |
753 #endif | |
754 #ifdef USE_DVDREAD | |
755 case STREAMTYPE_DVD: | |
9812
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
756 { |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
757 char tmp[512]; |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
758 sprintf( tmp,"dvd://%d",guiIntfStruct.Title ); |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
759 guiSetFilename( guiIntfStruct.Filename,tmp ); |
22092ed814ad
fix dvd, vcd playing, compiling, and add one small playlist patch
pontscho
parents:
9625
diff
changeset
|
760 } |
8423 | 761 dvd_chapter=guiIntfStruct.Chapter; |
762 dvd_angle=guiIntfStruct.Angle; | |
763 break; | |
764 #endif | |
6794 | 765 } |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
766 //if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore! |
8423 | 767 { |
768 if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename ); | |
769 else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename ); | |
770 } | |
7009 | 771 // --- video opts |
7019 | 772 |
7582 | 773 if ( !video_driver_list ) |
6794 | 774 { |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
775 int i = 0; |
6903 | 776 while ( video_out_drivers[i++] ) |
777 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
778 { | |
8150 | 779 gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name ); |
6903 | 780 break; |
781 } | |
6794 | 782 } |
783 | |
7582 | 784 if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } |
7009 | 785 |
786 { | |
787 int i = 0; | |
788 guiIntfStruct.NoWindow=False; | |
789 while ( video_out_drivers[i++] ) | |
790 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
6794 | 791 { |
8150 | 792 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 | 793 { guiIntfStruct.NoWindow=True; break; } |
6794 | 794 } |
7009 | 795 } |
796 | |
797 #ifdef HAVE_DXR3 | |
8043 | 798 #ifdef USE_LIBAVCODEC |
7009 | 799 remove_vop( "lavc" ); |
8043 | 800 #endif |
801 #ifdef USE_LIBFAME | |
7009 | 802 remove_vop( "fame" ); |
8043 | 803 #endif |
7582 | 804 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) ) |
7009 | 805 { |
806 if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) ) | |
807 { | |
8043 | 808 #ifdef USE_LIBAVCODEC |
7009 | 809 if ( gtkVopLAVC ) add_vop( "lavc" ); |
8043 | 810 #endif |
811 #ifdef USE_LIBFAME | |
7009 | 812 if ( gtkVopFAME ) add_vop( "fame" ); |
8043 | 813 #endif |
7009 | 814 } |
815 } | |
816 #endif | |
817 // --- | |
7019 | 818 if ( gtkVopPP ) add_vop( "pp" ); |
819 else remove_vop( "pp" ); | |
6794 | 820 |
821 // --- 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
|
822 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } |
14254 | 823 if (gtkAONorm) |
824 greplace(&af_cfg.list, "volnorm", "volnorm"); | |
825 if (gtkEnableAudioEqualizer) | |
826 greplace(&af_cfg.list, "equalizer", "equalizer"); | |
6794 | 827 if ( gtkAOExtraStereo ) |
828 { | |
14254 | 829 char *name = malloc(12 + 20 + 1); |
830 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); | |
831 name[12 + 20] = 0; | |
832 greplace(&af_cfg.list, "extrastereo", name); | |
833 free(name); | |
6794 | 834 } |
8600
54eac4cf587c
Lots of functions and variables specific to OSS audio are used without
arpi
parents:
8484
diff
changeset
|
835 #ifdef USE_OSS_AUDIO |
12918 | 836 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) ) |
6794 | 837 { |
12918 | 838 char *tmp; |
839 mixer_device = gtkAOOSSMixer; | |
840 mixer_channel = gtkAOOSSMixerChannel; | |
841 if (gtkAOOSSDevice) { | |
842 tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 ); | |
7019 | 843 sprintf( tmp,"oss:%s",gtkAOOSSDevice ); |
12918 | 844 } else |
845 tmp = "oss"; | |
846 gaddlist( &audio_driver_list,tmp ); | |
847 } | |
848 #endif | |
849 #if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X) | |
850 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) ) | |
851 { | |
852 char *tmp; | |
853 mixer_device = gtkAOALSAMixer; | |
854 mixer_channel = gtkAOALSAMixerChannel; | |
855 if (gtkAOALSADevice) { | |
856 tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 ); | |
857 sprintf( tmp,"alsa:device=%s",gtkAOALSADevice ); | |
858 } else | |
859 tmp = "alsa"; | |
7582 | 860 gaddlist( &audio_driver_list,tmp ); |
7019 | 861 } |
8615 | 862 #endif |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
863 #ifdef HAVE_SDL |
12918 | 864 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) ) |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
865 { |
12918 | 866 char *tmp; |
867 if (gtkAOSDLDriver) { | |
868 tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 ); | |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
869 sprintf( tmp,"sdl:%s",gtkAOSDLDriver ); |
12918 | 870 } else |
871 tmp = "sdl"; | |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
872 gaddlist( &audio_driver_list,tmp ); |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
873 } |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
874 #endif |
6794 | 875 // -- subtitle |
876 #ifdef USE_SUB | |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
877 //subdata->filename=gstrdup( guiIntfStruct.Subtitlename ); |
6794 | 878 stream_dump_type=0; |
879 if ( gtkSubDumpMPSub ) stream_dump_type=4; | |
880 if ( gtkSubDumpSrt ) stream_dump_type=6; | |
881 gtkSubDumpMPSub=gtkSubDumpSrt=0; | |
6627 | 882 #endif |
6794 | 883 #if defined( USE_OSD ) || defined( USE_SUB ) |
884 guiLoadFont(); | |
6627 | 885 #endif |
886 | |
6794 | 887 // --- misc |
8423 | 888 if ( gtkCacheOn ) stream_cache_size=gtkCacheSize; |
8484 | 889 if ( gtkAutoSyncOn ) autosync=gtkAutoSync; |
8423 | 890 |
8484 | 891 if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile ); |
892 else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream ); | |
893 //audio_stream=NULL; | |
6627 | 894 |
8423 | 895 guiIntfStruct.DiskChanged=0; |
896 guiIntfStruct.FilenameChanged=0; | |
897 guiIntfStruct.NewPlay=0; | |
898 | |
6627 | 899 break; |
4798 | 900 } |
7009 | 901 return False; |
4798 | 902 } |
903 | |
904 void guiEventHandling( void ) | |
905 { | |
7009 | 906 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
907 gtkEventHandling(); |
4798 | 908 } |
6627 | 909 |
910 // --- | |
911 | |
912 float gtkEquChannels[6][10]; | |
913 | |
6713 | 914 plItem * plCurrent = NULL; |
915 plItem * plList = NULL; | |
916 plItem * plLastPlayed = NULL; | |
917 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
918 URLItem *URLList = NULL; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
919 |
9055 | 920 char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL }; |
921 | |
6713 | 922 #if defined( MP_DEBUG ) && 0 |
923 void list( void ) | |
6627 | 924 { |
6713 | 925 plItem * next = plList; |
926 printf( "--- list ---\n" ); | |
927 while( next || next->next ) | |
928 { | |
929 printf( "item: %s/%s\n",next->path,next->name ); | |
930 if ( next->next ) next=next->next; else break; | |
931 } | |
932 printf( "--- end of list ---\n" ); | |
933 } | |
934 #else | |
935 #define list(); | |
936 #endif | |
937 | |
938 void * gtkSet( int cmd,float fparam, void * vparam ) | |
939 { | |
6627 | 940 equalizer_t * eq = (equalizer_t *)vparam; |
6713 | 941 plItem * item = (plItem *)vparam; |
6627 | 942 |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
943 URLItem * url_item = (URLItem *)vparam; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
944 int is_added = True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
945 |
6627 | 946 switch ( cmd ) |
947 { | |
6713 | 948 // --- handle playlist |
6755 | 949 case gtkAddPlItem: // add item to playlist |
6713 | 950 if ( plList ) |
951 { | |
952 plItem * next = plList; | |
953 while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; } | |
954 next->next=item; item->prev=next; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
955 } else { item->prev=item->next=NULL; plCurrent=plList=item; } |
6713 | 956 list(); |
957 return NULL; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
958 case gtkInsertPlItem: // add item into playlist after current |
6713 | 959 if ( plCurrent ) |
960 { | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
961 plItem * curr = plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
962 item->next=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
963 if (item->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
964 item->next->prev=item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
965 item->prev=curr; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
966 curr->next=item; |
6713 | 967 plCurrent=plCurrent->next; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
968 return plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
969 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
970 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
971 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
|
972 return NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
973 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
|
974 if ( plCurrent && plCurrent->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
975 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
976 plCurrent=plCurrent->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
977 /*if ( !plCurrent && plList ) |
6713 | 978 { |
979 plItem * next = plList; | |
980 while ( next->next ) { if ( !next->next ) break; next=next->next; } | |
981 plCurrent=next; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
982 }*/ |
6713 | 983 return plCurrent; |
984 } | |
985 return NULL; | |
986 case gtkGetPrevPlItem: | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
987 if ( plCurrent && plCurrent->prev) |
6713 | 988 { |
989 plCurrent=plCurrent->prev; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
990 //if ( !plCurrent && plList ) plCurrent=plList; |
6713 | 991 return plCurrent; |
992 } | |
6794 | 993 return NULL; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
994 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
|
995 plCurrent=item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
996 return plCurrent; |
6713 | 997 case gtkGetCurrPlItem: // get current item |
998 return plCurrent; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
999 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
|
1000 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1001 plItem * curr = plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1002 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1003 if (!curr) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1004 return NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1005 if (curr->prev) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1006 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
|
1007 if (curr->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1008 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
|
1009 if (curr==plList) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1010 plList=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1011 plCurrent=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1012 // Free it |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1013 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
|
1014 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
|
1015 free( curr ); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1016 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1017 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
|
1018 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1019 return plCurrent; |
6713 | 1020 case gtkDelPl: // delete list |
1021 { | |
1022 plItem * curr = plList; | |
1023 plItem * next; | |
1024 if ( !plList ) return NULL; | |
1025 if ( !curr->next ) | |
1026 { | |
1027 if ( curr->path ) free( curr->path ); | |
1028 if ( curr->name ) free( curr->name ); | |
1029 free( curr ); | |
1030 } | |
1031 else | |
1032 { | |
1033 while ( curr->next ) | |
1034 { | |
1035 next=curr->next; | |
1036 if ( curr->path ) free( curr->path ); | |
1037 if ( curr->name ) free( curr->name ); | |
1038 free( curr ); | |
1039 curr=next; | |
1040 } | |
1041 } | |
1042 plList=NULL; plCurrent=NULL; | |
1043 } | |
1044 return NULL; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1045 // ----- Handle url |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1046 case gtkAddURLItem: |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1047 if ( URLList ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1048 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1049 URLItem * next_url = URLList; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1050 is_added = False; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1051 while ( next_url->next ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1052 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1053 if ( !gstrcmp( next_url->url,url_item->url ) ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1054 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1055 is_added=True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1056 break; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1057 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1058 next_url=next_url->next; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1059 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1060 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
|
1061 } else { url_item->next=NULL; URLList=url_item; } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1062 return NULL; |
6794 | 1063 // --- subtitle |
7139 | 1064 #ifndef HAVE_FREETYPE |
6794 | 1065 case gtkSetFontFactor: |
7019 | 1066 font_factor=fparam; |
6794 | 1067 guiLoadFont(); |
1068 return NULL; | |
7139 | 1069 #else |
1070 case gtkSetFontOutLine: | |
1071 subtitle_font_thickness=( 8.0f / 100.0f ) * fparam; | |
1072 guiLoadFont(); | |
1073 return NULL; | |
1074 case gtkSetFontBlur: | |
1075 subtitle_font_radius=( 8.0f / 100.0f ) * fparam; | |
1076 guiLoadFont(); | |
1077 return NULL; | |
1078 case gtkSetFontTextScale: | |
1079 text_font_scale_factor=fparam; | |
1080 guiLoadFont(); | |
1081 return NULL; | |
1082 case gtkSetFontOSDScale: | |
1083 osd_font_scale_factor=fparam; | |
1084 guiLoadFont(); | |
1085 return NULL; | |
1086 case gtkSetFontEncoding: | |
9056 | 1087 gfree( (void **)&subtitle_font_encoding ); |
7139 | 1088 subtitle_font_encoding=gstrdup( (char *)vparam ); |
1089 guiLoadFont(); | |
1090 return NULL; | |
1091 case gtkSetFontAutoScale: | |
1092 subtitle_autoscale=(int)fparam; | |
1093 guiLoadFont(); | |
1094 return NULL; | |
1095 #endif | |
9056 | 1096 #ifdef USE_ICONV |
1097 case gtkSetSubEncoding: | |
1098 gfree( (void **)&sub_cp ); | |
1099 sub_cp=gstrdup( (char *)vparam ); | |
1100 break; | |
6794 | 1101 #endif |
1102 // --- misc | |
1103 case gtkClearStruct: | |
7009 | 1104 if ( (unsigned int)vparam & guiFilenames ) |
6794 | 1105 { |
1106 gfree( (void **)&guiIntfStruct.Filename ); | |
1107 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
1108 gfree( (void **)&guiIntfStruct.AudioFile ); | |
7009 | 1109 gtkSet( gtkDelPl,0,NULL ); |
6794 | 1110 } |
1111 #ifdef USE_DVDREAD | |
7009 | 1112 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) ); |
6794 | 1113 #endif |
1114 #ifdef HAVE_VCD | |
7009 | 1115 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0; |
6794 | 1116 #endif |
1117 return NULL; | |
1118 case gtkSetExtraStereo: | |
1119 gtkAOExtraStereoMul=fparam; | |
14254 | 1120 if (guiIntfStruct.afilter) |
1121 af_control_any_rev(guiIntfStruct.afilter, | |
1122 AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul); | |
6794 | 1123 return NULL; |
1124 case gtkSetPanscan: | |
7217 | 1125 { |
1126 mp_cmd_t * mp_cmd; | |
1127 mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); | |
1128 mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" ); | |
1129 mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1; | |
1130 mp_input_queue_cmd( mp_cmd ); | |
1131 } | |
6794 | 1132 return NULL; |
1133 case gtkSetAutoq: | |
7019 | 1134 auto_quality=(int)fparam; |
6794 | 1135 return NULL; |
6713 | 1136 // --- set equalizers |
6627 | 1137 case gtkSetContrast: |
7217 | 1138 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam ); |
1139 return NULL; | |
6627 | 1140 case gtkSetBrightness: |
7217 | 1141 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam ); |
1142 return NULL; | |
6627 | 1143 case gtkSetHue: |
7217 | 1144 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam ); |
1145 return NULL; | |
6627 | 1146 case gtkSetSaturation: |
7217 | 1147 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam ); |
1148 return NULL; | |
6627 | 1149 case gtkSetEqualizer: |
14254 | 1150 { |
1151 af_control_ext_t tmp; | |
6627 | 1152 if ( eq ) |
1153 { | |
1154 gtkEquChannels[eq->channel][eq->band]=eq->gain; | |
14254 | 1155 tmp.ch = eq->channel; |
1156 tmp.arg = gtkEquChannels[eq->channel]; | |
1157 if (guiIntfStruct.afilter) | |
1158 af_control_any_rev(guiIntfStruct.afilter, | |
1159 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); | |
6627 | 1160 } |
1161 else | |
1162 { | |
14254 | 1163 int i; |
6627 | 1164 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) ); |
14254 | 1165 if (guiIntfStruct.afilter) |
6627 | 1166 for ( i=0;i<6;i++ ) |
14254 | 1167 { |
1168 tmp.ch = i; | |
1169 tmp.arg = gtkEquChannels[i]; | |
1170 af_control_any_rev(guiIntfStruct.afilter, | |
1171 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); | |
1172 } | |
6627 | 1173 } |
6713 | 1174 return NULL; |
14254 | 1175 } |
6627 | 1176 } |
6713 | 1177 return NULL; |
6627 | 1178 } |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1179 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1180 #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
|
1181 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1182 #include "../playtree.h" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1183 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1184 //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
|
1185 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1186 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
|
1187 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1188 char *filename, *pathname; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1189 plItem * item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1190 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1191 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
|
1192 pathname = strdup(temp); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1193 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
|
1194 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
|
1195 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1196 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
|
1197 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
|
1198 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
|
1199 if (!item) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1200 return 0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1201 item->name=filename; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1202 item->path=pathname; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1203 if (insert) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1204 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
|
1205 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1206 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
|
1207 return 1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1208 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1209 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1210 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1211 // 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
|
1212 // by either: |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1213 // - 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
|
1214 // - 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
|
1215 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1216 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
|
1217 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1218 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
|
1219 int result=0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1220 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1221 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
|
1222 gtkSet(gtkDelPl,0,0); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1223 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1224 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
|
1225 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1226 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
|
1227 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1228 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
|
1229 result=1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1230 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1231 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1232 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1233 mplCurr(); // Update filename |
10193 | 1234 mplGotoTheNext=1; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1235 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1236 if (!enqueue) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1237 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
|
1238 // 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
|
1239 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1240 filename=NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1241 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1242 return result; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1243 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1244 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1245 // 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
|
1246 // 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
|
1247 // |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1248 // 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
|
1249 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1250 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
|
1251 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1252 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
|
1253 int result=0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1254 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
|
1255 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1256 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
|
1257 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1258 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
|
1259 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1260 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
|
1261 result=1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1262 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1263 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
|
1264 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1265 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1266 if (save) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1267 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
|
1268 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1269 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
|
1270 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1271 if (save && result) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1272 gtkSet(gtkDelCurrPlItem, 0, 0); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1273 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1274 mplCurr(); // Update filename |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1275 filename=NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1276 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1277 return result; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1278 } |