Mercurial > mplayer.hg
annotate Gui/interface.c @ 14627:cd16b26cf6e0
Yet another memleak...
author | reimar |
---|---|
date | Mon, 31 Jan 2005 18:16:39 +0000 |
parents | db75b76c11b2 |
children | e2b2ab284a9a |
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" |
14405
db75b76c11b2
libao2/eq.h was removed, use libaf/equalizer.h instead.
reimar
parents:
14254
diff
changeset
|
31 #include "../libaf/equalizer.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 |
14627 | 845 tmp = strdup("oss"); |
12918 | 846 gaddlist( &audio_driver_list,tmp ); |
14627 | 847 free(tmp); |
12918 | 848 } |
849 #endif | |
850 #if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X) | |
851 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) ) | |
852 { | |
853 char *tmp; | |
854 mixer_device = gtkAOALSAMixer; | |
855 mixer_channel = gtkAOALSAMixerChannel; | |
856 if (gtkAOALSADevice) { | |
857 tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 ); | |
858 sprintf( tmp,"alsa:device=%s",gtkAOALSADevice ); | |
859 } else | |
14627 | 860 tmp = strdup("alsa"); |
7582 | 861 gaddlist( &audio_driver_list,tmp ); |
14627 | 862 free(tmp); |
7019 | 863 } |
8615 | 864 #endif |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
865 #ifdef HAVE_SDL |
12918 | 866 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
|
867 { |
12918 | 868 char *tmp; |
869 if (gtkAOSDLDriver) { | |
870 tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 ); | |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
871 sprintf( tmp,"sdl:%s",gtkAOSDLDriver ); |
12918 | 872 } else |
14627 | 873 tmp = strdup("sdl"); |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
874 gaddlist( &audio_driver_list,tmp ); |
14627 | 875 free(tmp); |
8714
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
876 } |
a88f827ec563
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
pontscho
parents:
8635
diff
changeset
|
877 #endif |
6794 | 878 // -- subtitle |
879 #ifdef USE_SUB | |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9812
diff
changeset
|
880 //subdata->filename=gstrdup( guiIntfStruct.Subtitlename ); |
6794 | 881 stream_dump_type=0; |
882 if ( gtkSubDumpMPSub ) stream_dump_type=4; | |
883 if ( gtkSubDumpSrt ) stream_dump_type=6; | |
884 gtkSubDumpMPSub=gtkSubDumpSrt=0; | |
6627 | 885 #endif |
6794 | 886 #if defined( USE_OSD ) || defined( USE_SUB ) |
887 guiLoadFont(); | |
6627 | 888 #endif |
889 | |
6794 | 890 // --- misc |
8423 | 891 if ( gtkCacheOn ) stream_cache_size=gtkCacheSize; |
8484 | 892 if ( gtkAutoSyncOn ) autosync=gtkAutoSync; |
8423 | 893 |
8484 | 894 if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile ); |
895 else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream ); | |
896 //audio_stream=NULL; | |
6627 | 897 |
8423 | 898 guiIntfStruct.DiskChanged=0; |
899 guiIntfStruct.FilenameChanged=0; | |
900 guiIntfStruct.NewPlay=0; | |
901 | |
6627 | 902 break; |
4798 | 903 } |
7009 | 904 return False; |
4798 | 905 } |
906 | |
907 void guiEventHandling( void ) | |
908 { | |
7009 | 909 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents(); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
910 gtkEventHandling(); |
4798 | 911 } |
6627 | 912 |
913 // --- | |
914 | |
915 float gtkEquChannels[6][10]; | |
916 | |
6713 | 917 plItem * plCurrent = NULL; |
918 plItem * plList = NULL; | |
919 plItem * plLastPlayed = NULL; | |
920 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
921 URLItem *URLList = NULL; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
922 |
9055 | 923 char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL }; |
924 | |
6713 | 925 #if defined( MP_DEBUG ) && 0 |
926 void list( void ) | |
6627 | 927 { |
6713 | 928 plItem * next = plList; |
929 printf( "--- list ---\n" ); | |
930 while( next || next->next ) | |
931 { | |
932 printf( "item: %s/%s\n",next->path,next->name ); | |
933 if ( next->next ) next=next->next; else break; | |
934 } | |
935 printf( "--- end of list ---\n" ); | |
936 } | |
937 #else | |
938 #define list(); | |
939 #endif | |
940 | |
941 void * gtkSet( int cmd,float fparam, void * vparam ) | |
942 { | |
6627 | 943 equalizer_t * eq = (equalizer_t *)vparam; |
6713 | 944 plItem * item = (plItem *)vparam; |
6627 | 945 |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
946 URLItem * url_item = (URLItem *)vparam; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
947 int is_added = True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
948 |
6627 | 949 switch ( cmd ) |
950 { | |
6713 | 951 // --- handle playlist |
6755 | 952 case gtkAddPlItem: // add item to playlist |
6713 | 953 if ( plList ) |
954 { | |
955 plItem * next = plList; | |
956 while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; } | |
957 next->next=item; item->prev=next; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
958 } else { item->prev=item->next=NULL; plCurrent=plList=item; } |
6713 | 959 list(); |
960 return NULL; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
961 case gtkInsertPlItem: // add item into playlist after current |
6713 | 962 if ( plCurrent ) |
963 { | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
964 plItem * curr = plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
965 item->next=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
966 if (item->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
967 item->next->prev=item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
968 item->prev=curr; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
969 curr->next=item; |
6713 | 970 plCurrent=plCurrent->next; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
971 return plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
972 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
973 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
974 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
|
975 return NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
976 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
|
977 if ( plCurrent && plCurrent->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
978 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
979 plCurrent=plCurrent->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
980 /*if ( !plCurrent && plList ) |
6713 | 981 { |
982 plItem * next = plList; | |
983 while ( next->next ) { if ( !next->next ) break; next=next->next; } | |
984 plCurrent=next; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
985 }*/ |
6713 | 986 return plCurrent; |
987 } | |
988 return NULL; | |
989 case gtkGetPrevPlItem: | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
990 if ( plCurrent && plCurrent->prev) |
6713 | 991 { |
992 plCurrent=plCurrent->prev; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
993 //if ( !plCurrent && plList ) plCurrent=plList; |
6713 | 994 return plCurrent; |
995 } | |
6794 | 996 return NULL; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
997 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
|
998 plCurrent=item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
999 return plCurrent; |
6713 | 1000 case gtkGetCurrPlItem: // get current item |
1001 return plCurrent; | |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1002 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
|
1003 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1004 plItem * curr = plCurrent; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1005 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1006 if (!curr) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1007 return NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1008 if (curr->prev) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1009 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
|
1010 if (curr->next) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1011 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
|
1012 if (curr==plList) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1013 plList=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1014 plCurrent=curr->next; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1015 // Free it |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1016 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
|
1017 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
|
1018 free( curr ); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1019 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1020 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
|
1021 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1022 return plCurrent; |
6713 | 1023 case gtkDelPl: // delete list |
1024 { | |
1025 plItem * curr = plList; | |
1026 plItem * next; | |
1027 if ( !plList ) return NULL; | |
1028 if ( !curr->next ) | |
1029 { | |
1030 if ( curr->path ) free( curr->path ); | |
1031 if ( curr->name ) free( curr->name ); | |
1032 free( curr ); | |
1033 } | |
1034 else | |
1035 { | |
1036 while ( curr->next ) | |
1037 { | |
1038 next=curr->next; | |
1039 if ( curr->path ) free( curr->path ); | |
1040 if ( curr->name ) free( curr->name ); | |
1041 free( curr ); | |
1042 curr=next; | |
1043 } | |
1044 } | |
1045 plList=NULL; plCurrent=NULL; | |
1046 } | |
1047 return NULL; | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1048 // ----- Handle url |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1049 case gtkAddURLItem: |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1050 if ( URLList ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1051 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1052 URLItem * next_url = URLList; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1053 is_added = False; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1054 while ( next_url->next ) |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1055 { |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1056 if ( !gstrcmp( next_url->url,url_item->url ) ) |
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 is_added=True; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1059 break; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1060 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1061 next_url=next_url->next; |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1062 } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1063 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
|
1064 } else { url_item->next=NULL; URLList=url_item; } |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
7019
diff
changeset
|
1065 return NULL; |
6794 | 1066 // --- subtitle |
7139 | 1067 #ifndef HAVE_FREETYPE |
6794 | 1068 case gtkSetFontFactor: |
7019 | 1069 font_factor=fparam; |
6794 | 1070 guiLoadFont(); |
1071 return NULL; | |
7139 | 1072 #else |
1073 case gtkSetFontOutLine: | |
1074 subtitle_font_thickness=( 8.0f / 100.0f ) * fparam; | |
1075 guiLoadFont(); | |
1076 return NULL; | |
1077 case gtkSetFontBlur: | |
1078 subtitle_font_radius=( 8.0f / 100.0f ) * fparam; | |
1079 guiLoadFont(); | |
1080 return NULL; | |
1081 case gtkSetFontTextScale: | |
1082 text_font_scale_factor=fparam; | |
1083 guiLoadFont(); | |
1084 return NULL; | |
1085 case gtkSetFontOSDScale: | |
1086 osd_font_scale_factor=fparam; | |
1087 guiLoadFont(); | |
1088 return NULL; | |
1089 case gtkSetFontEncoding: | |
9056 | 1090 gfree( (void **)&subtitle_font_encoding ); |
7139 | 1091 subtitle_font_encoding=gstrdup( (char *)vparam ); |
1092 guiLoadFont(); | |
1093 return NULL; | |
1094 case gtkSetFontAutoScale: | |
1095 subtitle_autoscale=(int)fparam; | |
1096 guiLoadFont(); | |
1097 return NULL; | |
1098 #endif | |
9056 | 1099 #ifdef USE_ICONV |
1100 case gtkSetSubEncoding: | |
1101 gfree( (void **)&sub_cp ); | |
1102 sub_cp=gstrdup( (char *)vparam ); | |
1103 break; | |
6794 | 1104 #endif |
1105 // --- misc | |
1106 case gtkClearStruct: | |
7009 | 1107 if ( (unsigned int)vparam & guiFilenames ) |
6794 | 1108 { |
1109 gfree( (void **)&guiIntfStruct.Filename ); | |
1110 gfree( (void **)&guiIntfStruct.Subtitlename ); | |
1111 gfree( (void **)&guiIntfStruct.AudioFile ); | |
7009 | 1112 gtkSet( gtkDelPl,0,NULL ); |
6794 | 1113 } |
1114 #ifdef USE_DVDREAD | |
7009 | 1115 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) ); |
6794 | 1116 #endif |
1117 #ifdef HAVE_VCD | |
7009 | 1118 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0; |
6794 | 1119 #endif |
1120 return NULL; | |
1121 case gtkSetExtraStereo: | |
1122 gtkAOExtraStereoMul=fparam; | |
14254 | 1123 if (guiIntfStruct.afilter) |
1124 af_control_any_rev(guiIntfStruct.afilter, | |
1125 AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul); | |
6794 | 1126 return NULL; |
1127 case gtkSetPanscan: | |
7217 | 1128 { |
1129 mp_cmd_t * mp_cmd; | |
1130 mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); | |
1131 mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" ); | |
1132 mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1; | |
1133 mp_input_queue_cmd( mp_cmd ); | |
1134 } | |
6794 | 1135 return NULL; |
1136 case gtkSetAutoq: | |
7019 | 1137 auto_quality=(int)fparam; |
6794 | 1138 return NULL; |
6713 | 1139 // --- set equalizers |
6627 | 1140 case gtkSetContrast: |
7217 | 1141 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam ); |
1142 return NULL; | |
6627 | 1143 case gtkSetBrightness: |
7217 | 1144 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam ); |
1145 return NULL; | |
6627 | 1146 case gtkSetHue: |
7217 | 1147 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam ); |
1148 return NULL; | |
6627 | 1149 case gtkSetSaturation: |
7217 | 1150 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam ); |
1151 return NULL; | |
6627 | 1152 case gtkSetEqualizer: |
14254 | 1153 { |
1154 af_control_ext_t tmp; | |
6627 | 1155 if ( eq ) |
1156 { | |
1157 gtkEquChannels[eq->channel][eq->band]=eq->gain; | |
14254 | 1158 tmp.ch = eq->channel; |
1159 tmp.arg = gtkEquChannels[eq->channel]; | |
1160 if (guiIntfStruct.afilter) | |
1161 af_control_any_rev(guiIntfStruct.afilter, | |
1162 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); | |
6627 | 1163 } |
1164 else | |
1165 { | |
14254 | 1166 int i; |
6627 | 1167 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) ); |
14254 | 1168 if (guiIntfStruct.afilter) |
6627 | 1169 for ( i=0;i<6;i++ ) |
14254 | 1170 { |
1171 tmp.ch = i; | |
1172 tmp.arg = gtkEquChannels[i]; | |
1173 af_control_any_rev(guiIntfStruct.afilter, | |
1174 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); | |
1175 } | |
6627 | 1176 } |
6713 | 1177 return NULL; |
14254 | 1178 } |
6627 | 1179 } |
6713 | 1180 return NULL; |
6627 | 1181 } |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1182 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1183 #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
|
1184 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1185 #include "../playtree.h" |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1186 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1187 //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
|
1188 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1189 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
|
1190 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1191 char *filename, *pathname; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1192 plItem * item; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1193 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1194 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
|
1195 pathname = strdup(temp); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1196 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
|
1197 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
|
1198 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1199 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
|
1200 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
|
1201 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
|
1202 if (!item) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1203 return 0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1204 item->name=filename; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1205 item->path=pathname; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1206 if (insert) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1207 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
|
1208 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1209 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
|
1210 return 1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1211 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1212 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1213 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1214 // 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
|
1215 // by either: |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1216 // - 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
|
1217 // - 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
|
1218 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1219 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
|
1220 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1221 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
|
1222 int result=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 (!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
|
1225 gtkSet(gtkDelPl,0,0); |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1226 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1227 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
|
1228 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1229 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
|
1230 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1231 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
|
1232 result=1; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1233 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1234 } |
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 mplCurr(); // Update filename |
10193 | 1237 mplGotoTheNext=1; |
9291
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1238 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1239 if (!enqueue) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1240 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
|
1241 // 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
|
1242 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1243 filename=NULL; |
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 return result; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1246 } |
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 // 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
|
1249 // 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
|
1250 // |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1251 // 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
|
1252 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1253 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
|
1254 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1255 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
|
1256 int result=0; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1257 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
|
1258 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1259 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
|
1260 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1261 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
|
1262 { |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1263 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
|
1264 result=1; |
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 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
|
1267 } |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1268 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1269 if (save) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1270 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
|
1271 else |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1272 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
|
1273 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1274 if (save && result) |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1275 gtkSet(gtkDelCurrPlItem, 0, 0); |
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 mplCurr(); // Update filename |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1278 filename=NULL; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1279 |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1280 return result; |
64b8c5a07c2c
- It adds an option enqueue/noenqueue, so users can choose if they want to
arpi
parents:
9202
diff
changeset
|
1281 } |