annotate gui/mplayer/play.c @ 29100:1bdda4f68f5f

Avoid spurious rebuilds on svn up. The check to find out if the header file changed compared two lines to one, which would result in false positive updates.
author cehoyos
date Sat, 04 Apr 2009 19:50:57 +0000
parents 14c5017f40d2
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
19 #include <inttypes.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include <unistd.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include <signal.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
27 #include "config.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
28 #include "help_mp.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
29 #include "libvo/x11_common.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
30 #include "libvo/video_out.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
31 #include "input/input.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
32
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
33 #include "gui/wm/ws.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
34 #include "gui/wm/wsxdnd.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
36 #include "gui/app.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
37 #include "gui/wm/wskeys.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
38 #include "gui/interface.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40 #include "widgets.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41 #include "gmplayer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 #include "play.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
44 #include "gui/skin/skin.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
45 #include "gui/skin/font.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 #include "stream/stream.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 extern float rel_seek_secs;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 extern int abs_seek_pos;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 int mplGotoTheNext = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 void mplFullScreen( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 if ( guiIntfStruct.NoWindow && guiIntfStruct.Playing ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 switch ( appMPlayer.sub.x )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ) + wsOrgX; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 switch ( appMPlayer.sub.y )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69 case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ) + wsOrgY; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 if ( guiIntfStruct.Playing || gtkShowVideoWindow ) wsFullScreen( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 fullscreen=vo_fs=appMPlayer.subWindow.isFullScreen;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 if ( appMPlayer.menuIsPresent ) wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 void mplEnd( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 plItem * next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 if ( !mplGotoTheNext && guiIntfStruct.Playing) { mplGotoTheNext=1; return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 plLastPlayed=next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 guiSetDF( guiIntfStruct.Filename,next->path,next->name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 guiIntfStruct.StreamType=STREAMTYPE_FILE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 gfree( (void **)&guiIntfStruct.AudioFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 gfree( (void **)&guiIntfStruct.Subtitlename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 if ( guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 guiIntfStruct.TimeSec=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 guiIntfStruct.Position=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 guiIntfStruct.AudioType=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 guiIntfStruct.NoWindow=False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
107 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 guiIntfStruct.DVD.current_title=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 guiIntfStruct.DVD.current_angle=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 if ( !appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118 else wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 guiGetEvent( guiCEvent,guiSetStop );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 mplSubRender=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123 wsPostRedisplay( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 void mplPlay( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 if ( ( !guiIntfStruct.Filename )||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 ( guiIntfStruct.Filename[0] == 0 )||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 ( guiIntfStruct.Playing == 1 ) ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 guiGetEvent( guiCEvent,(void *)guiSetPlay );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 mplSubRender=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 void mplPause( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 if ( !guiIntfStruct.Playing ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 if ( guiIntfStruct.Playing == 1 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 mp_cmd_t * cmd = calloc( 1,sizeof( *cmd ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 cmd->id=MP_CMD_PAUSE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 cmd->name=strdup("pause");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 mp_input_queue_cmd(cmd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 } else guiIntfStruct.Playing=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 void mplState( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 btnModify( evPlaySwitchToPause,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 btnModify( evPauseSwitchToPlay,btnDisabled );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 btnModify( evPlaySwitchToPause,btnDisabled );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 btnModify( evPauseSwitchToPlay,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 float mplGetPosition( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 { // return 0.0 ... 100.0
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 return guiIntfStruct.Position;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 void mplRelSeek( float s )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 { // -+s
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 rel_seek_secs=s; abs_seek_pos=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 void mplAbsSeek( float s )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 { // 0.0 ... 100.0
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 rel_seek_secs=0.01*s; abs_seek_pos=3;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 listItems tmpList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 void ChangeSkin( char * name )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 int ret;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186 int prev = appMPlayer.menuIsPresent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 int bprev = appMPlayer.barIsPresent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189 mainVisible=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 appInitStruct( &tmpList );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 skinAppMPlayer=&tmpList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 fntFreeFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 ret=skinRead( name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 appInitStruct( &tmpList );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 skinAppMPlayer=&appMPlayer;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 appInitStruct( &appMPlayer );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 if ( ret ) name=skinName;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 if ( skinRead( name ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 mainVisible=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 // --- reload menu window
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 if ( prev && appMPlayer.menuIsPresent )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 } else { mplMenuInit(); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 // --- reload sub window
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 if ( !guiIntfStruct.Playing )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 mplSubRender=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 wsPostRedisplay( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235 // --- reload play bar
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 mplPBInit();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 // --- reload main window
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 if ( mplDrawBuffer ) free( mplDrawBuffer );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 if ( ( mplDrawBuffer = calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 wsDestroyWindow( &appMPlayer.mainWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 wsCreateWindow( &appMPlayer.mainWindow,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256 appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 wsXDNDMakeAwareness( &appMPlayer.mainWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 mainVisible=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 btnModify( evSetVolume,guiIntfStruct.Volume );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265 btnModify( evSetBalance,guiIntfStruct.Balance );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 btnModify( evSetMoviePosition,guiIntfStruct.Position );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
270 wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 void mplSetFileName( char * dir,char * name,int type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
275 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 if ( !name ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279 else guiSetDF( guiIntfStruct.Filename,dir,name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
280
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
281 // filename=guiIntfStruct.Filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 guiIntfStruct.StreamType=type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283 gfree( (void **)&guiIntfStruct.AudioFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 gfree( (void **)&guiIntfStruct.Subtitlename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 void mplCurr( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289 plItem * curr;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 int stop = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 if ( guiIntfStruct.Playing == 2 ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
294 {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
295 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
299 #ifdef CONFIG_VCD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 if ( (curr=gtkSet( gtkGetCurrPlItem,0,NULL)) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306 mplSetFileName( curr->path,curr->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307 mplGotoTheNext=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312 if ( stop ) mplEventHandling( evStop,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
317 void mplPrev( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 plItem * prev;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
320 int stop = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 if ( guiIntfStruct.Playing == 2 ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324 {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
325 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327 if ( --guiIntfStruct.DVD.current_chapter == 0 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
329 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
334 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
335 #ifdef CONFIG_VCD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 mplSetFileName( prev->path,prev->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 mplGotoTheNext=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 if ( stop ) mplEventHandling( evStop,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 void mplNext( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 int stop = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356 plItem * next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
357
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358 if ( guiIntfStruct.Playing == 2 ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
361 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366 if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
371 #ifdef CONFIG_VCD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
373 if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
376 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
377 if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
379 mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 mplGotoTheNext=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385 if ( stop ) mplEventHandling( evStop,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387 }