Mercurial > mplayer.hg
annotate Gui/mplayer/play.c @ 5429:e9e2dc1306b1
BITMAPINFOHEADER fixed to be accepted by win32 decoders (divx,divxds)
author | arpi |
---|---|
date | Sun, 31 Mar 2002 20:17:27 +0000 |
parents | b3bd4b29a03b |
children | 3e7f39c4110c |
rev | line source |
---|---|
4428 | 1 #include <inttypes.h> |
1693 | 2 #include <stdlib.h> |
3 #include <stdio.h> | |
4 | |
5 #include <unistd.h> | |
6 #include <signal.h> | |
7 | |
8 #include "../wm/ws.h" | |
9 #include "../../config.h" | |
1884 | 10 #include "../../help_mp.h" |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
11 #include "../../libvo/x11_common.h" |
1693 | 12 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
13 #include "../app.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
14 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
15 #include "../wm/wskeys.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
16 #include "../wm/widget.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
17 #include "../interface.h" |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
18 |
1693 | 19 #include "widgets.h" |
20 #include "./mplayer.h" | |
21 #include "play.h" | |
22 | |
1800 | 23 #include "../skin/skin.h" |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
24 #include "../skin/font.h" |
1693 | 25 |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
26 extern float rel_seek_secs; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
27 extern int abs_seek_pos; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1693
diff
changeset
|
28 |
1693 | 29 void mplFullScreen( void ) |
30 { | |
2029 | 31 static int sx,sy; |
2979 | 32 |
5032 | 33 // if ( !guiIntfStruct.Playing ) |
2029 | 34 { |
4981 | 35 wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); |
36 if ( appMPlayer.subWindow.isFullScreen ) | |
37 { | |
38 wsResizeWindow( &appMPlayer.subWindow,sx,sy ); | |
39 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); | |
40 wsWindowDecoration( &appMPlayer.subWindow,appMPlayer.subWindow.Decorations ); | |
41 appMPlayer.subWindow.isFullScreen=0; | |
42 } | |
43 else | |
44 { | |
45 sx=appMPlayer.subWindow.Width; sy=appMPlayer.subWindow.Height; | |
46 wsResizeWindow( &appMPlayer.subWindow,wsMaxX,wsMaxY ); | |
47 wsMoveWindow( &appMPlayer.subWindow,True,0,0 ); | |
48 wsWindowDecoration( &appMPlayer.subWindow,0 ); | |
49 appMPlayer.subWindow.isFullScreen=1; | |
50 } | |
5032 | 51 vo_fs=appMPlayer.subWindow.isFullScreen; |
4981 | 52 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
5032 | 53 }// else { vo_x11_fullscreen(); appMPlayer.subWindow.isFullScreen=vo_fs; } |
4981 | 54 |
55 fullscreen=appMPlayer.subWindow.isFullScreen; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
56 if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); |
2045 | 57 else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
1693 | 58 } |
59 | |
60 extern int mplSubRender; | |
61 | |
62 void mplStop() | |
63 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
64 guiIntfStruct.Playing=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
65 guiIntfStruct.TimeSec=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
66 guiIntfStruct.Position=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
67 guiIntfStruct.AudioType=0; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
68 // if ( !guiIntfStruct.Playing ) return; |
1796 | 69 if ( !appMPlayer.subWindow.isFullScreen ) |
70 { | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
71 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); |
2854 | 72 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
1796 | 73 } |
4963 | 74 guiGetEvent( guiCEvent,guiSetStop ); |
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 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
83 if ( ( !guiIntfStruct.Filename )|| |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
84 ( guiIntfStruct.Filename[0] == 0 )|| |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
85 ( guiIntfStruct.Playing == 1 ) ) return; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
86 if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; } |
4963 | 87 guiGetEvent( guiCEvent,guiSetPlay ); |
1791 | 88 mplSubRender=0; |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1852
diff
changeset
|
89 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
90 wsClearWindow( appMPlayer.subWindow ); |
4963 | 91 // wsPostRedisplay( &appMPlayer.subWindow ); |
1693 | 92 } |
93 | |
94 void mplPause( void ) | |
95 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
96 switch( guiIntfStruct.Playing ) |
1804 | 97 { |
98 case 1: // playing | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
99 guiIntfStruct.Playing=2; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
100 break; |
4465 | 101 case 2: // paused |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
102 guiIntfStruct.Playing=1; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
103 break; |
1804 | 104 } |
4465 | 105 mplState(); |
1815 | 106 mplSubRender=0; |
1693 | 107 } |
108 | |
4465 | 109 void mplState( void ) |
110 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
111 if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) ) |
4465 | 112 { |
113 btnModify( evPlaySwitchToPause,btnReleased ); | |
114 btnModify( evPauseSwitchToPlay,btnDisabled ); | |
115 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
116 else |
4465 | 117 { |
118 btnModify( evPlaySwitchToPause,btnDisabled ); | |
119 btnModify( evPauseSwitchToPlay,btnReleased ); | |
120 } | |
121 } | |
122 | |
1693 | 123 void mplMPlayerInit( int argc,char* argv[], char *envp[] ) |
124 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
125 guiIntfStruct.Balance=50.0f; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
126 guiIntfStruct.StreamType=-1; |
1693 | 127 } |
128 | |
129 float mplGetPosition( void ) | |
130 { // return 0.0 ... 100.0 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
131 return guiIntfStruct.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 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
146 void ChangeSkin( char * name ) |
1800 | 147 { |
1907 | 148 int ret; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
149 // if ( !strcmp( skinName,name ) ) return; |
1907 | 150 mainVisible=0; |
1800 | 151 |
1907 | 152 appInitStruct( &tmpList ); |
153 skinAppMPlayer=&tmpList; | |
154 fntFreeFont(); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
155 ret=skinRead( name ); |
1800 | 156 |
1907 | 157 appInitStruct( &tmpList ); |
158 skinAppMPlayer=&appMPlayer; | |
159 appInitStruct( &appMPlayer ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
160 if ( ret ) name=skinName; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
161 if ( skinRead( name ) ) |
1907 | 162 { |
163 mainVisible=1; | |
164 return; | |
165 } | |
1800 | 166 |
1907 | 167 if ( appMPlayer.menuBase.Bitmap.Image ) |
168 { | |
169 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); | |
170 if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
171 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } |
1907 | 172 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); |
173 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); | |
174 } | |
1800 | 175 |
2226 | 176 if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
177 if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) ) |
2226 | 178 { |
179 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); | |
2854 | 180 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
181 } |
2226 | 182 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
183 if ( !guiIntfStruct.Playing ) |
2226 | 184 { |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
185 mplSubRender=1; |
2911 | 186 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
2226 | 187 wsClearWindow( appMPlayer.subWindow ); |
188 wsPostRedisplay( &appMPlayer.subWindow ); | |
189 } | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1861
diff
changeset
|
190 |
1907 | 191 if ( mplDrawBuffer ) free( mplDrawBuffer ); |
192 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
193 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } |
1907 | 194 wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow ); |
195 wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); | |
2854 | 196 wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y ); |
1907 | 197 wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); |
198 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
2979 | 199 wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration ); |
1907 | 200 mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); |
201 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
202 |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
203 btnModify( evSetVolume,guiIntfStruct.Volume ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
204 btnModify( evSetBalance,guiIntfStruct.Balance ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
205 btnModify( evSetMoviePosition,guiIntfStruct.Position ); |
3479 | 206 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); |
1800 | 207 } |
1802 | 208 |
1952 | 209 void mplResizeToMovieSize( unsigned int width,unsigned int height ) |
210 { | |
211 if ( !appMPlayer.subWindow.isFullScreen ) | |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1953
diff
changeset
|
212 { |
1952 | 213 wsResizeWindow( &appMPlayer.subWindow,width,height ); |
2854 | 214 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
215 } |
1952 | 216 } |
2854 | 217 |
218 void mplSetFileName( char * fname ) | |
219 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
220 if ( !fname ) return; |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
221 if ( guiIntfStruct.Filename ) free( guiIntfStruct.Filename ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
222 guiIntfStruct.Filename=strdup( fname ); |
2854 | 223 } |