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