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