Mercurial > mplayer.hg
annotate Gui/mplayer/play.c @ 2039:452f3cb96b32
Make aware of new -fs calling.
author | atmos4 |
---|---|
date | Mon, 01 Oct 2001 20:40:07 +0000 |
parents | 41ed89701ece |
children | deb4aff05c44 |
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" | |
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; |
39 wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
40 if ( appMPlayer.subWindow.isFullScreen ) | |
41 { | |
42 wsResizeWindow( &appMPlayer.subWindow,sx,sy ); | |
43 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); | |
44 wsWindowDecoration( &appMPlayer.subWindow,appMPlayer.subWindow.Decorations ); | |
45 appMPlayer.subWindow.isFullScreen=0; | |
46 } | |
47 else | |
48 { | |
49 sx=appMPlayer.subWindow.Width; sy=appMPlayer.subWindow.Height; | |
50 wsResizeWindow( &appMPlayer.subWindow,wsMaxX,wsMaxY ); | |
51 wsMoveWindow( &appMPlayer.subWindow,0,0 ); | |
52 wsWindowDecoration( &appMPlayer.subWindow,0 ); | |
53 appMPlayer.subWindow.isFullScreen=1; | |
54 } | |
55 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
1756 | 56 mplResize( 0,0,appMPlayer.subWindow.Width,appMPlayer.subWindow.Height ); |
1693 | 57 } |
58 | |
59 extern int mplSubRender; | |
60 | |
61 void mplStop() | |
62 { | |
63 mplShMem->Playing=0; | |
1812 | 64 mplShMem->TimeSec=0; |
1825 | 65 mplShMem->Position=0; |
1888 | 66 mplShMem->AudioType=0; |
1953 | 67 // if ( !mplShMem->Playing ) return; |
1796 | 68 if ( !appMPlayer.subWindow.isFullScreen ) |
69 { | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
70 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); |
1796 | 71 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); |
72 } | |
1797 | 73 mplSubRender=1; |
1953 | 74 wsClearWindow( appMPlayer.subWindow ); |
75 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); | |
1797 | 76 wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 77 } |
78 | |
79 void mplPlay( void ) | |
80 { | |
1812 | 81 if ( ( mplShMem->Filename[0] == 0 )|| |
1804 | 82 ( mplShMem->Playing == 1 ) ) return; |
83 if ( mplShMem->Playing == 2 ) { mplPause(); return; } | |
1693 | 84 mplShMem->Playing=1; |
1791 | 85 mplSubRender=0; |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1852
diff
changeset
|
86 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); |
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1852
diff
changeset
|
87 wsClearWindow( appMPlayer.subWindow ); |
1852 | 88 wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 89 } |
90 | |
91 void mplPause( void ) | |
92 { | |
1804 | 93 switch( mplShMem->Playing ) |
94 { | |
95 case 1: // playing | |
96 mplShMem->Playing=2; | |
97 btnModify( evPlaySwitchToPause,btnReleased ); | |
98 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
99 break; | |
100 case 2: // paused | |
101 mplShMem->Playing=1; | |
102 btnModify( evPlaySwitchToPause,btnDisabled ); | |
103 btnModify( evPauseSwitchToPlay,btnReleased ); | |
104 break; | |
105 } | |
1815 | 106 mplSubRender=0; |
1693 | 107 } |
108 | |
109 void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) | |
110 { | |
1852 | 111 // printf( "----resize---> %dx%d --- \n",width,height ); |
1770 | 112 vo_setwindowsize( width,height ); |
113 vo_resize=1; | |
1693 | 114 } |
115 | |
116 void mplMPlayerInit( int argc,char* argv[], char *envp[] ) | |
117 { | |
1850 | 118 struct sigaction sa; |
119 | |
1825 | 120 mplShMem=calloc( 1,sizeof( mplCommStruct ) ); |
121 mplShMem->Balance=50.0f; | |
1850 | 122 memset(&sa, 0, sizeof(sa)); |
123 sa.sa_handler = mplMainSigHandler; | |
124 sigaction( SIGTYPE,&sa,NULL ); | |
1693 | 125 } |
126 | |
127 float mplGetPosition( void ) | |
128 { // return 0.0 ... 100.0 | |
1729 | 129 return mplShMem->Position; |
1693 | 130 } |
131 | |
132 void mplRelSeek( float s ) | |
133 { // -+s | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
134 rel_seek_secs=s; abs_seek_pos=0; |
1693 | 135 } |
136 | |
137 void mplAbsSeek( float s ) | |
138 { // 0.0 ... 100.0 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
139 rel_seek_secs=0.01*s; abs_seek_pos=3; |
1693 | 140 } |
141 | |
1800 | 142 listItems tmpList; |
143 | |
144 void ChangeSkin( void ) | |
145 { | |
1907 | 146 int ret; |
147 if ( !strcmp( skinName,gtkShMem->sb.name ) ) return; | |
1800 | 148 #ifdef DEBUG |
1907 | 149 dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name ); |
1800 | 150 #endif |
151 | |
1907 | 152 mainVisible=0; |
1800 | 153 |
1907 | 154 appInitStruct( &tmpList ); |
155 skinAppMPlayer=&tmpList; | |
156 fntFreeFont(); | |
157 ret=skinRead( gtkShMem->sb.name ); | |
1800 | 158 |
1907 | 159 appInitStruct( &tmpList ); |
160 skinAppMPlayer=&appMPlayer; | |
161 appInitStruct( &appMPlayer ); | |
162 if ( !ret ) strcpy( skinName,gtkShMem->sb.name ); | |
163 skinRead( skinName ); | |
164 if ( ret ) | |
165 { | |
166 mainVisible=1; | |
167 return; | |
168 } | |
1800 | 169 |
1907 | 170 if ( appMPlayer.menuBase.Bitmap.Image ) |
171 { | |
172 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); | |
173 if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
174 { message( False,MSGTR_NEMDB ); return; } | |
175 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
176 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
177 } | |
1800 | 178 |
1907 | 179 mplSkinChanged=1; |
180 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
181 if ( !mplShMem->Playing ) | |
182 { | |
183 mplSkinChanged=0; | |
184 if ( !appMPlayer.subWindow.isFullScreen ) | |
1800 | 185 { |
1907 | 186 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); |
187 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); | |
188 } | |
189 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); | |
190 wsClearWindow( appMPlayer.subWindow ); | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
191 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); |
1907 | 192 mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow ); |
193 } | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
194 |
1907 | 195 if ( mplDrawBuffer ) free( mplDrawBuffer ); |
196 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
197 { message( False,MSGTR_NEMDB ); return; } | |
198 wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow ); | |
199 wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
200 wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y ); | |
201 wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
202 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
203 mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); | |
204 wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration ); | |
205 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
206 |
1907 | 207 btnModify( evSetVolume,mplShMem->Volume ); |
208 btnModify( evSetBalance,mplShMem->Balance ); | |
209 btnModify( evSetMoviePosition,mplShMem->Position ); | |
1800 | 210 } |
1802 | 211 |
212 void EventHandling( void ) | |
213 { | |
1861 | 214 wsHandleEvents();mplTimerHandler(0); // handle GUI timer events |
1907 | 215 if ( mplShMem->SkinChange ) { ChangeSkin(); mplShMem->SkinChange=0; } |
1802 | 216 } |
1952 | 217 |
218 void mplResizeToMovieSize( unsigned int width,unsigned int height ) | |
219 { | |
220 if ( !appMPlayer.subWindow.isFullScreen ) | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
221 { |
1952 | 222 wsResizeWindow( &appMPlayer.subWindow,width,height ); |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
223 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); |
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
224 } |
1952 | 225 } |