Mercurial > mplayer.hg
annotate Gui/mplayer/play.c @ 2739:f365024806c0
mmx2 bgr24 stuff from swscale (slightly faster)
author | michael |
---|---|
date | Tue, 06 Nov 2001 14:43:19 +0000 |
parents | 3248aabc6d1d |
children | fd44ecf77f8d |
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; | |
2447 | 124 mplShMem->StreamType=-1; |
1850 | 125 memset(&sa, 0, sizeof(sa)); |
126 sa.sa_handler = mplMainSigHandler; | |
127 sigaction( SIGTYPE,&sa,NULL ); | |
1693 | 128 } |
129 | |
130 float mplGetPosition( void ) | |
131 { // return 0.0 ... 100.0 | |
1729 | 132 return mplShMem->Position; |
1693 | 133 } |
134 | |
135 void mplRelSeek( float s ) | |
136 { // -+s | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
137 rel_seek_secs=s; abs_seek_pos=0; |
1693 | 138 } |
139 | |
140 void mplAbsSeek( float s ) | |
141 { // 0.0 ... 100.0 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
142 rel_seek_secs=0.01*s; abs_seek_pos=3; |
1693 | 143 } |
144 | |
1800 | 145 listItems tmpList; |
146 | |
147 void ChangeSkin( void ) | |
148 { | |
1907 | 149 int ret; |
150 if ( !strcmp( skinName,gtkShMem->sb.name ) ) return; | |
1800 | 151 #ifdef DEBUG |
1907 | 152 dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name ); |
1800 | 153 #endif |
154 | |
1907 | 155 mainVisible=0; |
1800 | 156 |
1907 | 157 appInitStruct( &tmpList ); |
158 skinAppMPlayer=&tmpList; | |
159 fntFreeFont(); | |
160 ret=skinRead( gtkShMem->sb.name ); | |
1800 | 161 |
1907 | 162 appInitStruct( &tmpList ); |
163 skinAppMPlayer=&appMPlayer; | |
164 appInitStruct( &appMPlayer ); | |
165 if ( !ret ) strcpy( skinName,gtkShMem->sb.name ); | |
166 skinRead( skinName ); | |
167 if ( ret ) | |
168 { | |
169 mainVisible=1; | |
170 return; | |
171 } | |
1800 | 172 |
1907 | 173 if ( appMPlayer.menuBase.Bitmap.Image ) |
174 { | |
175 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); | |
176 if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
177 { message( False,MSGTR_NEMDB ); return; } | |
178 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
179 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
180 } | |
1800 | 181 |
2226 | 182 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); |
183 if ( ( !appMPlayer.subWindow.isFullScreen )&&( !mplShMem->Playing ) ) | |
184 { | |
185 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); | |
186 wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); | |
187 } | |
188 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); | |
189 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); | |
190 if ( !mplShMem->Playing ) | |
191 { | |
192 mplSubRender=1; | |
193 wsClearWindow( appMPlayer.subWindow ); | |
194 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 } |