annotate Gui/win32/interface.c @ 21984:607909d7cc56

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