annotate gui/win32/interface.c @ 23462:77cd8d54694a

protect _vidix_drivers variable, allowing --with-vidix-driver option to actually handle more than one driver
author ben
date Tue, 05 Jun 2007 18:35:34 +0000
parents 71efd1fc20c8
children 5701e23ebcb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1 /*
23079
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
2 * MPlayer GUI for Win32
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
3 * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
4 * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
5 * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
6 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
7 * This file is part of MPlayer.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
8 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
9 * MPlayer is free software; you can redistribute it and/or modify
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
10 * it under the terms of the GNU General Public License as published by
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
12 * (at your option) any later version.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
13 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
14 * MPlayer is distributed in the hope that it will be useful,
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
17 * GNU General Public License for more details.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
18 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
19 * You should have received a copy of the GNU General Public License
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
20 * along with MPlayer; if not, write to the Free Software
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
22 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include <windows.h>
23091
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
25
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
26 #include "interface.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
27 #include "m_option.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
28 #include "mixer.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
29 #include "mp_msg.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
30 #include "help_mp.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
31 #include "codec-cfg.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
32 #include "stream/stream.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
33 #include "libmpdemux/demuxer.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
34 #include "libmpdemux/stheader.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35 #ifdef USE_DVDREAD
23091
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
36 #include "stream/stream_dvd.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
37 #endif
23091
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
38 #include "input/input.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
39 #include "libvo/video_out.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
40 #include "libao2/audio_out.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
41 #include "access_mpcontext.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 #include "gui.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43 #include "dialogs.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44 #include "wincfg.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 #ifdef HAVE_LIBCDIO
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46 #include <cdio/cdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 extern int abs_seek_pos;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 extern float rel_seek_secs;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 extern int vcd_track;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 extern af_cfg_t af_cfg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 int guiWinID = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 char *skinName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 char *codecname = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 int mplGotoTheNext = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 static gui_t *mygui = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 static int update_subwindow(void);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 static RECT old_rect;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 static DWORD style;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 ao_functions_t *audio_out = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 vo_functions_t *video_out = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 mixer_t *mixer = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 /* test for playlist files, no need to specify -playlist on the commandline.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 * add any conceivable playlist extensions here.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 * - Erik
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69 */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 if(clear)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 mygui->playlist->clear_playlist(mygui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 if(strstr(file, ".m3u") || strstr(file, ".pls"))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 playtree = parse_playlist_file(file);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 import_playtree_playlist_into_gui(playtree, mconfig);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 return 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 /**
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 * \brief this actually creates a new list containing only one element...
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 void gaddlist( char ***list, const char *entry)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 if (*list)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 for (i=0; (*list)[i]; i++) free((*list)[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 free(*list);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 *list = malloc(2 * sizeof(char **));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 (*list)[0] = gstrdup(entry);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 (*list)[1] = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 char *gstrdup(const char *str)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 if (!str) return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 return strdup(str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 /**
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 * \brief this replaces a string starting with search by replace.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 * If not found, replace is appended.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112 void greplace(char ***list, char *search, char *replace)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 int i = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 int len = (search) ? strlen(search) : 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 if (*list)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 for (i = 0; (*list)[i]; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 if (search && (!strncmp((*list)[i], search, len)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123 free((*list)[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 (*list)[i] = gstrdup(replace);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 *list = realloc(*list, (i + 2) * sizeof(char *));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 *list = malloc(2 * sizeof(char *));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 (*list)[i] = gstrdup(replace);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 (*list)[i + 1] = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 /* this function gets called by the gui to update mplayer */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 static void guiSetEvent(int event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 if(guiIntfStruct.mpcontext)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 switch(event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 case evPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 case evPlaySwitchToPause:
23148
71efd1fc20c8 add missing case value, fixes functionality when using some skins.
vayne
parents: 23147
diff changeset
147 case evPauseSwitchToPlay:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 mplPlay();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 case evPause:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 mplPause();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 case evPlayDVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 static char dvdname[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 guiIntfStruct.DVD.current_title = dvd_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 guiIntfStruct.DVD.current_chapter = dvd_chapter;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 guiIntfStruct.DVD.current_angle = dvd_angle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 guiIntfStruct.DiskChanged = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 mplSetFileName(NULL, dvd_device, STREAMTYPE_DVD);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 dvdname[0] = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164 strcat(dvdname, "DVD Movie");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 GetVolumeInformation(dvd_device, dvdname, MAX_PATH, NULL, NULL, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 capitalize(dvdname);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 mp_msg(MSGT_GPLAYER, MSGL_V, "Opening DVD %s -> %s\n", dvd_device, dvdname);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 guiGetEvent(guiSetParameters, (char *) STREAMTYPE_DVD);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 mygui->playlist->clear_playlist(mygui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 mygui->playlist->add_track(mygui->playlist, filename, NULL, dvdname, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 mygui->startplay(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 #ifdef HAVE_LIBCDIO
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 case evPlayCD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 char track[10];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 char trackname[10];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 CdIo_t *p_cdio = cdio_open(NULL, DRIVER_UNKNOWN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 track_t i_tracks;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 if(p_cdio == NULL) printf("Couldn't find a driver.\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 i_tracks = cdio_get_num_tracks(p_cdio);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 mygui->playlist->clear_playlist(mygui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188 for(i=0;i<i_tracks;i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190 sprintf(track, "cdda://%d", i+1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 sprintf(trackname, "Track %d", i+1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 mygui->playlist->add_track(mygui->playlist, track, NULL, trackname, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 cdio_destroy(p_cdio);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 mygui->startplay(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 case evFullScreen:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 mp_input_queue_cmd(mp_input_parse_cmd("vo_fullscreen"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 case evExit:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 /* We are asking mplayer to exit, later it will ask us after uninit is made
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 this should be the only safe way to quit */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 mygui->activewidget = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 mp_input_queue_cmd(mp_input_parse_cmd("quit"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 case evStop:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 if(guiIntfStruct.Playing)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 guiGetEvent(guiCEvent, (void *) guiSetStop);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 case evSetMoviePosition:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 rel_seek_secs = guiIntfStruct.Position / 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 abs_seek_pos = 3;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 case evForward10sec:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 rel_seek_secs = 10.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 abs_seek_pos = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 case evBackward10sec:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 rel_seek_secs = -10.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 abs_seek_pos = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 case evSetBalance:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 case evSetVolume:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235 float l,r;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 if (guiIntfStruct.Playing == 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 if (guiIntfStruct.Balance == 50.0f)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 mixer_setvolume(mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 l = guiIntfStruct.Volume * ((100.0f - guiIntfStruct.Balance) / 50.0f);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 r = guiIntfStruct.Volume * ((guiIntfStruct.Balance) / 50.0f);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 if (l > guiIntfStruct.Volume) l=guiIntfStruct.Volume;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 if (r > guiIntfStruct.Volume) r=guiIntfStruct.Volume;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 mixer_setvolume(mixer, l, r);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 /* Check for balance support on mixer - there is a better way ?? */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 if (r != l)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 mixer_getvolume(mixer, &l, &r);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 if (r == l)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Mixer doesn't support balanced audio\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256 mixer_setvolume(mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 guiIntfStruct.Balance = 50.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 case evMute:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 mp_cmd_t * cmd = calloc(1, sizeof(*cmd));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265 cmd->id=MP_CMD_MUTE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 cmd->name=strdup("mute");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 mp_input_queue_cmd(cmd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
270 case evDropFile:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271 case evLoadPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273 switch(guiIntfStruct.StreamType)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 {
23147
21c35763b178 compilation fix for disabling dvd functionality, patch by <bangbangbear at gmail dot com>, slightly modified by me.
vayne
parents: 23123
diff changeset
275 #ifdef USE_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 guiIntfStruct.Title = guiIntfStruct.DVD.current_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279 guiIntfStruct.Chapter = guiIntfStruct.DVD.current_chapter;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
280 guiIntfStruct.Angle = guiIntfStruct.DVD.current_angle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
281 guiIntfStruct.DiskChanged = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 guiGetEvent(guiCEvent, (void *) guiSetPlay);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 }
23147
21c35763b178 compilation fix for disabling dvd functionality, patch by <bangbangbear at gmail dot com>, slightly modified by me.
vayne
parents: 23123
diff changeset
285 #endif
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289 update_playlistwindow();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 mplGotoTheNext = guiIntfStruct.Playing? 0 : 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291 guiGetEvent(guiCEvent, (void *) guiSetStop);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 guiGetEvent(guiCEvent, (void *) guiSetPlay);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
294 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
295 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298 case evNext:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 mplNext();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 case evPrev:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302 mplPrev();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307 void mplPlay( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 if((!guiIntfStruct.Filename ) || (guiIntfStruct.Filename[0] == 0))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312 if(guiIntfStruct.Playing > 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314 mplPause();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
317 guiIntfStruct.NewPlay = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 guiGetEvent(guiCEvent, (void *) guiSetPlay);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
320
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321 void mplPause( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323 if(!guiIntfStruct.Playing) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325 if(guiIntfStruct.Playing == 1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327 mp_cmd_t * cmd = calloc(1, sizeof(*cmd));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 cmd->id=MP_CMD_PAUSE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
329 cmd->name=strdup("pause");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 mp_input_queue_cmd(cmd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331 } else guiIntfStruct.Playing = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
334 void mplNext(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
335 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 if(guiIntfStruct.Playing == 2) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 switch(guiIntfStruct.StreamType)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 if(guiIntfStruct.DVD.current_chapter == (guiIntfStruct.DVD.chapters - 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 guiIntfStruct.DVD.current_chapter++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 if(mygui->playlist->current == (mygui->playlist->trackcount - 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 STREAMTYPE_STREAM);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 mygui->startplay(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356 void mplPrev(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
357 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358 if(guiIntfStruct.Playing == 2) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 switch(guiIntfStruct.StreamType)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 if(guiIntfStruct.DVD.current_chapter == 1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 guiIntfStruct.DVD.current_chapter--;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 if(mygui->playlist->current == 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371 mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)--]->filename,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 STREAMTYPE_STREAM);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
373 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375 mygui->startplay(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
376 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
377
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378 void mplEnd( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
379 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 if(!mplGotoTheNext && guiIntfStruct.Playing)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382 mplGotoTheNext = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386 if(mplGotoTheNext && guiIntfStruct.Playing &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387 (mygui->playlist->current < (mygui->playlist->trackcount - 1)) &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
388 guiIntfStruct.StreamType != STREAMTYPE_DVD &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389 guiIntfStruct.StreamType != STREAMTYPE_DVDNAV)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
390 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
391 /* we've finished this file, reset the aspect */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
392 if(movie_aspect >= 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
393 movie_aspect = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
394
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
395 mplGotoTheNext = guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
396 mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename, STREAMTYPE_STREAM);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
397 //sprintf(guiIntfStruct.Filename, mygui->playlist->tracks[(mygui->playlist->current)++]->filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
398 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
399
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
400 if(guiIntfStruct.FilenameChanged && guiIntfStruct.NewPlay)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
403 guiIntfStruct.TimeSec = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404 guiIntfStruct.Position = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405 guiIntfStruct.AudioType = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
408 guiIntfStruct.DVD.current_title = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
409 guiIntfStruct.DVD.current_chapter = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
410 guiIntfStruct.DVD.current_angle = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
411 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
412
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
413 if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
414 mygui->playlist->current = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
415
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
416 fullscreen = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
417 if(style == WS_VISIBLE | WS_POPUP)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 SetWindowLong(mygui->subwindow, GWL_STYLE, style);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
422 guiGetEvent(guiCEvent, (void *) guiSetStop);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
423 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
424
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
425 void mplSetFileName(char *dir, char *name, int type)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
426 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
427 if(!name) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
428 if(!dir)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
429 guiSetFilename(guiIntfStruct.Filename, name)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
430 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
431 guiSetDF(guiIntfStruct.Filename, dir, name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
432
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
433 guiIntfStruct.StreamType = type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
434 free((void **) &guiIntfStruct.AudioFile);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
435 free((void **) &guiIntfStruct.Subtitlename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
436 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
437
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
438 void mplFullScreen( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
439 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
440 if(!guiIntfStruct.sh_video) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
441
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
442 if(sub_window)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
444 if(!fullscreen && IsWindowVisible(mygui->subwindow) && !IsIconic(mygui->subwindow))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
445 GetWindowRect(mygui->subwindow, &old_rect);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
446
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
447 if(fullscreen)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
448 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
449 fullscreen = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
450 style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
451 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
452 fullscreen = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
453 style = WS_VISIBLE | WS_POPUP;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
454 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
455 SetWindowLong(mygui->subwindow, GWL_STYLE, style);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
456 update_subwindow();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
457 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 video_out->control(VOCTRL_FULLSCREEN, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
459 if(sub_window) ShowWindow(mygui->subwindow, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
460 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
461
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
462 static DWORD WINAPI GuiThread(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
463 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 MSG msg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 if(!skinName) skinName = strdup("Blue");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467 if(!mygui) mygui = create_gui(get_path("skins"), skinName, guiSetEvent);
23078
f81cd5be161b spelling cosmetics
diego
parents: 23077
diff changeset
468 if(!mygui) exit_player("Unable to load GUI.");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
469
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
470 if(autosync && autosync != gtkAutoSync)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
471 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
472 gtkAutoSyncOn = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
473 gtkAutoSync = autosync;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
474 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
475
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
476 while(mygui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
477 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
478 GetMessage(&msg, NULL, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479 TranslateMessage(&msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
480 DispatchMessage(&msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481 }
23078
f81cd5be161b spelling cosmetics
diego
parents: 23077
diff changeset
482 fprintf(stderr, "[GUI] GUI thread terminated.\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
483 fflush(stderr);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
486
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
487 void guiInit(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
489 DWORD threadId;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
490 memset(&guiIntfStruct, 0, sizeof(guiIntfStruct));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
491 /* Create The gui thread */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492 if (!mygui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
494 CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) GuiThread, NULL, 0, &threadId);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Creating GUI Thread 0x%04x\n", threadId);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
496 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
497
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
498 /* Wait until the gui is created */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
499 while(!mygui) Sleep(100);
23078
f81cd5be161b spelling cosmetics
diego
parents: 23077
diff changeset
500 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] GUI thread started.\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
503 void guiDone(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
504 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
505 if(mygui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
506 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
507 fprintf(stderr, "[GUI] Closed by main mplayer window\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
508 fflush(stderr);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
509 mygui->uninit(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
510 free(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
511 TerminateThread(GuiThread, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
512 mygui = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
513 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
514 /* Remove tray icon */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
515 Shell_NotifyIcon(NIM_DELETE, &nid);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 cfg_write();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
517 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
518
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
519 /* this function gets called by mplayer to update the gui */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
520 int guiGetEvent(int type, char *arg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
521 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 stream_t *stream = (stream_t *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
524 dvd_priv_t *dvdp = (dvd_priv_t *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
525 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
526 if(!mygui || !mygui->skin) return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
527
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 if(guiIntfStruct.mpcontext)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
529 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
530 audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531 video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
532 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
533 playtree = mpctx_get_playtree_iter(guiIntfStruct.mpcontext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
534 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
535
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
536 switch (type)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
537 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
538 case guiSetFileFormat:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
539 guiIntfStruct.FileFormat = (int) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
540 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541 case guiSetParameters:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543 guiGetEvent(guiSetDefaults, NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
544 guiIntfStruct.DiskChanged = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
545 guiIntfStruct.FilenameChanged = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
546 guiIntfStruct.NewPlay = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
547 switch(guiIntfStruct.StreamType)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
548 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
549 case STREAMTYPE_PLAYLIST:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
554 char tmp[512];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
555 dvd_title = guiIntfStruct.DVD.current_title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 dvd_chapter = guiIntfStruct.DVD.current_chapter;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557 dvd_angle = guiIntfStruct.DVD.current_angle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
558 sprintf(tmp,"dvd://%d", guiIntfStruct.Title);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
559 guiSetFilename(guiIntfStruct.Filename, tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
560 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
561 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
563 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
564 if(guiIntfStruct.Filename)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565 filename = strdup(guiIntfStruct.Filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
566 else if(filename)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
567 strcpy(guiIntfStruct.Filename, filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
568 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
570 case guiSetAudioOnly:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
571 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
572 guiIntfStruct.AudioOnly = (int) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
573 if(IsWindowVisible(mygui->subwindow))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
574 ShowWindow(mygui->subwindow, SW_HIDE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
575 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
576 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
577 case guiSetContext:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
578 guiIntfStruct.mpcontext = (void *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
579 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
580 case guiSetDemuxer:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
581 guiIntfStruct.demuxer = (void *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
582 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583 case guiSetValues:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585 guiIntfStruct.sh_video = arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
586 if (arg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
587 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588 sh_video_t *sh = (sh_video_t *)arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589 codecname = sh->codec->name;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
590 guiIntfStruct.FPS = sh->fps;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
591
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 /* we have video, show the subwindow */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
593 if(!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
594 ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
595 if(WinID == -1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 update_subwindow();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
597
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
598 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
599 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
600 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 case guiSetShVideo:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
603 guiIntfStruct.MovieWidth = vo_dwidth;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
604 guiIntfStruct.MovieHeight = vo_dheight;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606 sub_aspect = (float)guiIntfStruct.MovieWidth/guiIntfStruct.MovieHeight;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
607 if(WinID != -1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608 update_subwindow();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
609 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
610 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
611 case guiSetStream:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613 guiIntfStruct.StreamType = stream->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614 switch(stream->type)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
615 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
616 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
617 case STREAMTYPE_DVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618 guiGetEvent(guiSetDVD, (char *) stream->priv);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
619 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
620 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
621 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
622 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
623 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
624 #ifdef USE_DVDREAD
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
625 case guiSetDVD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
626 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
627 guiIntfStruct.DVD.titles = dvdp->vmg_file->tt_srpt->nr_of_srpts;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
628 guiIntfStruct.DVD.chapters = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
629 guiIntfStruct.DVD.angles = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
630 guiIntfStruct.DVD.nr_of_audio_channels = dvdp->nr_of_channels;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
631 memcpy(guiIntfStruct.DVD.audio_streams, dvdp->audio_streams, sizeof(dvdp->audio_streams));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
632 guiIntfStruct.DVD.nr_of_subtitles = dvdp->nr_of_subtitles;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
633 memcpy(guiIntfStruct.DVD.subtitles, dvdp->subtitles, sizeof(dvdp->subtitles));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
634 guiIntfStruct.DVD.current_title = dvd_title + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
635 guiIntfStruct.DVD.current_chapter = dvd_chapter + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
636 guiIntfStruct.DVD.current_angle = dvd_angle + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
637 guiIntfStruct.Track = dvd_title + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
638 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
639 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
640 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
641 case guiReDraw:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
642 mygui->updatedisplay(mygui, mygui->mainwindow);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
643 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
644 case guiSetAfilter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
645 guiIntfStruct.afilter = (void *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
646 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
647 case guiCEvent:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
648 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
649 guiIntfStruct.Playing = (int) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
650 switch (guiIntfStruct.Playing)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
651 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
652 case guiSetPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
653 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
654 guiIntfStruct.Playing = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
655 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
656 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
657 case guiSetStop:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
658 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
659 guiIntfStruct.Playing = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
660 if(movie_aspect >= 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
661 movie_aspect = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
662 update_subwindow();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
663 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
664 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
665 case guiSetPause:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
666 guiIntfStruct.Playing = 2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
667 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
668 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
669 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
670 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
671 case guiIEvent:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
673 mp_msg(MSGT_GPLAYER,MSGL_V, "cmd: %d\n", (int) arg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
674 /* MPlayer asks us to quit */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
675 switch((int) arg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
676 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
677 case MP_CMD_GUI_FULLSCREEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
678 mplFullScreen();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
679 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
680 case MP_CMD_QUIT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
681 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
682 mygui->uninit(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
683 free(mygui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684 mygui = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
685 exit_player("Done");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
686 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
687 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
688 case MP_CMD_GUI_STOP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
689 guiGetEvent(guiCEvent, (void *) guiSetStop);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
690 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
691 case MP_CMD_GUI_PLAY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
692 guiGetEvent(guiCEvent, (void *) guiSetPlay);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
693 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
694 case MP_CMD_GUI_SKINBROWSER:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
695 if(fullscreen) guiSetEvent(evFullScreen);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
696 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_SKINBROWSER, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
697 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
698 case MP_CMD_GUI_PLAYLIST:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
699 if(fullscreen) guiSetEvent(evFullScreen);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
700 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PLAYLIST, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
701 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
702 case MP_CMD_GUI_PREFERENCES:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
703 if(fullscreen) guiSetEvent(evFullScreen);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
704 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PREFS, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
705 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
706 case MP_CMD_GUI_LOADFILE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
707 if(fullscreen) guiSetEvent(evFullScreen);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
708 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDFILE_OPEN, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
709 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
710 case MP_CMD_GUI_LOADSUBTITLE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
711 if(fullscreen) guiSetEvent(evFullScreen);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
712 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDSUBTITLE_OPEN, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
713 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
714 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
715 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
716 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
717 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
718 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
719 case guiSetFileName:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
720 if (arg) guiIntfStruct.Filename = (char *) arg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
721 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
722 case guiSetDefaults:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
723 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
724 audio_id = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
725 video_id = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
726 dvdsub_id = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
727 vobsub_id = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
728 stream_cache_size = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
729 autosync = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
730 vcd_track = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
731 dvd_title = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
732 force_fps = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
733 if(!mygui->playlist->tracks) return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
734 filename = guiIntfStruct.Filename = mygui->playlist->tracks[mygui->playlist->current]->filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
735 guiIntfStruct.Track = mygui->playlist->current + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
736 if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
737 if(gtkAOExtraStereo)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
738 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
739 char *name = malloc(12 + 20 + 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
740 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
741 name[12 + 20] = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
742 greplace(&af_cfg.list, "extrastereo", name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
743 free(name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
744 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
745 if(gtkCacheOn) stream_cache_size = gtkCacheSize;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
746 if(gtkAutoSyncOn) autosync = gtkAutoSync;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
747 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
748 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
749 case guiSetVolume:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
750 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
751 if(audio_out)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
752 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
753 /* Some audio_out drivers do not support balance e.g. dsound */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
754 /* FIXME this algo is not correct */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
755 float l, r;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
756 mixer_getvolume(mixer, &l, &r);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
757 guiIntfStruct.Volume = (r > l ? r : l); /* max(r,l) */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
758 if (r != l)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
759 guiIntfStruct.Balance = ((r-l) + 100.0f) * 0.5f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
760 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
761 guiIntfStruct.Balance = 50.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
762 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
763 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
764 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
765 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
766 mp_msg(MSGT_GPLAYER, MSGL_ERR, "[GUI] GOT UNHANDLED EVENT %i\n", type);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
767 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
768 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
769 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
770
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
771 /* This function adds/inserts one file into the gui playlist */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
772 int import_file_into_gui(char *pathname, int insert)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
773 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
774 char filename[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
775 char *filepart = filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
776
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
777 if (strstr(pathname, "://"))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
778 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
779 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", pathname);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
780 mygui->playlist->add_track(mygui->playlist, pathname, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
781 return 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
782 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
783 if (GetFullPathName(pathname, MAX_PATH, filename, &filepart))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
784 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
785 if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
786 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
787 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
788 mygui->playlist->add_track(mygui->playlist, filename, NULL, filepart, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
789 return 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
790 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
791 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
792 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Cannot add %s\n", filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
793 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
794
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
795 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
796 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
797
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
798 /* This function imports the initial playtree (based on cmd-line files) into the gui playlist
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
799 by either:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
800 - overwriting gui pl (enqueue=0) */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
801
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
802 int import_initial_playtree_into_gui(play_tree_t *my_playtree, m_config_t *config, int enqueue)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
803 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
804 play_tree_iter_t *my_pt_iter = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
805 int result = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
806
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
807 if(!mygui) guiInit();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
808
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
809 if((my_pt_iter = pt_iter_create(&my_playtree, config)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
810 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
811 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
812 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
813 if (parse_filename(filename, my_playtree, config, 0))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
814 result = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
815 else if (import_file_into_gui(filename, 0)) /* Add it to end of list */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
816 result = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
817 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
818 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
819 mplGotoTheNext = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
820
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
821 if (result)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
822 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
823 mygui->playlist->current = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
824 filename = mygui->playlist->tracks[0]->filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
825 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
826 return result;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
827 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
828
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
829 /* This function imports and inserts an playtree, that is created "on the fly", for example by
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
830 parsing some MOV-Reference-File; or by loading an playlist with "File Open"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
831 The file which contained the playlist is thereby replaced with it's contents. */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
832
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
833 int import_playtree_playlist_into_gui(play_tree_t *my_playtree, m_config_t *config)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
834 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
835 play_tree_iter_t *my_pt_iter = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
836 int result = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
837
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
838 if((my_pt_iter = pt_iter_create(&my_playtree, config)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
839 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
840 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
841 if (import_file_into_gui(filename, 1)) /* insert it into the list and set plCurrent = new item */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
842 result = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
843 pt_iter_destroy(&my_pt_iter);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
844 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
845 filename = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
846 return result;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
847 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
848
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
849 inline void gtkMessageBox(int type, const char *str)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
850 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
851 if (type & GTK_MB_FATAL)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
852 MessageBox(NULL, str, "MPlayer GUI for Windows Error", MB_OK | MB_ICONERROR);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
853
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
854 fprintf(stderr, "[GUI] MessageBox: %s\n", str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
855 fflush(stderr);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
856 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
857
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
858 void guiMessageBox(int level, char *str)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
859 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
860 switch(level)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
861 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
862 case MSGL_FATAL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
863 gtkMessageBox(GTK_MB_FATAL | GTK_MB_SIMPLE, str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
864 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
865 case MSGL_ERR:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
866 gtkMessageBox(GTK_MB_ERROR | GTK_MB_SIMPLE, str);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
867 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
868 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
869 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
870
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
871 static int update_subwindow(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
872 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
873 int x,y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
874 RECT rd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
875 WINDOWPOS wp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
876
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
877 if(!sub_window)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
878 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
879 WinID = -1; // so far only directx supports WinID in windows
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
880
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
881 if(IsWindowVisible(mygui->subwindow) && guiIntfStruct.sh_video && guiIntfStruct.Playing)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
882 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
883 ShowWindow(mygui->subwindow, SW_HIDE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
884 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
885 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
886 else if(guiIntfStruct.AudioOnly)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
887 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
888 else ShowWindow(mygui->subwindow, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
889 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
890
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
891 /* we've come out of fullscreen at the end of file */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
892 if((!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow)) && !guiIntfStruct.AudioOnly)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
893 ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
894
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
895 /* get our current window coordinates */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
896 GetWindowRect(mygui->subwindow, &rd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
897
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
898 x = rd.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
899 y = rd.top;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
900
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
901 /* restore sub window position when coming out of fullscreen */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
902 if(x <= 0) x = old_rect.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
903 if(y <= 0) y = old_rect.top;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
904
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
905 if(!guiIntfStruct.Playing)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
906 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
907 window *desc = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
908 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
909
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
910 for (i=0; i<mygui->skin->windowcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
911 if(mygui->skin->windows[i]->type == wiSub)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
912 desc = mygui->skin->windows[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
913
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
914 rd.right = rd.left+desc->base->bitmap[0]->width;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
915 rd.bottom = rd.top+desc->base->bitmap[0]->height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
916 sub_aspect = (float)(rd.right-rd.left)/(rd.bottom-rd.top);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
917 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
918 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
919 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
920 rd.right = rd.left+guiIntfStruct.MovieWidth;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
921 rd.bottom = rd.top+guiIntfStruct.MovieHeight;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
922
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
923 if (movie_aspect > 0.0) // forced aspect from the cmdline
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
924 sub_aspect = movie_aspect;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
925 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
926
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
927
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
928 AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
929 SetWindowPos(mygui->subwindow, 0, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
930
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
931 wp.hwnd = mygui->subwindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
932 wp.x = rd.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
933 wp.y = rd.top;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
934 wp.cx = rd.right-rd.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
935 wp.cy = rd.bottom-rd.top;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
936 wp.flags = SWP_NOOWNERZORDER | SWP_SHOWWINDOW;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
937
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
938 /* erase the bitmap image if there's video */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
939 if(guiIntfStruct.Playing != 0 && guiIntfStruct.sh_video)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
940 SendMessage(mygui->subwindow, WM_ERASEBKGND, (WPARAM)GetDC(mygui->subwindow), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
941
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
942 /* reset the window aspect */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
943 SendMessage(mygui->subwindow, WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
944 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
945 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
946
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
947 void guiEventHandling(void) {}