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