Mercurial > mplayer.hg
annotate Gui/interface.c @ 5869:412ff784c971
Avoid bogus file not found message if vobsub isn'T forced (autodetect).
author | atmos4 |
---|---|
date | Sat, 27 Apr 2002 20:46:39 +0000 |
parents | 0132c5747e8a |
children | f9fe22a52e80 |
rev | line source |
---|---|
4798 | 1 |
4845 | 2 #include <inttypes.h> |
3 #include <stdlib.h> | |
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 | 6 |
7 #include "ws.h" | |
8 #include "mplayer/play.h" | |
9 #include "interface.h" | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
10 |
4798 | 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 | 16 #include "../libvo/video_out.h" |
4858 | 17 #include "../input/input.h" |
5789 | 18 |
5665 | 19 #include "../libmpdemux/stream.h" |
5789 | 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 | 37 |
4858 | 38 int guiCMDArray[] = |
39 { | |
40 evLoad, | |
41 evLoadSubtitle, | |
42 evAbout, | |
43 evPlay, | |
44 evStop, | |
45 evPlayList, | |
46 evPreferences, | |
47 evFullScreen, | |
48 evSkinBrowser | |
49 }; | |
50 | |
5789 | 51 typedef struct |
52 { | |
53 demux_stream_t *ds; | |
54 unsigned int format; | |
55 struct codecs_st *codec; | |
56 int inited; | |
57 // output format: | |
58 float timer; | |
59 float fps; | |
60 float frametime; | |
61 int i_bps; | |
62 int disp_w,disp_h; | |
63 } tmp_sh_video_t; | |
64 | |
4798 | 65 void guiGetEvent( int type,char * arg ) |
66 { | |
5672
1f8b34f1e7c0
ifdef reading dvd args, without it non-dvd compilation fails.
eyck
parents:
5665
diff
changeset
|
67 #ifdef USE_DVDREAD |
5665 | 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 | 70 switch ( type ) |
71 { | |
72 case guiXEvent: | |
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 | 76 case guiCEvent: |
4963 | 77 switch ( (int)arg ) |
78 { | |
79 case guiSetPlay: guiIntfStruct.Playing=1; mplState(); break; | |
80 case guiSetStop: guiIntfStruct.Playing=0; mplState(); break; | |
81 case guiSetPause: guiIntfStruct.Playing=2; mplState(); break; | |
82 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
83 break; |
5665 | 84 case guiSetState: |
85 mplState(); | |
86 break; | |
87 case guiSetFileName: | |
88 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); | |
89 break; | |
5789 | 90 case guiSetAudioOnly: |
91 guiIntfStruct.AudioOnly=(int)arg; | |
92 if ( (int)arg ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
93 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
94 break; | |
95 case guiReDrawSubWindow: | |
96 wsPostRedisplay( &appMPlayer.subWindow ); | |
97 break; | |
98 case guiSetShVideo: | |
99 if ( arg ) | |
100 { | |
101 tmp_sh_video_t * sh_video = (tmp_sh_video_t *)arg; | |
102 mplResizeToMovieSize( sh_video->disp_w,sh_video->disp_h ); | |
103 guiIntfStruct.MovieWidth=sh_video->disp_w; | |
104 guiIntfStruct.MovieHeight=sh_video->disp_h; | |
105 } | |
106 break; | |
5665 | 107 #ifdef USE_DVDREAD |
108 case guiSetDVD: | |
109 guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; | |
110 guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; | |
111 guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; | |
112 guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; | |
113 memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); | |
114 guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; | |
115 memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); | |
116 guiIntfStruct.DVD.current_title=dvd_title + 1; | |
117 guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; | |
118 guiIntfStruct.DVD.current_angle=dvd_angle + 1; | |
119 guiIntfStruct.Track=dvd_title + 1; | |
120 break; | |
121 #endif | |
5120 | 122 #ifdef HAVE_NEW_INPUT |
4858 | 123 case guiIEvent: |
124 printf( "cmd: %d\n",(int)arg ); | |
125 switch( (int)arg ) | |
126 { | |
127 case MP_CMD_QUIT: | |
128 mplEventHandling( evExit,0 ); | |
129 break; | |
130 case MP_CMD_VO_FULLSCREEN: | |
131 mplEventHandling( evFullScreen,0 ); | |
132 break; | |
133 default: | |
134 mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 ); | |
135 } | |
136 break; | |
5120 | 137 #endif |
4798 | 138 } |
139 } | |
140 | |
141 void guiEventHandling( void ) | |
142 { | |
5789 | 143 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
|
144 gtkEventHandling(); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4798
diff
changeset
|
145 mplTimerHandler(); // handle GUI timer events |
4798 | 146 } |