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