Mercurial > mplayer.hg
annotate Gui/mplayer/play.c @ 4585:55c8aefdef1b
vao, something changed in these files!
author | gabucino |
---|---|
date | Fri, 08 Feb 2002 13:57:14 +0000 |
parents | b013d01d9968 |
children | b1a2469e78ac |
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 int mplParent = 1; | |
9 | |
1765 | 10 int moviex,moviey,moviewidth,movieheight; |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
11 |
1693 | 12 #include "../app.h" |
13 | |
14 #include "../wm/ws.h" | |
15 #include "../wm/wskeys.h" | |
16 #include "../wm/widget.h" | |
17 | |
18 #include "../../config.h" | |
1884 | 19 #include "../../help_mp.h" |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
20 #include "../../libvo/x11_common.h" |
1693 | 21 |
22 #include "widgets.h" | |
23 #include "./mplayer.h" | |
24 #include "psignal.h" | |
25 #include "play.h" | |
26 | |
1800 | 27 #include "../skin/skin.h" |
28 #include "../error.h" | |
29 | |
1693 | 30 mplCommStruct * mplShMem; |
31 char * Filename = NULL; | |
32 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
33 extern float rel_seek_secs; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
34 extern int abs_seek_pos; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
35 |
1693 | 36 void mplFullScreen( void ) |
37 { | |
2029 | 38 static int sx,sy; |
2979 | 39 |
2029 | 40 wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); |
41 if ( appMPlayer.subWindow.isFullScreen ) | |
42 { | |
43 wsResizeWindow( &appMPlayer.subWindow,sx,sy ); | |
2854 | 44 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
2029 | 45 wsWindowDecoration( &appMPlayer.subWindow,appMPlayer.subWindow.Decorations ); |
46 appMPlayer.subWindow.isFullScreen=0; | |
47 } | |
48 else | |
49 { | |
50 sx=appMPlayer.subWindow.Width; sy=appMPlayer.subWindow.Height; | |
51 wsResizeWindow( &appMPlayer.subWindow,wsMaxX,wsMaxY ); | |
2854 | 52 wsMoveWindow( &appMPlayer.subWindow,True,0,0 ); |
2029 | 53 wsWindowDecoration( &appMPlayer.subWindow,0 ); |
54 appMPlayer.subWindow.isFullScreen=1; | |
55 } | |
2045 | 56 if ( mplShMem->Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); |
57 else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); | |
2029 | 58 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
1756 | 59 mplResize( 0,0,appMPlayer.subWindow.Width,appMPlayer.subWindow.Height ); |
1693 | 60 } |
61 | |
62 extern int mplSubRender; | |
63 | |
64 void mplStop() | |
65 { | |
66 mplShMem->Playing=0; | |
1812 | 67 mplShMem->TimeSec=0; |
1825 | 68 mplShMem->Position=0; |
1888 | 69 mplShMem->AudioType=0; |
1953 | 70 // if ( !mplShMem->Playing ) return; |
1796 | 71 if ( !appMPlayer.subWindow.isFullScreen ) |
72 { | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
73 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); |
2854 | 74 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
1796 | 75 } |
1797 | 76 mplSubRender=1; |
2045 | 77 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
1953 | 78 wsClearWindow( appMPlayer.subWindow ); |
1797 | 79 wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 80 } |
81 | |
82 void mplPlay( void ) | |
83 { | |
1812 | 84 if ( ( mplShMem->Filename[0] == 0 )|| |
1804 | 85 ( mplShMem->Playing == 1 ) ) return; |
86 if ( mplShMem->Playing == 2 ) { mplPause(); return; } | |
1693 | 87 mplShMem->Playing=1; |
1791 | 88 mplSubRender=0; |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1852
diff
changeset
|
89 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); |
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1852
diff
changeset
|
90 wsClearWindow( appMPlayer.subWindow ); |
1852 | 91 wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 92 } |
93 | |
94 void mplPause( void ) | |
95 { | |
1804 | 96 switch( mplShMem->Playing ) |
97 { | |
98 case 1: // playing | |
99 mplShMem->Playing=2; | |
4465 | 100 // btnModify( evPlaySwitchToPause,btnReleased ); |
101 // btnModify( evPauseSwitchToPlay,btnDisabled ); | |
1804 | 102 break; |
4465 | 103 case 2: // paused |
1804 | 104 mplShMem->Playing=1; |
4465 | 105 // btnModify( evPlaySwitchToPause,btnDisabled ); |
106 // btnModify( evPauseSwitchToPlay,btnReleased ); | |
1804 | 107 break; |
108 } | |
4465 | 109 mplState(); |
1815 | 110 mplSubRender=0; |
1693 | 111 } |
112 | |
4465 | 113 void mplState( void ) |
114 { | |
115 if ( ( mplShMem->Playing == 0 )||( mplShMem->Playing == 2 ) ) | |
116 { | |
117 btnModify( evPlaySwitchToPause,btnReleased ); | |
118 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
119 } | |
120 else | |
121 { | |
122 btnModify( evPlaySwitchToPause,btnDisabled ); | |
123 btnModify( evPauseSwitchToPlay,btnReleased ); | |
124 } | |
125 } | |
126 | |
1693 | 127 void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) |
128 { | |
1852 | 129 // printf( "----resize---> %dx%d --- \n",width,height ); |
1770 | 130 vo_setwindowsize( width,height ); |
131 vo_resize=1; | |
1693 | 132 } |
133 | |
134 void mplMPlayerInit( int argc,char* argv[], char *envp[] ) | |
135 { | |
1850 | 136 struct sigaction sa; |
137 | |
1825 | 138 mplShMem=calloc( 1,sizeof( mplCommStruct ) ); |
139 mplShMem->Balance=50.0f; | |
2447 | 140 mplShMem->StreamType=-1; |
1850 | 141 memset(&sa, 0, sizeof(sa)); |
142 sa.sa_handler = mplMainSigHandler; | |
143 sigaction( SIGTYPE,&sa,NULL ); | |
1693 | 144 } |
145 | |
146 float mplGetPosition( void ) | |
147 { // return 0.0 ... 100.0 | |
1729 | 148 return mplShMem->Position; |
1693 | 149 } |
150 | |
151 void mplRelSeek( float s ) | |
152 { // -+s | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
153 rel_seek_secs=s; abs_seek_pos=0; |
1693 | 154 } |
155 | |
156 void mplAbsSeek( float s ) | |
157 { // 0.0 ... 100.0 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
158 rel_seek_secs=0.01*s; abs_seek_pos=3; |
1693 | 159 } |
160 | |
1800 | 161 listItems tmpList; |
162 | |
163 void ChangeSkin( void ) | |
164 { | |
1907 | 165 int ret; |
166 if ( !strcmp( skinName,gtkShMem->sb.name ) ) return; | |
1800 | 167 #ifdef DEBUG |
1907 | 168 dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name ); |
1800 | 169 #endif |
170 | |
1907 | 171 mainVisible=0; |
1800 | 172 |
1907 | 173 appInitStruct( &tmpList ); |
174 skinAppMPlayer=&tmpList; | |
175 fntFreeFont(); | |
176 ret=skinRead( gtkShMem->sb.name ); | |
1800 | 177 |
1907 | 178 appInitStruct( &tmpList ); |
179 skinAppMPlayer=&appMPlayer; | |
180 appInitStruct( &appMPlayer ); | |
181 if ( !ret ) strcpy( skinName,gtkShMem->sb.name ); | |
182 skinRead( skinName ); | |
183 if ( ret ) | |
184 { | |
185 mainVisible=1; | |
186 return; | |
187 } | |
1800 | 188 |
1907 | 189 if ( appMPlayer.menuBase.Bitmap.Image ) |
190 { | |
191 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); | |
192 if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
193 { message( False,MSGTR_NEMDB ); return; } | |
194 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
195 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
196 } | |
1800 | 197 |
2226 | 198 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); |
199 if ( ( !appMPlayer.subWindow.isFullScreen )&&( !mplShMem->Playing ) ) | |
200 { | |
201 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); | |
2854 | 202 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
2226 | 203 } |
204 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); | |
205 if ( !mplShMem->Playing ) | |
206 { | |
207 mplSubRender=1; | |
2911 | 208 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
2226 | 209 wsClearWindow( appMPlayer.subWindow ); |
210 wsPostRedisplay( &appMPlayer.subWindow ); | |
211 } | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
212 |
1907 | 213 if ( mplDrawBuffer ) free( mplDrawBuffer ); |
214 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
215 { message( False,MSGTR_NEMDB ); return; } | |
216 wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow ); | |
217 wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
2854 | 218 wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y ); |
1907 | 219 wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); |
220 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
2979 | 221 wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration ); |
1907 | 222 mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); |
223 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
224 |
1907 | 225 btnModify( evSetVolume,mplShMem->Volume ); |
226 btnModify( evSetBalance,mplShMem->Balance ); | |
227 btnModify( evSetMoviePosition,mplShMem->Position ); | |
3479 | 228 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); |
1800 | 229 } |
1802 | 230 |
231 void EventHandling( void ) | |
232 { | |
1861 | 233 wsHandleEvents();mplTimerHandler(0); // handle GUI timer events |
1907 | 234 if ( mplShMem->SkinChange ) { ChangeSkin(); mplShMem->SkinChange=0; } |
1802 | 235 } |
1952 | 236 |
237 void mplResizeToMovieSize( unsigned int width,unsigned int height ) | |
238 { | |
239 if ( !appMPlayer.subWindow.isFullScreen ) | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
240 { |
1952 | 241 wsResizeWindow( &appMPlayer.subWindow,width,height ); |
2854 | 242 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
243 } |
1952 | 244 } |
2854 | 245 |
246 void mplSetFileName( char * fname ) | |
247 { | |
248 if ( ( fname )&&( gtkShMem ) ) strcpy( gtkShMem->fs.filename,fname ); | |
249 } |