Mercurial > mplayer.hg
annotate Gui/mplayer/play.c @ 5920:79f5f072348b
fix fullscreen bug
author | pontscho |
---|---|
date | Wed, 01 May 2002 14:12:32 +0000 |
parents | 20c335d98ab3 |
children | d34622ebaf45 |
rev | line source |
---|---|
4428 | 1 #include <inttypes.h> |
1693 | 2 #include <stdlib.h> |
3 #include <stdio.h> | |
4 | |
5 #include <unistd.h> | |
6 #include <signal.h> | |
7 | |
8 #include "../wm/ws.h" | |
9 #include "../../config.h" | |
1884 | 10 #include "../../help_mp.h" |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
11 #include "../../libvo/x11_common.h" |
5665 | 12 #include "../../input/input.h" |
1693 | 13 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
14 #include "../app.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
15 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
16 #include "../wm/wskeys.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
17 #include "../wm/widget.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
18 #include "../interface.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
19 |
1693 | 20 #include "widgets.h" |
21 #include "./mplayer.h" | |
22 #include "play.h" | |
23 | |
1800 | 24 #include "../skin/skin.h" |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
25 #include "../skin/font.h" |
1693 | 26 |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
27 extern float rel_seek_secs; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
28 extern int abs_seek_pos; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
29 |
1693 | 30 void mplFullScreen( void ) |
31 { | |
2029 | 32 static int sx,sy; |
2979 | 33 |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5701
diff
changeset
|
34 #if 0 |
5032 | 35 // if ( !guiIntfStruct.Playing ) |
2029 | 36 { |
4981 | 37 wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); |
38 if ( appMPlayer.subWindow.isFullScreen ) | |
39 { | |
40 wsResizeWindow( &appMPlayer.subWindow,sx,sy ); | |
41 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); | |
42 wsWindowDecoration( &appMPlayer.subWindow,appMPlayer.subWindow.Decorations ); | |
43 appMPlayer.subWindow.isFullScreen=0; | |
44 } | |
45 else | |
46 { | |
47 sx=appMPlayer.subWindow.Width; sy=appMPlayer.subWindow.Height; | |
48 wsResizeWindow( &appMPlayer.subWindow,wsMaxX,wsMaxY ); | |
49 wsMoveWindow( &appMPlayer.subWindow,True,0,0 ); | |
50 wsWindowDecoration( &appMPlayer.subWindow,0 ); | |
51 appMPlayer.subWindow.isFullScreen=1; | |
52 } | |
5032 | 53 vo_fs=appMPlayer.subWindow.isFullScreen; |
4981 | 54 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
5032 | 55 }// else { vo_x11_fullscreen(); appMPlayer.subWindow.isFullScreen=vo_fs; } |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5701
diff
changeset
|
56 #else |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5701
diff
changeset
|
57 wsFullScreen( &appMPlayer.subWindow ); |
5920 | 58 vo_fs=0; |
59 if ( appMPlayer.subWindow.isFullScreen ) vo_fs=1; | |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5701
diff
changeset
|
60 #endif |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5701
diff
changeset
|
61 |
4981 | 62 fullscreen=appMPlayer.subWindow.isFullScreen; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
63 if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); |
2045 | 64 else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
1693 | 65 } |
66 | |
67 extern int mplSubRender; | |
68 | |
69 void mplStop() | |
70 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
71 guiIntfStruct.Playing=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
72 guiIntfStruct.TimeSec=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
73 guiIntfStruct.Position=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
74 guiIntfStruct.AudioType=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
75 // if ( !guiIntfStruct.Playing ) return; |
1796 | 76 if ( !appMPlayer.subWindow.isFullScreen ) |
77 { | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
78 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); |
2854 | 79 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
1796 | 80 } |
5689 | 81 guiGetEvent( guiCEvent,guiSetStop ); |
1797 | 82 mplSubRender=1; |
2045 | 83 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
1953 | 84 wsClearWindow( appMPlayer.subWindow ); |
1797 | 85 wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 86 } |
87 | |
88 void mplPlay( void ) | |
89 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
90 if ( ( !guiIntfStruct.Filename )|| |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
91 ( guiIntfStruct.Filename[0] == 0 )|| |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
92 ( guiIntfStruct.Playing == 1 ) ) return; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
93 if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; } |
4963 | 94 guiGetEvent( guiCEvent,guiSetPlay ); |
1791 | 95 mplSubRender=0; |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1852
diff
changeset
|
96 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
97 wsClearWindow( appMPlayer.subWindow ); |
4963 | 98 // wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 99 } |
100 | |
101 void mplPause( void ) | |
102 { | |
5665 | 103 mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) ); |
104 cmd->id=MP_CMD_PAUSE; | |
105 cmd->name=strdup("pause"); | |
106 mp_input_queue_cmd(cmd); | |
1815 | 107 mplSubRender=0; |
1693 | 108 } |
109 | |
4465 | 110 void mplState( void ) |
111 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
112 if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) ) |
4465 | 113 { |
114 btnModify( evPlaySwitchToPause,btnReleased ); | |
115 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
116 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
117 else |
4465 | 118 { |
119 btnModify( evPlaySwitchToPause,btnDisabled ); | |
120 btnModify( evPauseSwitchToPlay,btnReleased ); | |
121 } | |
122 } | |
123 | |
1693 | 124 void mplMPlayerInit( int argc,char* argv[], char *envp[] ) |
125 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
126 guiIntfStruct.Balance=50.0f; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
127 guiIntfStruct.StreamType=-1; |
1693 | 128 } |
129 | |
130 float mplGetPosition( void ) | |
131 { // return 0.0 ... 100.0 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
132 return guiIntfStruct.Position; |
1693 | 133 } |
134 | |
135 void mplRelSeek( float s ) | |
136 { // -+s | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
137 rel_seek_secs=s; abs_seek_pos=0; |
1693 | 138 } |
139 | |
140 void mplAbsSeek( float s ) | |
141 { // 0.0 ... 100.0 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
142 rel_seek_secs=0.01*s; abs_seek_pos=3; |
1693 | 143 } |
144 | |
1800 | 145 listItems tmpList; |
146 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
147 void ChangeSkin( char * name ) |
1800 | 148 { |
1907 | 149 int ret; |
5690 | 150 |
1907 | 151 mainVisible=0; |
1800 | 152 |
1907 | 153 appInitStruct( &tmpList ); |
154 skinAppMPlayer=&tmpList; | |
155 fntFreeFont(); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
156 ret=skinRead( name ); |
1800 | 157 |
1907 | 158 appInitStruct( &tmpList ); |
159 skinAppMPlayer=&appMPlayer; | |
160 appInitStruct( &appMPlayer ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
161 if ( ret ) name=skinName; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
162 if ( skinRead( name ) ) |
1907 | 163 { |
164 mainVisible=1; | |
165 return; | |
166 } | |
1800 | 167 |
1907 | 168 if ( appMPlayer.menuBase.Bitmap.Image ) |
169 { | |
170 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); | |
171 if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
172 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } |
1907 | 173 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); |
174 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
175 } | |
1800 | 176 |
2226 | 177 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
178 if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) ) |
2226 | 179 { |
180 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); | |
2854 | 181 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
182 } |
2226 | 183 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
184 if ( !guiIntfStruct.Playing ) |
2226 | 185 { |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
186 mplSubRender=1; |
2911 | 187 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
2226 | 188 wsClearWindow( appMPlayer.subWindow ); |
189 wsPostRedisplay( &appMPlayer.subWindow ); | |
190 } | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
191 |
1907 | 192 if ( mplDrawBuffer ) free( mplDrawBuffer ); |
193 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
194 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } |
1907 | 195 wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow ); |
196 wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
2854 | 197 wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y ); |
1907 | 198 wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); |
199 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
2979 | 200 wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration ); |
1907 | 201 mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); |
202 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
203 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
204 btnModify( evSetVolume,guiIntfStruct.Volume ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
205 btnModify( evSetBalance,guiIntfStruct.Balance ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
206 btnModify( evSetMoviePosition,guiIntfStruct.Position ); |
3479 | 207 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); |
1800 | 208 } |
1802 | 209 |
1952 | 210 void mplResizeToMovieSize( unsigned int width,unsigned int height ) |
211 { | |
212 if ( !appMPlayer.subWindow.isFullScreen ) | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
213 { |
1952 | 214 wsResizeWindow( &appMPlayer.subWindow,width,height ); |
2854 | 215 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
216 } |
1952 | 217 } |
2854 | 218 |
219 void mplSetFileName( char * fname ) | |
220 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
221 if ( !fname ) return; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
222 if ( guiIntfStruct.Filename ) free( guiIntfStruct.Filename ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
223 guiIntfStruct.Filename=strdup( fname ); |
2854 | 224 } |
5689 | 225 |
226 void mplPrev( void ) | |
227 { | |
228 int stop = 0; | |
229 switch ( guiIntfStruct.StreamType ) | |
230 { | |
231 // case STREAMTYPE_FILE: | |
5701 | 232 #ifdef USE_DVDREAD |
5689 | 233 case STREAMTYPE_DVD: |
234 if ( guiIntfStruct.Playing == 2 ) break; | |
235 if ( --guiIntfStruct.DVD.current_chapter == 0 ) | |
236 { | |
237 guiIntfStruct.DVD.current_chapter=1; | |
238 if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; } | |
239 } | |
240 guiIntfStruct.Track=guiIntfStruct.DVD.current_title; | |
241 if ( stop ) mplEventHandling( evStop,0 ); | |
242 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); | |
243 break; | |
5701 | 244 #endif |
5689 | 245 } |
246 } | |
247 | |
248 void mplNext( void ) | |
249 { | |
250 int stop = 0; | |
251 switch ( guiIntfStruct.StreamType ) | |
252 { | |
253 // case STREAMTYPE_FILE: | |
5701 | 254 #ifdef USE_DVDREAD |
5689 | 255 case STREAMTYPE_DVD: |
256 if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters ) | |
257 { | |
258 guiIntfStruct.DVD.current_chapter=1; | |
259 if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; } | |
260 } | |
261 guiIntfStruct.Track=guiIntfStruct.DVD.current_title; | |
262 if ( stop ) mplEventHandling( evStop,0 ); | |
263 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); | |
264 break; | |
5701 | 265 #endif |
5689 | 266 } |
267 } |