Mercurial > mplayer.hg
annotate Gui/mplayer/play.c @ 1907:83291fafe66c
add new features. and fix skin error loop.
author | pontscho |
---|---|
date | Mon, 17 Sep 2001 21:16:00 +0000 |
parents | 1f1e98fbf3a7 |
children | b55163894e30 |
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 { | |
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; |
1888 | 53 mplShMem->AudioType=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 { | |
1907 | 130 int ret; |
131 if ( !strcmp( skinName,gtkShMem->sb.name ) ) return; | |
1800 | 132 #ifdef DEBUG |
1907 | 133 dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name ); |
1800 | 134 #endif |
135 | |
1907 | 136 mainVisible=0; |
1800 | 137 |
1907 | 138 appInitStruct( &tmpList ); |
139 skinAppMPlayer=&tmpList; | |
140 fntFreeFont(); | |
141 ret=skinRead( gtkShMem->sb.name ); | |
1800 | 142 |
1907 | 143 appInitStruct( &tmpList ); |
144 skinAppMPlayer=&appMPlayer; | |
145 appInitStruct( &appMPlayer ); | |
146 if ( !ret ) strcpy( skinName,gtkShMem->sb.name ); | |
147 skinRead( skinName ); | |
148 if ( ret ) | |
149 { | |
150 mainVisible=1; | |
151 return; | |
152 } | |
1800 | 153 |
1907 | 154 if ( appMPlayer.menuBase.Bitmap.Image ) |
155 { | |
156 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); | |
157 if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
158 { message( False,MSGTR_NEMDB ); return; } | |
159 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
160 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
161 } | |
1800 | 162 |
1907 | 163 mplSkinChanged=1; |
164 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
165 if ( !mplShMem->Playing ) | |
166 { | |
167 mplSkinChanged=0; | |
168 if ( !appMPlayer.subWindow.isFullScreen ) | |
1800 | 169 { |
1907 | 170 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); |
171 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); | |
172 } | |
173 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); | |
174 wsClearWindow( appMPlayer.subWindow ); | |
175 mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow ); | |
176 } | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
177 |
1907 | 178 if ( mplDrawBuffer ) free( mplDrawBuffer ); |
179 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
180 { message( False,MSGTR_NEMDB ); return; } | |
181 wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow ); | |
182 wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
183 wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y ); | |
184 wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
185 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
186 mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); | |
187 wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration ); | |
188 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
189 |
1907 | 190 btnModify( evSetVolume,mplShMem->Volume ); |
191 btnModify( evSetBalance,mplShMem->Balance ); | |
192 btnModify( evSetMoviePosition,mplShMem->Position ); | |
1800 | 193 } |
1802 | 194 |
195 void EventHandling( void ) | |
196 { | |
1861 | 197 wsHandleEvents();mplTimerHandler(0); // handle GUI timer events |
1907 | 198 if ( mplShMem->SkinChange ) { ChangeSkin(); mplShMem->SkinChange=0; } |
1802 | 199 } |