annotate Gui/mplayer/play.c @ 6857:397e7a1860f9

upsz 2
author pontscho
date Wed, 31 Jul 2002 13:26:46 +0000
parents 77980ab4e296
children c2d4100c964e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4428
3e1378354c2e Compilation fixing
nick
parents: 3479
diff changeset
1 #include <inttypes.h>
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
2 #include <stdlib.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3 #include <stdio.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5 #include <unistd.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6 #include <signal.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 #include "../wm/ws.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9 #include "../../config.h"
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
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"
5665
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5046
diff changeset
12 #include "../../input/input.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
14 #include "../app.h"
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
15
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
16 #include "../wm/wskeys.h"
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
17 #include "../wm/widget.h"
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
18 #include "../interface.h"
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
19
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 #include "widgets.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21 #include "./mplayer.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 #include "play.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23
1800
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
24 #include "../skin/skin.h"
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
25 #include "../skin/font.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1693
diff changeset
27 extern float rel_seek_secs;
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1693
diff changeset
28 extern int abs_seek_pos;
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1693
diff changeset
29
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
30 static int mplGotoTheNext = 1;
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
31
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 void mplFullScreen( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33 {
2029
41ed89701ece fix fucking icewm fullscreen bug.
pontscho
parents: 2025
diff changeset
34 static int sx,sy;
2979
6d341644ee28 smal; bugfix for main redraw
pontscho
parents: 2911
diff changeset
35
5910
20c335d98ab3 fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents: 5701
diff changeset
36 #if 0
5032
931ce1e11ad1 fix fs handling
pontscho
parents: 4983
diff changeset
37 // if ( !guiIntfStruct.Playing )
2029
41ed89701ece fix fucking icewm fullscreen bug.
pontscho
parents: 2025
diff changeset
38 {
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
39 wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
40 if ( appMPlayer.subWindow.isFullScreen )
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
41 {
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
42 wsResizeWindow( &appMPlayer.subWindow,sx,sy );
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
43 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
44 wsWindowDecoration( &appMPlayer.subWindow,appMPlayer.subWindow.Decorations );
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
45 appMPlayer.subWindow.isFullScreen=0;
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
46 }
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
47 else
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
48 {
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
49 sx=appMPlayer.subWindow.Width; sy=appMPlayer.subWindow.Height;
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
50 wsResizeWindow( &appMPlayer.subWindow,wsMaxX,wsMaxY );
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
51 wsMoveWindow( &appMPlayer.subWindow,True,0,0 );
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
52 wsWindowDecoration( &appMPlayer.subWindow,0 );
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
53 appMPlayer.subWindow.isFullScreen=1;
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
54 }
5032
931ce1e11ad1 fix fs handling
pontscho
parents: 4983
diff changeset
55 vo_fs=appMPlayer.subWindow.isFullScreen;
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
56 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
5032
931ce1e11ad1 fix fs handling
pontscho
parents: 4983
diff changeset
57 }// else { vo_x11_fullscreen(); appMPlayer.subWindow.isFullScreen=vo_fs; }
5910
20c335d98ab3 fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents: 5701
diff changeset
58 #else
5997
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
59 if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) )
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
60 {
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
61 appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
62 switch ( appMPlayer.sub.x )
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
63 {
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
64 case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ); break;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
65 case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth; break;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
66 default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
67 }
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
68 switch ( appMPlayer.sub.y )
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
69 {
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
70 case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ); break;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
71 case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight; break;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
72 default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
73 }
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
74 }
5910
20c335d98ab3 fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents: 5701
diff changeset
75 wsFullScreen( &appMPlayer.subWindow );
5997
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
76 vo_fs=appMPlayer.subWindow.isFullScreen;
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
77 wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
78 wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
5910
20c335d98ab3 fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents: 5701
diff changeset
79 #endif
20c335d98ab3 fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents: 5701
diff changeset
80
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4963
diff changeset
81 fullscreen=appMPlayer.subWindow.isFullScreen;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
82 if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
2045
deb4aff05c44 fix other bugs
pontscho
parents: 2029
diff changeset
83 else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 extern int mplSubRender;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
88 void mplEnd( void )
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
89 {
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
90 plItem * next;
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
91
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
92 if ( !mplGotoTheNext ) { mplGotoTheNext=1; return; }
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
93
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
94 if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
95 {
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
96 plLastPlayed=next;
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
97 guiSetDF( guiIntfStruct.Filename,next->path,next->name );
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
98 guiIntfStruct.StreamType=STREAMTYPE_FILE;
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
99 guiIntfStruct.FilenameChanged=1;
6857
pontscho
parents: 6794
diff changeset
100 gfree( (void **)&guiIntfStruct.AudioFile );
pontscho
parents: 6794
diff changeset
101 gfree( (void **)&guiIntfStruct.Subtitlename );
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
102 }
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
103 else
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
104 {
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
105 guiIntfStruct.TimeSec=0;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
106 guiIntfStruct.Position=0;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
107 guiIntfStruct.AudioType=0;
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
108
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
109 if ( !appMPlayer.subWindow.isFullScreen )
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
110 {
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
111 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
112 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
113 }
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
114 guiGetEvent( guiCEvent,guiSetStop );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
115 mplSubRender=1;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
116 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
117 wsClearWindow( appMPlayer.subWindow );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
118 wsPostRedisplay( &appMPlayer.subWindow );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
119 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
120 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
121
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
122 void mplPlay( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
123 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
124 if ( ( !guiIntfStruct.Filename )||
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
125 ( guiIntfStruct.Filename[0] == 0 )||
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
126 ( guiIntfStruct.Playing == 1 ) ) return;
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
127 if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
128 guiGetEvent( guiCEvent,(void *)guiSetPlay );
1791
2e86c5c8071e fix subvindov
pontscho
parents: 1784
diff changeset
129 mplSubRender=0;
1858
88a88d0a3f94 fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents: 1852
diff changeset
130 wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
131 wsClearWindow( appMPlayer.subWindow );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
132 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
133
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
134 void mplPause( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
135 {
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
136 if ( !guiIntfStruct.Playing ) return;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
137 if ( guiIntfStruct.Playing == 1 )
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
138 {
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
139 mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
140 cmd->id=MP_CMD_PAUSE;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
141 cmd->name=strdup("pause");
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
142 mp_input_queue_cmd(cmd);
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
143 } else guiIntfStruct.Playing=1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
144 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
145
4465
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
146 void mplState( void )
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
147 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
148 if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
4465
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
149 {
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
150 btnModify( evPlaySwitchToPause,btnReleased );
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
151 btnModify( evPauseSwitchToPlay,btnDisabled );
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
152 }
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
153 else
4465
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
154 {
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
155 btnModify( evPlaySwitchToPause,btnDisabled );
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
156 btnModify( evPauseSwitchToPlay,btnReleased );
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
157 }
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
158 }
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4428
diff changeset
159
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
160 float mplGetPosition( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
161 { // return 0.0 ... 100.0
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
162 return guiIntfStruct.Position;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
163 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
164
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
165 void mplRelSeek( float s )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
166 { // -+s
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1693
diff changeset
167 rel_seek_secs=s; abs_seek_pos=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
168 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
169
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
170 void mplAbsSeek( float s )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
171 { // 0.0 ... 100.0
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1693
diff changeset
172 rel_seek_secs=0.01*s; abs_seek_pos=3;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
173 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
174
1800
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
175 listItems tmpList;
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
176
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
177 void ChangeSkin( char * name )
1800
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
178 {
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
179 int ret;
5690
436cf6ef67fd fix skin loading bug
pontscho
parents: 5689
diff changeset
180
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
181 mainVisible=0;
1800
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
182
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
183 appInitStruct( &tmpList );
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
184 skinAppMPlayer=&tmpList;
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
185 fntFreeFont();
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
186 ret=skinRead( name );
1800
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
187
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
188 appInitStruct( &tmpList );
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
189 skinAppMPlayer=&appMPlayer;
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
190 appInitStruct( &appMPlayer );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
191 if ( ret ) name=skinName;
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
192 if ( skinRead( name ) )
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
193 {
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
194 mainVisible=1;
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
195 return;
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
196 }
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
197 if ( appMPlayer.menuBase.Bitmap.Image )
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
198 {
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
199 if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
200 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
201 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
202 wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
203 wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
6221
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6219
diff changeset
204 wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
6089
39c2bfe5c267 small fixes
pontscho
parents: 5997
diff changeset
205 wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
206 }
1800
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
207
2226
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
208 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
209 if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
2226
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
210 {
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
211 wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2447
diff changeset
212 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
213 }
2226
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
214 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
215 if ( !guiIntfStruct.Playing )
2226
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
216 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
217 mplSubRender=1;
2911
7a8cc25832fa skin change bug fix
pontscho
parents: 2854
diff changeset
218 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
2226
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
219 wsClearWindow( appMPlayer.subWindow );
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
220 wsPostRedisplay( &appMPlayer.subWindow );
9582af160d04 skin chaning bug fix.
pontscho
parents: 2045
diff changeset
221 }
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1861
diff changeset
222
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
223 if ( mplDrawBuffer ) free( mplDrawBuffer );
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
224 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
225 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
226
b9651eb9749e fix some gtk bug...
pontscho
parents: 6089
diff changeset
227 if ( wsWMType == wsWMUnknown ) wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
228 wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2447
diff changeset
229 wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y );
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
230 wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
231 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
2979
6d341644ee28 smal; bugfix for main redraw
pontscho
parents: 2911
diff changeset
232 wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration );
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
233 mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1888
diff changeset
234 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
235
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
236 btnModify( evSetVolume,guiIntfStruct.Volume );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
237 btnModify( evSetBalance,guiIntfStruct.Balance );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
238 btnModify( evSetMoviePosition,guiIntfStruct.Position );
3479
2704448de713 fs button bug fix
pontscho
parents: 2979
diff changeset
239 btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
1800
f5ffb03ebdb5 move skin changing here.
pontscho
parents: 1797
diff changeset
240 }
1802
82e77faa7341 async reply fix ?
pontscho
parents: 1800
diff changeset
241
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
242 void mplSetFileName( char * dir,char * name )
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2447
diff changeset
243 {
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
244 if ( !name || !dir ) return;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
245 guiSetDF( guiIntfStruct.Filename,dir,name );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
246 guiIntfStruct.StreamType=STREAMTYPE_FILE;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
247 guiIntfStruct.FilenameChanged=1;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
248 gfree( (void **)&guiIntfStruct.AudioFile );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
249 gfree( (void **)&guiIntfStruct.Subtitlename );
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2447
diff changeset
250 }
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
251
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
252 void mplPrev( void )
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
253 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
254 plItem * prev;
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
255 int stop = 0;
6280
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
256
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
257 if ( guiIntfStruct.Playing == 2 ) return;
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
258 switch ( guiIntfStruct.StreamType )
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
259 {
5701
67f0194f3a8c fix compile bug
pontscho
parents: 5690
diff changeset
260 #ifdef USE_DVDREAD
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
261 case STREAMTYPE_DVD:
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
262 if ( --guiIntfStruct.DVD.current_chapter == 0 )
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
263 {
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
264 guiIntfStruct.DVD.current_chapter=1;
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
265 if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; }
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
266 }
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
267 guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
268 break;
5701
67f0194f3a8c fix compile bug
pontscho
parents: 5690
diff changeset
269 #endif
6280
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
270 #ifdef HAVE_VCD
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
271 case STREAMTYPE_VCD:
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
272 if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
273 break;
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
274 #endif
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
275 default:
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
276 if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) )
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
277 {
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
278 mplSetFileName( prev->path,prev->name );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
279 mplGotoTheNext=0;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
280 break;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
281 }
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
282 return;
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
283 }
6280
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
284 if ( stop ) mplEventHandling( evStop,0 );
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
285 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
286 }
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
287
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
288 void mplNext( void )
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
289 {
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
290 int stop = 0;
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
291 plItem * next;
6280
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
292
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
293 if ( guiIntfStruct.Playing == 2 ) return;
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
294 switch ( guiIntfStruct.StreamType )
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
295 {
5701
67f0194f3a8c fix compile bug
pontscho
parents: 5690
diff changeset
296 #ifdef USE_DVDREAD
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
297 case STREAMTYPE_DVD:
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
298 if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters )
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
299 {
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
300 guiIntfStruct.DVD.current_chapter=1;
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
301 if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; }
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
302 }
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
303 guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
304 break;
5701
67f0194f3a8c fix compile bug
pontscho
parents: 5690
diff changeset
305 #endif
6280
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
306 #ifdef HAVE_VCD
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
307 case STREAMTYPE_VCD:
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
308 if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
309 break;
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
310 #endif
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
311 default:
6794
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
312 if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) )
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
313 {
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
314 mplSetFileName( next->path,next->name );
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
315 mplGotoTheNext=0;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
316 break;
77980ab4e296 - add preferences support (first try)
pontscho
parents: 6713
diff changeset
317 }
6713
cc917a581b6e add simple playlist support
pontscho
parents: 6280
diff changeset
318 return;
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
319 }
6280
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
320 if ( stop ) mplEventHandling( evStop,0 );
cf2c2b92d1a7 add VCD support for GUI
pontscho
parents: 6221
diff changeset
321 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
5689
2077782d0ca9 add prev/next title feature for gui dvd support
pontscho
parents: 5665
diff changeset
322 }