Mercurial > mplayer.hg
annotate gui/interface.c @ 34447:23d3354fbdad
Remove another md5sums reference file that missed the .md5 extension.
author | reimar |
---|---|
date | Sun, 08 Jan 2012 13:47:08 +0000 |
parents | 7f04823f744c |
children | 5a45efc630b8 |
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) { |
34424 | 630 case STREAMTYPE_FILE: |
631 case STREAMTYPE_STREAM: | |
632 break; | |
633 | |
34387 | 634 #ifdef CONFIG_CDDA |
635 case STREAMTYPE_CDDA: | |
636 guiInfo.Tracks = 0; | |
637 stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); | |
638 break; | |
639 #endif | |
640 | |
34077 | 641 #ifdef CONFIG_VCD |
642 case STREAMTYPE_VCD: | |
643 guiInfo.Tracks = 0; | |
34388
9ee95c78e85f
Replace VCD's STREAM_CTRL_GET_NUM_CHAPTERS by STREAM_CTRL_GET_NUM_TITLES.
ib
parents:
34387
diff
changeset
|
644 stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); |
34077 | 645 break; |
646 #endif | |
647 | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
648 #ifdef CONFIG_DVDREAD |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
649 case STREAMTYPE_DVD: |
34389
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
650 guiInfo.Tracks = 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_TITLES, &guiInfo.Tracks); |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
652 guiInfo.Chapters = 0; |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
653 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
|
654 guiInfo.Angles = 0; |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
655 stream_control(stream, STREAM_CTRL_GET_NUM_ANGLES, &guiInfo.Angles); |
33730 | 656 dvd = stream->priv; |
33902 | 657 guiInfo.AudioStreams = dvd->nr_of_channels; |
658 memcpy(guiInfo.AudioStream, dvd->audio_streams, sizeof(dvd->audio_streams)); | |
659 guiInfo.Subtitles = dvd->nr_of_subtitles; | |
660 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
|
661 guiInfo.Track = dvd_title + 1; |
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
662 guiInfo.Chapter = dvd_chapter + 1; |
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
663 guiInfo.Angle = dvd_angle + 1; |
33692
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 #endif |
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 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
668 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
669 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
670 case GUI_SET_AFILTER: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
671 guiInfo.afilter = data; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
672 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
673 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
674 case GUI_SET_VIDEO: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
675 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
676 // video |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
677 |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
678 guiInfo.sh_video = data; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
679 |
34074
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
680 state = (guiInfo.StreamType == STREAMTYPE_STREAM ? btnDisabled : btnReleased); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
681 btnSet(evForward10sec, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
682 btnSet(evBackward10sec, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
683 btnSet(evForward1min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
684 btnSet(evBackward1min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
685 btnSet(evForward10min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
686 btnSet(evBackward10min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
687 btnSet(evSetMoviePosition, state); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
688 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
689 #ifdef CONFIG_DXR3 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
690 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
|
691 gtkMessageBox(GTK_MB_FATAL, MSGTR_NEEDLAVC); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
692 return False; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
693 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
694 #endif |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
695 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
696 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
697 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
698 case GUI_SET_AUDIO: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
699 |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
700 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
|
701 |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
702 if (data && !guiInfo.sh_video) |
33901 | 703 guiInfo.VideoWindow = False; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
704 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
705 gui(GUI_SET_MIXER, 0); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
706 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
707 if (gtkEnableAudioEqualizer) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
708 equalizer_t eq; |
33693
006a2db8bd55
Use unsigned index variable for comparison with array size.
ib
parents:
33692
diff
changeset
|
709 unsigned int i, j; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
710 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
711 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
|
712 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
|
713 eq.channel = i; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
714 eq.band = j; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
715 eq.gain = gtkEquChannels[i][j]; |
33766 | 716 mplayer(MPLAYER_SET_EQUALIZER, 0, &eq); |
33692
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 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
720 |
33960 | 721 // These must be done here (in the last call from MPlayer before |
722 // playback starts) and not in GUI_SETUP_VIDEO_WINDOW, because... | |
723 | |
724 // ...without video there will be no call to GUI_SETUP_VIDEO_WINDOW | |
725 if (!guiInfo.VideoWindow) { | |
726 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); | |
33978 | 727 btnSet(evFullScreen, (gtkLoadFullscreen ? btnPressed : btnReleased)); |
33960 | 728 } |
729 | |
730 // ...option variable fullscreen determines whether MPlayer will handle | |
731 // the window given by WinID as fullscreen window (and will do aspect | |
732 // scaling then) or not - quite rubbish | |
733 fullscreen = gtkLoadFullscreen; | |
734 | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
735 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
736 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
737 case GUI_SET_MIXER: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
738 if (mixer) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
739 float l, r; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
740 static float last_balance = -1; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
741 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
742 mixer_getvolume(mixer, &l, &r); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
743 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
744 guiInfo.Volume = FFMAX(l, r); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
745 btnModify(evSetVolume, guiInfo.Volume); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
746 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
747 if (guiInfo.Balance != last_balance) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
748 if (guiInfo.Volume) |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
749 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
|
750 else |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
751 guiInfo.Balance = 50.0f; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
752 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
753 last_balance = guiInfo.Balance; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
754 btnModify(evSetBalance, guiInfo.Balance); |
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 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
757 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
758 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
759 case GUI_REDRAW: |
34333 | 760 uiEventHandling(ivRedraw, 0); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
761 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
762 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
763 case GUI_SETUP_VIDEO_WINDOW: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
764 |
33901 | 765 guiInfo.VideoWidth = vo_dwidth; |
766 guiInfo.VideoHeight = vo_dheight; | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
767 |
33960 | 768 if (!guiApp.subWindow.isFullScreen || !guiApp.subWindow.Mapped) { |
769 if (!guiApp.subWindow.isFullScreen) | |
770 wsResizeWindow(&guiApp.subWindow, guiInfo.VideoWidth, guiInfo.VideoHeight); | |
771 | |
33993 | 772 wsMoveWindow(&guiApp.subWindow, False, guiApp.sub.x, guiApp.sub.y); |
33960 | 773 |
774 if (!guiApp.subWindow.Mapped) | |
775 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); | |
776 } | |
777 | |
778 if (gtkLoadFullscreen ^ guiApp.subWindow.isFullScreen) | |
779 uiEventHandling(evFullScreen, 0); | |
780 | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
781 if (guiWinID >= 0) |
33993 | 782 wsMoveWindow(&guiApp.mainWindow, True, 0, guiInfo.VideoHeight); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
783 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
784 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
785 |
33733 | 786 case GUI_HANDLE_X_EVENT: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
787 wsEvents(wsDisplay, data); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
788 gtkEventHandling(); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
789 break; |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
790 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
791 case GUI_END_FILE: |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
792 |
34333 | 793 uiEventHandling(ivRedraw, 1); |
34035 | 794 |
34052 | 795 guiInfo.sh_video = NULL; |
796 | |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
797 if (!uiGotoTheNext && guiInfo.Playing) { |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
798 uiGotoTheNext = 1; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
799 break; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
800 } |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
801 |
34387 | 802 #ifdef CONFIG_CDDA |
803 if (guiInfo.StreamType == STREAMTYPE_CDDA) { | |
804 uiNext(); | |
805 | |
806 if (guiInfo.Playing) | |
807 break; | |
808 } | |
809 #endif | |
810 | |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33741
diff
changeset
|
811 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
|
812 plLastPlayed = next; |
34065
8a7056729022
Change guiInfo.Filename by using uiSetFileName() only.
ib
parents:
34064
diff
changeset
|
813 uiSetFileName(next->path, next->name, STREAMTYPE_FILE); |
34066 | 814 guiInfo.NewPlay = GUI_FILE_NEW; |
33898 | 815 guiInfo.Track++; |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
816 } else { |
33894 | 817 if (guiInfo.NewPlay == GUI_FILE_NEW) |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
818 break; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
819 |
34113 | 820 filename = NULL; |
821 | |
33897 | 822 guiInfo.ElapsedTime = 0; |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
823 guiInfo.Position = 0; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
824 guiInfo.AudioChannels = 0; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
825 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
826 #ifdef CONFIG_DVDREAD |
33876
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
827 guiInfo.Track = 1; |
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
828 guiInfo.Chapter = 1; |
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
829 guiInfo.Angle = 1; |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
830 #endif |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
831 |
33960 | 832 if (gtkShowVideoWindow) { |
833 guiInfo.VideoWindow = True; | |
834 guiInfo.VideoWidth = guiApp.sub.width; | |
835 guiInfo.VideoHeight = guiApp.sub.height; | |
836 | |
837 if (!guiApp.subWindow.isFullScreen) { | |
838 wsResizeWindow(&guiApp.subWindow, guiInfo.VideoWidth, guiInfo.VideoHeight); | |
33993 | 839 wsMoveWindow(&guiApp.subWindow, False, guiApp.sub.x, guiApp.sub.y); |
33960 | 840 } |
841 | |
842 if (!guiApp.subWindow.Mapped) | |
843 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); | |
844 | |
845 if (gtkLoadFullscreen ^ guiApp.subWindow.isFullScreen) | |
846 uiEventHandling(evFullScreen, 0); | |
847 } else { | |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
848 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); |
33960 | 849 guiInfo.VideoWindow = False; |
33978 | 850 btnSet(evFullScreen, (gtkLoadFullscreen ? btnPressed : btnReleased)); |
33960 | 851 } |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
852 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
853 gui(GUI_SET_STATE, (void *)GUI_STOP); |
33959 | 854 |
855 wsHandleEvents(); | |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
856 uiSubRender = 1; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
857 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
|
858 wsClearWindow(guiApp.subWindow); |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
859 wsPostRedisplay(&guiApp.subWindow); |
34032 | 860 wsVisibleMouse(&guiApp.subWindow, wsShowMouseCursor); |
33694
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 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
863 break; |
32984 | 864 } |
865 | |
33666
0f592e8530f1
Change return code of guiGetEvent() to indicate success.
ib
parents:
33664
diff
changeset
|
866 return True; |
23077 | 867 } |
868 | |
33746 | 869 // This function adds/inserts one file into the gui playlist. |
870 static int import_file_into_gui(char *temp, int insert) | |
871 { | |
872 char *filename, *pathname; | |
873 plItem *item; | |
874 | |
875 filename = strdup(mp_basename(temp)); | |
876 pathname = strdup(temp); | |
877 | |
878 if (strlen(pathname) - strlen(filename) > 0) | |
879 pathname[strlen(pathname) - strlen(filename) - 1] = 0; // we have some path, so remove / at end | |
880 else | |
881 pathname[strlen(pathname) - strlen(filename)] = 0; | |
882 | |
33985 | 883 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] playtree, add: %s/%s\n", pathname, filename); |
33746 | 884 |
885 item = calloc(1, sizeof(plItem)); | |
886 | |
887 if (!item) | |
888 return 0; | |
889 | |
890 item->name = filename; | |
891 item->path = pathname; | |
892 | |
893 if (insert) | |
894 listSet(gtkInsertPlItem, item); // inserts the item after current, and makes current=item | |
895 else | |
896 listSet(gtkAddPlItem, item); | |
897 | |
898 return 1; | |
899 } | |
900 | |
901 // This function imports the initial playtree (based on cmd-line files) | |
902 // into the gui playlist by either: | |
903 // - overwriting gui pl (enqueue=0) | |
904 // - appending it to gui pl (enqueue=1) | |
33752 | 905 int guiPlaylistInitialize(play_tree_t *my_playtree, m_config_t *config, int enqueue) |
33746 | 906 { |
907 play_tree_iter_t *my_pt_iter = NULL; | |
908 int result = 0; | |
909 | |
910 if (!enqueue) | |
911 listSet(gtkDelPl, NULL); // delete playlist before "appending" | |
912 | |
913 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) { | |
914 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) | |
915 // add it to end of list | |
916 if (import_file_into_gui(filename, 0)) | |
917 result = 1; | |
918 } | |
919 | |
920 uiCurr(); // update filename | |
921 uiGotoTheNext = 1; | |
922 | |
34069
5c505f79932d
Change handling for option "enqueue" in guiPlaylistInitialize().
ib
parents:
34068
diff
changeset
|
923 if (enqueue) |
5c505f79932d
Change handling for option "enqueue" in guiPlaylistInitialize().
ib
parents:
34068
diff
changeset
|
924 filename = NULL; // don't start playing |
33746 | 925 |
926 return result; | |
927 } | |
928 | |
929 // This function imports and inserts an playtree, that is created "on the fly", | |
930 // 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
|
931 // 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
|
932 // not working which is why this function won't get called for that reason.) |
33746 | 933 // The file which contained the playlist is thereby replaced with it's contents. |
33752 | 934 int guiPlaylistAdd(play_tree_t *my_playtree, m_config_t *config) |
33746 | 935 { |
936 play_tree_iter_t *my_pt_iter = NULL; | |
937 int result = 0; | |
938 plItem *save; | |
939 | |
940 save = (plItem *)listSet(gtkGetCurrPlItem, NULL); // save current item | |
941 | |
942 if ((my_pt_iter = pt_iter_create(&my_playtree, config))) { | |
943 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) | |
944 // insert it into the list and set plCurrent=new item | |
945 if (import_file_into_gui(filename, 1)) | |
946 result = 1; | |
947 | |
948 pt_iter_destroy(&my_pt_iter); | |
949 } | |
950 | |
951 if (save) | |
952 listSet(gtkSetCurrPlItem, save); | |
953 else | |
954 listSet(gtkSetCurrPlItem, plList); // go to head, if plList was empty before | |
955 | |
956 if (save && result) | |
957 listSet(gtkDelCurrPlItem, NULL); | |
958 | |
959 uiCurr(); // update filename | |
960 | |
961 return result; | |
962 } | |
963 | |
964 /* GUI -> MPlayer */ | |
965 | |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
966 void mplayer(int what, float value, void *data) |
23077 | 967 { |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
968 equalizer_t *eq = (equalizer_t *)data; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
969 |
33765 | 970 switch (what) { |
32984 | 971 // subtitle |
972 | |
27393 | 973 #ifndef CONFIG_FREETYPE |
33766 | 974 case MPLAYER_SET_FONT_FACTOR: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
975 font_factor = value; |
33763 | 976 mplayerLoadFont(); |
33744 | 977 break; |
23077 | 978 #else |
33766 | 979 case MPLAYER_SET_FONT_OUTLINE: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
980 subtitle_font_thickness = (8.0f / 100.0f) * value; |
33763 | 981 mplayerLoadFont(); |
33744 | 982 break; |
32984 | 983 |
33766 | 984 case MPLAYER_SET_FONT_BLUR: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
985 subtitle_font_radius = (8.0f / 100.0f) * value; |
33763 | 986 mplayerLoadFont(); |
33744 | 987 break; |
32984 | 988 |
33766 | 989 case MPLAYER_SET_FONT_TEXTSCALE: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
990 text_font_scale_factor = value; |
33763 | 991 mplayerLoadFont(); |
33744 | 992 break; |
32984 | 993 |
33766 | 994 case MPLAYER_SET_FONT_OSDSCALE: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
995 osd_font_scale_factor = value; |
33763 | 996 mplayerLoadFont(); |
33744 | 997 break; |
32984 | 998 |
33766 | 999 case MPLAYER_SET_FONT_ENCODING: |
33739 | 1000 nfree(subtitle_font_encoding); |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1001 subtitle_font_encoding = gstrdup((char *)data); |
33763 | 1002 mplayerLoadFont(); |
33744 | 1003 break; |
32984 | 1004 |
33766 | 1005 case MPLAYER_SET_FONT_AUTOSCALE: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1006 subtitle_autoscale = (int)value; |
33763 | 1007 mplayerLoadFont(); |
33744 | 1008 break; |
23077 | 1009 #endif |
32984 | 1010 |
27393 | 1011 #ifdef CONFIG_ICONV |
33766 | 1012 case MPLAYER_SET_SUB_ENCODING: |
33739 | 1013 nfree(sub_cp); |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1014 sub_cp = gstrdup((char *)data); |
32984 | 1015 break; |
23077 | 1016 #endif |
32984 | 1017 |
33766 | 1018 case MPLAYER_SET_EXTRA_STEREO: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1019 gtkAOExtraStereoMul = value; |
33555 | 1020 if (guiInfo.afilter) |
1021 af_control_any_rev(guiInfo.afilter, AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul); | |
33744 | 1022 break; |
32984 | 1023 |
33766 | 1024 case MPLAYER_SET_PANSCAN: |
32984 | 1025 { |
1026 mp_cmd_t *mp_cmd; | |
1027 | |
1028 mp_cmd = calloc(1, sizeof(*mp_cmd)); | |
1029 mp_cmd->id = MP_CMD_PANSCAN; | |
1030 mp_cmd->name = strdup("panscan"); | |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1031 mp_cmd->args[0].v.f = value; |
32984 | 1032 mp_cmd->args[1].v.i = 1; |
1033 mp_input_queue_cmd(mp_cmd); | |
1034 } | |
33744 | 1035 break; |
32984 | 1036 |
33766 | 1037 case MPLAYER_SET_AUTO_QUALITY: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1038 auto_quality = (int)value; |
33744 | 1039 break; |
32984 | 1040 |
1041 // set equalizers | |
1042 | |
33766 | 1043 case MPLAYER_SET_CONTRAST: |
33555 | 1044 if (guiInfo.sh_video) |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1045 set_video_colors(guiInfo.sh_video, "contrast", (int)value); |
33744 | 1046 break; |
32984 | 1047 |
33766 | 1048 case MPLAYER_SET_BRIGHTNESS: |
33555 | 1049 if (guiInfo.sh_video) |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1050 set_video_colors(guiInfo.sh_video, "brightness", (int)value); |
33744 | 1051 break; |
32984 | 1052 |
33766 | 1053 case MPLAYER_SET_HUE: |
33555 | 1054 if (guiInfo.sh_video) |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1055 set_video_colors(guiInfo.sh_video, "hue", (int)value); |
33744 | 1056 break; |
32984 | 1057 |
33766 | 1058 case MPLAYER_SET_SATURATION: |
33555 | 1059 if (guiInfo.sh_video) |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1060 set_video_colors(guiInfo.sh_video, "saturation", (int)value); |
33744 | 1061 break; |
32984 | 1062 |
33766 | 1063 case MPLAYER_SET_EQUALIZER: |
32984 | 1064 { |
23077 | 1065 af_control_ext_t tmp; |
32984 | 1066 |
1067 if (eq) { | |
1068 gtkEquChannels[eq->channel][eq->band] = eq->gain; | |
1069 tmp.ch = eq->channel; | |
1070 tmp.arg = gtkEquChannels[eq->channel]; | |
1071 | |
33555 | 1072 if (guiInfo.afilter) |
1073 af_control_any_rev(guiInfo.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); | |
32984 | 1074 } else { |
33693
006a2db8bd55
Use unsigned index variable for comparison with array size.
ib
parents:
33692
diff
changeset
|
1075 unsigned int i; |
32984 | 1076 |
1077 memset(gtkEquChannels, 0, sizeof(gtkEquChannels)); | |
1078 | |
33555 | 1079 if (guiInfo.afilter) { |
33689
8d0290220239
Replace numeric constants for gtkEquChannels array size.
ib
parents:
33688
diff
changeset
|
1080 for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) { |
32984 | 1081 tmp.ch = i; |
1082 tmp.arg = gtkEquChannels[i]; | |
33555 | 1083 af_control_any_rev(guiInfo.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); |
32984 | 1084 } |
1085 } | |
1086 } | |
1087 | |
33744 | 1088 break; |
32984 | 1089 } |
33768 | 1090 |
1091 case MPLAYER_EXIT_GUI: | |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1092 exit_player_with_rc((enum exit_reason)value, (enum exit_reason)value >= EXIT_ERROR); |
33768 | 1093 break; |
32984 | 1094 } |
23077 | 1095 } |
1096 | |
33763 | 1097 void mplayerLoadFont(void) |
33745 | 1098 { |
1099 #ifdef CONFIG_FREETYPE | |
1100 load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name, osd_font_scale_factor); | |
1101 #else | |
1102 if (vo_font) { | |
1103 int i; | |
1104 | |
1105 free(vo_font->name); | |
1106 free(vo_font->fpath); | |
1107 | |
1108 for (i = 0; i < 16; i++) { | |
1109 if (vo_font->pic_a[i]) { | |
1110 free(vo_font->pic_a[i]->bmp); | |
1111 free(vo_font->pic_a[i]->pal); | |
1112 } | |
1113 } | |
1114 | |
1115 for (i = 0; i < 16; i++) { | |
1116 if (vo_font->pic_b[i]) { | |
1117 free(vo_font->pic_b[i]->bmp); | |
1118 free(vo_font->pic_b[i]->pal); | |
1119 } | |
1120 } | |
1121 | |
1122 free(vo_font); | |
1123 vo_font = NULL; | |
1124 } | |
1125 | |
1126 if (font_name) { | |
1127 vo_font = read_font_desc(font_name, font_factor, 0); | |
1128 | |
1129 if (!vo_font) | |
1130 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadFont, font_name); | |
1131 } else { | |
1132 font_name = gstrdup(get_path("font/font.desc")); | |
1133 vo_font = read_font_desc(font_name, font_factor, 0); | |
1134 | |
1135 if (!vo_font) { | |
1136 nfree(font_name); | |
1137 font_name = gstrdup(MPLAYER_DATADIR "/font/font.desc"); | |
1138 vo_font = read_font_desc(font_name, font_factor, 0); | |
1139 } | |
1140 } | |
1141 #endif | |
1142 } | |
1143 | |
33790
ab6d06f5b98b
Add const to some string pointer arguments that will not be modified.
ib
parents:
33775
diff
changeset
|
1144 void mplayerLoadSubtitle(const char *name) |
33745 | 1145 { |
33773 | 1146 if (guiInfo.Playing == 0) |
33745 | 1147 return; |
1148 | |
1149 if (subdata) { | |
1150 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_DeletingSubtitles); | |
1151 | |
1152 sub_free(subdata); | |
1153 subdata = NULL; | |
1154 vo_sub = NULL; | |
1155 | |
1156 if (vo_osd_list) { | |
1157 int len; | |
1158 mp_osd_obj_t *osd; | |
1159 | |
1160 osd = vo_osd_list; | |
1161 | |
1162 while (osd) { | |
1163 if (osd->type == OSDTYPE_SUBTITLE) | |
1164 break; | |
1165 | |
1166 osd = osd->next; | |
1167 } | |
1168 | |
1169 if (osd && (osd->flags & OSDFLAG_VISIBLE)) { | |
1170 len = osd->stride * (osd->bbox.y2 - osd->bbox.y1); | |
1171 memset(osd->bitmap_buffer, 0, len); | |
1172 memset(osd->alpha_buffer, 0, len); | |
1173 } | |
1174 } | |
1175 } | |
1176 | |
1177 if (name) { | |
1178 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_LoadingSubtitles, name); | |
1179 | |
33775 | 1180 subdata = sub_read_file(name, (guiInfo.sh_video ? guiInfo.sh_video->fps : 0)); |
33745 | 1181 |
1182 if (!subdata) | |
1183 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadSub, name); | |
1184 | |
1185 sub_name = (malloc(2 * sizeof(char *))); // when mplayer will be restarted | |
1186 sub_name[0] = strdup(name); // sub_name[0] will be read | |
1187 sub_name[1] = NULL; | |
1188 } | |
1189 | |
1190 update_set_of_subtitles(); | |
1191 } | |
1192 | |
33023 | 1193 // NOTE TO MYSELF: This function is nonsense. |
33289 | 1194 // MPlayer should pass messages to the GUI |
1195 // which must decide then which message has | |
1196 // to be shown (MSGL_FATAL, for example). | |
1197 // But with this function it is at least | |
1198 // possible to show GUI's very critical or | |
1199 // abort messages. | |
33023 | 1200 void gmp_msg(int mod, int lev, const char *format, ...) |
1201 { | |
1202 char msg[512]; | |
1203 va_list va; | |
1204 | |
1205 va_start(va, format); | |
1206 vsnprintf(msg, sizeof(msg), format, va); | |
1207 va_end(va); | |
1208 | |
1209 mp_msg(mod, lev, msg); | |
1210 | |
1211 if (mp_msg_test(mod, lev)) | |
1212 gtkMessageBox(GTK_MB_FATAL, msg); | |
1213 } |