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