Mercurial > mplayer.hg
annotate gui/interface.c @ 33743:99562e7c8b27
Cosmetic: Rename remaining part of gtkSet() mplayer().
This is the GUI -> MPlayer part of the interface.
author | ib |
---|---|
date | Thu, 07 Jul 2011 12:02:20 +0000 |
parents | e1539e14d60f |
children | 8497620cefca |
rev | line source |
---|---|
26458 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
23077 | 18 |
19 #include <stdlib.h> | |
20 #include <string.h> | |
21 | |
32984 | 22 #include "interface.h" |
23 #include "app.h" | |
24 #include "skin/skin.h" | |
33556 | 25 #include "ui/gmplayer.h" |
26 #include "ui/widgets.h" | |
33741 | 27 #include "util/list.h" |
33739 | 28 #include "util/mem.h" |
33737 | 29 #include "util/string.h" |
23077 | 30 #include "wm/ws.h" |
31 #include "wm/wsxdnd.h" | |
32 | |
33 #include "access_mpcontext.h" | |
32984 | 34 #include "config.h" |
23077 | 35 #include "help_mp.h" |
32984 | 36 #include "input/input.h" |
37 #include "libaf/equalizer.h" | |
33689
8d0290220239
Replace numeric constants for gtkEquChannels array size.
ib
parents:
33688
diff
changeset
|
38 #include "libavutil/common.h" |
32984 | 39 #include "libmpcodecs/dec_audio.h" |
40 #include "libmpcodecs/dec_video.h" | |
41 #include "libmpcodecs/vd.h" | |
42 #include "libmpcodecs/vf.h" | |
33398 | 43 #include "libvo/video_out.h" |
32984 | 44 #include "libvo/x11_common.h" |
45 #include "mixer.h" | |
46 #include "mp_msg.h" | |
32032 | 47 #include "mpcommon.h" |
30536
39a4dd7ec420
Move GUI-related extern declarations to a GUI header file.
diego
parents:
30535
diff
changeset
|
48 #include "mplayer.h" |
32984 | 49 #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
|
50 #include "sub/font_load.h" |
32467 | 51 #include "sub/sub.h" |
23077 | 52 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
53 #ifdef CONFIG_DVDREAD |
23077 | 54 #include "stream/stream_dvd.h" |
55 #endif | |
56 | |
33662 | 57 guiInterface_t guiInfo = { |
33664 | 58 .StreamType = STREAMTYPE_DUMMY, |
33663 | 59 .MovieWindow = True, |
33664 | 60 .Balance = 50.0f |
33662 | 61 }; |
23077 | 62 |
32984 | 63 int guiWinID = -1; |
23077 | 64 |
32900 | 65 char *skinName; |
66 char *skinDirInHome; | |
67 char *skinMPlayerDir; | |
68 | |
32984 | 69 char *fsHistory[fsPersistant_MaxPos] = { NULL, NULL, NULL, NULL, NULL }; |
70 | |
71 float gtkEquChannels[6][10]; | |
72 | |
33265 | 73 static int initialized; |
74 | |
32984 | 75 void guiInit(void) |
23077 | 76 { |
32984 | 77 int i; |
23077 | 78 |
33530 | 79 mp_msg(MSGT_GPLAYER, MSGL_V, "GUI init.\n"); |
80 | |
32984 | 81 #ifdef CONFIG_DXR3 |
82 if (!gtkDXR3Device) | |
83 gtkDXR3Device = strdup("/dev/em8300-0"); | |
84 #endif | |
32927 | 85 |
32984 | 86 if (stream_cache_size > 0) { |
87 gtkCacheOn = 1; | |
88 gtkCacheSize = stream_cache_size; | |
89 } else if (stream_cache_size == 0) | |
90 gtkCacheOn = 0; | |
91 | |
92 if (autosync && (autosync != gtkAutoSync)) { | |
93 gtkAutoSyncOn = 1; | |
94 gtkAutoSync = autosync; | |
95 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
96 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
97 #ifdef CONFIG_ASS |
32984 | 98 gtkASS.enabled = ass_enabled; |
99 gtkASS.use_margins = ass_use_margins; | |
100 gtkASS.top_margin = ass_top_margin; | |
101 gtkASS.bottom_margin = ass_bottom_margin; | |
23077 | 102 #endif |
103 | |
32984 | 104 gtkInit(); |
105 | |
106 // initialize X | |
33463 | 107 wsXInit(mDisplay); |
32984 | 108 |
109 // load skin | |
110 | |
111 skinDirInHome = get_path("skins"); | |
112 skinMPlayerDir = MPLAYER_DATADIR "/skins"; | |
113 | |
33530 | 114 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #1: %s\n", skinDirInHome); |
115 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #2: %s\n", skinMPlayerDir); | |
32984 | 116 |
117 if (!skinName) | |
118 skinName = strdup("default"); | |
119 | |
120 i = skinRead(skinName); | |
121 | |
122 if (i == -1 && strcmp(skinName, "default") != 0) { | |
123 mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName); | |
124 | |
125 skinName = strdup("default"); | |
126 i = skinRead(skinName); | |
127 } | |
128 | |
129 switch (i) { | |
130 case -1: | |
33024 | 131 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinNotFound, skinName); |
33263 | 132 guiExit(EXIT_ERROR); |
23077 | 133 |
32984 | 134 case -2: |
33025 | 135 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinCfgError, skinName); |
33263 | 136 guiExit(EXIT_ERROR); |
32984 | 137 } |
138 | |
139 // initialize windows | |
140 | |
33555 | 141 mainDrawBuffer = malloc(guiApp.main.Bitmap.ImageSize); |
32984 | 142 |
33555 | 143 if (!mainDrawBuffer) { |
33024 | 144 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB); |
33263 | 145 guiExit(EXIT_ERROR); |
32984 | 146 } |
23077 | 147 |
32984 | 148 if (gui_save_pos) { |
33218
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33053
diff
changeset
|
149 if (gui_main_pos_x != -3) |
33555 | 150 guiApp.main.x = gui_main_pos_x; |
33218
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33053
diff
changeset
|
151 if (gui_main_pos_y != -3) |
33555 | 152 guiApp.main.y = gui_main_pos_y; |
33218
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33053
diff
changeset
|
153 if (gui_sub_pos_x != -3) |
33555 | 154 guiApp.sub.x = gui_sub_pos_x; |
33218
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33053
diff
changeset
|
155 if (gui_sub_pos_y != -3) |
33555 | 156 guiApp.sub.y = gui_sub_pos_y; |
32984 | 157 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
158 |
32984 | 159 if (WinID > 0) { |
33555 | 160 guiApp.subWindow.Parent = WinID; |
161 guiApp.sub.x = 0; | |
162 guiApp.sub.y = 0; | |
32984 | 163 } |
23077 | 164 |
32984 | 165 if (guiWinID >= 0) |
33555 | 166 guiApp.mainWindow.Parent = guiWinID; |
23077 | 167 |
33555 | 168 wsCreateWindow(&guiApp.subWindow, guiApp.sub.x, guiApp.sub.y, guiApp.sub.width, guiApp.sub.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsHideWindow, "MPlayer - Video"); |
169 wsDestroyImage(&guiApp.subWindow); | |
170 wsCreateImage(&guiApp.subWindow, guiApp.sub.Bitmap.Width, guiApp.sub.Bitmap.Height); | |
171 wsXDNDMakeAwareness(&guiApp.subWindow); | |
32984 | 172 |
33555 | 173 uiMenuInit(); |
174 uiPlaybarInit(); | |
23077 | 175 |
176 // i=wsHideFrame|wsMaxSize|wsHideWindow; | |
33555 | 177 // if ( guiApp.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; |
32984 | 178 i = wsShowFrame | wsMaxSize | wsHideWindow; |
33555 | 179 wsCreateWindow(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, i, "MPlayer"); |
180 wsSetShape(&guiApp.mainWindow, guiApp.main.Mask.Image); | |
181 wsXDNDMakeAwareness(&guiApp.mainWindow); | |
23077 | 182 |
33530 | 183 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] screen depth: %d\n", wsDepthOnScreen); |
33555 | 184 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] mainWindow ID: 0x%x\n", (int)guiApp.mainWindow.WindowID); |
185 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] subWindow ID: 0x%x\n", (int)guiApp.subWindow.WindowID); | |
23077 | 186 |
33555 | 187 guiApp.mainWindow.ReDraw = (void *)uiMainDraw; |
188 guiApp.mainWindow.MouseHandler = uiMainMouseHandle; | |
189 guiApp.mainWindow.KeyHandler = uiMainKeyHandle; | |
190 guiApp.mainWindow.DandDHandler = uiDandDHandler; | |
32984 | 191 |
33555 | 192 guiApp.subWindow.ReDraw = (void *)uiSubDraw; |
193 guiApp.subWindow.MouseHandler = uiSubMouseHandle; | |
194 guiApp.subWindow.KeyHandler = uiMainKeyHandle; | |
195 guiApp.subWindow.DandDHandler = uiDandDHandler; | |
23077 | 196 |
33555 | 197 wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B); |
198 wsClearWindow(guiApp.subWindow); | |
23077 | 199 |
33555 | 200 if (guiApp.sub.Bitmap.Image) |
201 wsConvert(&guiApp.subWindow, guiApp.sub.Bitmap.Image); | |
32984 | 202 |
33555 | 203 btnModify(evSetVolume, guiInfo.Volume); |
204 btnModify(evSetBalance, guiInfo.Balance); | |
205 btnModify(evSetMoviePosition, guiInfo.Position); | |
23077 | 206 |
33555 | 207 wsSetIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon); |
208 wsSetIcon(wsDisplay, guiApp.subWindow.WindowID, &guiIcon); | |
32984 | 209 |
33555 | 210 if (!guiApp.mainDecoration) |
211 wsWindowDecoration(&guiApp.mainWindow, 0); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
212 |
33555 | 213 wsVisibleWindow(&guiApp.mainWindow, wsShowWindow); |
23077 | 214 |
215 #if 0 | |
33555 | 216 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); |
32984 | 217 { |
218 XEvent xev; | |
23077 | 219 |
32984 | 220 do |
221 XNextEvent(wsDisplay, &xev); | |
33555 | 222 while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); |
32984 | 223 |
33555 | 224 guiApp.subWindow.Mapped = wsMapped; |
32984 | 225 } |
226 | |
227 if (!fullscreen) | |
228 fullscreen = gtkLoadFullscreen; | |
23077 | 229 |
32984 | 230 if (fullscreen) { |
33555 | 231 uiFullScreen(); |
32984 | 232 btnModify(evFullScreen, btnPressed); |
233 } | |
234 #else | |
235 if (!fullscreen) | |
236 fullscreen = gtkLoadFullscreen; | |
237 | |
238 if (gtkShowVideoWindow) { | |
33555 | 239 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); |
32984 | 240 { |
241 XEvent xev; | |
242 | |
243 do | |
244 XNextEvent(wsDisplay, &xev); | |
33555 | 245 while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); |
32984 | 246 |
33555 | 247 guiApp.subWindow.Mapped = wsMapped; |
32984 | 248 } |
23077 | 249 |
32984 | 250 if (fullscreen) { |
33555 | 251 uiFullScreen(); |
32984 | 252 btnModify(evFullScreen, btnPressed); |
253 } | |
254 } else { | |
255 if (fullscreen) { | |
33555 | 256 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); |
32984 | 257 { |
258 XEvent xev; | |
259 | |
260 do | |
261 XNextEvent(wsDisplay, &xev); | |
33555 | 262 while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); |
32984 | 263 |
33555 | 264 guiApp.subWindow.Mapped = wsMapped; |
32984 | 265 } |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
266 guiInfo.Playing = GUI_PAUSE; // because of !gtkShowVideoWindow... |
33630 | 267 uiFullScreen(); // ...guiInfo.Playing is required |
33609 | 268 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); |
32984 | 269 btnModify(evFullScreen, btnPressed); |
270 } | |
271 } | |
23077 | 272 #endif |
32984 | 273 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
274 guiInfo.Playing = GUI_STOP; |
33609 | 275 |
33555 | 276 uiSubRender = 1; |
32984 | 277 |
278 if (plCurrent && !filename) | |
33555 | 279 uiSetFileName(plCurrent->path, plCurrent->name, STREAMTYPE_FILE); |
32984 | 280 |
281 if (subdata) | |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
282 setdup(&guiInfo.Subtitlename, subdata->filename); |
32984 | 283 |
284 guiLoadFont(); | |
33265 | 285 |
286 initialized = 1; | |
23077 | 287 } |
288 | |
32984 | 289 void guiDone(void) |
23077 | 290 { |
33307 | 291 if (initialized) { |
33555 | 292 uiMainRender = 0; |
32984 | 293 |
33308 | 294 if (gui_save_pos) { |
33555 | 295 gui_main_pos_x = guiApp.mainWindow.X; |
296 gui_main_pos_y = guiApp.mainWindow.Y; | |
297 gui_sub_pos_x = guiApp.subWindow.X; | |
298 gui_sub_pos_y = guiApp.subWindow.Y; | |
33308 | 299 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
300 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
301 #ifdef CONFIG_ASS |
33308 | 302 ass_enabled = gtkASS.enabled; |
303 ass_use_margins = gtkASS.use_margins; | |
304 ass_top_margin = gtkASS.top_margin; | |
305 ass_bottom_margin = gtkASS.bottom_margin; | |
23077 | 306 #endif |
307 | |
33308 | 308 cfg_write(); |
309 wsXDone(); | |
33307 | 310 } |
33263 | 311 |
33307 | 312 appFreeStruct(); |
33542 | 313 free(guiIcon.collection); |
33307 | 314 |
315 if (gui_conf) { | |
316 m_config_free(gui_conf); | |
317 gui_conf = NULL; | |
318 } | |
33530 | 319 |
320 mp_msg(MSGT_GPLAYER, MSGL_V, "GUI done.\n"); | |
33263 | 321 } |
322 | |
33309 | 323 void guiExit(enum exit_reason how) |
33263 | 324 { |
33307 | 325 exit_player_with_rc(how, how >= EXIT_ERROR); |
23077 | 326 } |
327 | |
32984 | 328 void guiLoadFont(void) |
23077 | 329 { |
27393 | 330 #ifdef CONFIG_FREETYPE |
32984 | 331 load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name, osd_font_scale_factor); |
23077 | 332 #else |
32984 | 333 if (vo_font) { |
334 int i; | |
335 | |
336 free(vo_font->name); | |
337 free(vo_font->fpath); | |
338 | |
339 for (i = 0; i < 16; i++) { | |
340 if (vo_font->pic_a[i]) { | |
341 free(vo_font->pic_a[i]->bmp); | |
342 free(vo_font->pic_a[i]->pal); | |
343 } | |
344 } | |
345 | |
346 for (i = 0; i < 16; i++) { | |
347 if (vo_font->pic_b[i]) { | |
348 free(vo_font->pic_b[i]->bmp); | |
349 free(vo_font->pic_b[i]->pal); | |
350 } | |
351 } | |
352 | |
353 free(vo_font); | |
354 vo_font = NULL; | |
355 } | |
356 | |
357 if (font_name) { | |
358 vo_font = read_font_desc(font_name, font_factor, 0); | |
359 | |
360 if (!vo_font) | |
33530 | 361 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadFont, font_name); |
32984 | 362 } else { |
363 font_name = gstrdup(get_path("font/font.desc")); | |
364 vo_font = read_font_desc(font_name, font_factor, 0); | |
365 | |
366 if (!vo_font) { | |
33739 | 367 nfree(font_name); |
32984 | 368 font_name = gstrdup(MPLAYER_DATADIR "/font/font.desc"); |
369 vo_font = read_font_desc(font_name, font_factor, 0); | |
370 } | |
371 } | |
23077 | 372 #endif |
373 } | |
374 | |
32984 | 375 void guiLoadSubtitle(char *name) |
23077 | 376 { |
33555 | 377 if (guiInfo.Playing == 0) { |
378 guiInfo.SubtitleChanged = 1; // what is this for? (mw) | |
32984 | 379 return; |
23077 | 380 } |
32984 | 381 |
382 if (subdata) { | |
383 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_DeletingSubtitles); | |
384 | |
385 sub_free(subdata); | |
386 subdata = NULL; | |
387 vo_sub = NULL; | |
388 | |
389 if (vo_osd_list) { | |
390 int len; | |
391 mp_osd_obj_t *osd; | |
392 | |
393 osd = vo_osd_list; | |
394 | |
395 while (osd) { | |
396 if (osd->type == OSDTYPE_SUBTITLE) | |
397 break; | |
398 | |
399 osd = osd->next; | |
400 } | |
23077 | 401 |
32984 | 402 if (osd && (osd->flags & OSDFLAG_VISIBLE)) { |
403 len = osd->stride * (osd->bbox.y2 - osd->bbox.y1); | |
404 memset(osd->bitmap_buffer, 0, len); | |
405 memset(osd->alpha_buffer, 0, len); | |
406 } | |
407 } | |
408 } | |
409 | |
410 if (name) { | |
411 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_LoadingSubtitles, name); | |
412 | |
33555 | 413 subdata = sub_read_file(name, guiInfo.FPS); |
32984 | 414 |
415 if (!subdata) | |
33530 | 416 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadSub, name); |
32984 | 417 |
418 sub_name = (malloc(2 * sizeof(char *))); // when mplayer will be restarted | |
419 sub_name[0] = strdup(name); // sub_name[0] will be read | |
420 sub_name[1] = NULL; | |
421 } | |
422 | |
423 update_set_of_subtitles(); | |
23077 | 424 } |
425 | |
32984 | 426 static void add_vf(char *str) |
23077 | 427 { |
32984 | 428 void *p; |
429 | |
430 if (vf_settings) { | |
431 int i = 0; | |
432 | |
433 while (vf_settings[i].name) { | |
434 if (!gstrcmp(vf_settings[i++].name, str)) { | |
435 i = -1; | |
436 break; | |
437 } | |
438 } | |
439 | |
440 if (i != -1) { | |
441 p = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t)); | |
32712 | 442 |
32984 | 443 if (!p) |
444 return; | |
445 | |
446 vf_settings = p; | |
447 vf_settings[i].name = strdup(str); | |
448 vf_settings[i].attribs = NULL; | |
449 vf_settings[i + 1].name = NULL; | |
450 } | |
451 } else { | |
452 vf_settings = malloc(2 * sizeof(m_obj_settings_t)); | |
453 vf_settings[0].name = strdup(str); | |
454 vf_settings[0].attribs = NULL; | |
455 vf_settings[1].name = NULL; | |
32712 | 456 } |
457 | |
33530 | 458 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_AddingVideoFilter, str); |
23077 | 459 } |
460 | |
33726 | 461 int gui(int what, void *arg) |
23077 | 462 { |
32984 | 463 mixer_t *mixer = NULL; |
33685
ca6c9a80a062
Make assignments to variables in guiGetEvent() only if needed.
ib
parents:
33683
diff
changeset
|
464 stream_t *stream; |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
465 #ifdef CONFIG_DVDREAD |
33687 | 466 dvd_priv_t *dvd; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
467 #endif |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
468 plItem *next; |
23077 | 469 |
33555 | 470 if (guiInfo.mpcontext) |
471 mixer = mpctx_get_mixer(guiInfo.mpcontext); | |
23077 | 472 |
33726 | 473 switch (what) { |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
474 case GUI_SET_CONTEXT: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
475 guiInfo.mpcontext = arg; |
23077 | 476 break; |
32984 | 477 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
478 case GUI_SET_STATE: |
32984 | 479 |
480 switch ((int)arg) { | |
33631 | 481 case GUI_STOP: |
33614 | 482 case GUI_PLAY: |
33555 | 483 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &guiApp.subWindow,wsHideWindow ); |
33614 | 484 case GUI_PAUSE: |
33631 | 485 guiInfo.Playing = (int)arg; |
32984 | 486 break; |
487 } | |
488 | |
33555 | 489 uiState(); |
23077 | 490 break; |
32984 | 491 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
492 case GUI_SET_FILE: |
32984 | 493 |
33555 | 494 // if ( guiInfo.Playing == 1 && guiInfo.FilenameChanged ) |
495 if (guiInfo.FilenameChanged) { | |
32984 | 496 audio_id = -1; |
497 video_id = -1; | |
498 dvdsub_id = -1; | |
499 vobsub_id = -1; | |
500 stream_cache_size = -1; | |
501 autosync = 0; | |
502 dvd_title = 0; | |
503 force_fps = 0; | |
504 } | |
505 | |
33555 | 506 guiInfo.sh_video = NULL; |
507 wsPostRedisplay(&guiApp.subWindow); | |
32984 | 508 |
509 break; | |
510 | |
33732 | 511 case GUI_HANDLE_EVENTS: |
512 if (!guiInfo.Playing || !guiInfo.MovieWindow) | |
513 wsHandleEvents(); | |
514 gtkEventHandling(); | |
515 break; | |
516 | |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
517 case GUI_RUN_COMMAND: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
518 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
519 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_COMMAND: %d\n", (int)arg); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
520 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
521 switch ((int)arg) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
522 case MP_CMD_VO_FULLSCREEN: |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
523 uiEventHandling(evFullScreen, 0); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
524 break; |
33696
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
525 |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
526 case MP_CMD_PLAY_TREE_STEP: |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
527 uiEventHandling(evNext, 0); |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
528 break; |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
529 |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
530 case -MP_CMD_PLAY_TREE_STEP: |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
531 uiEventHandling(evPrev, 0); |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
532 break; |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
533 |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
534 case MP_CMD_STOP: |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
535 uiEventHandling(evStop, 0); |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
536 break; |
33697 | 537 |
538 case MP_CMD_QUIT: | |
539 uiEventHandling(evExit, 0); | |
540 break; | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
541 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
542 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
543 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
544 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
545 case GUI_PREPARE: |
32984 | 546 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
547 gui(GUI_SET_FILE, 0); |
32984 | 548 |
33555 | 549 switch (guiInfo.StreamType) { |
32984 | 550 case STREAMTYPE_PLAYLIST: |
551 break; | |
552 | |
553 #ifdef CONFIG_VCD | |
554 case STREAMTYPE_VCD: | |
555 { | |
556 char tmp[512]; | |
557 | |
33555 | 558 sprintf(tmp, "vcd://%d", guiInfo.Track + 1); |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
559 setdup(&guiInfo.Filename, tmp); |
32984 | 560 } |
561 break; | |
562 #endif | |
563 | |
564 #ifdef CONFIG_DVDREAD | |
565 case STREAMTYPE_DVD: | |
566 { | |
567 char tmp[512]; | |
568 | |
33555 | 569 sprintf(tmp, "dvd://%d", guiInfo.Title); |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
570 setdup(&guiInfo.Filename, tmp); |
32984 | 571 } |
572 | |
33555 | 573 dvd_chapter = guiInfo.Chapter; |
574 dvd_angle = guiInfo.Angle; | |
32984 | 575 |
576 break; | |
577 #endif | |
578 } | |
579 | |
33555 | 580 // if ( guiInfo.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore! |
32984 | 581 { |
33555 | 582 if (guiInfo.Filename) |
583 filename = gstrdup(guiInfo.Filename); | |
32984 | 584 else if (filename) |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
585 setdup(&guiInfo.Filename, filename); |
32984 | 586 } |
587 | |
588 // video opts | |
589 | |
590 if (!video_driver_list) { | |
591 int i = 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
592 |
32984 | 593 while (video_out_drivers[i++]) { |
594 if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) { | |
595 gaddlist(&video_driver_list, (char *)video_out_drivers[i - 1]->info->short_name); | |
596 break; | |
597 } | |
598 } | |
599 } | |
600 | |
601 if (!video_driver_list && !video_driver_list[0]) { | |
33024 | 602 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_IDFGCVD); |
33263 | 603 guiExit(EXIT_ERROR); |
32984 | 604 } |
605 | |
606 { | |
607 int i = 0; | |
608 | |
33655 | 609 guiInfo.MovieWindow = True; |
32984 | 610 |
611 while (video_out_drivers[i++]) { | |
612 if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) { | |
613 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)) { | |
33655 | 614 guiInfo.MovieWindow = False; |
32984 | 615 break; |
616 } | |
617 } | |
618 } | |
619 } | |
620 | |
621 #ifdef CONFIG_DXR3 | |
622 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3")) | |
33555 | 623 if (guiInfo.StreamType != STREAMTYPE_DVD && guiInfo.StreamType != STREAMTYPE_VCD) |
32984 | 624 if (gtkVfLAVC) |
625 add_vf("lavc"); | |
626 #endif | |
627 | |
628 if (gtkVfPP) | |
629 add_vf("pp"); | |
630 | |
631 // audio opts | |
632 | |
633 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } | |
634 if (gtkAONorm) | |
635 greplace(&af_cfg.list, "volnorm", "volnorm"); | |
636 | |
637 if (gtkEnableAudioEqualizer) | |
638 greplace(&af_cfg.list, "equalizer", "equalizer"); | |
639 | |
640 if (gtkAOExtraStereo) { | |
641 char *name; | |
642 | |
643 name = malloc(12 + 20 + 1); | |
644 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); | |
645 name[12 + 20] = 0; | |
646 greplace(&af_cfg.list, "extrastereo", name); | |
647 free(name); | |
648 } | |
649 | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
650 #ifdef CONFIG_OSS_AUDIO |
32984 | 651 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "oss", 3)) { |
652 char *tmp; | |
653 | |
654 mixer_device = gtkAOOSSMixer; | |
655 mixer_channel = gtkAOOSSMixerChannel; | |
656 | |
657 if (gtkAOOSSDevice) { | |
658 tmp = calloc(1, strlen(gtkAOOSSDevice) + 7); | |
659 sprintf(tmp, "oss:%s", gtkAOOSSDevice); | |
660 } else | |
661 tmp = strdup("oss"); | |
662 | |
663 gaddlist(&audio_driver_list, tmp); | |
664 free(tmp); | |
665 } | |
23077 | 666 #endif |
32984 | 667 |
27390
9d95dc936e66
Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents:
27387
diff
changeset
|
668 #ifdef CONFIG_ALSA |
32984 | 669 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "alsa", 4)) { |
670 char *tmp; | |
671 | |
672 mixer_device = gtkAOALSAMixer; | |
673 mixer_channel = gtkAOALSAMixerChannel; | |
674 | |
675 if (gtkAOALSADevice) { | |
676 tmp = calloc(1, strlen(gtkAOALSADevice) + 14); | |
677 sprintf(tmp, "alsa:device=%s", gtkAOALSADevice); | |
678 } else | |
679 tmp = strdup("alsa"); | |
680 | |
681 gaddlist(&audio_driver_list, tmp); | |
682 free(tmp); | |
683 } | |
23077 | 684 #endif |
32984 | 685 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27359
diff
changeset
|
686 #ifdef CONFIG_SDL |
32984 | 687 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "sdl", 3)) { |
688 char *tmp; | |
689 | |
690 if (gtkAOSDLDriver) { | |
691 tmp = calloc(1, strlen(gtkAOSDLDriver) + 10); | |
692 sprintf(tmp, "sdl:%s", gtkAOSDLDriver); | |
693 } else | |
694 tmp = strdup("sdl"); | |
695 | |
696 gaddlist(&audio_driver_list, tmp); | |
697 free(tmp); | |
698 } | |
23077 | 699 #endif |
32984 | 700 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
701 #ifdef CONFIG_ESD |
32984 | 702 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "esd", 3)) { |
703 char *tmp; | |
704 | |
705 if (gtkAOESDDevice) { | |
706 tmp = calloc(1, strlen(gtkAOESDDevice) + 10); | |
707 sprintf(tmp, "esd:%s", gtkAOESDDevice); | |
708 } else | |
709 tmp = strdup("esd"); | |
710 | |
711 gaddlist(&audio_driver_list, tmp); | |
712 free(tmp); | |
713 } | |
23077 | 714 #endif |
32984 | 715 |
716 // subtitle | |
717 | |
33555 | 718 // subdata->filename=gstrdup( guiInfo.Subtitlename ); |
32984 | 719 stream_dump_type = 0; |
720 | |
721 if (gtkSubDumpMPSub) | |
722 stream_dump_type = 4; | |
723 | |
724 if (gtkSubDumpSrt) | |
725 stream_dump_type = 6; | |
726 | |
727 gtkSubDumpMPSub = gtkSubDumpSrt = 0; | |
23077 | 728 guiLoadFont(); |
729 | |
32984 | 730 // misc |
731 | |
732 if (gtkCacheOn) | |
733 stream_cache_size = gtkCacheSize; | |
734 | |
735 if (gtkAutoSyncOn) | |
736 autosync = gtkAutoSync; | |
23077 | 737 |
33555 | 738 if (guiInfo.AudioFile) |
739 audio_stream = gstrdup(guiInfo.AudioFile); | |
740 else if (guiInfo.FilenameChanged) | |
33739 | 741 nfree(audio_stream); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
742 |
32984 | 743 // audio_stream = NULL; |
744 | |
33555 | 745 guiInfo.DiskChanged = 0; |
746 guiInfo.FilenameChanged = 0; | |
747 guiInfo.NewPlay = 0; | |
23077 | 748 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
749 #ifdef CONFIG_ASS |
32984 | 750 ass_enabled = gtkASS.enabled; |
751 ass_use_margins = gtkASS.use_margins; | |
752 ass_top_margin = gtkASS.top_margin; | |
23077 | 753 ass_bottom_margin = gtkASS.bottom_margin; |
754 #endif | |
755 | |
32984 | 756 break; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
757 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
758 case GUI_SET_STREAM: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
759 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
760 stream = arg; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
761 guiInfo.StreamType = stream->type; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
762 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
763 switch (guiInfo.StreamType) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
764 #ifdef CONFIG_DVDREAD |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
765 case STREAMTYPE_DVD: |
33730 | 766 dvd = stream->priv; |
767 guiInfo.DVD.titles = dvd->vmg_file->tt_srpt->nr_of_srpts; | |
768 guiInfo.DVD.chapters = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; | |
769 guiInfo.DVD.angles = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; | |
770 guiInfo.DVD.nr_of_audio_channels = dvd->nr_of_channels; | |
771 memcpy(guiInfo.DVD.audio_streams, dvd->audio_streams, sizeof(dvd->audio_streams)); | |
772 guiInfo.DVD.nr_of_subtitles = dvd->nr_of_subtitles; | |
773 memcpy(guiInfo.DVD.subtitles, dvd->subtitles, sizeof(dvd->subtitles)); | |
774 guiInfo.DVD.current_title = dvd_title + 1; | |
775 guiInfo.DVD.current_chapter = dvd_chapter + 1; | |
776 guiInfo.DVD.current_angle = dvd_angle + 1; | |
777 guiInfo.Track = dvd_title + 1; | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
778 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
779 #endif |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
780 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
781 #ifdef CONFIG_VCD |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
782 case STREAMTYPE_VCD: |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
783 guiInfo.VCDTracks = 0; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
784 stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.VCDTracks); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
785 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
786 #endif |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
787 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
788 default: |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
789 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
790 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
791 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
792 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
793 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
794 case GUI_SET_AFILTER: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
795 guiInfo.afilter = arg; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
796 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
797 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
798 case GUI_SET_VIDEO: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
799 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
800 // video |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
801 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
802 guiInfo.sh_video = arg; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
803 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
804 if (arg) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
805 sh_video_t *sh = arg; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
806 guiInfo.FPS = sh->fps; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
807 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
808 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
809 if (guiInfo.StreamType == STREAMTYPE_STREAM) |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
810 btnSet(evSetMoviePosition, btnDisabled); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
811 else |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
812 btnSet(evSetMoviePosition, btnReleased); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
813 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
814 #ifdef CONFIG_DXR3 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
815 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3") && (((demuxer_t *)mpctx_get_demuxer(guiInfo.mpcontext))->file_format != DEMUXER_TYPE_MPEG_PS) && !gtkVfLAVC) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
816 gtkMessageBox(GTK_MB_FATAL, MSGTR_NEEDLAVC); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
817 return False; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
818 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
819 #endif |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
820 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
821 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
822 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
823 case GUI_SET_AUDIO: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
824 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
825 guiInfo.AudioChannels = arg ? ((sh_audio_t *)arg)->channels : 0; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
826 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
827 if (arg && !guiInfo.sh_video) |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
828 guiInfo.MovieWindow = False; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
829 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
830 gui(GUI_SET_MIXER, 0); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
831 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
832 if (gtkEnableAudioEqualizer) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
833 equalizer_t eq; |
33693
006a2db8bd55
Use unsigned index variable for comparison with array size.
ib
parents:
33692
diff
changeset
|
834 unsigned int i, j; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
835 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
836 for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
837 for (j = 0; j < FF_ARRAY_ELEMS(*gtkEquChannels); j++) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
838 eq.channel = i; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
839 eq.band = j; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
840 eq.gain = gtkEquChannels[i][j]; |
33743
99562e7c8b27
Cosmetic: Rename remaining part of gtkSet() mplayer().
ib
parents:
33742
diff
changeset
|
841 mplayer(gtkSetEqualizer, 0, &eq); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
842 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
843 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
844 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
845 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
846 wsVisibleWindow(&guiApp.subWindow, (guiInfo.MovieWindow ? wsShowWindow : wsHideWindow)); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
847 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
848 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
849 case GUI_SET_MIXER: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
850 if (mixer) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
851 float l, r; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
852 static float last_balance = -1; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
853 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
854 mixer_getvolume(mixer, &l, &r); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
855 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
856 guiInfo.Volume = FFMAX(l, r); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
857 btnModify(evSetVolume, guiInfo.Volume); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
858 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
859 if (guiInfo.Balance != last_balance) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
860 if (guiInfo.Volume) |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
861 guiInfo.Balance = ((r - l) / guiInfo.Volume + 1.0) * 50.0; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
862 else |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
863 guiInfo.Balance = 50.0f; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
864 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
865 last_balance = guiInfo.Balance; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
866 btnModify(evSetBalance, guiInfo.Balance); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
867 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
868 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
869 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
870 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
871 case GUI_REDRAW: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
872 uiEventHandling(evRedraw, 0); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
873 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
874 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
875 case GUI_SETUP_VIDEO_WINDOW: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
876 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
877 if (!guiApp.subWindow.isFullScreen) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
878 wsResizeWindow(&guiApp.subWindow, vo_dwidth, vo_dheight); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
879 wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
880 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
881 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
882 guiInfo.MovieWidth = vo_dwidth; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
883 guiInfo.MovieHeight = vo_dheight; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
884 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
885 if (guiWinID >= 0) |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
886 wsMoveWindow(&guiApp.mainWindow, False, 0, vo_dheight); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
887 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
888 WinID = guiApp.subWindow.WindowID; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
889 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
890 |
33733 | 891 case GUI_HANDLE_X_EVENT: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
892 guiInfo.event_struct = arg; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
893 wsEvents(wsDisplay, arg); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
894 gtkEventHandling(); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
895 break; |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
896 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
897 case GUI_END_FILE: |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
898 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
899 if (!uiGotoTheNext && guiInfo.Playing) { |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
900 uiGotoTheNext = 1; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
901 break; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
902 } |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
903 |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
904 if (guiInfo.Playing && (next = listSet(gtkGetNextPlItem, NULL)) && (plLastPlayed != next)) { |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
905 plLastPlayed = next; |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
906 setddup(&guiInfo.Filename, next->path, next->name); |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
907 guiInfo.StreamType = STREAMTYPE_FILE; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
908 guiInfo.FilenameChanged = guiInfo.NewPlay = 1; |
33739 | 909 nfree(guiInfo.AudioFile); |
910 nfree(guiInfo.Subtitlename); | |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
911 } else { |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
912 if (guiInfo.FilenameChanged || guiInfo.NewPlay) |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
913 break; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
914 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
915 guiInfo.TimeSec = 0; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
916 guiInfo.Position = 0; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
917 guiInfo.AudioChannels = 0; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
918 guiInfo.MovieWindow = True; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
919 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
920 #ifdef CONFIG_DVDREAD |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
921 guiInfo.DVD.current_title = 1; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
922 guiInfo.DVD.current_chapter = 1; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
923 guiInfo.DVD.current_angle = 1; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
924 #endif |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
925 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
926 if (!guiApp.subWindow.isFullScreen && gtkShowVideoWindow) { |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
927 wsResizeWindow(&guiApp.subWindow, guiApp.sub.width, guiApp.sub.height); |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
928 wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
929 } else |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
930 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
931 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
932 gui(GUI_SET_STATE, (void *)GUI_STOP); |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
933 uiSubRender = 1; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
934 wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B); |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
935 wsClearWindow(guiApp.subWindow); |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
936 wsPostRedisplay(&guiApp.subWindow); |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
937 } |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
938 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
939 break; |
32984 | 940 } |
941 | |
33666
0f592e8530f1
Change return code of guiGetEvent() to indicate success.
ib
parents:
33664
diff
changeset
|
942 return True; |
23077 | 943 } |
944 | |
33743
99562e7c8b27
Cosmetic: Rename remaining part of gtkSet() mplayer().
ib
parents:
33742
diff
changeset
|
945 void *mplayer(int cmd, float fparam, void *vparam) |
23077 | 946 { |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
947 equalizer_t *eq = (equalizer_t *)vparam; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
948 |
32984 | 949 switch (cmd) { |
950 // subtitle | |
951 | |
27393 | 952 #ifndef CONFIG_FREETYPE |
32984 | 953 case gtkSetFontFactor: |
954 font_factor = fparam; | |
955 guiLoadFont(); | |
956 return NULL; | |
23077 | 957 #else |
32984 | 958 case gtkSetFontOutLine: |
959 subtitle_font_thickness = (8.0f / 100.0f) * fparam; | |
960 guiLoadFont(); | |
961 return NULL; | |
962 | |
963 case gtkSetFontBlur: | |
964 subtitle_font_radius = (8.0f / 100.0f) * fparam; | |
965 guiLoadFont(); | |
966 return NULL; | |
967 | |
968 case gtkSetFontTextScale: | |
969 text_font_scale_factor = fparam; | |
970 guiLoadFont(); | |
971 return NULL; | |
972 | |
973 case gtkSetFontOSDScale: | |
974 osd_font_scale_factor = fparam; | |
975 guiLoadFont(); | |
976 return NULL; | |
977 | |
978 case gtkSetFontEncoding: | |
33739 | 979 nfree(subtitle_font_encoding); |
32984 | 980 subtitle_font_encoding = gstrdup((char *)vparam); |
981 guiLoadFont(); | |
982 return NULL; | |
983 | |
984 case gtkSetFontAutoScale: | |
985 subtitle_autoscale = (int)fparam; | |
986 guiLoadFont(); | |
987 return NULL; | |
23077 | 988 #endif |
32984 | 989 |
27393 | 990 #ifdef CONFIG_ICONV |
32984 | 991 case gtkSetSubEncoding: |
33739 | 992 nfree(sub_cp); |
32984 | 993 sub_cp = gstrdup((char *)vparam); |
994 break; | |
23077 | 995 #endif |
32984 | 996 |
997 // misc | |
33743
99562e7c8b27
Cosmetic: Rename remaining part of gtkSet() mplayer().
ib
parents:
33742
diff
changeset
|
998 // NOTE TO MYSELF: This should rather be in app.c. |
32984 | 999 case gtkClearStruct: |
1000 | |
1001 if ((unsigned int)vparam & guiFilenames) { | |
33739 | 1002 nfree(guiInfo.Filename); |
1003 nfree(guiInfo.Subtitlename); | |
1004 nfree(guiInfo.AudioFile); | |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1005 listSet(gtkDelPl, NULL); |
32984 | 1006 } |
1007 | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
1008 #ifdef CONFIG_DVDREAD |
32984 | 1009 if ((unsigned int)vparam & guiDVD) |
33555 | 1010 memset(&guiInfo.DVD, 0, sizeof(guiDVDStruct)); |
23077 | 1011 #endif |
32984 | 1012 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27359
diff
changeset
|
1013 #ifdef CONFIG_VCD |
32984 | 1014 if ((unsigned int)vparam & guiVCD) |
33555 | 1015 guiInfo.VCDTracks = 0; |
23077 | 1016 #endif |
32984 | 1017 |
1018 return NULL; | |
1019 | |
1020 case gtkSetExtraStereo: | |
1021 gtkAOExtraStereoMul = fparam; | |
33555 | 1022 if (guiInfo.afilter) |
1023 af_control_any_rev(guiInfo.afilter, AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul); | |
32984 | 1024 return NULL; |
1025 | |
1026 case gtkSetPanscan: | |
1027 { | |
1028 mp_cmd_t *mp_cmd; | |
1029 | |
1030 mp_cmd = calloc(1, sizeof(*mp_cmd)); | |
1031 mp_cmd->id = MP_CMD_PANSCAN; | |
1032 mp_cmd->name = strdup("panscan"); | |
1033 mp_cmd->args[0].v.f = fparam; | |
1034 mp_cmd->args[1].v.i = 1; | |
1035 mp_input_queue_cmd(mp_cmd); | |
1036 } | |
33053 | 1037 |
23077 | 1038 return NULL; |
32984 | 1039 |
1040 case gtkSetAutoq: | |
1041 auto_quality = (int)fparam; | |
1042 return NULL; | |
1043 | |
1044 // set equalizers | |
1045 | |
1046 case gtkSetContrast: | |
33555 | 1047 if (guiInfo.sh_video) |
1048 set_video_colors(guiInfo.sh_video, "contrast", (int)fparam); | |
32984 | 1049 return NULL; |
1050 | |
1051 case gtkSetBrightness: | |
33555 | 1052 if (guiInfo.sh_video) |
1053 set_video_colors(guiInfo.sh_video, "brightness", (int)fparam); | |
32984 | 1054 return NULL; |
1055 | |
1056 case gtkSetHue: | |
33555 | 1057 if (guiInfo.sh_video) |
1058 set_video_colors(guiInfo.sh_video, "hue", (int)fparam); | |
23077 | 1059 return NULL; |
32984 | 1060 |
1061 case gtkSetSaturation: | |
33555 | 1062 if (guiInfo.sh_video) |
1063 set_video_colors(guiInfo.sh_video, "saturation", (int)fparam); | |
32984 | 1064 return NULL; |
1065 | |
1066 case gtkSetEqualizer: | |
1067 { | |
23077 | 1068 af_control_ext_t tmp; |
32984 | 1069 |
1070 if (eq) { | |
1071 gtkEquChannels[eq->channel][eq->band] = eq->gain; | |
1072 tmp.ch = eq->channel; | |
1073 tmp.arg = gtkEquChannels[eq->channel]; | |
1074 | |
33555 | 1075 if (guiInfo.afilter) |
1076 af_control_any_rev(guiInfo.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); | |
32984 | 1077 } else { |
33693
006a2db8bd55
Use unsigned index variable for comparison with array size.
ib
parents:
33692
diff
changeset
|
1078 unsigned int i; |
32984 | 1079 |
1080 memset(gtkEquChannels, 0, sizeof(gtkEquChannels)); | |
1081 | |
33555 | 1082 if (guiInfo.afilter) { |
33689
8d0290220239
Replace numeric constants for gtkEquChannels array size.
ib
parents:
33688
diff
changeset
|
1083 for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) { |
32984 | 1084 tmp.ch = i; |
1085 tmp.arg = gtkEquChannels[i]; | |
33555 | 1086 af_control_any_rev(guiInfo.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); |
32984 | 1087 } |
1088 } | |
1089 } | |
1090 | |
1091 return NULL; | |
1092 } | |
1093 } | |
1094 | |
1095 return NULL; | |
23077 | 1096 } |
1097 | |
32984 | 1098 // This function adds/inserts one file into the gui playlist. |
1099 static int import_file_into_gui(char *temp, int insert) | |
1100 { | |
1101 char *filename, *pathname; | |
1102 plItem *item; | |
23077 | 1103 |
32984 | 1104 filename = strdup(mp_basename(temp)); |
1105 pathname = strdup(temp); | |
1106 | |
1107 if (strlen(pathname) - strlen(filename) > 0) | |
1108 pathname[strlen(pathname) - strlen(filename) - 1] = 0; // we have some path, so remove / at end | |
1109 else | |
1110 pathname[strlen(pathname) - strlen(filename)] = 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
1111 |
33530 | 1112 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[interface] playtree, add: %s/%s\n", pathname, filename); |
32984 | 1113 |
1114 item = calloc(1, sizeof(plItem)); | |
1115 | |
1116 if (!item) | |
1117 return 0; | |
1118 | |
1119 item->name = filename; | |
1120 item->path = pathname; | |
1121 | |
1122 if (insert) | |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1123 listSet(gtkInsertPlItem, item); // inserts the item after current, and makes current=item |
32984 | 1124 else |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1125 listSet(gtkAddPlItem, item); |
32984 | 1126 |
1127 return 1; | |
23077 | 1128 } |
1129 | |
32984 | 1130 // This function imports the initial playtree (based on cmd-line files) |
1131 // into the gui playlist by either: | |
1132 // - overwriting gui pl (enqueue=0) | |
1133 // - appending it to gui pl (enqueue=1) | |
33734 | 1134 int guiInitializePlaylist(play_tree_t *my_playtree, m_config_t *config, int enqueue) |
32984 | 1135 { |
1136 play_tree_iter_t *my_pt_iter = NULL; | |
1137 int result = 0; | |
23077 | 1138 |
32984 | 1139 if (!enqueue) |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1140 listSet(gtkDelPl, NULL); // delete playlist before "appending" |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
1141 |
32984 | 1142 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) { |
1143 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) | |
1144 // add it to end of list | |
1145 if (import_file_into_gui(filename, 0)) | |
1146 result = 1; | |
23077 | 1147 } |
1148 | |
33555 | 1149 uiCurr(); // update filename |
1150 uiGotoTheNext = 1; | |
23077 | 1151 |
32984 | 1152 if (!enqueue) |
33555 | 1153 filename = guiInfo.Filename; // Backward compatibility; if file is specified on commandline, |
1154 // gmplayer does directly start in Play-Mode. | |
32984 | 1155 else |
1156 filename = NULL; | |
23077 | 1157 |
32984 | 1158 return result; |
23077 | 1159 } |
1160 | |
32984 | 1161 // This function imports and inserts an playtree, that is created "on the fly", |
1162 // for example by parsing some MOV-Reference-File; or by loading an playlist | |
1163 // with "File Open". | |
23077 | 1164 // The file which contained the playlist is thereby replaced with it's contents. |
33734 | 1165 int guiAddPlaylist(play_tree_t *my_playtree, m_config_t *config) |
32984 | 1166 { |
1167 play_tree_iter_t *my_pt_iter = NULL; | |
1168 int result = 0; | |
1169 plItem *save; | |
23077 | 1170 |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1171 save = (plItem *)listSet(gtkGetCurrPlItem, NULL); // save current item |
23077 | 1172 |
32984 | 1173 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) { |
1174 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) | |
1175 // insert it into the list and set plCurrent=new item | |
1176 if (import_file_into_gui(filename, 1)) | |
1177 result = 1; | |
1178 | |
1179 pt_iter_destroy(&my_pt_iter); | |
23077 | 1180 } |
1181 | |
32984 | 1182 if (save) |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1183 listSet(gtkSetCurrPlItem, save); |
32984 | 1184 else |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1185 listSet(gtkSetCurrPlItem, plList); // go to head, if plList was empty before |
23077 | 1186 |
32984 | 1187 if (save && result) |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
1188 listSet(gtkDelCurrPlItem, NULL); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
1189 |
33555 | 1190 uiCurr(); // update filename |
32984 | 1191 filename = NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
1192 |
32984 | 1193 return result; |
23077 | 1194 } |
33023 | 1195 |
1196 // NOTE TO MYSELF: This function is nonsense. | |
33289 | 1197 // MPlayer should pass messages to the GUI |
1198 // which must decide then which message has | |
1199 // to be shown (MSGL_FATAL, for example). | |
1200 // But with this function it is at least | |
1201 // possible to show GUI's very critical or | |
1202 // abort messages. | |
33023 | 1203 void gmp_msg(int mod, int lev, const char *format, ...) |
1204 { | |
1205 char msg[512]; | |
1206 va_list va; | |
1207 | |
1208 va_start(va, format); | |
1209 vsnprintf(msg, sizeof(msg), format, va); | |
1210 va_end(va); | |
1211 | |
1212 mp_msg(mod, lev, msg); | |
1213 | |
1214 if (mp_msg_test(mod, lev)) | |
1215 gtkMessageBox(GTK_MB_FATAL, msg); | |
1216 } |