annotate gui/win32/interface.c @ 33670:3b3e2d2f68c3

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