annotate gui/interface.c @ 33244:cee07c3dbff5

Do not remove video filters. If a video filter option isn't set, it does not mean to remove the filter, but such option (if set) should only cause adding the filter (if not already present). That way filters can be specified in MPlayer's config or on the command line, too. This closes Bugzilla #1442.
author ib
date Mon, 25 Apr 2011 14:25:15 +0000
parents 5f9eaf3eea63
children 5f527a9a9521
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 "libao2/audio_out.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
36 #include "libmpcodecs/dec_audio.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
37 #include "libmpcodecs/dec_video.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
38 #include "libmpcodecs/vd.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
39 #include "libmpcodecs/vf.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
40 #include "libvo/video_out.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
41 #include "libvo/x11_common.h"
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
42 #include "mixer.h"
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 30063
diff changeset
43 #include "mp_core.h"
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
44 #include "mp_msg.h"
32032
52b0385d2d7a Move **sub_name extern declaration to mpcommon.h.
diego
parents: 32030
diff changeset
45 #include "mpcommon.h"
30536
39a4dd7ec420 Move GUI-related extern declarations to a GUI header file.
diego
parents: 30535
diff changeset
46 #include "mplayer.h"
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
47 #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
48 #include "sub/font_load.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32466
diff changeset
49 #include "sub/sub.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
51 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 #include "stream/stream_dvd.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
55 guiInterface_t guiIntfStruct;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
57 int guiWinID = -1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58
32900
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
59 char *skinName;
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
60 char *skinDirInHome;
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
61 char *skinMPlayerDir;
1481268ccd30 Move global skin directory variables.
ib
parents: 32847
diff changeset
62
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
63 plItem *plCurrent = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
64 plItem *plList = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
65 plItem *plLastPlayed = 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 URLItem *URLList = 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 char *fsHistory[fsPersistant_MaxPos] = { NULL, NULL, NULL, NULL, NULL };
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
70
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
71 float gtkEquChannels[6][10];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
72
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 appInitStruct();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
169
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
170 memset(&gtkEquChannels, 0, sizeof(gtkEquChannels));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
172 #ifdef CONFIG_DXR3
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
173 if (!gtkDXR3Device)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
174 gtkDXR3Device = strdup("/dev/em8300-0");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
175 #endif
32927
edb972e22021 Fix memory leak in appInitStruct().
ib
parents: 32900
diff changeset
176
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
177 if (stream_cache_size > 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
178 gtkCacheOn = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
179 gtkCacheSize = stream_cache_size;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
180 } else if (stream_cache_size == 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
181 gtkCacheOn = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
182
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
183 if (autosync && (autosync != gtkAutoSync)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
184 gtkAutoSyncOn = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
185 gtkAutoSync = autosync;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
186 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
187
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
188 #ifdef CONFIG_ASS
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
189 gtkASS.enabled = ass_enabled;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
190 gtkASS.use_margins = ass_use_margins;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
191 gtkASS.top_margin = ass_top_margin;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
192 gtkASS.bottom_margin = ass_bottom_margin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
195 gtkInit();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
196
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
197 // initialize X
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
198 wsXInit((void *)mDisplay);
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 // load skin
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
201
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
202 skinDirInHome = get_path("skins");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
203 skinMPlayerDir = MPLAYER_DATADIR "/skins";
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
204
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
205 mp_msg(MSGT_GPLAYER, MSGL_V, "SKIN dir 1: '%s'\n", skinDirInHome);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
206 mp_msg(MSGT_GPLAYER, MSGL_V, "SKIN dir 2: '%s'\n", skinMPlayerDir);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
207
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
208 if (!skinName)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
209 skinName = strdup("default");
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 i = skinRead(skinName);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
212
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
213 if (i == -1 && strcmp(skinName, "default") != 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
214 mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
215
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
216 skinName = strdup("default");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
217 i = skinRead(skinName);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
218 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
219
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
220 switch (i) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
221 case -1:
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
222 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinNotFound, skinName);
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
223 exit_player(EXIT_ERROR);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
225 case -2:
33025
7f06781043d9 Revise some GUI error message texts.
ib
parents: 33024
diff changeset
226 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinCfgError, skinName);
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
227 exit_player(EXIT_ERROR);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
228 }
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 // initialize windows
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 mplDrawBuffer = malloc(appMPlayer.main.Bitmap.ImageSize);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
233
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
234 if (!mplDrawBuffer) {
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
235 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
236 exit_player(EXIT_ERROR);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
237 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
239 if (gui_save_pos) {
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
240 if (gui_main_pos_x != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
241 appMPlayer.main.x = gui_main_pos_x;
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
242 if (gui_main_pos_y != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
243 appMPlayer.main.y = gui_main_pos_y;
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
244 if (gui_sub_pos_x != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
245 appMPlayer.sub.x = gui_sub_pos_x;
33218
f0c2a62e3e89 Position windows initially at coordinates given in skin file.
ib
parents: 33053
diff changeset
246 if (gui_sub_pos_y != -3)
33219
5f9eaf3eea63 Cosmetic: Adjust indent and space.
ib
parents: 33218
diff changeset
247 appMPlayer.sub.y = gui_sub_pos_y;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
248 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
249
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
250 if (WinID > 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
251 appMPlayer.subWindow.Parent = WinID;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
252 appMPlayer.sub.x = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
253 appMPlayer.sub.y = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
254 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
256 if (guiWinID >= 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
257 appMPlayer.mainWindow.Parent = guiWinID;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
259 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
260 wsDestroyImage(&appMPlayer.subWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
261 wsCreateImage(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Width, appMPlayer.sub.Bitmap.Height);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
262 wsXDNDMakeAwareness(&appMPlayer.subWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
263
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
264 mplMenuInit();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
265 mplPBInit();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 // i=wsHideFrame|wsMaxSize|wsHideWindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
269 i = wsShowFrame | wsMaxSize | wsHideWindow;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
270 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
271 wsSetShape(&appMPlayer.mainWindow, appMPlayer.main.Mask.Image);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
272 wsXDNDMakeAwareness(&appMPlayer.mainWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 #ifdef DEBUG
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
275 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
276 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
277 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[main] sub: 0x%x\n", (int)appMPlayer.subWindow.WindowID);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
280 appMPlayer.mainWindow.ReDraw = (void *)mplMainDraw;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
281 appMPlayer.mainWindow.MouseHandler = mplMainMouseHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
282 appMPlayer.mainWindow.KeyHandler = mplMainKeyHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
283 appMPlayer.mainWindow.DandDHandler = mplDandDHandler;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
284
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
285 appMPlayer.subWindow.ReDraw = (void *)mplSubDraw;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
286 appMPlayer.subWindow.MouseHandler = mplSubMouseHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
287 appMPlayer.subWindow.KeyHandler = mplMainKeyHandle;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
288 appMPlayer.subWindow.DandDHandler = mplDandDHandler;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
290 wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
291 wsClearWindow(appMPlayer.subWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
293 if (appMPlayer.sub.Bitmap.Image)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
294 wsConvert(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Image, appMPlayer.sub.Bitmap.ImageSize);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
295
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
296 btnModify(evSetVolume, guiIntfStruct.Volume);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
297 btnModify(evSetBalance, guiIntfStruct.Balance);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
298 btnModify(evSetMoviePosition, guiIntfStruct.Position);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
300 wsSetIcon(wsDisplay, appMPlayer.mainWindow.WindowID, guiIcon, guiIconMask);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
301 wsSetIcon(wsDisplay, appMPlayer.subWindow.WindowID, guiIcon, guiIconMask);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
302
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
303 guiIntfStruct.Playing = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
305 if (!appMPlayer.mainDecoration)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
306 wsWindowDecoration(&appMPlayer.mainWindow, 0);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
307
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
308 wsVisibleWindow(&appMPlayer.mainWindow, wsShowWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 #if 0
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
311 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
312 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
313 XEvent xev;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
315 do
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
316 XNextEvent(wsDisplay, &xev);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
317 while (xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID);
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 appMPlayer.subWindow.Mapped = wsMapped;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
320 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
321
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
322 if (!fullscreen)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
323 fullscreen = gtkLoadFullscreen;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
325 if (fullscreen) {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 mplFullScreen();
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
327 btnModify(evFullScreen, btnPressed);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
328 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
329 #else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
330 if (!fullscreen)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
331 fullscreen = gtkLoadFullscreen;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
332
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
333 if (gtkShowVideoWindow) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
334 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
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 XEvent xev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
337
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
338 do
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
339 XNextEvent(wsDisplay, &xev);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
340 while (xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
341
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
342 appMPlayer.subWindow.Mapped = wsMapped;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
343 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
345 if (fullscreen) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
346 mplFullScreen();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
347 btnModify(evFullScreen, btnPressed);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
348 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
349 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
350 if (fullscreen) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
351 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
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 XEvent xev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
354
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
355 do
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
356 XNextEvent(wsDisplay, &xev);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
357 while (xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID);
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 appMPlayer.subWindow.Mapped = wsMapped;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
360 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
361 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
362 mplFullScreen();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
363 btnModify(evFullScreen, btnPressed);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
364 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
365 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366 #endif
32984
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 mplSubRender = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
369
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
370 if (filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
371 mplSetFileName(NULL, filename, STREAMTYPE_FILE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
373 if (plCurrent && !filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
374 mplSetFileName(plCurrent->path, plCurrent->name, STREAMTYPE_FILE);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
375
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
376 if (subdata)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
377 guiSetFilename(guiIntfStruct.Subtitlename, subdata->filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
378
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
379 guiLoadFont();
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 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
384 mplMainRender = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
385
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
386 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] done.\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
388 if (gui_save_pos) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
389 gui_main_pos_x = appMPlayer.mainWindow.X;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
390 gui_main_pos_y = appMPlayer.mainWindow.Y;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
391 gui_sub_pos_x = appMPlayer.subWindow.X;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
392 gui_sub_pos_y = appMPlayer.subWindow.Y;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
393 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
394
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
395 #ifdef CONFIG_ASS
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
396 ass_enabled = gtkASS.enabled;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
397 ass_use_margins = gtkASS.use_margins;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
398 ass_top_margin = gtkASS.top_margin;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
399 ass_bottom_margin = gtkASS.bottom_margin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
400 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
402 cfg_write();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
403 wsXDone();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
406 void guiLoadFont(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 {
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27390
diff changeset
408 #ifdef CONFIG_FREETYPE
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
409 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
410 #else
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
411 if (vo_font) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
412 int i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
413
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
414 free(vo_font->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
415 free(vo_font->fpath);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
416
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
417 for (i = 0; i < 16; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
418 if (vo_font->pic_a[i]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
419 free(vo_font->pic_a[i]->bmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
420 free(vo_font->pic_a[i]->pal);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
421 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
422 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
423
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
424 for (i = 0; i < 16; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
425 if (vo_font->pic_b[i]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
426 free(vo_font->pic_b[i]->bmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
427 free(vo_font->pic_b[i]->pal);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
428 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
429 }
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 free(vo_font);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
432 vo_font = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
433 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
434
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
435 if (font_name) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
436 vo_font = read_font_desc(font_name, font_factor, 0);
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 if (!vo_font)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
439 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_CantLoadFont, font_name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
440 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
441 font_name = gstrdup(get_path("font/font.desc"));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
442 vo_font = read_font_desc(font_name, font_factor, 0);
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 if (!vo_font) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
445 gfree((void **)&font_name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
446 font_name = gstrdup(MPLAYER_DATADIR "/font/font.desc");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
447 vo_font = read_font_desc(font_name, font_factor, 0);
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 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
450 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
451 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
452
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
453 void guiLoadSubtitle(char *name)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
454 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
455 if (guiIntfStruct.Playing == 0) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
456 guiIntfStruct.SubtitleChanged = 1; // what is this for? (mw)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
457 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 }
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
459
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
460 if (subdata) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
461 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_DeletingSubtitles);
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 sub_free(subdata);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
464 subdata = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
465 vo_sub = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
466
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
467 if (vo_osd_list) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
468 int len;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
469 mp_osd_obj_t *osd;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
470
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
471 osd = vo_osd_list;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
472
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
473 while (osd) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
474 if (osd->type == OSDTYPE_SUBTITLE)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
475 break;
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 osd = osd->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
478 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
480 if (osd && (osd->flags & OSDFLAG_VISIBLE)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
481 len = osd->stride * (osd->bbox.y2 - osd->bbox.y1);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
482 memset(osd->bitmap_buffer, 0, len);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
483 memset(osd->alpha_buffer, 0, len);
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 }
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
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
488 if (name) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
489 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_LoadingSubtitles, name);
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 subdata = sub_read_file(name, guiIntfStruct.FPS);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
492
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
493 if (!subdata)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
494 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadSub, name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
495
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
496 sub_name = (malloc(2 * sizeof(char *))); // when mplayer will be restarted
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
497 sub_name[0] = strdup(name); // sub_name[0] will be read
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
498 sub_name[1] = NULL;
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 update_set_of_subtitles();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
503
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
504 static void add_vf(char *str)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
505 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
506 void *p;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
507
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
508 if (vf_settings) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
509 int i = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
510
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
511 while (vf_settings[i].name) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
512 if (!gstrcmp(vf_settings[i++].name, str)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
513 i = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
514 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
515 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
516 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
517
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
518 if (i != -1) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
519 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
520
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
521 if (!p)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
522 return;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
523
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
524 vf_settings = p;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
525 vf_settings[i].name = strdup(str);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
526 vf_settings[i].attribs = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
527 vf_settings[i + 1].name = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
528 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
529 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
530 vf_settings = malloc(2 * sizeof(m_obj_settings_t));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
531 vf_settings[0].name = strdup(str);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
532 vf_settings[0].attribs = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
533 vf_settings[1].name = NULL;
32712
6ff3cc81d602 Fix resource leaks and check for realloc failures
ib
parents: 32543
diff changeset
534 }
6ff3cc81d602 Fix resource leaks and check for realloc failures
ib
parents: 32543
diff changeset
535
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
536 mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_AddingVideoFilter, str);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
537 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
538
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
539 int guiGetEvent(int type, void *arg)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
540 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
541 const ao_functions_t *audio_out = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
542 const vo_functions_t *video_out = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
543 mixer_t *mixer = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
544
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
545 stream_t *stream = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
546
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
547 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
548 dvd_priv_t *dvdp = arg;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
549 #endif
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
551 if (guiIntfStruct.mpcontext) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
552 audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
553 video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
554 mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
555 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
557 switch (type) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
558 case guiXEvent:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
559 guiIntfStruct.event_struct = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
560 wsEvents(wsDisplay, arg, NULL);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
561 gtkEventHandling();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562 break;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
563
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
564 case guiCEvent:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
565
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
566 switch ((int)arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
567 case guiSetPlay:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
568 guiIntfStruct.Playing = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
569 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
570 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
571
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
572 case guiSetStop:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
573 guiIntfStruct.Playing = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
574 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
575 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
576
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
577 case guiSetPause:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
578 guiIntfStruct.Playing = 2;
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
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
582 mplState();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583 break;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
584
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
585 case guiSetState:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
586 mplState();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
587 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
588
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
589 case guiSetFileName:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
590 if (arg)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
591 guiSetFilename(guiIntfStruct.Filename, arg);
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 guiSetAudioOnly:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
595
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
596 guiIntfStruct.AudioOnly = (int)arg;
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 if ((int)arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
599 guiIntfStruct.NoWindow = True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
600 wsVisibleWindow(&appMPlayer.subWindow, wsHideWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
601 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
602 wsVisibleWindow(&appMPlayer.subWindow, wsShowWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
603
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
604 break;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
605
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
606 case guiSetContext:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
607 guiIntfStruct.mpcontext = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
608 // NOTE TO MYSELF: is break missing?
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
609
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
610 case guiSetDemuxer:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
611 guiIntfStruct.demuxer = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
612 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
613
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
614 case guiSetAfilter:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
615 guiIntfStruct.afilter = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
616 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
617
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
618 case guiSetShVideo:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
619
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
620 if (!appMPlayer.subWindow.isFullScreen) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
621 wsResizeWindow(&appMPlayer.subWindow, vo_dwidth, vo_dheight);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
622 wsMoveWindow(&appMPlayer.subWindow, True, appMPlayer.sub.x, appMPlayer.sub.y);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
623 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
624
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
625 guiIntfStruct.MovieWidth = vo_dwidth;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
626 guiIntfStruct.MovieHeight = vo_dheight;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
627
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
628 if (guiWinID >= 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
629 wsMoveWindow(&appMPlayer.mainWindow, 0, 0, vo_dheight);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
630
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
631 WinID = appMPlayer.subWindow.WindowID;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
632 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
633
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
634 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
635 case guiSetDVD:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
636 guiIntfStruct.DVD.titles = dvdp->vmg_file->tt_srpt->nr_of_srpts;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
637 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
638 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
639 guiIntfStruct.DVD.nr_of_audio_channels = dvdp->nr_of_channels;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
640 memcpy(guiIntfStruct.DVD.audio_streams, dvdp->audio_streams, sizeof(dvdp->audio_streams));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
641 guiIntfStruct.DVD.nr_of_subtitles = dvdp->nr_of_subtitles;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
642 memcpy(guiIntfStruct.DVD.subtitles, dvdp->subtitles, sizeof(dvdp->subtitles));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
643 guiIntfStruct.DVD.current_title = dvd_title + 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
644 guiIntfStruct.DVD.current_chapter = dvd_chapter + 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
645 guiIntfStruct.DVD.current_angle = dvd_angle + 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
646 guiIntfStruct.Track = dvd_title + 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
647 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
648 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
649
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
650 case guiSetStream:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
651
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
652 guiIntfStruct.StreamType = stream->type;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
653
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
654 switch (stream->type) {
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
655 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
656 case STREAMTYPE_DVD:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
657 guiGetEvent(guiSetDVD, (char *)stream->priv);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
658 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
659 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
660
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
661 #ifdef CONFIG_VCD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
662 case STREAMTYPE_VCD:
33006
66d908462d76 Initialize guiIntfStruct.VCDTracks.
ib
parents: 33005
diff changeset
663 guiIntfStruct.VCDTracks = 0;
66d908462d76 Initialize guiIntfStruct.VCDTracks.
ib
parents: 33005
diff changeset
664 stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiIntfStruct.VCDTracks);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
665 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
666 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
667
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
668 default:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
669 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
670 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
671
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
672 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
673
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
674 case guiIEvent:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
675
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
676 mp_msg(MSGT_GPLAYER, MSGL_V, "cmd: %d\n", (int)arg);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
677
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
678 switch ((int)arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
679 case MP_CMD_QUIT:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
680 mplEventHandling(evExit, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
681 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
682
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
683 case MP_CMD_VO_FULLSCREEN:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
684 mplEventHandling(evFullScreen, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
685 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
686 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
687
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
688 break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
689
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
690 case guiReDraw:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
691 mplEventHandling(evRedraw, 0);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
692 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
693
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
694 case guiSetVolume:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
695 if (audio_out) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
696 float l, r;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
697
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
698 mixer_getvolume(mixer, &l, &r);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
699 guiIntfStruct.Volume = (r > l ? r : l);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
700
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
701 if (r != l)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
702 guiIntfStruct.Balance = ((r - l) + 100) * 0.5f;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
703 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
704 guiIntfStruct.Balance = 50.0f;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
705
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
706 btnModify(evSetVolume, guiIntfStruct.Volume);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
707 btnModify(evSetBalance, guiIntfStruct.Balance);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
708 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
709 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
710
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
711 case guiSetFileFormat:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
712 guiIntfStruct.FileFormat = (int)arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
713 break;
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 case guiSetValues:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
716
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
717 // video
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
718
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
719 guiIntfStruct.sh_video = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
720
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
721 if (arg) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
722 sh_video_t *sh = arg;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
723 guiIntfStruct.FPS = sh->fps;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
724 }
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 if (guiIntfStruct.NoWindow)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
727 wsVisibleWindow(&appMPlayer.subWindow, wsHideWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
728
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
729 if (guiIntfStruct.StreamType == STREAMTYPE_STREAM)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
730 btnSet(evSetMoviePosition, btnDisabled);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
731 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
732 btnSet(evSetMoviePosition, btnReleased);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
733
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
734 // audio
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
735
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
736 if (audio_out) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
737 float l, r;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
738
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
739 mixer_getvolume(mixer, &l, &r);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
740 guiIntfStruct.Volume = (r > l ? r : l);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
741
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
742 if (r != l)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
743 guiIntfStruct.Balance = ((r - l) + 100) * 0.5f;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
744 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
745 guiIntfStruct.Balance = 50.0f;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
746
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
747 btnModify(evSetVolume, guiIntfStruct.Volume);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
748 btnModify(evSetBalance, guiIntfStruct.Balance);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
749 }
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 (gtkEnableAudioEqualizer) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
752 equalizer_t eq;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
753 int i, j;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
754
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
755 for (i = 0; i < 6; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
756 for (j = 0; j < 10; j++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
757 eq.channel = i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
758 eq.band = j;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
759 eq.gain = gtkEquChannels[i][j];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
760 gtkSet(gtkSetEqualizer, 0, &eq);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
761 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
762 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
763 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
764
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
765 // subtitle
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
766
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
767 #ifdef CONFIG_DXR3
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
768 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
769 gtkMessageBox(GTK_MB_FATAL, MSGTR_NEEDLAVC);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
770 guiIntfStruct.Playing = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
771 return True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
772 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
773 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
774
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
775 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
776
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
777 case guiSetDefaults:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
778
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
779 // if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
780 if (guiIntfStruct.FilenameChanged) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
781 audio_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
782 video_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
783 dvdsub_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
784 vobsub_id = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
785 stream_cache_size = -1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
786 autosync = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
787 dvd_title = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
788 force_fps = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
789 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
790
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
791 guiIntfStruct.demuxer = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
792 guiIntfStruct.sh_video = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
793 wsPostRedisplay(&appMPlayer.subWindow);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
794
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
795 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
796
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
797 case guiSetParameters:
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 guiGetEvent(guiSetDefaults, NULL);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
800
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
801 switch (guiIntfStruct.StreamType) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
802 case STREAMTYPE_PLAYLIST:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
803 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
804
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
805 #ifdef CONFIG_VCD
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
806 case STREAMTYPE_VCD:
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 char tmp[512];
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 sprintf(tmp, "vcd://%d", guiIntfStruct.Track + 1);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
811 guiSetFilename(guiIntfStruct.Filename, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
812 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
813 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
814 #endif
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
815
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
816 #ifdef CONFIG_DVDREAD
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
817 case STREAMTYPE_DVD:
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 char tmp[512];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
820
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
821 sprintf(tmp, "dvd://%d", guiIntfStruct.Title);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
822 guiSetFilename(guiIntfStruct.Filename, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
823 }
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 dvd_chapter = guiIntfStruct.Chapter;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
826 dvd_angle = guiIntfStruct.Angle;
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 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
829 #endif
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
830 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
831
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
832 // if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore!
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 if (guiIntfStruct.Filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
835 filename = gstrdup(guiIntfStruct.Filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
836 else if (filename)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
837 guiSetFilename(guiIntfStruct.Filename, filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
838 }
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 // video opts
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
841
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
842 if (!video_driver_list) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
843 int i = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
844
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
845 while (video_out_drivers[i++]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
846 if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
847 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
848 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
849 }
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 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
852
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
853 if (!video_driver_list && !video_driver_list[0]) {
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 33023
diff changeset
854 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_IDFGCVD);
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
855 exit_player(EXIT_ERROR);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
856 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
857
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 int i = 0;
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 guiIntfStruct.NoWindow = False;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
862
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
863 while (video_out_drivers[i++]) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
864 if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
865 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
866 guiIntfStruct.NoWindow = True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
867 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
868 }
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 }
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
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
873 #ifdef CONFIG_DXR3
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
874 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3"))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
875 if (guiIntfStruct.StreamType != STREAMTYPE_DVD && guiIntfStruct.StreamType != STREAMTYPE_VCD)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
876 if (gtkVfLAVC)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
877 add_vf("lavc");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
878 #endif
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 if (gtkVfPP)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
881 add_vf("pp");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
882
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
883 // audio opts
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
884
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
885 // 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
886 if (gtkAONorm)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
887 greplace(&af_cfg.list, "volnorm", "volnorm");
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 (gtkEnableAudioEqualizer)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
890 greplace(&af_cfg.list, "equalizer", "equalizer");
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 if (gtkAOExtraStereo) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
893 char *name;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
894
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
895 name = malloc(12 + 20 + 1);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
896 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
897 name[12 + 20] = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
898 greplace(&af_cfg.list, "extrastereo", name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
899 free(name);
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
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
902 #ifdef CONFIG_OSS_AUDIO
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
903 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "oss", 3)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
904 char *tmp;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
905
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
906 mixer_device = gtkAOOSSMixer;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
907 mixer_channel = gtkAOOSSMixerChannel;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
908
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
909 if (gtkAOOSSDevice) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
910 tmp = calloc(1, strlen(gtkAOOSSDevice) + 7);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
911 sprintf(tmp, "oss:%s", gtkAOOSSDevice);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
912 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
913 tmp = strdup("oss");
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 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
916 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
917 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
918 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
919
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27387
diff changeset
920 #ifdef CONFIG_ALSA
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
921 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "alsa", 4)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
922 char *tmp;
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 mixer_device = gtkAOALSAMixer;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
925 mixer_channel = gtkAOALSAMixerChannel;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
926
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
927 if (gtkAOALSADevice) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
928 tmp = calloc(1, strlen(gtkAOALSADevice) + 14);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
929 sprintf(tmp, "alsa:device=%s", gtkAOALSADevice);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
930 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
931 tmp = strdup("alsa");
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 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
934 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
935 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
936 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
937
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
938 #ifdef CONFIG_SDL
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
939 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "sdl", 3)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
940 char *tmp;
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 if (gtkAOSDLDriver) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
943 tmp = calloc(1, strlen(gtkAOSDLDriver) + 10);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
944 sprintf(tmp, "sdl:%s", gtkAOSDLDriver);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
945 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
946 tmp = strdup("sdl");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
947
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
948 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
949 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
950 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
951 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
952
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
953 #ifdef CONFIG_ESD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
954 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "esd", 3)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
955 char *tmp;
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 if (gtkAOESDDevice) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
958 tmp = calloc(1, strlen(gtkAOESDDevice) + 10);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
959 sprintf(tmp, "esd:%s", gtkAOESDDevice);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
960 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
961 tmp = strdup("esd");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
962
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
963 gaddlist(&audio_driver_list, tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
964 free(tmp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
965 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
966 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
967
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
968 // subtitle
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
969
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
970 // subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
971 stream_dump_type = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
972
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
973 if (gtkSubDumpMPSub)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
974 stream_dump_type = 4;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
975
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
976 if (gtkSubDumpSrt)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
977 stream_dump_type = 6;
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 gtkSubDumpMPSub = gtkSubDumpSrt = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
980 guiLoadFont();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
981
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
982 // misc
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
983
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
984 if (gtkCacheOn)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
985 stream_cache_size = gtkCacheSize;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
986
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
987 if (gtkAutoSyncOn)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
988 autosync = gtkAutoSync;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
989
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
990 if (guiIntfStruct.AudioFile)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
991 audio_stream = gstrdup(guiIntfStruct.AudioFile);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
992 else if (guiIntfStruct.FilenameChanged)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
993 gfree((void **)&audio_stream);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
994
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
995 // audio_stream = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
996
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
997 guiIntfStruct.DiskChanged = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
998 guiIntfStruct.FilenameChanged = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
999 guiIntfStruct.NewPlay = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1000
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
1001 #ifdef CONFIG_ASS
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1002 ass_enabled = gtkASS.enabled;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1003 ass_use_margins = gtkASS.use_margins;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1004 ass_top_margin = gtkASS.top_margin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1005 ass_bottom_margin = gtkASS.bottom_margin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1006 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1007
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1008 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1009 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1010
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1011 return False;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1012 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1013
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1014 void guiEventHandling(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1015 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1016 if (!guiIntfStruct.Playing || guiIntfStruct.NoWindow)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1017 wsHandleEvents();
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 gtkEventHandling();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1020 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1021
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1022 // ---
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1023 #if defined(MP_DEBUG) && 0
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1024 void list(void)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1025 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1026 plItem *next = plList;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1027
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1028 printf("--- list ---\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1029
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1030 while (next || next->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1031 printf("item: %s/%s\n", next->path, next->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1032
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1033 if (next->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1034 next = next->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1035 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1036 break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1037 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1038
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1039 printf("--- end of list ---\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1040 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1041 #else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1042 #define list();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1043 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1044
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1045 void *gtkSet(int cmd, float fparam, void *vparam)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1046 {
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1047 equalizer_t *eq = (equalizer_t *)vparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1048 plItem *item = (plItem *)vparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1049 URLItem *url_item = (URLItem *)vparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1050 int is_added = True;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1051
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1052 switch (cmd) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1053 // handle playlist
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1054
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1055 // add item to playlist
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1056 case gtkAddPlItem:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1057
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1058 if (plList) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1059 plItem *next = plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1060
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1061 while (next->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1062 // {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1063 // printf( "%s\n",next->name );
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1064 next = next->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1065 // }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1066
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1067 next->next = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1068 item->prev = next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1069 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1070 item->prev = item->next = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1071 plCurrent = plList = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1072 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1073
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1074 list();
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1075
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1076 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1077
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1078 // add item into playlist after current
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1079 case gtkInsertPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1080 if (plCurrent) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1081 plItem *curr = plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1082 item->next = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1083
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1084 if (item->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1085 item->next->prev = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1086
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1087 item->prev = curr;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1088 curr->next = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1089 plCurrent = plCurrent->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1090
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1091 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1092 } else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1093 return gtkSet(gtkAddPlItem, 0, (void *)item);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1094 return NULL; // NOTE TO MYSELF: remove this
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1095
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1096 // get current item from playlist
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1097 case gtkGetNextPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1098 if (plCurrent && plCurrent->next) {
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 // if (!plCurrent && plList)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1101 // {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1102 // plItem *next = plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1103 //
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1104 // while (next->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1105 // {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1106 // if (!next->next) break;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1107 // next = next->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1108 // }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1109 //
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1110 // plCurrent = next;
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 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1113 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1114
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1115 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1116
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1117 case gtkGetPrevPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1118 if (plCurrent && plCurrent->prev) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1119 plCurrent = plCurrent->prev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1120 // if ( !plCurrent && plList ) plCurrent=plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1121 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1122 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1123
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1124 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1125
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1126 // set current item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1127 case gtkSetCurrPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1128 plCurrent = item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1129 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1130
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1131 // get current item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1132 case gtkGetCurrPlItem:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1133 return plCurrent;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1134
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1135 // delete current item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1136 case gtkDelCurrPlItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1137 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1138 plItem *curr = plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1139
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1140 if (!curr)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1141 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1142
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1143 if (curr->prev)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1144 curr->prev->next = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1145 if (curr->next)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1146 curr->next->prev = curr->prev;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1147 if (curr == plList)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1148 plList = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1149
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1150 plCurrent = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1151
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1152 // free it
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1153 free(curr->path);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1154 free(curr->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1155 free(curr);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1156 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1157
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1158 mplCurr(); // instead of using mplNext && mplPrev
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1159
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1160 return plCurrent;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1161
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1162 // delete list
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1163 case gtkDelPl:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1164 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1165 plItem *curr = plList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1166 plItem *next;
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 if (!plList)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1169 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1170
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1171 if (!curr->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1172 free(curr->path);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1173 free(curr->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1174 free(curr);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1175 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1176 while (curr->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1177 next = curr->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1178 free(curr->path);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1179 free(curr->name);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1180 free(curr);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1181 curr = next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1182 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1183 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1184
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1185 plList = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1186 plCurrent = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1187 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1188
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1189 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1190
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1191 // handle url
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1192 case gtkAddURLItem:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1193 if (URLList) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1194 URLItem *next_url = URLList;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1195 is_added = False;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1196
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1197 while (next_url->next) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1198 if (!gstrcmp(next_url->url, url_item->url)) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1199 is_added = True;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1200 break;
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
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1203 next_url = next_url->next;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1204 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1205
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1206 if (!is_added && gstrcmp(next_url->url, url_item->url))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1207 next_url->next = url_item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1208 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1209 url_item->next = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1210 URLList = url_item;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1211 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1212
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1213 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1214
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1215 // subtitle
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1216
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27390
diff changeset
1217 #ifndef CONFIG_FREETYPE
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1218 case gtkSetFontFactor:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1219 font_factor = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1220 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1221 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1222 #else
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1223 case gtkSetFontOutLine:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1224 subtitle_font_thickness = (8.0f / 100.0f) * fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1225 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1226 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1227
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1228 case gtkSetFontBlur:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1229 subtitle_font_radius = (8.0f / 100.0f) * fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1230 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1231 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1232
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1233 case gtkSetFontTextScale:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1234 text_font_scale_factor = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1235 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1236 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1237
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1238 case gtkSetFontOSDScale:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1239 osd_font_scale_factor = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1240 guiLoadFont();
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1241 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1242
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1243 case gtkSetFontEncoding:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1244 gfree((void **)&subtitle_font_encoding);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1245 subtitle_font_encoding = gstrdup((char *)vparam);
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 gtkSetFontAutoScale:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1250 subtitle_autoscale = (int)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;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1253 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1254
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27390
diff changeset
1255 #ifdef CONFIG_ICONV
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1256 case gtkSetSubEncoding:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1257 gfree((void **)&sub_cp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1258 sub_cp = gstrdup((char *)vparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1259 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1260 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1261
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1262 // misc
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1263
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1264 case gtkClearStruct:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1265
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1266 if ((unsigned int)vparam & guiFilenames) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1267 gfree((void **)&guiIntfStruct.Filename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1268 gfree((void **)&guiIntfStruct.Subtitlename);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1269 gfree((void **)&guiIntfStruct.AudioFile);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1270 gtkSet(gtkDelPl, 0, NULL);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1271 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1272
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
1273 #ifdef CONFIG_DVDREAD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1274 if ((unsigned int)vparam & guiDVD)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1275 memset(&guiIntfStruct.DVD, 0, sizeof(guiDVDStruct));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1276 #endif
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1277
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
1278 #ifdef CONFIG_VCD
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1279 if ((unsigned int)vparam & guiVCD)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1280 guiIntfStruct.VCDTracks = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1281 #endif
32984
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 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1284
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1285 case gtkSetExtraStereo:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1286 gtkAOExtraStereoMul = fparam;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1287 if (guiIntfStruct.afilter)
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1288 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
1289 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1290
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1291 case gtkSetPanscan:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1292 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1293 mp_cmd_t *mp_cmd;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1294
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1295 mp_cmd = calloc(1, sizeof(*mp_cmd));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1296 mp_cmd->id = MP_CMD_PANSCAN;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1297 mp_cmd->name = strdup("panscan");
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1298 mp_cmd->args[0].v.f = fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1299 mp_cmd->args[1].v.i = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1300 mp_input_queue_cmd(mp_cmd);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1301 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33025
diff changeset
1302
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1303 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1304
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1305 case gtkSetAutoq:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1306 auto_quality = (int)fparam;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1307 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1308
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1309 // set equalizers
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1310
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1311 case gtkSetContrast:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1312 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1313 set_video_colors(guiIntfStruct.sh_video, "contrast", (int)fparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1314 return NULL;
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 gtkSetBrightness:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1317 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1318 set_video_colors(guiIntfStruct.sh_video, "brightness", (int)fparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1319 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1320
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1321 case gtkSetHue:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1322 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1323 set_video_colors(guiIntfStruct.sh_video, "hue", (int)fparam);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1324 return NULL;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1325
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1326 case gtkSetSaturation:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1327 if (guiIntfStruct.sh_video)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1328 set_video_colors(guiIntfStruct.sh_video, "saturation", (int)fparam);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1329 return NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1330
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1331 case gtkSetEqualizer:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1332 {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1333 af_control_ext_t tmp;
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1334
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1335 if (eq) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1336 gtkEquChannels[eq->channel][eq->band] = eq->gain;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1337 tmp.ch = eq->channel;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1338 tmp.arg = gtkEquChannels[eq->channel];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1339
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1340 if (guiIntfStruct.afilter)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1341 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
1342 } else {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1343 int i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1344
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1345 memset(gtkEquChannels, 0, sizeof(gtkEquChannels));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1346
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1347 if (guiIntfStruct.afilter) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1348 for (i = 0; i < 6; i++) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1349 tmp.ch = i;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1350 tmp.arg = gtkEquChannels[i];
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1351 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
1352 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1353 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1354 }
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 return NULL;
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 }
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1359
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1360 return NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1361 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1362
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1363 // This function adds/inserts one file into the gui playlist.
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1364 static int import_file_into_gui(char *temp, int insert)
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 char *filename, *pathname;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1367 plItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1368
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1369 filename = strdup(mp_basename(temp));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1370 pathname = strdup(temp);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1371
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1372 if (strlen(pathname) - strlen(filename) > 0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1373 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
1374 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1375 pathname[strlen(pathname) - strlen(filename)] = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1376
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1377 // NOTE TO MYSELF: FIXME: Change to MSGL_DBG2?
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1378 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
1379
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1380 item = calloc(1, sizeof(plItem));
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1381
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1382 if (!item)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1383 return 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1384
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1385 item->name = filename;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1386 item->path = pathname;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1387
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1388 if (insert)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1389 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
1390 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1391 gtkSet(gtkAddPlItem, 0, (void *)item);
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 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1394 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1395
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1396 // This function imports the initial playtree (based on cmd-line files)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1397 // into the gui playlist by either:
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1398 // - overwriting gui pl (enqueue=0)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1399 // - appending it to gui pl (enqueue=1)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1400 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
1401 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1402 play_tree_iter_t *my_pt_iter = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1403 int result = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1404
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1405 if (!enqueue)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1406 gtkSet(gtkDelPl, 0, 0); // delete playlist before "appending"
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1407
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1408 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1409 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1410 // add it to end of list
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1411 if (import_file_into_gui(filename, 0))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1412 result = 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1413 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1414
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1415 mplCurr(); // update filename
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1416 mplGotoTheNext = 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1417
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1418 if (!enqueue)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1419 filename = guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline,
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1420 // gmplayer does directly start in Play-Mode.
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1421 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1422 filename = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1423
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1424 return result;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1425 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1426
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1427 // 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
1428 // 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
1429 // with "File Open".
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1430 // 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
1431 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
1432 {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1433 play_tree_iter_t *my_pt_iter = NULL;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1434 int result = 0;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1435 plItem *save;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1436
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1437 save = (plItem *)gtkSet(gtkGetCurrPlItem, 0, 0); // save current item
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1438
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1439 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) {
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1440 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1441 // insert it into the list and set plCurrent=new item
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1442 if (import_file_into_gui(filename, 1))
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1443 result = 1;
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1444
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1445 pt_iter_destroy(&my_pt_iter);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1446 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1447
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1448 if (save)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1449 gtkSet(gtkSetCurrPlItem, 0, (void *)save);
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1450 else
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1451 gtkSet(gtkSetCurrPlItem, 0, (void *)plList); // go to head, if plList was empty before
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1452
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1453 if (save && result)
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1454 gtkSet(gtkDelCurrPlItem, 0, 0);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1455
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1456 mplCurr(); // update filename
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1457 filename = NULL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27393
diff changeset
1458
32984
eb831a979df7 Cosmetic: Format to MPlayer coding style.
ib
parents: 32978
diff changeset
1459 return result;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1460 }
33023
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1461
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1462 // NOTE TO MYSELF: This function is nonsense.
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1463 // MPlayer should pass messages to the GUI
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1464 // which must decide then which message has
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1465 // to be shown (MSGL_FATAL, for example).
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1466 // But with this function it is at least
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1467 // possible to show GUI's very critical or
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1468 // abort messages.
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1469 void gmp_msg(int mod, int lev, const char *format, ...)
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1470 {
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1471 char msg[512];
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1472 va_list va;
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1473
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1474 va_start(va, format);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1475 vsnprintf(msg, sizeof(msg), format, va);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1476 va_end(va);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1477
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1478 mp_msg(mod, lev, msg);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1479
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1480 if (mp_msg_test(mod, lev))
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1481 gtkMessageBox(GTK_MB_FATAL, msg);
ba432e34dc7e Add message showing function.
ib
parents: 33006
diff changeset
1482 }