Mercurial > mplayer.hg
annotate Gui/mplayer/play.c @ 1852:58dd326fcc4a
fix xshape, mixer, fullscreen, etc
author | pontscho |
---|---|
date | Tue, 04 Sep 2001 15:21:00 +0000 |
parents | 62b8e85865a2 |
children | 88a88d0a3f94 |
rev | line source |
---|---|
1693 | 1 |
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" | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
19 #include "../../libvo/x11_common.h" |
1693 | 20 |
21 #include "widgets.h" | |
22 #include "./mplayer.h" | |
23 #include "psignal.h" | |
24 #include "play.h" | |
25 | |
1800 | 26 #include "../skin/skin.h" |
27 #include "../config.h" | |
28 #include "../error.h" | |
29 #include "../language.h" | |
30 | |
1693 | 31 mplCommStruct * mplShMem; |
32 char * Filename = NULL; | |
33 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
34 extern float rel_seek_secs; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
35 extern int abs_seek_pos; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
36 |
1693 | 37 void mplFullScreen( void ) |
38 { | |
1765 | 39 // if ( appMPlayer.subWindow.isFullScreen ) |
40 // { | |
41 // } | |
42 wsFullScreen( &appMPlayer.subWindow ); | |
1756 | 43 mplResize( 0,0,appMPlayer.subWindow.Width,appMPlayer.subWindow.Height ); |
1693 | 44 } |
45 | |
46 extern int mplSubRender; | |
47 | |
48 void mplStop() | |
49 { | |
50 if ( !mplShMem->Playing ) return; | |
51 mplShMem->Playing=0; | |
1812 | 52 mplShMem->TimeSec=0; |
1825 | 53 mplShMem->Position=0; |
1796 | 54 if ( !appMPlayer.subWindow.isFullScreen ) |
55 { | |
56 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); | |
57 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); | |
58 } | |
1797 | 59 mplSubRender=1; |
60 wsPostRedisplay( &appMPlayer.subWindow ); | |
1693 | 61 } |
62 | |
63 void mplPlay( void ) | |
64 { | |
1812 | 65 if ( ( mplShMem->Filename[0] == 0 )|| |
1804 | 66 ( mplShMem->Playing == 1 ) ) return; |
67 if ( mplShMem->Playing == 2 ) { mplPause(); return; } | |
1693 | 68 mplShMem->Playing=1; |
1791 | 69 mplSubRender=0; |
1852 | 70 wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 71 } |
72 | |
73 void mplPause( void ) | |
74 { | |
1804 | 75 switch( mplShMem->Playing ) |
76 { | |
77 case 1: // playing | |
78 mplShMem->Playing=2; | |
79 btnModify( evPlaySwitchToPause,btnReleased ); | |
80 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
81 break; | |
82 case 2: // paused | |
83 mplShMem->Playing=1; | |
84 btnModify( evPlaySwitchToPause,btnDisabled ); | |
85 btnModify( evPauseSwitchToPlay,btnReleased ); | |
86 break; | |
87 } | |
1815 | 88 mplSubRender=0; |
1693 | 89 } |
90 | |
91 void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) | |
92 { | |
1852 | 93 // printf( "----resize---> %dx%d --- \n",width,height ); |
1770 | 94 vo_setwindowsize( width,height ); |
95 vo_resize=1; | |
1693 | 96 } |
97 | |
98 void mplMPlayerInit( int argc,char* argv[], char *envp[] ) | |
99 { | |
1850 | 100 struct sigaction sa; |
101 | |
1825 | 102 mplShMem=calloc( 1,sizeof( mplCommStruct ) ); |
103 mplShMem->Balance=50.0f; | |
1850 | 104 memset(&sa, 0, sizeof(sa)); |
105 sa.sa_handler = mplMainSigHandler; | |
106 sigaction( SIGTYPE,&sa,NULL ); | |
1693 | 107 } |
108 | |
109 float mplGetPosition( void ) | |
110 { // return 0.0 ... 100.0 | |
1729 | 111 return mplShMem->Position; |
1693 | 112 } |
113 | |
114 void mplRelSeek( float s ) | |
115 { // -+s | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
116 rel_seek_secs=s; abs_seek_pos=0; |
1693 | 117 } |
118 | |
119 void mplAbsSeek( float s ) | |
120 { // 0.0 ... 100.0 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
121 rel_seek_secs=0.01*s; abs_seek_pos=3; |
1693 | 122 } |
123 | |
1800 | 124 listItems tmpList; |
125 | |
126 void ChangeSkin( void ) | |
127 { | |
128 if ( strcmp( cfgSkin,gtkShMem->sb.name ) ) | |
129 { | |
130 int ret; | |
131 #ifdef DEBUG | |
132 dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name ); | |
133 #endif | |
134 | |
135 mainVisible=0; | |
136 | |
137 appInitStruct( &tmpList ); | |
138 skinAppMPlayer=&tmpList; | |
139 ret=skinRead( gtkShMem->sb.name ); | |
140 | |
1829 | 141 fntFreeFont(); |
142 | |
1800 | 143 appInitStruct( &tmpList ); |
144 skinAppMPlayer=&appMPlayer; | |
145 appInitStruct( &appMPlayer ); | |
146 if ( !ret ) strcpy( cfgSkin,gtkShMem->sb.name ); | |
147 skinRead( cfgSkin ); | |
148 | |
149 if ( ret ) | |
150 { | |
151 mainVisible=1; | |
152 return; | |
153 } | |
154 | |
155 // appCopy( &appMPlayer,&tmpList ); | |
156 // appInitStruct( &tmpList ); | |
157 // skinAppMPlayer=&appMPlayer; | |
158 // strcpy( cfgSkin,gtkShMem->sb.name ); | |
159 | |
160 if ( mplDrawBuffer ) free( mplDrawBuffer ); | |
161 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
162 { message( False,langNEMDB ); return; } | |
163 wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
164 wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y ); | |
165 wsResizeImage( &appMPlayer.mainWindow ); | |
166 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
167 mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); | |
168 btnModify( evSetVolume,mplShMem->Volume ); | |
169 btnModify( evSetBalance,mplShMem->Balance ); | |
170 btnModify( evSetMoviePosition,mplShMem->Position ); | |
171 | |
172 if ( appMPlayer.menuBase.Bitmap.Image ) | |
173 { | |
174 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); | |
175 if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
176 { message( False,langNEMDB ); return; } | |
177 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
178 wsResizeImage( &appMPlayer.menuWindow ); | |
179 } | |
180 | |
181 mplSkinChanged=1; | |
182 if ( !mplShMem->Playing ) | |
183 { | |
184 mplSkinChanged=0; | |
185 if ( appMPlayer.subWindow.isFullScreen ) wsFullScreen( &appMPlayer.subWindow ); | |
186 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); | |
187 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); | |
188 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow ); | |
189 mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow ); | |
190 } | |
191 } | |
1802 | 192 mplShMem->SkinChange=0; |
1800 | 193 } |
1802 | 194 |
195 void EventHandling( void ) | |
196 { | |
197 wsHandleEvents();mplTimerHandler(0); // handle GUI timer events | |
198 if ( mplShMem->SkinChange ) ChangeSkin(); | |
199 } |