annotate Gui/win32/interface.c @ 22889:d78278e1ece6

thread compatibility fixes for Win9x. based on patch by sergemp at mail dot ru.
author vayne
date Tue, 03 Apr 2007 15:57:55 +0000
parents 1c5ea79749ea
children
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>
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
38 #include <access_mpcontext.h>
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
39 #include "gui.h"
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
40 #include "dialogs.h"
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
41 #include "wincfg.h"
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
42 #ifdef HAVE_LIBCDIO
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
43 #include <cdio/cdio.h>
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
44 #endif
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
45
21429
d4cb537b3414 Replace deprecated vo_plugin_args by vf_settings.
diego
parents: 21428
diff changeset
46 extern m_obj_settings_t *vf_settings;
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
47 extern void exit_player(const char *how);
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
48 extern char *filename;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
49 extern int abs_seek_pos;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
50 extern float rel_seek_secs;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
51 extern int audio_id;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
52 extern int video_id;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
53 extern int dvdsub_id;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
54 extern int vobsub_id;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
55 extern int stream_cache_size;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
56 extern int autosync;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
57 extern int vcd_track;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
58 extern int dvd_title;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
59 extern float force_fps;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
60 extern af_cfg_t af_cfg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
61 int guiWinID = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
62
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
63 char *skinName = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
64 char *codecname = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
65 int mplGotoTheNext = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
66 static gui_t *mygui = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
67 static int update_subwindow(void);
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
68 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
69 static DWORD style;
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
70 ao_functions_t *audio_out = NULL;
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
71 vo_functions_t *video_out = NULL;
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
72 mixer_t *mixer = NULL;
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
73
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
74 /* test for playlist files, no need to specify -playlist on the commandline.
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
75 * add any conceivable playlist extensions here.
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
76 * - Erik
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
77 */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
78 int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
79 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
80 if(clear)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
81 mygui->playlist->clear_playlist(mygui->playlist);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
82
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
83 if(strstr(file, ".m3u") || strstr(file, ".pls"))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
84 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
85 playtree = parse_playlist_file(file);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
86 import_playtree_playlist_into_gui(playtree, mconfig);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
87 return 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
88 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
89 return 0;
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 /**
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
93 * \brief this actually creates a new list containing only one element...
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
94 */
19147
2149651156bc Compile fix, patch by Aidan Thornton % makomk # lycos P co P uk %
gpoirier
parents: 19104
diff changeset
95 void gaddlist( char ***list, const char *entry)
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
96 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
97 int i;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
98
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
99 if (*list)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
100 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
101 for (i=0; (*list)[i]; i++) free((*list)[i]);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
102 free(*list);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
103 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
104
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
105 *list = malloc(2 * sizeof(char **));
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
106 (*list)[0] = gstrdup(entry);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
107 (*list)[1] = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
108 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
109
19147
2149651156bc Compile fix, patch by Aidan Thornton % makomk # lycos P co P uk %
gpoirier
parents: 19104
diff changeset
110 char *gstrdup(const char *str)
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
111 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
112 if (!str) return NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
113 return strdup(str);
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 /**
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
117 * \brief this replaces a string starting with search by replace.
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
118 * If not found, replace is appended.
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
119 */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
120 void greplace(char ***list, char *search, char *replace)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
121 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
122 int i = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
123 int len = (search) ? strlen(search) : 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
124
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
125 if (*list)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
126 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
127 for (i = 0; (*list)[i]; i++)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
128 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
129 if (search && (!strncmp((*list)[i], search, len)))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
130 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
131 free((*list)[i]);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
132 (*list)[i] = gstrdup(replace);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
133 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
134 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
135 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
136 *list = realloc(*list, (i + 2) * sizeof(char *));
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
137 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
138 else
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
139 *list = malloc(2 * sizeof(char *));
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
140
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
141 (*list)[i] = gstrdup(replace);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
142 (*list)[i + 1] = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
143 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
144
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
145 /* this function gets called by the gui to update mplayer */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
146 static void guiSetEvent(int event)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
147 {
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
148 if(guiIntfStruct.mpcontext)
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
149 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
150
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
151 switch(event)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
152 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
153 case evPlay:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
154 case evPlaySwitchToPause:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
155 mplPlay();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
156 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
157 case evPause:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
158 mplPause();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
159 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
160 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
161 case evPlayDVD:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
162 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
163 static char dvdname[MAX_PATH];
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
164 guiIntfStruct.DVD.current_title = dvd_title;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
165 guiIntfStruct.DVD.current_chapter = dvd_chapter;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
166 guiIntfStruct.DVD.current_angle = dvd_angle;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
167 guiIntfStruct.DiskChanged = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
168
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
169 mplSetFileName(NULL, dvd_device, STREAMTYPE_DVD);
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)
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
248 mixer_setvolume(mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
18914
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;
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
255 mixer_setvolume(mixer, l, r);
18914
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 {
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
259 mixer_getvolume(mixer, &l, &r);
18914
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");
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
263 mixer_setvolume(mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
18914
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 {
22487
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
280 switch(guiIntfStruct.StreamType)
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
281 {
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
282 case STREAMTYPE_DVD:
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
283 {
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
284 guiIntfStruct.Title = guiIntfStruct.DVD.current_title;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
285 guiIntfStruct.Chapter = guiIntfStruct.DVD.current_chapter;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
286 guiIntfStruct.Angle = guiIntfStruct.DVD.current_angle;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
287 guiIntfStruct.DiskChanged = 1;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
288 guiGetEvent(guiCEvent, (void *) guiSetPlay);
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
289 break;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
290 }
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
291 default:
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
292 {
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
293 guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
294 update_playlistwindow();
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
295 mplGotoTheNext = guiIntfStruct.Playing? 0 : 1;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
296 guiGetEvent(guiCEvent, (void *) guiSetStop);
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
297 guiGetEvent(guiCEvent, (void *) guiSetPlay);
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
298 break;
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
299 }
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
300 }
1c5ea79749ea fixed dvd chapter and title switching
vayne
parents: 22486
diff changeset
301 break;
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
302 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
303 case evNext:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
304 mplNext();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
305 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
306 case evPrev:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
307 mplPrev();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
308 break;
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
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
312 void mplPlay( void )
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
313 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
314 if((!guiIntfStruct.Filename ) || (guiIntfStruct.Filename[0] == 0))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
315 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
316
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
317 if(guiIntfStruct.Playing > 0)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
318 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
319 mplPause();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
320 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
321 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
322 guiIntfStruct.NewPlay = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
323 guiGetEvent(guiCEvent, (void *) guiSetPlay);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
324 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
325
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
326 void mplPause( void )
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
327 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
328 if(!guiIntfStruct.Playing) return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
329
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
330 if(guiIntfStruct.Playing == 1)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
331 {
19061
86350b4b8203 drops casts from void * on malloc/calloc from the gui code
reynaldo
parents: 18953
diff changeset
332 mp_cmd_t * cmd = calloc(1, sizeof(*cmd));
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
333 cmd->id=MP_CMD_PAUSE;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
334 cmd->name=strdup("pause");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
335 mp_input_queue_cmd(cmd);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
336 } else guiIntfStruct.Playing = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
337 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
338
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
339 void mplNext(void)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
340 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
341 if(guiIntfStruct.Playing == 2) return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
342 switch(guiIntfStruct.StreamType)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
343 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
344 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
345 case STREAMTYPE_DVD:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
346 if(guiIntfStruct.DVD.current_chapter == (guiIntfStruct.DVD.chapters - 1))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
347 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
348 guiIntfStruct.DVD.current_chapter++;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
349 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
350 #endif
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
351 default:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
352 if(mygui->playlist->current == (mygui->playlist->trackcount - 1))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
353 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
354 mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename,
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
355 STREAMTYPE_STREAM);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
356 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
357 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
358 mygui->startplay(mygui);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
359 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
360
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
361 void mplPrev(void)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
362 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
363 if(guiIntfStruct.Playing == 2) return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
364 switch(guiIntfStruct.StreamType)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
365 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
366 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
367 case STREAMTYPE_DVD:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
368 if(guiIntfStruct.DVD.current_chapter == 1)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
369 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
370 guiIntfStruct.DVD.current_chapter--;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
371 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
372 #endif
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
373 default:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
374 if(mygui->playlist->current == 0)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
375 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
376 mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)--]->filename,
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
377 STREAMTYPE_STREAM);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
378 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
379 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
380 mygui->startplay(mygui);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
381 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
382
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
383 void mplEnd( void )
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
384 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
385 if(!mplGotoTheNext && guiIntfStruct.Playing)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
386 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
387 mplGotoTheNext = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
388 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
389 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
390
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
391 if(mplGotoTheNext && guiIntfStruct.Playing &&
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
392 (mygui->playlist->current < (mygui->playlist->trackcount - 1)) &&
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
393 guiIntfStruct.StreamType != STREAMTYPE_DVD &&
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
394 guiIntfStruct.StreamType != STREAMTYPE_DVDNAV)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
395 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
396 /* we've finished this file, reset the aspect */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
397 if(movie_aspect >= 0)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
398 movie_aspect = -1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
399
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
400 mplGotoTheNext = guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
401 mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename, STREAMTYPE_STREAM);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
402 //sprintf(guiIntfStruct.Filename, mygui->playlist->tracks[(mygui->playlist->current)++]->filename);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
403 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
404
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
405 if(guiIntfStruct.FilenameChanged && guiIntfStruct.NewPlay)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
406 return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
407
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
408 guiIntfStruct.TimeSec = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
409 guiIntfStruct.Position = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
410 guiIntfStruct.AudioType = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
411
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
412 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
413 guiIntfStruct.DVD.current_title = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
414 guiIntfStruct.DVD.current_chapter = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
415 guiIntfStruct.DVD.current_angle = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
416 #endif
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
417
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
418 if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
419 mygui->playlist->current = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
420
19408
df307a050359 further improvements to fullscreen switching.
vayne
parents: 19271
diff changeset
421 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
422 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
423 {
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
424 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
425 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
426 }
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
427 guiGetEvent(guiCEvent, (void *) guiSetStop);
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 void mplSetFileName(char *dir, char *name, int type)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
431 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
432 if(!name) return;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
433 if(!dir)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
434 guiSetFilename(guiIntfStruct.Filename, name)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
435 else
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
436 guiSetDF(guiIntfStruct.Filename, dir, name);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
437
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
438 guiIntfStruct.StreamType = type;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
439 free((void **) &guiIntfStruct.AudioFile);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
440 free((void **) &guiIntfStruct.Subtitlename);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
441 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
442
22389
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
443 void mplFullScreen( void )
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
444 {
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
445 if(!guiIntfStruct.sh_video) return;
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
446
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
447 if(sub_window)
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
448 {
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
449 if(!fullscreen && IsWindowVisible(mygui->subwindow) && !IsIconic(mygui->subwindow))
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
450 GetWindowRect(mygui->subwindow, &old_rect);
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
451
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
452 if(fullscreen)
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
453 {
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
454 fullscreen = 0;
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
455 style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
456 } else {
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
457 fullscreen = 1;
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
458 style = WS_VISIBLE | WS_POPUP;
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
459 }
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
460 SetWindowLong(mygui->subwindow, GWL_STYLE, style);
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
461 update_subwindow();
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
462 }
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
463 video_out->control(VOCTRL_FULLSCREEN, 0);
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
464 if(sub_window) ShowWindow(mygui->subwindow, SW_SHOW);
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
465 }
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
466
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
467 static DWORD WINAPI GuiThread(void)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
468 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
469 MSG msg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
470
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
471 if(!skinName) skinName = strdup("Blue");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
472 if(!mygui) mygui = create_gui(get_path("skins"), skinName, guiSetEvent);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
473 if(!mygui) exit_player("Unable to load gui");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
474
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
475 if(autosync && autosync != gtkAutoSync)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
476 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
477 gtkAutoSyncOn = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
478 gtkAutoSync = autosync;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
479 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
480
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
481 while(mygui)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
482 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
483 GetMessage(&msg, NULL, 0, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
484 TranslateMessage(&msg);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
485 DispatchMessage(&msg);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
486 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
487 fprintf(stderr, "[GUI] Gui Thread Terminated\n");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
488 fflush(stderr);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
489 return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
490 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
491
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
492 void guiInit(void)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
493 {
22889
d78278e1ece6 thread compatibility fixes for Win9x. based on patch by sergemp at mail dot ru.
vayne
parents: 22487
diff changeset
494 DWORD threadId;
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
495 memset(&guiIntfStruct, 0, sizeof(guiIntfStruct));
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
496 /* Create The gui thread */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
497 if (!mygui)
22889
d78278e1ece6 thread compatibility fixes for Win9x. based on patch by sergemp at mail dot ru.
vayne
parents: 22487
diff changeset
498 {
d78278e1ece6 thread compatibility fixes for Win9x. based on patch by sergemp at mail dot ru.
vayne
parents: 22487
diff changeset
499 CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) GuiThread, NULL, 0, &threadId);
d78278e1ece6 thread compatibility fixes for Win9x. based on patch by sergemp at mail dot ru.
vayne
parents: 22487
diff changeset
500 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Creating GUI Thread 0x%04x\n", threadId);
d78278e1ece6 thread compatibility fixes for Win9x. based on patch by sergemp at mail dot ru.
vayne
parents: 22487
diff changeset
501 }
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
502
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
503 /* Wait until the gui is created */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
504 while(!mygui) Sleep(100);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
505 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Gui Thread started\n");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
506 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
507
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
508 void guiDone(void)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
509 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
510 if(mygui)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
511 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
512 fprintf(stderr, "[GUI] Closed by main mplayer window\n");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
513 fflush(stderr);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
514 mygui->uninit(mygui);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
515 free(mygui);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
516 TerminateThread(GuiThread, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
517 mygui = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
518 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
519 /* Remove tray icon */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
520 Shell_NotifyIcon(NIM_DELETE, &nid);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
521 cfg_write();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
522 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
523
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
524 /* this function gets called by mplayer to update the gui */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
525 int guiGetEvent(int type, char *arg)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
526 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
527 stream_t *stream = (stream_t *) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
528 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
529 dvd_priv_t *dvdp = (dvd_priv_t *) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
530 #endif
19718
e701a6eed5cb ISO C90 warnings fixes
vayne
parents: 19535
diff changeset
531 if(!mygui || !mygui->skin) return 0;
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
532
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
533 if(guiIntfStruct.mpcontext)
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
534 {
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
535 audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
536 video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
537 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
22394
ecaabc8f28cc add missing playtree entry
vayne
parents: 22389
diff changeset
538 playtree = mpctx_get_playtree_iter(guiIntfStruct.mpcontext);
22399
299ec0c2a313 cosmetics, fix indentation as pointed out by Reimar
vayne
parents: 22394
diff changeset
539 }
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
540
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
541 switch (type)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
542 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
543 case guiSetFileFormat:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
544 guiIntfStruct.FileFormat = (int) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
545 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
546 case guiSetParameters:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
547 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
548 guiGetEvent(guiSetDefaults, NULL);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
549 guiIntfStruct.DiskChanged = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
550 guiIntfStruct.FilenameChanged = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
551 guiIntfStruct.NewPlay = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
552 switch(guiIntfStruct.StreamType)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
553 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
554 case STREAMTYPE_PLAYLIST:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
555 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
556 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
557 case STREAMTYPE_DVD:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
558 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
559 char tmp[512];
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
560 dvd_title = guiIntfStruct.DVD.current_title;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
561 dvd_chapter = guiIntfStruct.DVD.current_chapter;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
562 dvd_angle = guiIntfStruct.DVD.current_angle;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
563 sprintf(tmp,"dvd://%d", guiIntfStruct.Title);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
564 guiSetFilename(guiIntfStruct.Filename, tmp);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
565 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
566 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
567 #endif
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
568 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
569 if(guiIntfStruct.Filename)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
570 filename = strdup(guiIntfStruct.Filename);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
571 else if(filename)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
572 strcpy(guiIntfStruct.Filename, filename);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
573 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
574 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
575 case guiSetAudioOnly:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
576 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
577 guiIntfStruct.AudioOnly = (int) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
578 if(IsWindowVisible(mygui->subwindow))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
579 ShowWindow(mygui->subwindow, SW_HIDE);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
580 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
581 }
22388
c7b920227b00 add forgotten case value as per recent changes to mplayer.c
vayne
parents: 22308
diff changeset
582 case guiSetContext:
c7b920227b00 add forgotten case value as per recent changes to mplayer.c
vayne
parents: 22308
diff changeset
583 guiIntfStruct.mpcontext = (void *) arg;
c7b920227b00 add forgotten case value as per recent changes to mplayer.c
vayne
parents: 22308
diff changeset
584 break;
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
585 case guiSetDemuxer:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
586 guiIntfStruct.demuxer = (void *) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
587 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
588 case guiSetValues:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
589 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
590 guiIntfStruct.sh_video = arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
591 if (arg)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
592 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
593 sh_video_t *sh = (sh_video_t *)arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
594 codecname = sh->codec->name;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
595 guiIntfStruct.FPS = sh->fps;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
596
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
597 /* we have video, show the subwindow */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
598 if(!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
599 ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
600 if(WinID == -1)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
601 update_subwindow();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
602
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
603 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
604 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
605 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
606 case guiSetShVideo:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
607 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
608 guiIntfStruct.MovieWidth = vo_dwidth;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
609 guiIntfStruct.MovieHeight = vo_dheight;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
610
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
611 sub_aspect = (float)guiIntfStruct.MovieWidth/guiIntfStruct.MovieHeight;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
612 if(WinID != -1)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
613 update_subwindow();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
614 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
615 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
616 case guiSetStream:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
617 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
618 guiIntfStruct.StreamType = stream->type;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
619 switch(stream->type)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
620 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
621 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
622 case STREAMTYPE_DVD:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
623 guiGetEvent(guiSetDVD, (char *) stream->priv);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
624 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
625 #endif
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
626 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
627 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
628 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
629 #ifdef USE_DVDREAD
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
630 case guiSetDVD:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
631 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
632 guiIntfStruct.DVD.titles = dvdp->vmg_file->tt_srpt->nr_of_srpts;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
633 guiIntfStruct.DVD.chapters = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
634 guiIntfStruct.DVD.angles = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
635 guiIntfStruct.DVD.nr_of_audio_channels = dvdp->nr_of_channels;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
636 memcpy(guiIntfStruct.DVD.audio_streams, dvdp->audio_streams, sizeof(dvdp->audio_streams));
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
637 guiIntfStruct.DVD.nr_of_subtitles = dvdp->nr_of_subtitles;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
638 memcpy(guiIntfStruct.DVD.subtitles, dvdp->subtitles, sizeof(dvdp->subtitles));
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
639 guiIntfStruct.DVD.current_title = dvd_title + 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
640 guiIntfStruct.DVD.current_chapter = dvd_chapter + 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
641 guiIntfStruct.DVD.current_angle = dvd_angle + 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
642 guiIntfStruct.Track = dvd_title + 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
643 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
644 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
645 #endif
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
646 case guiReDraw:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
647 mygui->updatedisplay(mygui, mygui->mainwindow);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
648 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
649 case guiSetAfilter:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
650 guiIntfStruct.afilter = (void *) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
651 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
652 case guiCEvent:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
653 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
654 guiIntfStruct.Playing = (int) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
655 switch (guiIntfStruct.Playing)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
656 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
657 case guiSetPlay:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
658 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
659 guiIntfStruct.Playing = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
660 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
661 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
662 case guiSetStop:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
663 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
664 guiIntfStruct.Playing = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
665 if(movie_aspect >= 0)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
666 movie_aspect = -1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
667 update_subwindow();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
668 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
669 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
670 case guiSetPause:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
671 guiIntfStruct.Playing = 2;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
672 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
673 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
674 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
675 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
676 case guiIEvent:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
677 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
678 mp_msg(MSGT_GPLAYER,MSGL_V, "cmd: %d\n", (int) arg);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
679 /* MPlayer asks us to quit */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
680 switch((int) arg)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
681 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
682 case MP_CMD_GUI_FULLSCREEN:
22389
8ab800c12f85 simplify and modify fullscreen switching to avoid improper aspects
vayne
parents: 22388
diff changeset
683 mplFullScreen();
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
684 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
685 case MP_CMD_QUIT:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
686 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
687 mygui->uninit(mygui);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
688 free(mygui);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
689 mygui = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
690 exit_player("Done");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
691 return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
692 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
693 case MP_CMD_GUI_STOP:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
694 guiGetEvent(guiCEvent, (void *) guiSetStop);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
695 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
696 case MP_CMD_GUI_PLAY:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
697 guiGetEvent(guiCEvent, (void *) guiSetPlay);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
698 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
699 case MP_CMD_GUI_SKINBROWSER:
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
700 if(fullscreen) guiSetEvent(evFullScreen);
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
701 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_SKINBROWSER, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
702 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
703 case MP_CMD_GUI_PLAYLIST:
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
704 if(fullscreen) guiSetEvent(evFullScreen);
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
705 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PLAYLIST, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
706 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
707 case MP_CMD_GUI_PREFERENCES:
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
708 if(fullscreen) guiSetEvent(evFullScreen);
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
709 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PREFS, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
710 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
711 case MP_CMD_GUI_LOADFILE:
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
712 if(fullscreen) guiSetEvent(evFullScreen);
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
713 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDFILE_OPEN, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
714 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
715 case MP_CMD_GUI_LOADSUBTITLE:
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
716 if(fullscreen) guiSetEvent(evFullScreen);
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
717 PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDSUBTITLE_OPEN, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
718 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
719 default:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
720 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
721 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
722 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
723 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
724 case guiSetFileName:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
725 if (arg) guiIntfStruct.Filename = (char *) arg;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
726 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
727 case guiSetDefaults:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
728 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
729 audio_id = -1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
730 video_id = -1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
731 dvdsub_id = -1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
732 vobsub_id = -1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
733 stream_cache_size = -1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
734 autosync = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
735 vcd_track = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
736 dvd_title = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
737 force_fps = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
738 if(!mygui->playlist->tracks) return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
739 filename = guiIntfStruct.Filename = mygui->playlist->tracks[mygui->playlist->current]->filename;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
740 guiIntfStruct.Track = mygui->playlist->current + 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
741 if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm");
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
742 if(gtkAOExtraStereo)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
743 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
744 char *name = malloc(12 + 20 + 1);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
745 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
746 name[12 + 20] = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
747 greplace(&af_cfg.list, "extrastereo", name);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
748 free(name);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
749 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
750 if(gtkCacheOn) stream_cache_size = gtkCacheSize;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
751 if(gtkAutoSyncOn) autosync = gtkAutoSync;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
752 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
753 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
754 case guiSetVolume:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
755 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
756 if(audio_out)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
757 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
758 /* Some audio_out drivers do not support balance e.g. dsound */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
759 /* FIXME this algo is not correct */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
760 float l, r;
22308
9f5657a1dbf7 Gui compilation fixes
vayne
parents: 21897
diff changeset
761 mixer_getvolume(mixer, &l, &r);
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
762 guiIntfStruct.Volume = (r > l ? r : l); /* max(r,l) */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
763 if (r != l)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
764 guiIntfStruct.Balance = ((r-l) + 100.0f) * 0.5f;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
765 else
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
766 guiIntfStruct.Balance = 50.0f;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
767 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
768 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
769 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
770 default:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
771 mp_msg(MSGT_GPLAYER, MSGL_ERR, "[GUI] GOT UNHANDLED EVENT %i\n", type);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
772 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
773 return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
774 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
775
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
776 /* This function adds/inserts one file into the gui playlist */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
777 int import_file_into_gui(char *pathname, int insert)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
778 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
779 char filename[MAX_PATH];
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
780 char *filepart = filename;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
781
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
782 if (strstr(pathname, "://"))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
783 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
784 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", pathname);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
785 mygui->playlist->add_track(mygui->playlist, pathname, NULL, NULL, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
786 return 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
787 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
788 if (GetFullPathName(pathname, MAX_PATH, filename, &filepart))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
789 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
790 if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
791 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
792 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, filename);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
793 mygui->playlist->add_track(mygui->playlist, filename, NULL, filepart, 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
794 return 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
795 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
796 else
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
797 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Cannot add %s\n", filename);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
798 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
799
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
800 return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
801 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
802
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
803 /* This function imports the initial playtree (based on cmd-line files) into the gui playlist
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
804 by either:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
805 - overwriting gui pl (enqueue=0) */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
806
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
807 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
808 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
809 play_tree_iter_t *my_pt_iter = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
810 int result = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
811
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
812 if(!mygui) guiInit();
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
813
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
814 if((my_pt_iter = pt_iter_create(&my_playtree, config)))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
815 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
816 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
817 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
818 if (parse_filename(filename, my_playtree, config, 0))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
819 result = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
820 else if (import_file_into_gui(filename, 0)) /* Add it to end of list */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
821 result = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
822 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
823 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
824 mplGotoTheNext = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
825
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
826 if (result)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
827 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
828 mygui->playlist->current = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
829 filename = mygui->playlist->tracks[0]->filename;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
830 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
831 return result;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
832 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
833
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
834 /* 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
835 parsing some MOV-Reference-File; or by loading an playlist with "File Open"
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
836 The file which contained the playlist is thereby replaced with it's contents. */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
837
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
838 int import_playtree_playlist_into_gui(play_tree_t *my_playtree, m_config_t *config)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
839 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
840 play_tree_iter_t *my_pt_iter = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
841 int result = 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
842
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
843 if((my_pt_iter = pt_iter_create(&my_playtree, config)))
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
844 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
845 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
846 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
847 result = 1;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
848 pt_iter_destroy(&my_pt_iter);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
849 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
850 filename = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
851 return result;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
852 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
853
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
854 inline void gtkMessageBox(int type, const char *str)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
855 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
856 if (type & GTK_MB_FATAL)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
857 MessageBox(NULL, str, "MPlayer GUI for Windows Error", MB_OK | MB_ICONERROR);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
858
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
859 fprintf(stderr, "[GUI] MessageBox: %s\n", str);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
860 fflush(stderr);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
861 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
862
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
863 void guiMessageBox(int level, char *str)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
864 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
865 switch(level)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
866 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
867 case MSGL_FATAL:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
868 gtkMessageBox(GTK_MB_FATAL | GTK_MB_SIMPLE, str);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
869 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
870 case MSGL_ERR:
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
871 gtkMessageBox(GTK_MB_ERROR | GTK_MB_SIMPLE, str);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
872 break;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
873 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
874 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
875
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
876 static int update_subwindow(void)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
877 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
878 int x,y;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
879 RECT rd;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
880 WINDOWPOS wp;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
881
18947
06ab2099c10e OpenGL outputs actually support WinID, not to mention that showing the option
reimar
parents: 18914
diff changeset
882 if(!sub_window)
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
883 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
884 WinID = -1; // so far only directx supports WinID in windows
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
885
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
886 if(IsWindowVisible(mygui->subwindow) && guiIntfStruct.sh_video && guiIntfStruct.Playing)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
887 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
888 ShowWindow(mygui->subwindow, SW_HIDE);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
889 return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
890 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
891 else if(guiIntfStruct.AudioOnly)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
892 return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
893 else ShowWindow(mygui->subwindow, SW_SHOW);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
894 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
895
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
896 /* we've come out of fullscreen at the end of file */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
897 if((!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow)) && !guiIntfStruct.AudioOnly)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
898 ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
899
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
900 /* 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
901 GetWindowRect(mygui->subwindow, &rd);
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
902
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
903 x = rd.left;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
904 y = rd.top;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
905
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
906 /* 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
907 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
908 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
909
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
910 if(!guiIntfStruct.Playing)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
911 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
912 window *desc = NULL;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
913 int i;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
915 for (i=0; i<mygui->skin->windowcount; i++)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
916 if(mygui->skin->windows[i]->type == wiSub)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
917 desc = mygui->skin->windows[i];
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
918
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
919 rd.right = rd.left+desc->base->bitmap[0]->width;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
920 rd.bottom = rd.top+desc->base->bitmap[0]->height;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
921 sub_aspect = (float)(rd.right-rd.left)/(rd.bottom-rd.top);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
922 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
923 else
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
924 {
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
925 rd.right = rd.left+guiIntfStruct.MovieWidth;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
926 rd.bottom = rd.top+guiIntfStruct.MovieHeight;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
927
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
928 if (movie_aspect > 0.0) // forced aspect from the cmdline
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
929 sub_aspect = movie_aspect;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
930 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
931
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
932
18914
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
933 AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
19245
15b9a8cdea4c improved fullscreen switching
vayne
parents: 19147
diff changeset
934 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
935
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
936 wp.hwnd = mygui->subwindow;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
937 wp.x = rd.left;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
938 wp.y = rd.top;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
939 wp.cx = rd.right-rd.left;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
940 wp.cy = rd.bottom-rd.top;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
941 wp.flags = SWP_NOOWNERZORDER | SWP_SHOWWINDOW;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
942
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
943 /* erase the bitmap image if there's video */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
944 if(guiIntfStruct.Playing != 0 && guiIntfStruct.sh_video)
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
945 SendMessage(mygui->subwindow, WM_ERASEBKGND, (WPARAM)GetDC(mygui->subwindow), 0);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
946
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
947 /* reset the window aspect */
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
948 SendMessage(mygui->subwindow, WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp);
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
949 return 0;
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
950 }
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
951
d450ec82ae57 Initial win32 gui release.
vayne
parents:
diff changeset
952 void guiEventHandling(void) {}