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