comparison Gui/mplayer/play.c @ 6794:77980ab4e296

- add preferences support (first try) - fix some playlist bug - fix some equ bug - fix some redraw bug - fix dvd playing - fix file open dialog box - etc.
author pontscho
date Thu, 25 Jul 2002 20:26:38 +0000
parents cc917a581b6e
children 397e7a1860f9
comparison
equal deleted inserted replaced
6793:48d432a8d531 6794:77980ab4e296
89 { 89 {
90 plItem * next; 90 plItem * next;
91 91
92 if ( !mplGotoTheNext ) { mplGotoTheNext=1; return; } 92 if ( !mplGotoTheNext ) { mplGotoTheNext=1; return; }
93 93
94 if ( (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next ) 94 if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
95 { 95 {
96 plLastPlayed=next; 96 plLastPlayed=next;
97 guiSetDF( guiIntfStruct.Filename,next->path,next->name ); 97 guiSetDF( guiIntfStruct.Filename,next->path,next->name );
98 guiIntfStruct.StreamType=STREAMTYPE_FILE; 98 guiIntfStruct.StreamType=STREAMTYPE_FILE;
99 guiIntfStruct.FilenameChanged=1; 99 guiIntfStruct.FilenameChanged=1;
100 if ( guiIntfStruct.AudioFile ) free( guiIntfStruct.AudioFile ); 100 if ( guiIntfStruct.AudioFile ) free( guiIntfStruct.AudioFile );
101 guiIntfStruct.AudioFile=NULL; 101 guiIntfStruct.AudioFile=NULL;
102 } else mplStop(); 102 }
103 } 103 else
104 104 {
105 void mplStop( void ) 105 guiIntfStruct.TimeSec=0;
106 { 106 guiIntfStruct.Position=0;
107 guiIntfStruct.Playing=0; 107 guiIntfStruct.AudioType=0;
108 guiIntfStruct.TimeSec=0; 108
109 guiIntfStruct.Position=0; 109 if ( !appMPlayer.subWindow.isFullScreen )
110 guiIntfStruct.AudioType=0; 110 {
111 111 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
112 if ( !appMPlayer.subWindow.isFullScreen ) 112 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
113 { 113 }
114 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); 114 guiGetEvent( guiCEvent,guiSetStop );
115 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); 115 mplSubRender=1;
116 } 116 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
117 guiGetEvent( guiCEvent,guiSetStop ); 117 wsClearWindow( appMPlayer.subWindow );
118 mplSubRender=1; 118 wsPostRedisplay( &appMPlayer.subWindow );
119 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); 119 }
120 wsClearWindow( appMPlayer.subWindow );
121 wsPostRedisplay( &appMPlayer.subWindow );
122 } 120 }
123 121
124 void mplPlay( void ) 122 void mplPlay( void )
125 { 123 {
126 if ( ( !guiIntfStruct.Filename )|| 124 if ( ( !guiIntfStruct.Filename )||
127 ( guiIntfStruct.Filename[0] == 0 )|| 125 ( guiIntfStruct.Filename[0] == 0 )||
128 ( guiIntfStruct.Playing == 1 ) ) return; 126 ( guiIntfStruct.Playing == 1 ) ) return;
129 if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; } 127 if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
130 guiGetEvent( guiCEvent,guiSetPlay ); 128 guiGetEvent( guiCEvent,(void *)guiSetPlay );
131 mplSubRender=0; 129 mplSubRender=0;
132 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); 130 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
133 wsClearWindow( appMPlayer.subWindow ); 131 wsClearWindow( appMPlayer.subWindow );
134 // wsPostRedisplay( &appMPlayer.subWindow );
135 } 132 }
136 133
137 void mplPause( void ) 134 void mplPause( void )
138 { 135 {
139 mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) ); 136 if ( !guiIntfStruct.Playing ) return;
140 cmd->id=MP_CMD_PAUSE; 137 if ( guiIntfStruct.Playing == 1 )
141 cmd->name=strdup("pause"); 138 {
142 mp_input_queue_cmd(cmd); 139 mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) );
143 mplSubRender=0; 140 cmd->id=MP_CMD_PAUSE;
141 cmd->name=strdup("pause");
142 mp_input_queue_cmd(cmd);
143 } else guiIntfStruct.Playing=1;
144 } 144 }
145 145
146 void mplState( void ) 146 void mplState( void )
147 { 147 {
148 if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) ) 148 if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
237 btnModify( evSetBalance,guiIntfStruct.Balance ); 237 btnModify( evSetBalance,guiIntfStruct.Balance );
238 btnModify( evSetMoviePosition,guiIntfStruct.Position ); 238 btnModify( evSetMoviePosition,guiIntfStruct.Position );
239 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); 239 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
240 } 240 }
241 241
242 void mplSetFileName( char * fname ) 242 void mplSetFileName( char * dir,char * name )
243 { 243 {
244 if ( !fname ) return; 244 if ( !name || !dir ) return;
245 if ( guiIntfStruct.Filename ) free( guiIntfStruct.Filename ); 245 guiSetDF( guiIntfStruct.Filename,dir,name );
246 guiIntfStruct.Filename=strdup( fname ); 246 guiIntfStruct.StreamType=STREAMTYPE_FILE;
247 guiIntfStruct.FilenameChanged=1;
248 gfree( (void **)&guiIntfStruct.AudioFile );
249 gfree( (void **)&guiIntfStruct.Subtitlename );
247 } 250 }
248 251
249 void mplPrev( void ) 252 void mplPrev( void )
250 { 253 {
251 plItem * prev; 254 plItem * prev;
268 case STREAMTYPE_VCD: 271 case STREAMTYPE_VCD:
269 if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; } 272 if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
270 break; 273 break;
271 #endif 274 #endif
272 default: 275 default:
273 if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) ) { mplGotoTheNext=0; break; } 276 if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) )
274 // { 277 {
275 // guiSetDF( guiIntfStruct.Filename,prev->path,prev->name ); 278 mplSetFileName( prev->path,prev->name );
276 // guiIntfStruct.FilenameChanged=1; 279 mplGotoTheNext=0;
277 // break; 280 break;
278 // } 281 }
279 return; 282 return;
280 } 283 }
281 if ( stop ) mplEventHandling( evStop,0 ); 284 if ( stop ) mplEventHandling( evStop,0 );
282 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); 285 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
283 } 286 }
304 case STREAMTYPE_VCD: 307 case STREAMTYPE_VCD:
305 if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; } 308 if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
306 break; 309 break;
307 #endif 310 #endif
308 default: 311 default:
309 if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) ) { mplGotoTheNext=0; break; } 312 if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) )
310 // { 313 {
311 // guiSetDF( guiIntfStruct.Filename,next->path,next->name ); 314 mplSetFileName( next->path,next->name );
312 // guiIntfStruct.FilenameChanged=1; 315 mplGotoTheNext=0;
313 // break; 316 break;
314 // } 317 }
315 return; 318 return;
316 } 319 }
317 if ( stop ) mplEventHandling( evStop,0 ); 320 if ( stop ) mplEventHandling( evStop,0 );
318 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); 321 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
319 } 322 }