annotate gui/mplayer/play.c @ 32564:61ac00c3c51c

Support clearing subtitles. Makes PGS subtitles disappear at the appropriate time.
author reimar
date Sat, 27 Nov 2010 10:01:11 +0000
parents 8fa2f43cb760
children dd3b365972a4
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"
32039
5c708ee9b4ab Add appropriate #include instead of declaring seek-related variables extern.
diego
parents: 30653
diff changeset
29 #include "mp_core.h"
30653
3d23e24c5c60 Declare externally used variables from vd.c as extern in vd.h.
diego
parents: 29263
diff changeset
30 #include "libmpcodecs/vd.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
31 #include "libvo/x11_common.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
32 #include "libvo/video_out.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
33 #include "input/input.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
34
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
35 #include "gui/wm/ws.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
36 #include "gui/wm/wsxdnd.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
37
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
38 #include "gui/app.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
39 #include "gui/wm/wskeys.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
40 #include "gui/interface.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 #include "widgets.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43 #include "gmplayer.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44 #include "play.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
46 #include "gui/skin/skin.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
47 #include "gui/skin/font.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 #include "stream/stream.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 int mplGotoTheNext = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 void mplFullScreen( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 if ( guiIntfStruct.NoWindow && guiIntfStruct.Playing ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) )
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
58 {
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
59 appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 switch ( appMPlayer.sub.x )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ) + wsOrgX; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 switch ( appMPlayer.sub.y )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ) + wsOrgY; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69 case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 if ( guiIntfStruct.Playing || gtkShowVideoWindow ) wsFullScreen( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 fullscreen=vo_fs=appMPlayer.subWindow.isFullScreen;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 if ( appMPlayer.menuIsPresent ) wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 void mplEnd( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 plItem * next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 if ( !mplGotoTheNext && guiIntfStruct.Playing) { mplGotoTheNext=1; return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 plLastPlayed=next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 guiSetDF( guiIntfStruct.Filename,next->path,next->name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 guiIntfStruct.StreamType=STREAMTYPE_FILE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 gfree( (void **)&guiIntfStruct.AudioFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 gfree( (void **)&guiIntfStruct.Subtitlename );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
96 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 if ( guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 guiIntfStruct.TimeSec=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 guiIntfStruct.Position=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 guiIntfStruct.AudioType=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 guiIntfStruct.NoWindow=False;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
106 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 guiIntfStruct.DVD.current_title=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 guiIntfStruct.DVD.current_angle=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112 if ( !appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 else wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118 guiGetEvent( guiCEvent,guiSetStop );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 mplSubRender=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 wsPostRedisplay( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 void mplPlay( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 if ( ( !guiIntfStruct.Filename )||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 ( guiIntfStruct.Filename[0] == 0 )||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 ( guiIntfStruct.Playing == 1 ) ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 guiGetEvent( guiCEvent,(void *)guiSetPlay );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 mplSubRender=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 void mplPause( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 if ( !guiIntfStruct.Playing ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 if ( guiIntfStruct.Playing == 1 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 mp_cmd_t * cmd = calloc( 1,sizeof( *cmd ) );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 cmd->id=MP_CMD_PAUSE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 cmd->name=strdup("pause");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 mp_input_queue_cmd(cmd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 } else guiIntfStruct.Playing=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 void mplState( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 btnModify( evPlaySwitchToPause,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 btnModify( evPauseSwitchToPlay,btnDisabled );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 btnModify( evPlaySwitchToPause,btnDisabled );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 btnModify( evPauseSwitchToPlay,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164 float mplGetPosition( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 { // return 0.0 ... 100.0
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 return guiIntfStruct.Position;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 void mplRelSeek( float s )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 { // -+s
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 rel_seek_secs=s; abs_seek_pos=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 void mplAbsSeek( float s )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 { // 0.0 ... 100.0
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 rel_seek_secs=0.01*s; abs_seek_pos=3;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 listItems tmpList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 void ChangeSkin( char * name )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 int ret;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 int prev = appMPlayer.menuIsPresent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186 int bprev = appMPlayer.barIsPresent;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188 mainVisible=0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
189
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190 appInitStruct( &tmpList );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 skinAppMPlayer=&tmpList;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 fntFreeFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 ret=skinRead( name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 appInitStruct( &tmpList );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 skinAppMPlayer=&appMPlayer;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 appInitStruct( &appMPlayer );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 if ( ret ) name=skinName;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 if ( skinRead( name ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 mainVisible=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 // --- reload menu window
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 if ( prev && appMPlayer.menuIsPresent )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 {
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32039
diff changeset
209 free( mplMenuDrawBuffer );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 } else { mplMenuInit(); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 // --- reload sub window
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 if ( !guiIntfStruct.Playing )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 mplSubRender=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 wsClearWindow( appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 wsPostRedisplay( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 // --- reload play bar
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235 if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 mplPBInit();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 // --- reload main window
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32039
diff changeset
239 free( mplDrawBuffer );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 if ( ( mplDrawBuffer = calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 wsDestroyWindow( &appMPlayer.mainWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245 wsCreateWindow( &appMPlayer.mainWindow,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 wsXDNDMakeAwareness( &appMPlayer.mainWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 mainVisible=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 btnModify( evSetVolume,guiIntfStruct.Volume );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 btnModify( evSetBalance,guiIntfStruct.Balance );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265 btnModify( evSetMoviePosition,guiIntfStruct.Position );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
270
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273 void mplSetFileName( char * dir,char * name,int type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
275 if ( !name ) return;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
276
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277 if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 else guiSetDF( guiIntfStruct.Filename,dir,name );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
280 // filename=guiIntfStruct.Filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
281 guiIntfStruct.StreamType=type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 gfree( (void **)&guiIntfStruct.AudioFile );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283 gfree( (void **)&guiIntfStruct.Subtitlename );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286 void mplCurr( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 plItem * curr;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289 int stop = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
290
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291 if ( guiIntfStruct.Playing == 2 ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293 {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
294 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
295 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
298 #ifdef CONFIG_VCD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
302 default:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 if ( (curr=gtkSet( gtkGetCurrPlItem,0,NULL)) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 mplSetFileName( curr->path,curr->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306 mplGotoTheNext=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 if ( stop ) mplEventHandling( evStop,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316 void mplPrev( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
317 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 plItem * prev;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 int stop = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
320
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321 if ( guiIntfStruct.Playing == 2 ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323 {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
324 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 if ( --guiIntfStruct.DVD.current_chapter == 0 )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
329 if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331 guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
334 #ifdef CONFIG_VCD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
335 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
339 default:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 mplSetFileName( prev->path,prev->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 mplGotoTheNext=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 if ( stop ) mplEventHandling( evStop,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352 void mplNext( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 int stop = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 plItem * next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
357 if ( guiIntfStruct.Playing == 2 ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358 switch ( guiIntfStruct.StreamType )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
360 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 guiIntfStruct.DVD.current_chapter=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
370 #ifdef CONFIG_VCD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371 case STREAMTYPE_VCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
373 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375 default:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
376 if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) )
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
377 {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378 mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
379 mplGotoTheNext=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 if ( stop ) mplEventHandling( evStop,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386 }