annotate Gui/interface.c @ 6125:018a0d7dddd4

-vm -fs fix by Tobias Diedrich <ranma@gmx.at>
author arpi
date Sun, 19 May 2002 23:31:10 +0000
parents b5fb9a927bf3
children 8cfddba867b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
1
4845
ed5aa118e142 inttypes.h bug fix. 10l
pontscho
parents: 4818
diff changeset
2 #include <inttypes.h>
ed5aa118e142 inttypes.h bug fix. 10l
pontscho
parents: 4818
diff changeset
3 #include <stdlib.h>
ed5aa118e142 inttypes.h bug fix. 10l
pontscho
parents: 4818
diff changeset
4 #include <stdio.h>
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
5 #include <string.h>
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
6
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
7 #include "ws.h"
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
8 #include "mplayer/play.h"
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
9 #include "interface.h"
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
10
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
11 #include "../mplayer.h"
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
12 #include "mplayer/widgets.h"
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
13 #include "mplayer/mplayer.h"
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 #include "../libvo/x11_common.h"
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
16 #include "../libvo/video_out.h"
4858
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
17 #include "../input/input.h"
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
18
5665
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
19 #include "../libmpdemux/stream.h"
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
20 #include "../libmpdemux/demuxer.h"
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
21
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
22 guiInterface_t guiIntfStruct;
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
23
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
24 void guiInit( int argc,char* argv[], char *envp[] )
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
25 {
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
26 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
27 appInit( argc,argv,envp,(void*)mDisplay );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
28 }
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
29
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
30 void guiDone( void )
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
31 {
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
32 mp_msg( MSGT_GPLAYER,MSGL_V,"[mplayer] exit.\n" );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
33 mplStop();
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
34 gtkDone();
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
35 wsXDone();
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
36 }
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
37
4858
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
38 int guiCMDArray[] =
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
39 {
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
40 evLoad,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
41 evLoadSubtitle,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
42 evAbout,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
43 evPlay,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
44 evStop,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
45 evPlayList,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
46 evPreferences,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
47 evFullScreen,
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
48 evSkinBrowser
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
49 };
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
50
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
51 typedef struct
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
52 {
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
53 demux_stream_t *ds;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
54 unsigned int format;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
55 struct codecs_st *codec;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
56 int inited;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
57 // output format:
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
58 float timer;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
59 float fps;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
60 float frametime;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
61 int i_bps;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
62 int disp_w,disp_h;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
63 } tmp_sh_video_t;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
64
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
65 void guiGetEvent( int type,char * arg )
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
66 {
5672
1f8b34f1e7c0 ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents: 5665
diff changeset
67 #ifdef USE_DVDREAD
5665
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
68 dvd_priv_t * dvdp = (dvd_priv_t *) arg;
5672
1f8b34f1e7c0 ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents: 5665
diff changeset
69 #endif
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
70 switch ( type )
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
71 {
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
72 case guiXEvent:
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
73 wsEvents( wsDisplay,(XEvent *)arg,NULL );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
74 gtkEventHandling();
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
75 break;
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
76 case guiCEvent:
4963
13262bd21965 small changes
pontscho
parents: 4858
diff changeset
77 switch ( (int)arg )
13262bd21965 small changes
pontscho
parents: 4858
diff changeset
78 {
13262bd21965 small changes
pontscho
parents: 4858
diff changeset
79 case guiSetPlay: guiIntfStruct.Playing=1; mplState(); break;
13262bd21965 small changes
pontscho
parents: 4858
diff changeset
80 case guiSetStop: guiIntfStruct.Playing=0; mplState(); break;
13262bd21965 small changes
pontscho
parents: 4858
diff changeset
81 case guiSetPause: guiIntfStruct.Playing=2; mplState(); break;
13262bd21965 small changes
pontscho
parents: 4858
diff changeset
82 }
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
83 break;
5665
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
84 case guiSetState:
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
85 mplState();
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
86 break;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
87 case guiSetFileName:
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
88 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
89 break;
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
90 case guiSetAudioOnly:
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
91 guiIntfStruct.AudioOnly=(int)arg;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
92 if ( (int)arg ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
93 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
94 break;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
95 case guiReDrawSubWindow:
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
96 wsPostRedisplay( &appMPlayer.subWindow );
5956
1e6273906977 fix video vindov background
pontscho
parents: 5955
diff changeset
97 if ( guiIntfStruct.Playing == 1 ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
98 break;
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
99 case guiSetShVideo:
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
100 {
5986
d34622ebaf45 window resize bug fixed
pontscho
parents: 5956
diff changeset
101 if ( !appMPlayer.subWindow.isFullScreen )
d34622ebaf45 window resize bug fixed
pontscho
parents: 5956
diff changeset
102 {
d34622ebaf45 window resize bug fixed
pontscho
parents: 5956
diff changeset
103 wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight );
d34622ebaf45 window resize bug fixed
pontscho
parents: 5956
diff changeset
104 wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
d34622ebaf45 window resize bug fixed
pontscho
parents: 5956
diff changeset
105 }
5955
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
106 guiIntfStruct.MovieWidth=vo_dwidth;
5997
b5fb9a927bf3 add WM detection, and wm specific fullscreen code. (???)
pontscho
parents: 5986
diff changeset
107 guiIntfStruct.MovieHeight=vo_dheight;
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
108 }
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
109 break;
5665
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
110 #ifdef USE_DVDREAD
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
111 case guiSetDVD:
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
112 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
113 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
114 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
115 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
116 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) );
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
117 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
118 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) );
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
119 guiIntfStruct.DVD.current_title=dvd_title + 1;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
120 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
121 guiIntfStruct.DVD.current_angle=dvd_angle + 1;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
122 guiIntfStruct.Track=dvd_title + 1;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
123 break;
3e7f39c4110c fix dvd playing under gui
pontscho
parents: 5120
diff changeset
124 #endif
5120
ce054c1eabdc workaround to compile without new-input support
alex
parents: 4965
diff changeset
125 #ifdef HAVE_NEW_INPUT
4858
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
126 case guiIEvent:
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
127 printf( "cmd: %d\n",(int)arg );
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
128 switch( (int)arg )
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
129 {
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
130 case MP_CMD_QUIT:
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
131 mplEventHandling( evExit,0 );
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
132 break;
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
133 case MP_CMD_VO_FULLSCREEN:
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
134 mplEventHandling( evFullScreen,0 );
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
135 break;
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
136 default:
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
137 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 );
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
138 }
65730cea02e7 add half new input support for gui
pontscho
parents: 4845
diff changeset
139 break;
5120
ce054c1eabdc workaround to compile without new-input support
alex
parents: 4965
diff changeset
140 #endif
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
141 }
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
142 }
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
143
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
144 void guiEventHandling( void )
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
145 {
5789
0132c5747e8a fix audio only files play
pontscho
parents: 5672
diff changeset
146 if ( ( use_gui && !guiIntfStruct.Playing )||( guiIntfStruct.AudioOnly ) ) wsHandleEvents();
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
147 gtkEventHandling();
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4798
diff changeset
148 mplTimerHandler(); // handle GUI timer events
4798
c39affa2b376 new interface ? :)
pontscho
parents:
diff changeset
149 }