annotate gui/interface.c @ 33526:140525bcc32f

Fix GUI icon bug. The GUI icon did not display properly but showed up with various distortions. The reason was the icon mask which hadn't been put to the X server yet when used. The icon itself was okay, but is rendered now in a way that doesn't need a drawable which spares creating a GTK window and destroying it right after. The locally used GDK variables have been moved inside the function where they are needed. Patch with grateful support by Steaphan Greene, sgreene cs.binghamton edu. This closes Bugzilla #582.
author ib
date Tue, 14 Jun 2011 17:51:17 +0000
parents b1bda1dded08
children 276eef06fb3d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
5 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
14 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25851
diff changeset
17 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
19 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
22 #include "interface.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
23 #include "app.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
24 #include "mplayer/gmplayer.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
25 #include "mplayer/widgets.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
26 #include "skin/skin.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27 #include "wm/ws.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
28 #include "wm/wsxdnd.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30 #include "access_mpcontext.h"
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
31 #include "config.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
32 #include "help_mp.h"
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
33 #include "input/input.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
34 #include "libaf/equalizer.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
35 #include "libmpcodecs/dec_audio.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
36 #include "libmpcodecs/dec_video.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
37 #include "libmpcodecs/vd.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
38 #include "libmpcodecs/vf.h"
33398
3feb6b8799a1 Revert r33482.
ib
parents: 33395
diff changeset
39 #include "libvo/video_out.h"
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
40 #include "libvo/x11_common.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
41 #include "mixer.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
42 #include "mp_msg.h"
32032
52b0385d2d7a Move **sub_name extern declaration to mpcommon.h.
diego
parents: 32030
diff changeset
43 #include "mpcommon.h"
30536
39a4dd7ec420 Move GUI-related extern declarations to a GUI header file.
diego
parents: 30535
diff changeset
44 #include "mplayer.h"
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
45 #include "path.h"
32466
9e627a1793b1 Move font_load.[ch], font_load_ft.c and osd_font.h from libvo to sub.
cigaes
parents: 32461
diff changeset
46 #include "sub/font_load.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32466
diff changeset
47 #include "sub/sub.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
49 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 #include "stream/stream_dvd.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
53 guiInterface_t guiIntfStruct;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
55 int guiWinID = -1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56
32900
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
57 char *skinName;
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
58 char *skinDirInHome;
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
59 char *skinMPlayerDir;
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
60
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
61 plItem *plCurrent = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
62 plItem *plList = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
63 plItem *plLastPlayed = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
64
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
65 URLItem *URLList = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
66
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
67 char *fsHistory[fsPersistant_MaxPos] = { NULL, NULL, NULL, NULL, NULL };
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
68
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
69 float gtkEquChannels[6][10];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
70
33265
62c0471bcf8c Free config.
ib
parents: 33263
diff changeset
71 static int initialized;
62c0471bcf8c Free config.
ib
parents: 33263
diff changeset
72
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
73 int gstrcmp(const char *a, const char *b)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
75 if (!a && !b)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
76 return 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
77 if (!a || !b)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
78 return -1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
80 return strcmp(a, b);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
83 static int gstrncmp(const char *a, const char *b, int size)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
85 if (!a && !b)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
86 return 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
87 if (!a || !b)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
88 return -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
89
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
90 return strncmp(a, b, size);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
93 char *gstrdup(const char *str)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
95 if (!str)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
96 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
97
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
98 return strdup(str);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
101 char *gstrchr(char *str, int c)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
103 if (!str)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
104 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
105
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
106 return strchr(str, c);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
107 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
108
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
109 void gfree(void **p)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
110 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
111 free(*p);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
112 *p = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 /**
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
116 * \brief This actually creates a new list containing only one element...
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 */
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
118 void gaddlist(char ***list, const char *entry)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
120 int i;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
122 if (*list) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
123 for (i = 0; (*list)[i]; i++)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
124 free((*list)[i]);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
126 free(*list);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
127 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
128
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
129 *list = malloc(2 * sizeof(char **));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
130 (*list)[0] = gstrdup(entry);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
131 (*list)[1] = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 /**
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
135 * \brief This replaces a string starting with search by replace.
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 * If not found, replace is appended.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 */
30535
016e5fc1dead GUI: Mark functions that are not used outside their files as static.
diego
parents: 30516
diff changeset
138 static void greplace(char ***list, const char *search, const char *replace)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
140 int i = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
141 int len = (search ? strlen(search) : 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
143 if (*list) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
144 for (i = 0; (*list)[i]; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
145 if (search && (strncmp((*list)[i], search, len) == 0)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
146 free((*list)[i]);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
147 (*list)[i] = gstrdup(replace);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
148 return;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
149 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
150 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
152 *list = realloc(*list, (i + 2) * sizeof(char *));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
153 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
154 *list = malloc(2 * sizeof(char *));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
155
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
156 (*list)[i] = gstrdup(replace);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
157 (*list)[i + 1] = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
159
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
160 void guiInit(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
162 int i;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
164 memset(&guiIntfStruct, 0, sizeof(guiIntfStruct));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
165 guiIntfStruct.Balance = 50.0f;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
166 guiIntfStruct.StreamType = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
167
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
168 memset(&gtkEquChannels, 0, sizeof(gtkEquChannels));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
170 #ifdef CONFIG_DXR3
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
171 if (!gtkDXR3Device)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
172 gtkDXR3Device = strdup("/dev/em8300-0");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
173 #endif
32927
edb972e22021 Fix memory leak in appInitStruct().
ib
parents: 32900
diff changeset
174
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
175 if (stream_cache_size > 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
176 gtkCacheOn = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
177 gtkCacheSize = stream_cache_size;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
178 } else if (stream_cache_size == 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
179 gtkCacheOn = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
180
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
181 if (autosync && (autosync != gtkAutoSync)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
182 gtkAutoSyncOn = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
183 gtkAutoSync = autosync;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
184 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
185
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
186 #ifdef CONFIG_ASS
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
187 gtkASS.enabled = ass_enabled;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
188 gtkASS.use_margins = ass_use_margins;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
189 gtkASS.top_margin = ass_top_margin;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
190 gtkASS.bottom_margin = ass_bottom_margin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
193 gtkInit();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
194
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
195 // initialize X
33463
47b5846b20b6 Don't pointlessly cast Display pointer.
ib
parents: 33398
diff changeset
196 wsXInit(mDisplay);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
197
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
198 // load skin
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
199
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
200 skinDirInHome = get_path("skins");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
201 skinMPlayerDir = MPLAYER_DATADIR "/skins";
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
202
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
203 mp_msg(MSGT_GPLAYER, MSGL_V, "SKIN dir 1: '%s'\n", skinDirInHome);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
204 mp_msg(MSGT_GPLAYER, MSGL_V, "SKIN dir 2: '%s'\n", skinMPlayerDir);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
205
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
206 if (!skinName)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
207 skinName = strdup("default");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
208
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
209 i = skinRead(skinName);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
210
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
211 if (i == -1 && strcmp(skinName, "default") != 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
212 mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
213
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
214 skinName = strdup("default");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
215 i = skinRead(skinName);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
216 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
217
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
218 switch (i) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
219 case -1:
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
220 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinNotFound, skinName);
33263
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
221 guiExit(EXIT_ERROR);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
223 case -2:
33025
7f06781043d9 Revise some GUI error message texts.
ib
parents: 33024
diff changeset
224 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinCfgError, skinName);
33263
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
225 guiExit(EXIT_ERROR);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
226 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
227
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
228 // initialize windows
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
229
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
230 mplDrawBuffer = malloc(appMPlayer.main.Bitmap.ImageSize);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
231
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
232 if (!mplDrawBuffer) {
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
233 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
33263
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
234 guiExit(EXIT_ERROR);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
235 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
237 if (gui_save_pos) {
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
238 if (gui_main_pos_x != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
239 appMPlayer.main.x = gui_main_pos_x;
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
240 if (gui_main_pos_y != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
241 appMPlayer.main.y = gui_main_pos_y;
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
242 if (gui_sub_pos_x != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
243 appMPlayer.sub.x = gui_sub_pos_x;
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
244 if (gui_sub_pos_y != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
245 appMPlayer.sub.y = gui_sub_pos_y;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
246 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
247
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
248 if (WinID > 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
249 appMPlayer.subWindow.Parent = WinID;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
250 appMPlayer.sub.x = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
251 appMPlayer.sub.y = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
252 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
254 if (guiWinID >= 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
255 appMPlayer.mainWindow.Parent = guiWinID;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
257 wsCreateWindow(&appMPlayer.subWindow, appMPlayer.sub.x, appMPlayer.sub.y, appMPlayer.sub.width, appMPlayer.sub.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsHideWindow, "MPlayer - Video");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
258 wsDestroyImage(&appMPlayer.subWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
259 wsCreateImage(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Width, appMPlayer.sub.Bitmap.Height);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
260 wsXDNDMakeAwareness(&appMPlayer.subWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
261
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
262 mplMenuInit();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
263 mplPBInit();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265 // i=wsHideFrame|wsMaxSize|wsHideWindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
267 i = wsShowFrame | wsMaxSize | wsHideWindow;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
268 wsCreateWindow(&appMPlayer.mainWindow, appMPlayer.main.x, appMPlayer.main.y, appMPlayer.main.width, appMPlayer.main.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, i, "MPlayer");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
269 wsSetShape(&appMPlayer.mainWindow, appMPlayer.main.Mask.Image);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
270 wsXDNDMakeAwareness(&appMPlayer.mainWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 #ifdef DEBUG
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
273 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[main] depth on screen: %d\n", wsDepthOnScreen);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
274 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[main] parent: 0x%x\n", (int)appMPlayer.mainWindow.WindowID);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
275 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[main] sub: 0x%x\n", (int)appMPlayer.subWindow.WindowID);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
278 appMPlayer.mainWindow.ReDraw = (void *)mplMainDraw;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
279 appMPlayer.mainWindow.MouseHandler = mplMainMouseHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
280 appMPlayer.mainWindow.KeyHandler = mplMainKeyHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
281 appMPlayer.mainWindow.DandDHandler = mplDandDHandler;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
282
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
283 appMPlayer.subWindow.ReDraw = (void *)mplSubDraw;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
284 appMPlayer.subWindow.MouseHandler = mplSubMouseHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
285 appMPlayer.subWindow.KeyHandler = mplMainKeyHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
286 appMPlayer.subWindow.DandDHandler = mplDandDHandler;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
288 wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
289 wsClearWindow(appMPlayer.subWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
291 if (appMPlayer.sub.Bitmap.Image)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
292 wsConvert(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Image, appMPlayer.sub.Bitmap.ImageSize);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
293
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
294 btnModify(evSetVolume, guiIntfStruct.Volume);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
295 btnModify(evSetBalance, guiIntfStruct.Balance);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
296 btnModify(evSetMoviePosition, guiIntfStruct.Position);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
298 wsSetIcon(wsDisplay, appMPlayer.mainWindow.WindowID, guiIcon, guiIconMask);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
299 wsSetIcon(wsDisplay, appMPlayer.subWindow.WindowID, guiIcon, guiIconMask);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
300
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
301 guiIntfStruct.Playing = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
303 if (!appMPlayer.mainDecoration)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
304 wsWindowDecoration(&appMPlayer.mainWindow, 0);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
305
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
306 wsVisibleWindow(&appMPlayer.mainWindow, wsShowWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 #if 0
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
309 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
310 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
311 XEvent xev;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
313 do
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
314 XNextEvent(wsDisplay, &xev);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
315 while (xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
316
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
317 appMPlayer.subWindow.Mapped = wsMapped;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
318 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
319
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
320 if (!fullscreen)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
321 fullscreen = gtkLoadFullscreen;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
323 if (fullscreen) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324 mplFullScreen();
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
325 btnModify(evFullScreen, btnPressed);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
326 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
327 #else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
328 if (!fullscreen)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
329 fullscreen = gtkLoadFullscreen;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
330
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
331 if (gtkShowVideoWindow) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
332 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
333 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
334 XEvent xev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
335
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
336 do
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
337 XNextEvent(wsDisplay, &xev);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
338 while (xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
339
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
340 appMPlayer.subWindow.Mapped = wsMapped;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
341 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
343 if (fullscreen) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
344 mplFullScreen();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
345 btnModify(evFullScreen, btnPressed);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
346 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
347 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
348 if (fullscreen) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
349 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
350 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
351 XEvent xev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
352
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
353 do
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
354 XNextEvent(wsDisplay, &xev);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
355 while (xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
356
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
357 appMPlayer.subWindow.Mapped = wsMapped;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
358 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
359 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
360 mplFullScreen();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
361 btnModify(evFullScreen, btnPressed);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
362 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
363 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
365
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
366 mplSubRender = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
367
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
368 if (filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
369 mplSetFileName(NULL, filename, STREAMTYPE_FILE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
371 if (plCurrent && !filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
372 mplSetFileName(plCurrent->path, plCurrent->name, STREAMTYPE_FILE);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
373
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
374 if (subdata)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
375 guiSetFilename(guiIntfStruct.Subtitlename, subdata->filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
376
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
377 guiLoadFont();
33265
62c0471bcf8c Free config.
ib
parents: 33263
diff changeset
378
62c0471bcf8c Free config.
ib
parents: 33263
diff changeset
379 initialized = 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
382 void guiDone(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 {
33307
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
384 if (initialized) {
33308
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
385 mplMainRender = 0;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
386
33308
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
387 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] done.\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
388
33308
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
389 if (gui_save_pos) {
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
390 gui_main_pos_x = appMPlayer.mainWindow.X;
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
391 gui_main_pos_y = appMPlayer.mainWindow.Y;
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
392 gui_sub_pos_x = appMPlayer.subWindow.X;
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
393 gui_sub_pos_y = appMPlayer.subWindow.Y;
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
394 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
395
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
396 #ifdef CONFIG_ASS
33308
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
397 ass_enabled = gtkASS.enabled;
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
398 ass_use_margins = gtkASS.use_margins;
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
399 ass_top_margin = gtkASS.top_margin;
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
400 ass_bottom_margin = gtkASS.bottom_margin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402
33308
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
403 cfg_write();
0c2f2368a031 Cosmetic: Adjust indent.
ib
parents: 33307
diff changeset
404 wsXDone();
33307
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
405 }
33263
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
406
33307
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
407 appFreeStruct();
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
408
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
409 if (gui_conf) {
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
410 m_config_free(gui_conf);
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
411 gui_conf = NULL;
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
412 }
33263
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
413 }
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
414
33309
733376438418 Declare parameter type for guiExit() more precisely.
ib
parents: 33308
diff changeset
415 void guiExit(enum exit_reason how)
33263
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
416 {
33307
552f1f7731c8 Set GUI initialization flag earlier.
ib
parents: 33289
diff changeset
417 exit_player_with_rc(how, how >= EXIT_ERROR);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
420 void guiLoadFont(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421 {
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27390
diff changeset
422 #ifdef CONFIG_FREETYPE
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
423 load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name, osd_font_scale_factor);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
424 #else
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
425 if (vo_font) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
426 int i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
427
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
428 free(vo_font->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
429 free(vo_font->fpath);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
430
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
431 for (i = 0; i < 16; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
432 if (vo_font->pic_a[i]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
433 free(vo_font->pic_a[i]->bmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
434 free(vo_font->pic_a[i]->pal);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
435 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
436 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
437
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
438 for (i = 0; i < 16; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
439 if (vo_font->pic_b[i]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
440 free(vo_font->pic_b[i]->bmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
441 free(vo_font->pic_b[i]->pal);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
442 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
443 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
444
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
445 free(vo_font);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
446 vo_font = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
447 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
448
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
449 if (font_name) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
450 vo_font = read_font_desc(font_name, font_factor, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
451
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
452 if (!vo_font)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
453 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_CantLoadFont, font_name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
454 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
455 font_name = gstrdup(get_path("font/font.desc"));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
456 vo_font = read_font_desc(font_name, font_factor, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
457
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
458 if (!vo_font) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
459 gfree((void **)&font_name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
460 font_name = gstrdup(MPLAYER_DATADIR "/font/font.desc");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
461 vo_font = read_font_desc(font_name, font_factor, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
462 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
463 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
467 void guiLoadSubtitle(char *name)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
468 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
469 if (guiIntfStruct.Playing == 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
470 guiIntfStruct.SubtitleChanged = 1; // what is this for? (mw)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
471 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
472 }
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
473
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
474 if (subdata) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
475 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_DeletingSubtitles);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
476
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
477 sub_free(subdata);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
478 subdata = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
479 vo_sub = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
480
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
481 if (vo_osd_list) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
482 int len;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
483 mp_osd_obj_t *osd;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
484
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
485 osd = vo_osd_list;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
486
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
487 while (osd) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
488 if (osd->type == OSDTYPE_SUBTITLE)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
489 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
490
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
491 osd = osd->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
492 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
494 if (osd && (osd->flags & OSDFLAG_VISIBLE)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
495 len = osd->stride * (osd->bbox.y2 - osd->bbox.y1);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
496 memset(osd->bitmap_buffer, 0, len);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
497 memset(osd->alpha_buffer, 0, len);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
498 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
499 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
500 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
501
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
502 if (name) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
503 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_LoadingSubtitles, name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
504
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
505 subdata = sub_read_file(name, guiIntfStruct.FPS);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
506
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
507 if (!subdata)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
508 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadSub, name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
509
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
510 sub_name = (malloc(2 * sizeof(char *))); // when mplayer will be restarted
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
511 sub_name[0] = strdup(name); // sub_name[0] will be read
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
512 sub_name[1] = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
513 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
514
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
515 update_set_of_subtitles();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
517
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
518 static void add_vf(char *str)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
519 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
520 void *p;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
521
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
522 if (vf_settings) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
523 int i = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
524
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
525 while (vf_settings[i].name) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
526 if (!gstrcmp(vf_settings[i++].name, str)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
527 i = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
528 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
529 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
530 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
531
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
532 if (i != -1) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
533 p = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t));
32712
6ff3cc81d602 Fix resource leaks and check for realloc failures
ib
parents: 32543
diff changeset
534
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
535 if (!p)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
536 return;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
537
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
538 vf_settings = p;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
539 vf_settings[i].name = strdup(str);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
540 vf_settings[i].attribs = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
541 vf_settings[i + 1].name = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
542 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
543 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
544 vf_settings = malloc(2 * sizeof(m_obj_settings_t));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
545 vf_settings[0].name = strdup(str);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
546 vf_settings[0].attribs = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
547 vf_settings[1].name = NULL;
32712
6ff3cc81d602 Fix resource leaks and check for realloc failures
ib
parents: 32543
diff changeset
548 }
6ff3cc81d602 Fix resource leaks and check for realloc failures
ib
parents: 32543
diff changeset
549
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
550 mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_AddingVideoFilter, str);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
553 int guiGetEvent(int type, void *arg)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
554 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
555 mixer_t *mixer = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
557 stream_t *stream = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
558
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
559 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
560 dvd_priv_t *dvdp = arg;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
561 #endif
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562
33395
4e9058b47bde Cosmetic: Remove braces and adjust indent after r33481.
ib
parents: 33394
diff changeset
563 if (guiIntfStruct.mpcontext)
4e9058b47bde Cosmetic: Remove braces and adjust indent after r33481.
ib
parents: 33394
diff changeset
564 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
566 switch (type) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
567 case guiXEvent:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
568 guiIntfStruct.event_struct = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
569 wsEvents(wsDisplay, arg, NULL);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
570 gtkEventHandling();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
571 break;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
572
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
573 case guiCEvent:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
574
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
575 switch ((int)arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
576 case guiSetPlay:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
577 guiIntfStruct.Playing = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
578 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
579 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
580
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
581 case guiSetStop:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
582 guiIntfStruct.Playing = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
583 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
584 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
585
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
586 case guiSetPause:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
587 guiIntfStruct.Playing = 2;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
588 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
589 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
590
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
591 mplState();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 break;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
593
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
594 case guiSetState:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
595 mplState();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
596 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
597
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
598 case guiSetFileName:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
599 if (arg)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
600 guiSetFilename(guiIntfStruct.Filename, arg);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 break;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
602
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
603 case guiSetAudioOnly:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
604
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
605 guiIntfStruct.AudioOnly = (int)arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
606
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
607 if ((int)arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
608 guiIntfStruct.NoWindow = True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
609 wsVisibleWindow(&appMPlayer.subWindow, wsHideWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
610 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
611 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
612
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613 break;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
614
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
615 case guiSetContext:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
616 guiIntfStruct.mpcontext = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
617 // NOTE TO MYSELF: is break missing?
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
618
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
619 case guiSetDemuxer:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
620 guiIntfStruct.demuxer = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
621 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
622
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
623 case guiSetAfilter:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
624 guiIntfStruct.afilter = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
625 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
626
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
627 case guiSetShVideo:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
628
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
629 if (!appMPlayer.subWindow.isFullScreen) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
630 wsResizeWindow(&appMPlayer.subWindow, vo_dwidth, vo_dheight);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
631 wsMoveWindow(&appMPlayer.subWindow, True, appMPlayer.sub.x, appMPlayer.sub.y);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
632 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
633
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
634 guiIntfStruct.MovieWidth = vo_dwidth;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
635 guiIntfStruct.MovieHeight = vo_dheight;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
636
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
637 if (guiWinID >= 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
638 wsMoveWindow(&appMPlayer.mainWindow, 0, 0, vo_dheight);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
639
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
640 WinID = appMPlayer.subWindow.WindowID;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
641 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
642
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
643 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
644 case guiSetDVD:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
645 guiIntfStruct.DVD.titles = dvdp->vmg_file->tt_srpt->nr_of_srpts;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
646 guiIntfStruct.DVD.chapters = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
647 guiIntfStruct.DVD.angles = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
648 guiIntfStruct.DVD.nr_of_audio_channels = dvdp->nr_of_channels;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
649 memcpy(guiIntfStruct.DVD.audio_streams, dvdp->audio_streams, sizeof(dvdp->audio_streams));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
650 guiIntfStruct.DVD.nr_of_subtitles = dvdp->nr_of_subtitles;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
651 memcpy(guiIntfStruct.DVD.subtitles, dvdp->subtitles, sizeof(dvdp->subtitles));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
652 guiIntfStruct.DVD.current_title = dvd_title + 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
653 guiIntfStruct.DVD.current_chapter = dvd_chapter + 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
654 guiIntfStruct.DVD.current_angle = dvd_angle + 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
655 guiIntfStruct.Track = dvd_title + 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
656 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
657 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
658
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
659 case guiSetStream:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
660
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
661 guiIntfStruct.StreamType = stream->type;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
662
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
663 switch (stream->type) {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
664 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
665 case STREAMTYPE_DVD:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
666 guiGetEvent(guiSetDVD, (char *)stream->priv);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
667 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
668 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
669
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
670 #ifdef CONFIG_VCD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
671 case STREAMTYPE_VCD:
33006
66d908462d76 Initialize guiIntfStruct.VCDTracks.
ib
parents: 33005
diff changeset
672 guiIntfStruct.VCDTracks = 0;
66d908462d76 Initialize guiIntfStruct.VCDTracks.
ib
parents: 33005
diff changeset
673 stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiIntfStruct.VCDTracks);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
674 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
675 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
676
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
677 default:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
678 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
679 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
680
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
681 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
682
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
683 case guiIEvent:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
684
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
685 mp_msg(MSGT_GPLAYER, MSGL_V, "cmd: %d\n", (int)arg);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
686
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
687 switch ((int)arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
688 case MP_CMD_QUIT:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
689 mplEventHandling(evExit, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
690 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
691
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
692 case MP_CMD_VO_FULLSCREEN:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
693 mplEventHandling(evFullScreen, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
694 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
695 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
696
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
697 break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
698
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
699 case guiReDraw:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
700 mplEventHandling(evRedraw, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
701 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
702
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
703 case guiSetVolume:
33393
eda1d0125255 Use mixer directly without checking for an audio_out.
reimar
parents: 33392
diff changeset
704 if (mixer) {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
705 float l, r;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
706
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
707 mixer_getvolume(mixer, &l, &r);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
708 guiIntfStruct.Volume = (r > l ? r : l);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
709
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
710 if (r != l)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
711 guiIntfStruct.Balance = ((r - l) + 100) * 0.5f;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
712 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
713 guiIntfStruct.Balance = 50.0f;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
714
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
715 btnModify(evSetVolume, guiIntfStruct.Volume);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
716 btnModify(evSetBalance, guiIntfStruct.Balance);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
717 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
718 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
719
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
720 case guiSetFileFormat:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
721 guiIntfStruct.FileFormat = (int)arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
722 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
723
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
724 case guiSetValues:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
725
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
726 // video
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
727
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
728 guiIntfStruct.sh_video = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
729
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
730 if (arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
731 sh_video_t *sh = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
732 guiIntfStruct.FPS = sh->fps;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
733 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
734
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
735 if (guiIntfStruct.NoWindow)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
736 wsVisibleWindow(&appMPlayer.subWindow, wsHideWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
737
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
738 if (guiIntfStruct.StreamType == STREAMTYPE_STREAM)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
739 btnSet(evSetMoviePosition, btnDisabled);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
740 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
741 btnSet(evSetMoviePosition, btnReleased);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
742
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
743 // audio
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
744
33393
eda1d0125255 Use mixer directly without checking for an audio_out.
reimar
parents: 33392
diff changeset
745 if (mixer) {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
746 float l, r;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
747
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
748 mixer_getvolume(mixer, &l, &r);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
749 guiIntfStruct.Volume = (r > l ? r : l);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
750
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
751 if (r != l)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
752 guiIntfStruct.Balance = ((r - l) + 100) * 0.5f;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
753 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
754 guiIntfStruct.Balance = 50.0f;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
755
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
756 btnModify(evSetVolume, guiIntfStruct.Volume);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
757 btnModify(evSetBalance, guiIntfStruct.Balance);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
758 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
759
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
760 if (gtkEnableAudioEqualizer) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
761 equalizer_t eq;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
762 int i, j;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
763
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
764 for (i = 0; i < 6; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
765 for (j = 0; j < 10; j++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
766 eq.channel = i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
767 eq.band = j;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
768 eq.gain = gtkEquChannels[i][j];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
769 gtkSet(gtkSetEqualizer, 0, &eq);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
770 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
771 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
772 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
773
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
774 // subtitle
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
775
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
776 #ifdef CONFIG_DXR3
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
777 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3") && (guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS) && !gtkVfLAVC) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
778 gtkMessageBox(GTK_MB_FATAL, MSGTR_NEEDLAVC);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
779 guiIntfStruct.Playing = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
780 return True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
781 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
782 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
783
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
784 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
785
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
786 case guiSetDefaults:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
787
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
788 // if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
789 if (guiIntfStruct.FilenameChanged) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
790 audio_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
791 video_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
792 dvdsub_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
793 vobsub_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
794 stream_cache_size = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
795 autosync = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
796 dvd_title = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
797 force_fps = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
798 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
799
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
800 guiIntfStruct.demuxer = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
801 guiIntfStruct.sh_video = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
802 wsPostRedisplay(&appMPlayer.subWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
803
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
804 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
805
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
806 case guiSetParameters:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
807
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
808 guiGetEvent(guiSetDefaults, NULL);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
809
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
810 switch (guiIntfStruct.StreamType) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
811 case STREAMTYPE_PLAYLIST:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
812 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
813
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
814 #ifdef CONFIG_VCD
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
815 case STREAMTYPE_VCD:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
816 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
817 char tmp[512];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
818
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
819 sprintf(tmp, "vcd://%d", guiIntfStruct.Track + 1);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
820 guiSetFilename(guiIntfStruct.Filename, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
821 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
822 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
823 #endif
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
824
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
825 #ifdef CONFIG_DVDREAD
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
826 case STREAMTYPE_DVD:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
827 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
828 char tmp[512];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
829
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
830 sprintf(tmp, "dvd://%d", guiIntfStruct.Title);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
831 guiSetFilename(guiIntfStruct.Filename, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
832 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
833
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
834 dvd_chapter = guiIntfStruct.Chapter;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
835 dvd_angle = guiIntfStruct.Angle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
836
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
837 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
838 #endif
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
839 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
840
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
841 // if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore!
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
842 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
843 if (guiIntfStruct.Filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
844 filename = gstrdup(guiIntfStruct.Filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
845 else if (filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
846 guiSetFilename(guiIntfStruct.Filename, filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
847 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
848
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
849 // video opts
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
850
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
851 if (!video_driver_list) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
852 int i = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
853
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
854 while (video_out_drivers[i++]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
855 if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
856 gaddlist(&video_driver_list, (char *)video_out_drivers[i - 1]->info->short_name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
857 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
858 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
859 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
860 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
861
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
862 if (!video_driver_list && !video_driver_list[0]) {
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
863 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_IDFGCVD);
33263
5f527a9a9521 Add an exit function.
ib
parents: 33244
diff changeset
864 guiExit(EXIT_ERROR);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
865 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
866
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
867 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
868 int i = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
869
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
870 guiIntfStruct.NoWindow = False;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
871
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
872 while (video_out_drivers[i++]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
873 if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
874 if ((video_driver_list && !gstrcmp(video_driver_list[0], (char *)video_out_drivers[i - 1]->info->short_name)) && (video_out_drivers[i - 1]->control(VOCTRL_GUI_NOWINDOW, NULL) == VO_TRUE)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
875 guiIntfStruct.NoWindow = True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
876 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
877 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
878 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
879 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
880 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
881
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
882 #ifdef CONFIG_DXR3
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
883 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3"))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
884 if (guiIntfStruct.StreamType != STREAMTYPE_DVD && guiIntfStruct.StreamType != STREAMTYPE_VCD)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
885 if (gtkVfLAVC)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
886 add_vf("lavc");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
887 #endif
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
888
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
889 if (gtkVfPP)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
890 add_vf("pp");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
891
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
892 // audio opts
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
893
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
894 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
895 if (gtkAONorm)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
896 greplace(&af_cfg.list, "volnorm", "volnorm");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
897
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
898 if (gtkEnableAudioEqualizer)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
899 greplace(&af_cfg.list, "equalizer", "equalizer");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
900
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
901 if (gtkAOExtraStereo) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
902 char *name;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
903
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
904 name = malloc(12 + 20 + 1);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
905 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
906 name[12 + 20] = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
907 greplace(&af_cfg.list, "extrastereo", name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
908 free(name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
909 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
910
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
911 #ifdef CONFIG_OSS_AUDIO
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
912 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "oss", 3)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
913 char *tmp;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
914
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
915 mixer_device = gtkAOOSSMixer;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
916 mixer_channel = gtkAOOSSMixerChannel;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
917
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
918 if (gtkAOOSSDevice) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
919 tmp = calloc(1, strlen(gtkAOOSSDevice) + 7);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
920 sprintf(tmp, "oss:%s", gtkAOOSSDevice);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
921 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
922 tmp = strdup("oss");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
923
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
924 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
925 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
926 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
927 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
928
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27387
diff changeset
929 #ifdef CONFIG_ALSA
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
930 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "alsa", 4)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
931 char *tmp;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
932
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
933 mixer_device = gtkAOALSAMixer;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
934 mixer_channel = gtkAOALSAMixerChannel;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
935
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
936 if (gtkAOALSADevice) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
937 tmp = calloc(1, strlen(gtkAOALSADevice) + 14);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
938 sprintf(tmp, "alsa:device=%s", gtkAOALSADevice);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
939 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
940 tmp = strdup("alsa");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
941
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
942 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
943 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
944 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
945 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
946
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
947 #ifdef CONFIG_SDL
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
948 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "sdl", 3)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
949 char *tmp;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
950
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
951 if (gtkAOSDLDriver) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
952 tmp = calloc(1, strlen(gtkAOSDLDriver) + 10);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
953 sprintf(tmp, "sdl:%s", gtkAOSDLDriver);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
954 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
955 tmp = strdup("sdl");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
956
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
957 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
958 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
959 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
960 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
961
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
962 #ifdef CONFIG_ESD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
963 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "esd", 3)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
964 char *tmp;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
965
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
966 if (gtkAOESDDevice) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
967 tmp = calloc(1, strlen(gtkAOESDDevice) + 10);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
968 sprintf(tmp, "esd:%s", gtkAOESDDevice);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
969 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
970 tmp = strdup("esd");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
971
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
972 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
973 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
974 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
975 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
976
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
977 // subtitle
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
978
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
979 // subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
980 stream_dump_type = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
981
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
982 if (gtkSubDumpMPSub)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
983 stream_dump_type = 4;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
985 if (gtkSubDumpSrt)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
986 stream_dump_type = 6;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
987
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
988 gtkSubDumpMPSub = gtkSubDumpSrt = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
989 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
990
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
991 // misc
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
992
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
993 if (gtkCacheOn)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
994 stream_cache_size = gtkCacheSize;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
995
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
996 if (gtkAutoSyncOn)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
997 autosync = gtkAutoSync;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
998
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
999 if (guiIntfStruct.AudioFile)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1000 audio_stream = gstrdup(guiIntfStruct.AudioFile);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1001 else if (guiIntfStruct.FilenameChanged)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1002 gfree((void **)&audio_stream);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1003
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1004 // audio_stream = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1005
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1006 guiIntfStruct.DiskChanged = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1007 guiIntfStruct.FilenameChanged = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1008 guiIntfStruct.NewPlay = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1009
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
1010 #ifdef CONFIG_ASS
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1011 ass_enabled = gtkASS.enabled;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1012 ass_use_margins = gtkASS.use_margins;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1013 ass_top_margin = gtkASS.top_margin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1014 ass_bottom_margin = gtkASS.bottom_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1015 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1016
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1017 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1018 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1019
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1020 return False;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1021 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1022
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1023 void guiEventHandling(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1024 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1025 if (!guiIntfStruct.Playing || guiIntfStruct.NoWindow)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1026 wsHandleEvents();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1027
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1028 gtkEventHandling();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1029 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1030
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1031 // ---
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1032 #if defined(MP_DEBUG) && 0
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1033 void list(void)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1034 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1035 plItem *next = plList;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1036
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1037 printf("--- list ---\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1038
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1039 while (next || next->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1040 printf("item: %s/%s\n", next->path, next->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1041
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1042 if (next->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1043 next = next->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1044 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1045 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1046 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1047
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1048 printf("--- end of list ---\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1049 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1050 #else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1051 #define list();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1052 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1053
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1054 void *gtkSet(int cmd, float fparam, void *vparam)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1055 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1056 equalizer_t *eq = (equalizer_t *)vparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1057 plItem *item = (plItem *)vparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1058 URLItem *url_item = (URLItem *)vparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1059 int is_added = True;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1060
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1061 switch (cmd) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1062 // handle playlist
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1063
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1064 // add item to playlist
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1065 case gtkAddPlItem:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1066
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1067 if (plList) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1068 plItem *next = plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1069
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1070 while (next->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1071 // {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1072 // printf( "%s\n",next->name );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1073 next = next->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1074 // }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1075
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1076 next->next = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1077 item->prev = next;
33475
b1bda1dded08 When adding a playlist item, preventively set its next pointer to NULL.
ib
parents: 33473
diff changeset
1078 item->next = NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1079 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1080 item->prev = item->next = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1081 plCurrent = plList = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1082 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1083
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1084 list();
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1085
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1086 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1087
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1088 // add item into playlist after current
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1089 case gtkInsertPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1090 if (plCurrent) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1091 plItem *curr = plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1092 item->next = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1093
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1094 if (item->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1095 item->next->prev = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1096
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1097 item->prev = curr;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1098 curr->next = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1099 plCurrent = plCurrent->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1100
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1101 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1102 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1103 return gtkSet(gtkAddPlItem, 0, (void *)item);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1104 return NULL; // NOTE TO MYSELF: remove this
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1105
33473
74db5e584741 Cosmetic: Correct a comment and add a new one.
ib
parents: 33463
diff changeset
1106 // get next item from playlist
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1107 case gtkGetNextPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1108 if (plCurrent && plCurrent->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1109 plCurrent = plCurrent->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1110 // if (!plCurrent && plList)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1111 // {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1112 // plItem *next = plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1113 //
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1114 // while (next->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1115 // {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1116 // if (!next->next) break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1117 // next = next->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1118 // }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1119 //
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1120 // plCurrent = next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1121 // }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1122 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1123 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1124
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1125 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1126
33473
74db5e584741 Cosmetic: Correct a comment and add a new one.
ib
parents: 33463
diff changeset
1127 // get previous item from playlist
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1128 case gtkGetPrevPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1129 if (plCurrent && plCurrent->prev) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1130 plCurrent = plCurrent->prev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1131 // if ( !plCurrent && plList ) plCurrent=plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1132 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1133 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1134
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1135 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1136
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1137 // set current item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1138 case gtkSetCurrPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1139 plCurrent = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1140 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1141
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1142 // get current item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1143 case gtkGetCurrPlItem:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1144 return plCurrent;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1145
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1146 // delete current item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1147 case gtkDelCurrPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1148 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1149 plItem *curr = plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1150
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1151 if (!curr)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1152 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1153
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1154 if (curr->prev)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1155 curr->prev->next = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1156 if (curr->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1157 curr->next->prev = curr->prev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1158 if (curr == plList)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1159 plList = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1160
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1161 plCurrent = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1162
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1163 // free it
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1164 free(curr->path);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1165 free(curr->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1166 free(curr);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1167 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1168
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1169 mplCurr(); // instead of using mplNext && mplPrev
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1170
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1171 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1172
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1173 // delete list
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1174 case gtkDelPl:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1175 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1176 plItem *curr = plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1177 plItem *next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1178
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1179 if (!plList)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1180 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1181
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1182 if (!curr->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1183 free(curr->path);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1184 free(curr->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1185 free(curr);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1186 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1187 while (curr->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1188 next = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1189 free(curr->path);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1190 free(curr->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1191 free(curr);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1192 curr = next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1193 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1194 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1195
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1196 plList = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1197 plCurrent = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1198 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1199
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1200 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1201
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1202 // handle url
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1203 case gtkAddURLItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1204 if (URLList) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1205 URLItem *next_url = URLList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1206 is_added = False;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1207
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1208 while (next_url->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1209 if (!gstrcmp(next_url->url, url_item->url)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1210 is_added = True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1211 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1212 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1213
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1214 next_url = next_url->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1215 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1216
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1217 if (!is_added && gstrcmp(next_url->url, url_item->url))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1218 next_url->next = url_item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1219 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1220 url_item->next = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1221 URLList = url_item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1222 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1223
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1224 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1225
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1226 // subtitle
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1227
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27390
diff changeset
1228 #ifndef CONFIG_FREETYPE
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1229 case gtkSetFontFactor:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1230 font_factor = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1231 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1232 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1233 #else
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1234 case gtkSetFontOutLine:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1235 subtitle_font_thickness = (8.0f / 100.0f) * fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1236 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1237 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1238
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1239 case gtkSetFontBlur:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1240 subtitle_font_radius = (8.0f / 100.0f) * fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1241 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1242 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1243
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1244 case gtkSetFontTextScale:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1245 text_font_scale_factor = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1246 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1247 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1248
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1249 case gtkSetFontOSDScale:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1250 osd_font_scale_factor = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1251 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1252 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1253
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1254 case gtkSetFontEncoding:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1255 gfree((void **)&subtitle_font_encoding);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1256 subtitle_font_encoding = gstrdup((char *)vparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1257 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1258 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1259
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1260 case gtkSetFontAutoScale:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1261 subtitle_autoscale = (int)fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1262 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1263 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1264 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1265
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27390
diff changeset
1266 #ifdef CONFIG_ICONV
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1267 case gtkSetSubEncoding:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1268 gfree((void **)&sub_cp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1269 sub_cp = gstrdup((char *)vparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1270 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1271 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1272
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1273 // misc
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1274
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1275 case gtkClearStruct:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1276
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1277 if ((unsigned int)vparam & guiFilenames) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1278 gfree((void **)&guiIntfStruct.Filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1279 gfree((void **)&guiIntfStruct.Subtitlename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1280 gfree((void **)&guiIntfStruct.AudioFile);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1281 gtkSet(gtkDelPl, 0, NULL);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1282 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1283
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
1284 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1285 if ((unsigned int)vparam & guiDVD)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1286 memset(&guiIntfStruct.DVD, 0, sizeof(guiDVDStruct));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1287 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1288
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
1289 #ifdef CONFIG_VCD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1290 if ((unsigned int)vparam & guiVCD)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1291 guiIntfStruct.VCDTracks = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1292 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1293
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1294 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1295
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1296 case gtkSetExtraStereo:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1297 gtkAOExtraStereoMul = fparam;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1298 if (guiIntfStruct.afilter)
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1299 af_control_any_rev(guiIntfStruct.afilter, AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1300 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1301
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1302 case gtkSetPanscan:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1303 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1304 mp_cmd_t *mp_cmd;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1305
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1306 mp_cmd = calloc(1, sizeof(*mp_cmd));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1307 mp_cmd->id = MP_CMD_PANSCAN;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1308 mp_cmd->name = strdup("panscan");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1309 mp_cmd->args[0].v.f = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1310 mp_cmd->args[1].v.i = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1311 mp_input_queue_cmd(mp_cmd);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1312 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1313
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1314 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1315
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1316 case gtkSetAutoq:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1317 auto_quality = (int)fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1318 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1319
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1320 // set equalizers
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1321
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1322 case gtkSetContrast:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1323 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1324 set_video_colors(guiIntfStruct.sh_video, "contrast", (int)fparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1325 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1326
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1327 case gtkSetBrightness:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1328 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1329 set_video_colors(guiIntfStruct.sh_video, "brightness", (int)fparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1330 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1331
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1332 case gtkSetHue:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1333 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1334 set_video_colors(guiIntfStruct.sh_video, "hue", (int)fparam);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1335 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1336
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1337 case gtkSetSaturation:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1338 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1339 set_video_colors(guiIntfStruct.sh_video, "saturation", (int)fparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1340 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1341
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1342 case gtkSetEqualizer:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1343 {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1344 af_control_ext_t tmp;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1345
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1346 if (eq) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1347 gtkEquChannels[eq->channel][eq->band] = eq->gain;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1348 tmp.ch = eq->channel;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1349 tmp.arg = gtkEquChannels[eq->channel];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1350
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1351 if (guiIntfStruct.afilter)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1352 af_control_any_rev(guiIntfStruct.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1353 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1354 int i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1355
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1356 memset(gtkEquChannels, 0, sizeof(gtkEquChannels));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1357
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1358 if (guiIntfStruct.afilter) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1359 for (i = 0; i < 6; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1360 tmp.ch = i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1361 tmp.arg = gtkEquChannels[i];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1362 af_control_any_rev(guiIntfStruct.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1363 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1364 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1365 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1366
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1367 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1368 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1369 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1370
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1371 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1372 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1373
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1374 // This function adds/inserts one file into the gui playlist.
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1375 static int import_file_into_gui(char *temp, int insert)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1376 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1377 char *filename, *pathname;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1378 plItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1379
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1380 filename = strdup(mp_basename(temp));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1381 pathname = strdup(temp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1382
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1383 if (strlen(pathname) - strlen(filename) > 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1384 pathname[strlen(pathname) - strlen(filename) - 1] = 0; // we have some path, so remove / at end
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1385 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1386 pathname[strlen(pathname) - strlen(filename)] = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1387
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1388 // NOTE TO MYSELF: FIXME: Change to MSGL_DBG2?
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1389 mp_msg(MSGT_PLAYTREE, MSGL_V, "Adding filename %s && pathname %s\n", filename, pathname);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1390
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1391 item = calloc(1, sizeof(plItem));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1392
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1393 if (!item)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1394 return 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1395
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1396 item->name = filename;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1397 item->path = pathname;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1398
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1399 if (insert)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1400 gtkSet(gtkInsertPlItem, 0, (void *)item); // inserts the item after current, and makes current=item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1401 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1402 gtkSet(gtkAddPlItem, 0, (void *)item);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1403
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1404 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1405 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1406
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1407 // This function imports the initial playtree (based on cmd-line files)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1408 // into the gui playlist by either:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1409 // - overwriting gui pl (enqueue=0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1410 // - appending it to gui pl (enqueue=1)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1411 int import_initial_playtree_into_gui(play_tree_t *my_playtree, m_config_t *config, int enqueue)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1412 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1413 play_tree_iter_t *my_pt_iter = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1414 int result = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1415
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1416 if (!enqueue)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1417 gtkSet(gtkDelPl, 0, 0); // delete playlist before "appending"
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1418
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1419 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1420 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1421 // add it to end of list
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1422 if (import_file_into_gui(filename, 0))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1423 result = 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1424 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1425
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1426 mplCurr(); // update filename
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1427 mplGotoTheNext = 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1428
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1429 if (!enqueue)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1430 filename = guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline,
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1431 // gmplayer does directly start in Play-Mode.
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1432 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1433 filename = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1434
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1435 return result;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1436 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1437
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1438 // This function imports and inserts an playtree, that is created "on the fly",
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1439 // for example by parsing some MOV-Reference-File; or by loading an playlist
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1440 // with "File Open".
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1441 // The file which contained the playlist is thereby replaced with it's contents.
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1442 int import_playtree_playlist_into_gui(play_tree_t *my_playtree, m_config_t *config)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1443 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1444 play_tree_iter_t *my_pt_iter = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1445 int result = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1446 plItem *save;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1447
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1448 save = (plItem *)gtkSet(gtkGetCurrPlItem, 0, 0); // save current item
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1449
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1450 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1451 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1452 // insert it into the list and set plCurrent=new item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1453 if (import_file_into_gui(filename, 1))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1454 result = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1455
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1456 pt_iter_destroy(&my_pt_iter);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1457 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1458
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1459 if (save)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1460 gtkSet(gtkSetCurrPlItem, 0, (void *)save);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1461 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1462 gtkSet(gtkSetCurrPlItem, 0, (void *)plList); // go to head, if plList was empty before
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1463
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1464 if (save && result)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1465 gtkSet(gtkDelCurrPlItem, 0, 0);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1466
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1467 mplCurr(); // update filename
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1468 filename = NULL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1469
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1470 return result;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1471 }
33023
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1472
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1473 // NOTE TO MYSELF: This function is nonsense.
33289
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33268
diff changeset
1474 // MPlayer should pass messages to the GUI
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33268
diff changeset
1475 // which must decide then which message has
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33268
diff changeset
1476 // to be shown (MSGL_FATAL, for example).
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33268
diff changeset
1477 // But with this function it is at least
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33268
diff changeset
1478 // possible to show GUI's very critical or
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33268
diff changeset
1479 // abort messages.
33023
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1480 void gmp_msg(int mod, int lev, const char *format, ...)
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1481 {
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1482 char msg[512];
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1483 va_list va;
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1484
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1485 va_start(va, format);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1486 vsnprintf(msg, sizeof(msg), format, va);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1487 va_end(va);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1488
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1489 mp_msg(mod, lev, msg);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1490
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1491 if (mp_msg_test(mod, lev))
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1492 gtkMessageBox(GTK_MB_FATAL, msg);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1493 }