Mercurial > mplayer.hg
annotate gui/interface.c @ 36864:c17524b27039
Cosmetic: Adjust indent.
author | ib |
---|---|
date | Sat, 01 Mar 2014 15:01:53 +0000 |
parents | 8c331bcef482 |
children | 80536f6e6f07 |
rev | line source |
---|---|
26458 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
23077 | 18 |
33754 | 19 #include <stdarg.h> |
36772
0da6c7ff95d2
Revise code of listMgr() command PLAYLIST_ITEM_GET_POS.
ib
parents:
36762
diff
changeset
|
20 #include <stdint.h> |
33754 | 21 #include <stdio.h> |
23077 | 22 #include <stdlib.h> |
23 #include <string.h> | |
24 | |
32984 | 25 #include "interface.h" |
35525 | 26 #include "app/app.h" |
36429 | 27 #include "app/cfg.h" |
35525 | 28 #include "app/gui.h" |
35529 | 29 #include "dialog/dialog.h" |
32984 | 30 #include "skin/skin.h" |
35772 | 31 #include "ui/actions.h" |
35528 | 32 #include "ui/ui.h" |
33741 | 33 #include "util/list.h" |
33739 | 34 #include "util/mem.h" |
33737 | 35 #include "util/string.h" |
23077 | 36 #include "wm/ws.h" |
37 #include "wm/wsxdnd.h" | |
38 | |
39 #include "access_mpcontext.h" | |
35462 | 40 #include "codec-cfg.h" |
32984 | 41 #include "config.h" |
23077 | 42 #include "help_mp.h" |
36032 | 43 #include "mixer.h" |
44 #include "mp_msg.h" | |
45 #include "mpcommon.h" | |
46 #include "mplayer.h" | |
47 #include "path.h" | |
32984 | 48 #include "input/input.h" |
49 #include "libaf/equalizer.h" | |
33689
8d0290220239
Replace numeric constants for gtkEquChannels array size.
ib
parents:
33688
diff
changeset
|
50 #include "libavutil/common.h" |
32984 | 51 #include "libmpcodecs/dec_audio.h" |
52 #include "libmpcodecs/dec_video.h" | |
53 #include "libmpcodecs/vd.h" | |
54 #include "libmpcodecs/vf.h" | |
33398 | 55 #include "libvo/video_out.h" |
32984 | 56 #include "libvo/x11_common.h" |
36292 | 57 #include "osdep/timer.h" |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
58 #ifdef CONFIG_DVDREAD |
23077 | 59 #include "stream/stream_dvd.h" |
60 #endif | |
35523 | 61 #include "sub/font_load.h" |
62 #include "sub/sub.h" | |
63 #include "sub/subreader.h" | |
23077 | 64 |
35524 | 65 /** |
66 * @brief Initialize interface data. | |
67 */ | |
33662 | 68 guiInterface_t guiInfo = { |
35430
2d55540614a9
Move uiProcessNextInPlaylist to the guiInfo structure.
ib
parents:
35429
diff
changeset
|
69 .StreamType = STREAMTYPE_DUMMY, |
2d55540614a9
Move uiProcessNextInPlaylist to the guiInfo structure.
ib
parents:
35429
diff
changeset
|
70 .Balance = 50.0f, |
35493 | 71 .PlaylistNext = True |
33662 | 72 }; |
23077 | 73 |
36049 | 74 static int guiInitialized; |
36650 | 75 static int orig_fontconfig; |
76 | |
77 /** | |
78 * @brief Set option 'fontconfig' depending on #font_name. | |
79 */ | |
80 static void set_fontconfig(void) | |
81 { | |
82 font_fontconfig = (font_name && strchr(font_name, '/') ? -1 : orig_fontconfig); | |
83 } | |
33265 | 84 |
33745 | 85 /* MPlayer -> GUI */ |
86 | |
35524 | 87 /** |
88 * @brief Initialize and start the GUI. | |
89 */ | |
32984 | 90 void guiInit(void) |
23077 | 91 { |
35794 | 92 int ret; |
34664
4df4d842d5fb
Remove global variable pointing to current playlist item.
ib
parents:
34663
diff
changeset
|
93 plItem *playlist; |
23077 | 94 |
33530 | 95 mp_msg(MSGT_GPLAYER, MSGL_V, "GUI init.\n"); |
96 | |
35627 | 97 /* check options */ |
98 | |
34403 | 99 if (!cdrom_device) |
100 cdrom_device = strdup(DEFAULT_CDROM_DEVICE); | |
101 if (!dvd_device) | |
102 dvd_device = strdup(DEFAULT_DVD_DEVICE); | |
35625 | 103 #ifdef CONFIG_DXR3 |
32984 | 104 if (!gtkDXR3Device) |
105 gtkDXR3Device = strdup("/dev/em8300-0"); | |
35625 | 106 #endif |
32927 | 107 |
32984 | 108 if (stream_cache_size > 0) { |
35493 | 109 gtkCacheOn = True; |
32984 | 110 gtkCacheSize = stream_cache_size; |
111 } else if (stream_cache_size == 0) | |
35493 | 112 gtkCacheOn = False; |
32984 | 113 |
114 if (autosync && (autosync != gtkAutoSync)) { | |
35493 | 115 gtkAutoSyncOn = True; |
32984 | 116 gtkAutoSync = autosync; |
117 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
118 |
32984 | 119 gtkASS.enabled = ass_enabled; |
120 gtkASS.use_margins = ass_use_margins; | |
121 gtkASS.top_margin = ass_top_margin; | |
122 gtkASS.bottom_margin = ass_bottom_margin; | |
23077 | 123 |
35627 | 124 /* initialize graphical user interfaces */ |
125 | |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
126 wsInit(mDisplay); |
35629 | 127 gtkInit(mDisplayName); |
32984 | 128 |
34684 | 129 /* load skin */ |
32984 | 130 |
36043 | 131 skinDirInHome = get_path("skins"); |
132 skinDirInData = MPLAYER_DATADIR "/skins"; | |
32984 | 133 |
33985 | 134 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #1: %s\n", skinDirInHome); |
36043 | 135 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] skin directory #2: %s\n", skinDirInData); |
32984 | 136 |
137 if (!skinName) | |
138 skinName = strdup("default"); | |
139 | |
35794 | 140 ret = skinRead(skinName); |
32984 | 141 |
35794 | 142 if (ret == -1 && strcmp(skinName, "default") != 0) { |
36694 | 143 mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_GUI_MSG_SkinCfgSelectedNotFound, skinName); |
32984 | 144 |
145 skinName = strdup("default"); | |
35794 | 146 ret = skinRead(skinName); |
32984 | 147 } |
148 | |
35794 | 149 switch (ret) { |
32984 | 150 case -1: |
36694 | 151 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_GUI_MSG_SkinCfgNotFound, skinName); |
33768 | 152 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); |
23077 | 153 |
32984 | 154 case -2: |
36694 | 155 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_GUI_MSG_SkinCfgError, skinName); |
33768 | 156 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); |
32984 | 157 } |
158 | |
34684 | 159 /* initialize windows */ |
32984 | 160 |
161 if (gui_save_pos) { | |
33218
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33053
diff
changeset
|
162 if (gui_main_pos_x != -3) |
33555 | 163 guiApp.main.x = gui_main_pos_x; |
33218
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33053
diff
changeset
|
164 if (gui_main_pos_y != -3) |
33555 | 165 guiApp.main.y = gui_main_pos_y; |
34697 | 166 if (gui_video_pos_x != -3) |
167 guiApp.video.x = gui_video_pos_x; | |
168 if (gui_video_pos_y != -3) | |
169 guiApp.video.y = gui_video_pos_y; | |
32984 | 170 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
171 |
32984 | 172 if (WinID > 0) { |
34697 | 173 guiApp.videoWindow.Parent = WinID; |
174 guiApp.video.x = 0; | |
175 guiApp.video.y = 0; | |
32984 | 176 } |
23077 | 177 |
32984 | 178 if (guiWinID >= 0) |
33555 | 179 guiApp.mainWindow.Parent = guiWinID; |
23077 | 180 |
35780 | 181 uiMainInit(); // main window must be first! |
35781 | 182 uiVideoInit(); // video window must be second! |
35780 | 183 uiPlaybarInit(); |
184 uiMenuInit(); | |
23077 | 185 |
36843 | 186 WinID = (Window)guiApp.videoWindow.WindowID; |
32984 | 187 |
33555 | 188 btnModify(evSetVolume, guiInfo.Volume); |
189 btnModify(evSetBalance, guiInfo.Balance); | |
190 btnModify(evSetMoviePosition, guiInfo.Position); | |
23077 | 191 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
192 wsWindowVisibility(&guiApp.mainWindow, wsShowWindow); |
23077 | 193 |
32984 | 194 if (gtkShowVideoWindow) { |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
195 wsWindowVisibility(&guiApp.videoWindow, wsShowWindow); |
33960 | 196 |
35654 | 197 guiInfo.VideoWindow = True; |
23077 | 198 |
33960 | 199 if (gtkLoadFullscreen) |
33555 | 200 uiFullScreen(); |
33960 | 201 } else |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
202 wsWindowBackground(&guiApp.videoWindow, 0, 0, 0); |
32984 | 203 |
33960 | 204 if (gtkLoadFullscreen) |
33978 | 205 btnSet(evFullScreen, btnPressed); |
32984 | 206 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
207 guiInfo.Playing = GUI_STOP; |
33609 | 208 |
34664
4df4d842d5fb
Remove global variable pointing to current playlist item.
ib
parents:
34663
diff
changeset
|
209 playlist = listMgr(PLAYLIST_ITEM_GET_CURR, 0); |
4df4d842d5fb
Remove global variable pointing to current playlist item.
ib
parents:
34663
diff
changeset
|
210 |
4df4d842d5fb
Remove global variable pointing to current playlist item.
ib
parents:
34663
diff
changeset
|
211 if (playlist && !filename) { |
35452 | 212 uiSetFile(playlist->path, playlist->name, STREAMTYPE_FILE); |
36772
0da6c7ff95d2
Revise code of listMgr() command PLAYLIST_ITEM_GET_POS.
ib
parents:
36762
diff
changeset
|
213 guiInfo.Tracks = (uintptr_t)listMgr(PLAYLIST_ITEM_GET_POS, 0); |
35489 | 214 guiInfo.Track = 1; |
215 filename = NULL; // don't start playing | |
34064 | 216 } |
32984 | 217 |
218 if (subdata) | |
33897 | 219 setdup(&guiInfo.SubtitleFilename, subdata->filename); |
32984 | 220 |
36650 | 221 orig_fontconfig = font_fontconfig; |
222 set_fontconfig(); | |
223 | |
36049 | 224 guiInitialized = True; |
23077 | 225 } |
226 | |
35524 | 227 /** |
228 * @brief Stop and finalize the GUI. | |
229 */ | |
32984 | 230 void guiDone(void) |
23077 | 231 { |
36049 | 232 if (guiInitialized) { |
33308 | 233 if (gui_save_pos) { |
34698 | 234 gui_main_pos_x = guiApp.mainWindow.X; |
235 gui_main_pos_y = guiApp.mainWindow.Y; | |
35664 | 236 gui_video_pos_x = guiApp.videoWindow.X; |
237 gui_video_pos_y = guiApp.videoWindow.Y; | |
33308 | 238 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
239 |
33308 | 240 ass_enabled = gtkASS.enabled; |
241 ass_use_margins = gtkASS.use_margins; | |
242 ass_top_margin = gtkASS.top_margin; | |
243 ass_bottom_margin = gtkASS.bottom_margin; | |
23077 | 244 |
33308 | 245 cfg_write(); |
35746 | 246 |
35796
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35794
diff
changeset
|
247 if (guiApp.menuIsPresent) |
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35794
diff
changeset
|
248 uiMenuDone(); |
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35794
diff
changeset
|
249 if (guiApp.playbarIsPresent) |
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35794
diff
changeset
|
250 uiPlaybarDone(); |
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35794
diff
changeset
|
251 |
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35794
diff
changeset
|
252 uiVideoDone(); |
497a1c45a597
Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents:
35794
diff
changeset
|
253 uiMainDone(); |
35746 | 254 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
255 wsDone(); |
33307 | 256 } |
33263 | 257 |
35549 | 258 uiUnsetFile(); |
34663 | 259 listMgr(PLAYLIST_DELETE, 0); |
260 listMgr(URLLIST_DELETE, 0); | |
35550 | 261 appFreeStruct(); |
33542 | 262 free(guiIcon.collection); |
33307 | 263 |
264 if (gui_conf) { | |
265 m_config_free(gui_conf); | |
266 gui_conf = NULL; | |
267 } | |
33530 | 268 |
269 mp_msg(MSGT_GPLAYER, MSGL_V, "GUI done.\n"); | |
33263 | 270 } |
271 | |
32984 | 272 static void add_vf(char *str) |
23077 | 273 { |
32984 | 274 void *p; |
275 | |
276 if (vf_settings) { | |
277 int i = 0; | |
278 | |
279 while (vf_settings[i].name) { | |
280 if (!gstrcmp(vf_settings[i++].name, str)) { | |
281 i = -1; | |
282 break; | |
283 } | |
284 } | |
285 | |
286 if (i != -1) { | |
287 p = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t)); | |
32712 | 288 |
32984 | 289 if (!p) |
290 return; | |
291 | |
292 vf_settings = p; | |
293 vf_settings[i].name = strdup(str); | |
294 vf_settings[i].attribs = NULL; | |
295 vf_settings[i + 1].name = NULL; | |
296 } | |
297 } else { | |
298 vf_settings = malloc(2 * sizeof(m_obj_settings_t)); | |
299 vf_settings[0].name = strdup(str); | |
300 vf_settings[0].attribs = NULL; | |
301 vf_settings[1].name = NULL; | |
32712 | 302 } |
303 | |
36694 | 304 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, str); |
23077 | 305 } |
306 | |
35524 | 307 /** |
308 * @brief Issue a command to the GUI. | |
309 * | |
310 * @note The GUI is controlled by giving it commands. | |
311 * | |
312 * @param what command to be performed | |
313 * @param data pointer to data needed for the command | |
314 * | |
315 * @return #True (ok) or #False (error) | |
316 */ | |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
317 int gui(int what, void *data) |
23077 | 318 { |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
319 #ifdef CONFIG_DVDREAD |
33687 | 320 dvd_priv_t *dvd; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
321 #endif |
36779 | 322 int idata = (intptr_t)data, msg, state; |
36456 | 323 stream_t *stream = NULL; |
36455 | 324 sh_audio_t *sh_audio; |
36454 | 325 mixer_t *mixer; |
36457 | 326 plItem *next = NULL; |
23077 | 327 |
33726 | 328 switch (what) { |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
329 case GUI_SET_CONTEXT: |
35541 | 330 |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
331 guiInfo.mpcontext = data; |
23077 | 332 break; |
32984 | 333 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
334 case GUI_SET_STATE: |
32984 | 335 |
36779 | 336 switch (idata) { |
33631 | 337 case GUI_STOP: |
33614 | 338 case GUI_PLAY: |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
339 // if ( !gtkShowVideoWindow ) wsWindowVisibility( &guiApp.videoWindow,wsHideWindow ); |
33614 | 340 case GUI_PAUSE: |
36779 | 341 guiInfo.Playing = idata; |
32984 | 342 break; |
343 } | |
344 | |
33555 | 345 uiState(); |
23077 | 346 break; |
32984 | 347 |
36294 | 348 case GUI_REDRAW: |
349 | |
350 uiEvent(ivRedraw, 0); | |
35541 | 351 |
33901 | 352 if (!guiInfo.Playing || !guiInfo.VideoWindow) |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
353 wsEvents(); |
36068 | 354 /* else it's handled by the vo driver calling GUI_HANDLE_X_EVENT */ |
35541 | 355 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
356 wsMouseAutohide(); |
36070 | 357 gtkEvents(); |
35541 | 358 |
33732 | 359 break; |
360 | |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
361 case GUI_RUN_COMMAND: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
362 |
36779 | 363 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_COMMAND: %d\n", idata); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
364 |
36779 | 365 switch (idata) { |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
366 case MP_CMD_VO_FULLSCREEN: |
35773 | 367 uiEvent(evFullScreen, True); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
368 break; |
33696
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
369 |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
370 case MP_CMD_PLAY_TREE_STEP: |
35773 | 371 uiEvent(evNext, 0); |
33696
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
372 break; |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
373 |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
374 case -MP_CMD_PLAY_TREE_STEP: |
35773 | 375 uiEvent(evPrev, 0); |
33696
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
376 break; |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
377 |
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
378 case MP_CMD_STOP: |
35773 | 379 uiEvent(evStop, 0); |
33696
24d919fb6778
Don't let MPlayer directly call user interface functions.
ib
parents:
33695
diff
changeset
|
380 break; |
33697 | 381 |
382 case MP_CMD_QUIT: | |
35773 | 383 uiEvent(evExit, 0); |
33697 | 384 break; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
385 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
386 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
387 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
388 |
34339 | 389 case GUI_RUN_MESSAGE: |
35541 | 390 |
34339 | 391 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_MESSAGE: %s\n", (const char *)data); |
392 msg = appFindMessage((const char *)data); | |
35541 | 393 |
34458 | 394 if ((msg == evMenu) || appFindItem(msg)) |
35773 | 395 uiEvent(msg, 0); |
35541 | 396 |
34339 | 397 break; |
398 | |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
399 case GUI_PREPARE: |
32984 | 400 |
36292 | 401 uiEvent(ivRedraw, True); |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
402 wsMouseVisibility(&guiApp.videoWindow, wsHideMouseCursor); |
36292 | 403 usec_sleep(20000); |
404 wsEvents(); | |
32984 | 405 |
34052 | 406 if (guiInfo.NewPlay == GUI_FILE_NEW) { |
407 audio_id = -1; | |
408 video_id = -1; | |
409 dvdsub_id = -1; | |
410 vobsub_id = -1; | |
411 | |
412 stream_cache_size = -1; | |
413 autosync = 0; | |
414 force_fps = 0; | |
415 } | |
34032 | 416 |
33555 | 417 switch (guiInfo.StreamType) { |
34073 | 418 case STREAMTYPE_FILE: |
419 case STREAMTYPE_STREAM: | |
35484 | 420 filename = guiInfo.Filename; |
32984 | 421 break; |
422 | |
34387 | 423 case STREAMTYPE_CDDA: |
424 { | |
425 char tmp[512]; | |
426 | |
427 sprintf(tmp, "cdda://%d", guiInfo.Track); | |
35452 | 428 uiSetFile(NULL, tmp, SAME_STREAMTYPE); |
34387 | 429 } |
430 break; | |
431 | |
32984 | 432 case STREAMTYPE_VCD: |
433 { | |
434 char tmp[512]; | |
435 | |
33874 | 436 sprintf(tmp, "vcd://%d", guiInfo.Track); |
35452 | 437 uiSetFile(NULL, tmp, SAME_STREAMTYPE); |
32984 | 438 } |
439 break; | |
440 | |
441 case STREAMTYPE_DVD: | |
442 { | |
443 char tmp[512]; | |
444 | |
33876
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
445 sprintf(tmp, "dvd://%d", guiInfo.Track); |
35452 | 446 uiSetFile(NULL, tmp, SAME_STREAMTYPE); |
32984 | 447 } |
35168 | 448 #ifdef CONFIG_DVDREAD |
33555 | 449 dvd_chapter = guiInfo.Chapter; |
450 dvd_angle = guiInfo.Angle; | |
35168 | 451 #endif |
32984 | 452 break; |
36429 | 453 |
454 case STREAMTYPE_TV: | |
455 case STREAMTYPE_DVB: | |
456 { | |
457 char tmp[512]; | |
458 | |
459 sprintf(tmp, "%s://", guiTV[gui_tv_digital].SchemeName); | |
460 uiSetFile(NULL, tmp, SAME_STREAMTYPE); | |
461 } | |
32984 | 462 } |
463 | |
34684 | 464 /* video opts */ |
32984 | 465 |
466 if (!video_driver_list) { | |
467 int i = 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
468 |
32984 | 469 while (video_out_drivers[i++]) { |
470 if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) { | |
36841 | 471 listSet(&video_driver_list, video_out_drivers[i - 1]->info->short_name); |
32984 | 472 break; |
473 } | |
474 } | |
475 } | |
476 | |
477 if (!video_driver_list && !video_driver_list[0]) { | |
36694 | 478 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_GUI_MSG_VideoOutError); |
33768 | 479 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); |
32984 | 480 } |
481 | |
482 { | |
483 int i = 0; | |
484 | |
36863 | 485 guiInfo.VideoWindow = False; |
32984 | 486 |
487 while (video_out_drivers[i++]) { | |
36864 | 488 if ((video_driver_list && !gstrcmp(video_driver_list[0], video_out_drivers[i - 1]->info->short_name)) && (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE)) { |
489 guiInfo.VideoWindow = True; | |
490 break; | |
491 } | |
32984 | 492 } |
493 } | |
494 | |
495 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3")) | |
33555 | 496 if (guiInfo.StreamType != STREAMTYPE_DVD && guiInfo.StreamType != STREAMTYPE_VCD) |
32984 | 497 if (gtkVfLAVC) |
498 add_vf("lavc"); | |
499 | |
500 if (gtkVfPP) | |
501 add_vf("pp"); | |
502 | |
34684 | 503 /* audio opts */ |
32984 | 504 |
505 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } | |
506 if (gtkAONorm) | |
34610 | 507 listRepl(&af_cfg.list, "volnorm", "volnorm"); |
32984 | 508 |
509 if (gtkEnableAudioEqualizer) | |
34610 | 510 listRepl(&af_cfg.list, "equalizer", "equalizer"); |
32984 | 511 |
512 if (gtkAOExtraStereo) { | |
513 char *name; | |
514 | |
515 name = malloc(12 + 20 + 1); | |
516 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); | |
517 name[12 + 20] = 0; | |
34610 | 518 listRepl(&af_cfg.list, "extrastereo", name); |
32984 | 519 free(name); |
520 } | |
521 | |
522 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "oss", 3)) { | |
523 mixer_device = gtkAOOSSMixer; | |
524 mixer_channel = gtkAOOSSMixerChannel; | |
525 | |
526 if (gtkAOOSSDevice) { | |
34625 | 527 char *tmp; |
34624 | 528 |
32984 | 529 tmp = calloc(1, strlen(gtkAOOSSDevice) + 7); |
530 sprintf(tmp, "oss:%s", gtkAOOSSDevice); | |
34625 | 531 listSet(&audio_driver_list, tmp); |
532 free(tmp); | |
34624 | 533 } |
32984 | 534 } |
535 | |
536 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "alsa", 4)) { | |
537 mixer_device = gtkAOALSAMixer; | |
538 mixer_channel = gtkAOALSAMixerChannel; | |
539 | |
540 if (gtkAOALSADevice) { | |
34625 | 541 char *tmp; |
34624 | 542 |
32984 | 543 tmp = calloc(1, strlen(gtkAOALSADevice) + 14); |
544 sprintf(tmp, "alsa:device=%s", gtkAOALSADevice); | |
34625 | 545 listSet(&audio_driver_list, tmp); |
546 free(tmp); | |
34624 | 547 } |
32984 | 548 } |
549 | |
550 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "sdl", 3)) { | |
34624 | 551 if (gtkAOSDLDriver) { |
34625 | 552 char *tmp; |
32984 | 553 |
554 tmp = calloc(1, strlen(gtkAOSDLDriver) + 10); | |
555 sprintf(tmp, "sdl:%s", gtkAOSDLDriver); | |
34625 | 556 listSet(&audio_driver_list, tmp); |
557 free(tmp); | |
34624 | 558 } |
32984 | 559 } |
560 | |
561 if (audio_driver_list && !gstrncmp(audio_driver_list[0], "esd", 3)) { | |
34624 | 562 if (gtkAOESDDevice) { |
34625 | 563 char *tmp; |
32984 | 564 |
565 tmp = calloc(1, strlen(gtkAOESDDevice) + 10); | |
566 sprintf(tmp, "esd:%s", gtkAOESDDevice); | |
34625 | 567 listSet(&audio_driver_list, tmp); |
568 free(tmp); | |
34624 | 569 } |
32984 | 570 } |
571 | |
34684 | 572 /* subtitle */ |
32984 | 573 |
33897 | 574 // subdata->filename=gstrdup( guiInfo.SubtitleFilename ); |
32984 | 575 stream_dump_type = 0; |
576 | |
577 if (gtkSubDumpMPSub) | |
578 stream_dump_type = 4; | |
579 | |
580 if (gtkSubDumpSrt) | |
581 stream_dump_type = 6; | |
582 | |
35493 | 583 gtkSubDumpMPSub = gtkSubDumpSrt = False; |
23077 | 584 |
34684 | 585 /* misc */ |
32984 | 586 |
587 if (gtkCacheOn) | |
588 stream_cache_size = gtkCacheSize; | |
589 | |
590 if (gtkAutoSyncOn) | |
591 autosync = gtkAutoSync; | |
23077 | 592 |
33897 | 593 if (guiInfo.AudioFilename) |
594 audio_stream = gstrdup(guiInfo.AudioFilename); | |
33894 | 595 else if (guiInfo.NewPlay == GUI_FILE_NEW) |
33739 | 596 nfree(audio_stream); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
597 |
32984 | 598 // audio_stream = NULL; |
599 | |
33555 | 600 guiInfo.NewPlay = 0; |
23077 | 601 |
32984 | 602 ass_enabled = gtkASS.enabled; |
603 ass_use_margins = gtkASS.use_margins; | |
604 ass_top_margin = gtkASS.top_margin; | |
23077 | 605 ass_bottom_margin = gtkASS.bottom_margin; |
606 | |
32984 | 607 break; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
608 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
609 case GUI_SET_STREAM: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
610 |
34859 | 611 if (guiInfo.StreamType == STREAMTYPE_PLAYLIST) |
612 guiInfo.mpcontext->file_format = DEMUXER_TYPE_PLAYLIST; | |
36456 | 613 else { |
36457 | 614 stream = data; |
615 guiInfo.StreamType = stream->type; | |
36456 | 616 } |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
617 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
618 switch (guiInfo.StreamType) { |
34424 | 619 case STREAMTYPE_FILE: |
620 case STREAMTYPE_STREAM: | |
36772
0da6c7ff95d2
Revise code of listMgr() command PLAYLIST_ITEM_GET_POS.
ib
parents:
36762
diff
changeset
|
621 guiInfo.Tracks = (uintptr_t)listMgr(PLAYLIST_ITEM_GET_POS, 0); |
34424 | 622 break; |
623 | |
34387 | 624 case STREAMTYPE_CDDA: |
625 guiInfo.Tracks = 0; | |
626 stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); | |
36437
eb6cdd6b9b86
Update track information at GUI_SET_STREAM for CDDA and VCD.
ib
parents:
36430
diff
changeset
|
627 if (stream_control(stream, STREAM_CTRL_GET_CURRENT_TITLE, &guiInfo.Track) == STREAM_OK) |
eb6cdd6b9b86
Update track information at GUI_SET_STREAM for CDDA and VCD.
ib
parents:
36430
diff
changeset
|
628 guiInfo.Track++; |
34387 | 629 break; |
630 | |
34077 | 631 case STREAMTYPE_VCD: |
632 guiInfo.Tracks = 0; | |
34388
9ee95c78e85f
Replace VCD's STREAM_CTRL_GET_NUM_CHAPTERS by STREAM_CTRL_GET_NUM_TITLES.
ib
parents:
34387
diff
changeset
|
633 stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); |
36437
eb6cdd6b9b86
Update track information at GUI_SET_STREAM for CDDA and VCD.
ib
parents:
36430
diff
changeset
|
634 if (stream_control(stream, STREAM_CTRL_GET_CURRENT_TITLE, &guiInfo.Track) == STREAM_OK) |
eb6cdd6b9b86
Update track information at GUI_SET_STREAM for CDDA and VCD.
ib
parents:
36430
diff
changeset
|
635 guiInfo.Track++; |
34077 | 636 break; |
637 | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
638 case STREAMTYPE_DVD: |
34389
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
639 guiInfo.Tracks = 0; |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
640 stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
641 guiInfo.Chapters = 0; |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
642 stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.Chapters); |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
643 guiInfo.Angles = 0; |
b2d661762e90
Retrieve DVD's titles, chapters and angles by stream control commands.
ib
parents:
34388
diff
changeset
|
644 stream_control(stream, STREAM_CTRL_GET_NUM_ANGLES, &guiInfo.Angles); |
36430
08f21a09a545
Don't discard current DVD track information without cause.
ib
parents:
36429
diff
changeset
|
645 if (stream_control(stream, STREAM_CTRL_GET_CURRENT_TITLE, &guiInfo.Track) == STREAM_OK) |
08f21a09a545
Don't discard current DVD track information without cause.
ib
parents:
36429
diff
changeset
|
646 guiInfo.Track++; |
35168 | 647 // guiInfo.Chapter will be set by mplayer |
648 guiInfo.Angle = 1; | |
649 stream_control(stream, STREAM_CTRL_GET_ANGLE, &guiInfo.Angle); | |
34454 | 650 #ifdef CONFIG_DVDREAD |
33730 | 651 dvd = stream->priv; |
33902 | 652 guiInfo.AudioStreams = dvd->nr_of_channels; |
653 memcpy(guiInfo.AudioStream, dvd->audio_streams, sizeof(dvd->audio_streams)); | |
654 guiInfo.Subtitles = dvd->nr_of_subtitles; | |
655 memcpy(guiInfo.Subtitle, dvd->subtitles, sizeof(dvd->subtitles)); | |
34454 | 656 #endif |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
657 break; |
36429 | 658 |
659 case STREAMTYPE_TV: | |
660 case STREAMTYPE_DVB: | |
36437
eb6cdd6b9b86
Update track information at GUI_SET_STREAM for CDDA and VCD.
ib
parents:
36430
diff
changeset
|
661 guiInfo.Tracks = guiInfo.Track = 1; |
36429 | 662 break; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
663 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
664 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
665 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
666 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
667 case GUI_SET_VIDEO: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
668 |
34684 | 669 /* video */ |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
670 |
36265 | 671 guiInfo.sh_video = data; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
672 |
35462 | 673 nfree(guiInfo.CodecName); |
674 | |
675 if (guiInfo.sh_video) | |
676 guiInfo.CodecName = strdup(guiInfo.sh_video->codec->name); | |
677 | |
36429 | 678 state = (isSeekableStreamtype ? btnReleased : btnDisabled); |
34074
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
679 btnSet(evForward10sec, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
680 btnSet(evBackward10sec, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
681 btnSet(evForward1min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
682 btnSet(evBackward1min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
683 btnSet(evForward10min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
684 btnSet(evBackward10min, state); |
360ed500a6e9
Set all buttons related to seek operations according to stream type.
ib
parents:
34073
diff
changeset
|
685 btnSet(evSetMoviePosition, state); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
686 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
687 if (video_driver_list && !gstrcmp(video_driver_list[0], "dxr3") && (((demuxer_t *)mpctx_get_demuxer(guiInfo.mpcontext))->file_format != DEMUXER_TYPE_MPEG_PS) && !gtkVfLAVC) { |
36694 | 688 gtkMessageBox(MSGBOX_FATAL, MSGTR_GUI_MSG_DXR3NeedsLavc); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
689 return False; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
690 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
691 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
692 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
693 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
694 case GUI_SET_AUDIO: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
695 |
36455 | 696 sh_audio = data; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
697 |
36455 | 698 guiInfo.AudioChannels = sh_audio ? sh_audio->channels : 0; |
699 | |
700 if (sh_audio && !guiInfo.sh_video) { | |
33901 | 701 guiInfo.VideoWindow = False; |
35454 | 702 guiInfo.VideoWidth = 0; |
703 guiInfo.VideoHeight = 0; | |
704 } | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
705 |
36454 | 706 gui(GUI_SET_MIXER, mpctx_get_mixer(guiInfo.mpcontext)); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
707 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
708 if (gtkEnableAudioEqualizer) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
709 equalizer_t eq; |
33693
006a2db8bd55
Use unsigned index variable for comparison with array size.
ib
parents:
33692
diff
changeset
|
710 unsigned int i, j; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
711 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
712 for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
713 for (j = 0; j < FF_ARRAY_ELEMS(*gtkEquChannels); j++) { |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
714 eq.channel = i; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
715 eq.band = j; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
716 eq.gain = gtkEquChannels[i][j]; |
33766 | 717 mplayer(MPLAYER_SET_EQUALIZER, 0, &eq); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
718 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
719 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
720 } |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
721 |
33960 | 722 // These must be done here (in the last call from MPlayer before |
723 // playback starts) and not in GUI_SETUP_VIDEO_WINDOW, because... | |
724 | |
725 // ...without video there will be no call to GUI_SETUP_VIDEO_WINDOW | |
726 if (!guiInfo.VideoWindow) { | |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
727 wsWindowVisibility(&guiApp.videoWindow, wsHideWindow); |
33978 | 728 btnSet(evFullScreen, (gtkLoadFullscreen ? btnPressed : btnReleased)); |
33960 | 729 } |
730 | |
731 // ...option variable fullscreen determines whether MPlayer will handle | |
732 // the window given by WinID as fullscreen window (and will do aspect | |
733 // scaling then) or not - quite rubbish | |
734 fullscreen = gtkLoadFullscreen; | |
735 | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
736 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
737 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
738 case GUI_SET_MIXER: |
35535 | 739 |
36454 | 740 mixer = data; |
35535 | 741 |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
742 if (mixer) { |
35537 | 743 float l, r, b; |
35542 | 744 static float last_balance = 50.0f; |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
745 |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
746 mixer_getvolume(mixer, &l, &r); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
747 guiInfo.Volume = FFMAX(l, r); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
748 btnModify(evSetVolume, guiInfo.Volume); |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
749 |
35537 | 750 mixer_getbalance(mixer, &b); |
35544 | 751 guiInfo.Balance = (b + 1.0) * 50.0; // transform -1..1 to 0..100 |
35542 | 752 |
753 if (guiInfo.Balance != last_balance) { | |
754 l = guiInfo.Volume * (100.0 - guiInfo.Balance) / 50.0; | |
755 r = guiInfo.Volume * guiInfo.Balance / 50.0; | |
756 mixer_setvolume(mixer, FFMIN(l, guiInfo.Volume), FFMIN(r, guiInfo.Volume)); | |
757 btnModify(evSetBalance, guiInfo.Balance); | |
758 last_balance = guiInfo.Balance; | |
759 } | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
760 } |
35541 | 761 |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
762 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
763 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
764 case GUI_SETUP_VIDEO_WINDOW: |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
765 |
33901 | 766 guiInfo.VideoWidth = vo_dwidth; |
767 guiInfo.VideoHeight = vo_dheight; | |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
768 |
34697 | 769 if (!guiApp.videoWindow.isFullScreen || !guiApp.videoWindow.Mapped) { |
770 if (!guiApp.videoWindow.isFullScreen) | |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
771 wsWindowResize(&guiApp.videoWindow, guiInfo.VideoWidth, guiInfo.VideoHeight); |
34697 | 772 if (!guiApp.videoWindow.Mapped) |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
773 wsWindowVisibility(&guiApp.videoWindow, wsShowWindow); |
33960 | 774 } |
775 | |
34697 | 776 if (gtkLoadFullscreen ^ guiApp.videoWindow.isFullScreen) |
35773 | 777 uiEvent(evFullScreen, True); |
33960 | 778 |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
779 if (guiWinID >= 0) |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
780 wsWindowMove(&guiApp.mainWindow, True, 0, guiInfo.VideoHeight); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
781 |
35755
589cf8a5f165
Realize a smooth and flicker-free video when resizing during playback.
ib
parents:
35748
diff
changeset
|
782 wsWindowBackground(&guiApp.videoWindow, -1, -1, -1); |
589cf8a5f165
Realize a smooth and flicker-free video when resizing during playback.
ib
parents:
35748
diff
changeset
|
783 |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
784 break; |
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
785 |
33733 | 786 case GUI_HANDLE_X_EVENT: |
35541 | 787 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
788 wsEvent(data); |
33692
0e9a5c0194ed
Cosmetic: Arrange guiGetEvent() types in the sequence they are called.
ib
parents:
33691
diff
changeset
|
789 break; |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
790 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
791 case GUI_END_FILE: |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
792 |
35330 | 793 guiInfo.sh_video = NULL; |
34035 | 794 |
35773 | 795 uiEvent(ivRedraw, True); |
34052 | 796 |
35565
5f7a983fc838
Embrace several individual "if (guiInfo.Playing)" conditions.
ib
parents:
35564
diff
changeset
|
797 if (guiInfo.Playing) { |
35566 | 798 if (!guiInfo.PlaylistNext) { |
799 guiInfo.PlaylistNext = True; | |
800 break; | |
801 } | |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
802 |
35566 | 803 if (guiInfo.StreamType == STREAMTYPE_CDDA && guiInfo.Track < guiInfo.Tracks) { |
804 uiNext(); | |
805 break; | |
806 } | |
34387 | 807 |
35468
047fc4746236
Cosmetic: Adjust indent and move guiInfo member CodecName in structure.
ib
parents:
35467
diff
changeset
|
808 next = listMgr(PLAYLIST_ITEM_GET_NEXT, 0); |
35565
5f7a983fc838
Embrace several individual "if (guiInfo.Playing)" conditions.
ib
parents:
35564
diff
changeset
|
809 } |
34669
697aaedfe59e
Remove global variable pointing to playlist item last played.
ib
parents:
34667
diff
changeset
|
810 |
35565
5f7a983fc838
Embrace several individual "if (guiInfo.Playing)" conditions.
ib
parents:
35564
diff
changeset
|
811 if (next) { |
35452 | 812 uiSetFile(next->path, next->name, STREAMTYPE_FILE); |
34066 | 813 guiInfo.NewPlay = GUI_FILE_NEW; |
36772
0da6c7ff95d2
Revise code of listMgr() command PLAYLIST_ITEM_GET_POS.
ib
parents:
36762
diff
changeset
|
814 guiInfo.Track = (uintptr_t)listMgr(PLAYLIST_ITEM_GET_POS, next); |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
815 } else { |
33894 | 816 if (guiInfo.NewPlay == GUI_FILE_NEW) |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
817 break; |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
818 |
34113 | 819 filename = NULL; |
820 | |
35546
cd2c85083fdd
Reset playlist to first item after playback has stopped.
ib
parents:
35544
diff
changeset
|
821 if (isPlaylistStreamtype) { |
35555 | 822 plItem *curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0); |
823 | |
824 if (!curr) | |
35547 | 825 uiUnsetFile(); |
35558 | 826 else if ((curr != listMgr(PLAYLIST_GET, 0)) && guiInfo.Playing) { |
35555 | 827 curr = listMgr(PLAYLIST_ITEM_SET_CURR, listMgr(PLAYLIST_GET, 0)); |
35546
cd2c85083fdd
Reset playlist to first item after playback has stopped.
ib
parents:
35544
diff
changeset
|
828 uiSetFile(curr->path, curr->name, STREAMTYPE_FILE); |
35551
99a11b051705
Set track number after resetting playlist to first item.
ib
parents:
35550
diff
changeset
|
829 guiInfo.Track = 1; |
35546
cd2c85083fdd
Reset playlist to first item after playback has stopped.
ib
parents:
35544
diff
changeset
|
830 } |
35559
14e36699a6e7
Relocate code to set Track, Chapter and Angle start values.
ib
parents:
35558
diff
changeset
|
831 } else if (guiInfo.Playing) { |
35563
d4a84f674401
Reset media information for CD/VCD/DVD after playback.
ib
parents:
35559
diff
changeset
|
832 int first = (guiInfo.StreamType == STREAMTYPE_VCD ? 2 : 1); |
35559
14e36699a6e7
Relocate code to set Track, Chapter and Angle start values.
ib
parents:
35558
diff
changeset
|
833 |
35563
d4a84f674401
Reset media information for CD/VCD/DVD after playback.
ib
parents:
35559
diff
changeset
|
834 if (guiInfo.Track != first) { |
35568 | 835 uiUnsetMedia(True); |
35563
d4a84f674401
Reset media information for CD/VCD/DVD after playback.
ib
parents:
35559
diff
changeset
|
836 guiInfo.Track = first; |
d4a84f674401
Reset media information for CD/VCD/DVD after playback.
ib
parents:
35559
diff
changeset
|
837 } |
35564
8d4a7387d592
Relocate and change code to set Chapter and Angle start values.
ib
parents:
35563
diff
changeset
|
838 |
8d4a7387d592
Relocate and change code to set Chapter and Angle start values.
ib
parents:
35563
diff
changeset
|
839 if (guiInfo.StreamType == STREAMTYPE_DVD) { |
8d4a7387d592
Relocate and change code to set Chapter and Angle start values.
ib
parents:
35563
diff
changeset
|
840 guiInfo.Chapter = 1; |
8d4a7387d592
Relocate and change code to set Chapter and Angle start values.
ib
parents:
35563
diff
changeset
|
841 guiInfo.Angle = 1; |
8d4a7387d592
Relocate and change code to set Chapter and Angle start values.
ib
parents:
35563
diff
changeset
|
842 } |
35546
cd2c85083fdd
Reset playlist to first item after playback has stopped.
ib
parents:
35544
diff
changeset
|
843 } |
35381
746e2e0577b2
Without current playlist item, reset guiInfo's Filename and StreamType.
ib
parents:
35376
diff
changeset
|
844 |
35413 | 845 guiInfo.ElapsedTime = 0; |
36279 | 846 guiInfo.Position = 0.0f; |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
847 |
33960 | 848 if (gtkShowVideoWindow) { |
849 guiInfo.VideoWindow = True; | |
850 | |
35663
d1f84b219340
Don't unnecessarily and annoyingly move the video window.
ib
parents:
35658
diff
changeset
|
851 if (!guiApp.videoWindow.isFullScreen) |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
852 wsWindowResize(&guiApp.videoWindow, guiApp.video.width, guiApp.video.height); |
33960 | 853 |
34697 | 854 if (!guiApp.videoWindow.Mapped) |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
855 wsWindowVisibility(&guiApp.videoWindow, wsShowWindow); |
33960 | 856 |
34697 | 857 if (gtkLoadFullscreen ^ guiApp.videoWindow.isFullScreen) |
35773 | 858 uiEvent(evFullScreen, False); |
33960 | 859 } else { |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
860 wsWindowVisibility(&guiApp.videoWindow, wsHideWindow); |
33960 | 861 guiInfo.VideoWindow = False; |
33978 | 862 btnSet(evFullScreen, (gtkLoadFullscreen ? btnPressed : btnReleased)); |
33960 | 863 } |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
864 |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33730
diff
changeset
|
865 gui(GUI_SET_STATE, (void *)GUI_STOP); |
33959 | 866 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
867 wsWindowRedraw(&guiApp.videoWindow); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35678
diff
changeset
|
868 wsMouseVisibility(&guiApp.videoWindow, wsShowMouseCursor); |
36293 | 869 wsEvents(); |
33694
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
870 } |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
871 |
45553d0f65c6
Don't let MPlayer directly call user interface functions.
ib
parents:
33693
diff
changeset
|
872 break; |
32984 | 873 } |
874 | |
33666
0f592e8530f1
Change return code of guiGetEvent() to indicate success.
ib
parents:
33664
diff
changeset
|
875 return True; |
23077 | 876 } |
877 | |
35517 | 878 /** |
879 * @brief Initialize the GUI playlist (i.e. import files that had been given | |
880 * on the command line) or add files "on the fly" (i.e. replace the | |
881 * current one (a playlist file) by other ones (its content)). | |
882 * | |
883 * @param what command (#GUI_PLAYLIST_INIT or #GUI_PLAYLIST_ADD) to be performed | |
884 * @param playtree MPlayer playtree to read from | |
885 * @param config MPlayer config context | |
886 * @param enqueue whether to overwrite GUI playlist (#False) or to append to it (#True) | |
887 * | |
888 * @return #True (ok) or #False (error) | |
889 */ | |
35512 | 890 int guiPlaylist(int what, play_tree_t *playtree, m_config_t *config, int enqueue) |
35510 | 891 { |
35513 | 892 play_tree_iter_t *pt_iter; |
35519
7f1be403a640
Don't unnecessarily use global MPlayer variable filename.
ib
parents:
35518
diff
changeset
|
893 const char *file; |
35510 | 894 int added = False; |
35512 | 895 plItem *curr; |
35510 | 896 |
35513 | 897 pt_iter = pt_iter_create(&playtree, config); |
898 | |
899 if (!pt_iter) | |
900 return False; | |
901 | |
35510 | 902 switch (what) { |
903 case GUI_PLAYLIST_INIT: | |
33746 | 904 |
35511 | 905 if (!enqueue) |
35517 | 906 listMgr(PLAYLIST_DELETE, 0); |
33746 | 907 |
35519
7f1be403a640
Don't unnecessarily use global MPlayer variable filename.
ib
parents:
35518
diff
changeset
|
908 while ((file = pt_iter_get_next_file(pt_iter))) |
7f1be403a640
Don't unnecessarily use global MPlayer variable filename.
ib
parents:
35518
diff
changeset
|
909 if (add_to_gui_playlist(file, PLAYLIST_ITEM_APPEND)) |
35514 | 910 added = True; |
33746 | 911 |
35511 | 912 uiCurr(); // update filename |
913 guiInfo.PlaylistNext = True; | |
33746 | 914 |
35518 | 915 if (added) |
916 guiInfo.Track = 1; | |
917 | |
35511 | 918 if (enqueue) |
919 filename = NULL; // don't start playing | |
33746 | 920 |
35510 | 921 break; |
33746 | 922 |
35510 | 923 case GUI_PLAYLIST_ADD: |
33746 | 924 |
35516 | 925 curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0); |
33746 | 926 |
35519
7f1be403a640
Don't unnecessarily use global MPlayer variable filename.
ib
parents:
35518
diff
changeset
|
927 while ((file = pt_iter_get_next_file(pt_iter))) |
7f1be403a640
Don't unnecessarily use global MPlayer variable filename.
ib
parents:
35518
diff
changeset
|
928 if (add_to_gui_playlist(file, PLAYLIST_ITEM_INSERT)) |
35514 | 929 added = True; |
33746 | 930 |
35512 | 931 if (curr) |
932 listMgr(PLAYLIST_ITEM_SET_CURR, curr); | |
35511 | 933 else |
35517 | 934 listMgr(PLAYLIST_ITEM_SET_CURR, listMgr(PLAYLIST_GET, 0)); |
33746 | 935 |
35512 | 936 if (curr && added) |
35511 | 937 listMgr(PLAYLIST_ITEM_DEL_CURR, 0); |
33746 | 938 |
35511 | 939 uiCurr(); // update filename |
33746 | 940 |
35510 | 941 break; |
942 } | |
943 | |
35513 | 944 pt_iter_destroy(&pt_iter); |
945 | |
35494 | 946 return added; |
33746 | 947 } |
948 | |
949 /* GUI -> MPlayer */ | |
950 | |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
951 void mplayer(int what, float value, void *data) |
23077 | 952 { |
36461 | 953 af_stream_t *afilter; |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
954 equalizer_t *eq = (equalizer_t *)data; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
955 |
33765 | 956 switch (what) { |
34684 | 957 /* subtitle */ |
32984 | 958 |
33766 | 959 case MPLAYER_SET_FONT_FACTOR: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
960 font_factor = value; |
36658 | 961 mplayer(MPLAYER_LOAD_FONT, 0, 0); |
33744 | 962 break; |
34454 | 963 |
33766 | 964 case MPLAYER_SET_FONT_OUTLINE: |
36282
872298702c15
Increase precision of calculation by using constants of type double.
ib
parents:
36279
diff
changeset
|
965 subtitle_font_thickness = 8.0 * value / 100.0; // transform 0..100 to 0..8 |
36658 | 966 mplayer(MPLAYER_LOAD_FONT, 0, 0); |
33744 | 967 break; |
32984 | 968 |
33766 | 969 case MPLAYER_SET_FONT_BLUR: |
36282
872298702c15
Increase precision of calculation by using constants of type double.
ib
parents:
36279
diff
changeset
|
970 subtitle_font_radius = 8.0 * value / 100.0; // transform 0..100 to 0..8 |
36658 | 971 mplayer(MPLAYER_LOAD_FONT, 0, 0); |
33744 | 972 break; |
32984 | 973 |
33766 | 974 case MPLAYER_SET_FONT_TEXTSCALE: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
975 text_font_scale_factor = value; |
36658 | 976 mplayer(MPLAYER_LOAD_FONT, 0, 0); |
33744 | 977 break; |
32984 | 978 |
33766 | 979 case MPLAYER_SET_FONT_OSDSCALE: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
980 osd_font_scale_factor = value; |
36658 | 981 mplayer(MPLAYER_LOAD_FONT, 0, 0); |
33744 | 982 break; |
32984 | 983 |
33766 | 984 case MPLAYER_SET_FONT_ENCODING: |
33739 | 985 nfree(subtitle_font_encoding); |
36842 | 986 subtitle_font_encoding = gstrdup(data); |
36658 | 987 mplayer(MPLAYER_LOAD_FONT, 0, 0); |
33744 | 988 break; |
32984 | 989 |
33766 | 990 case MPLAYER_SET_FONT_AUTOSCALE: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
991 subtitle_autoscale = (int)value; |
36658 | 992 mplayer(MPLAYER_LOAD_FONT, 0, 0); |
993 break; | |
994 | |
995 case MPLAYER_LOAD_FONT: | |
996 #ifdef CONFIG_FREETYPE | |
997 set_fontconfig(); | |
998 | |
999 force_load_font = 1; | |
1000 #else | |
1001 free_font_desc(vo_font); | |
1002 | |
1003 if (font_name) { | |
1004 vo_font = read_font_desc(font_name, font_factor, 0); | |
1005 | |
1006 if (!vo_font) | |
1007 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadFont, font_name); | |
1008 } else { | |
1009 char *fname = get_path("font/font.desc"); | |
1010 | |
1011 setdup(&font_name, fname); | |
1012 free(fname); | |
1013 vo_font = read_font_desc(font_name, font_factor, 0); | |
1014 | |
1015 if (!vo_font) { | |
1016 setdup(&font_name, MPLAYER_DATADIR "/font/font.desc"); | |
1017 vo_font = read_font_desc(font_name, font_factor, 0); | |
1018 } | |
1019 } | |
1020 #endif | |
33744 | 1021 break; |
32984 | 1022 |
33766 | 1023 case MPLAYER_SET_SUB_ENCODING: |
33739 | 1024 nfree(sub_cp); |
36842 | 1025 sub_cp = gstrdup(data); |
32984 | 1026 break; |
1027 | |
33766 | 1028 case MPLAYER_SET_EXTRA_STEREO: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1029 gtkAOExtraStereoMul = value; |
36461 | 1030 afilter = mpctx_get_afilter(guiInfo.mpcontext); |
1031 if (afilter) | |
1032 af_control_any_rev(afilter, AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul); | |
33744 | 1033 break; |
32984 | 1034 |
33766 | 1035 case MPLAYER_SET_PANSCAN: |
32984 | 1036 { |
1037 mp_cmd_t *mp_cmd; | |
1038 | |
1039 mp_cmd = calloc(1, sizeof(*mp_cmd)); | |
1040 mp_cmd->id = MP_CMD_PANSCAN; | |
1041 mp_cmd->name = strdup("panscan"); | |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1042 mp_cmd->args[0].v.f = value; |
32984 | 1043 mp_cmd->args[1].v.i = 1; |
1044 mp_input_queue_cmd(mp_cmd); | |
1045 } | |
33744 | 1046 break; |
32984 | 1047 |
33766 | 1048 case MPLAYER_SET_AUTO_QUALITY: |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1049 auto_quality = (int)value; |
33744 | 1050 break; |
32984 | 1051 |
34684 | 1052 /* set equalizers */ |
32984 | 1053 |
33766 | 1054 case MPLAYER_SET_CONTRAST: |
33555 | 1055 if (guiInfo.sh_video) |
36842 | 1056 set_video_colors(guiInfo.sh_video, "contrast", value); |
33744 | 1057 break; |
32984 | 1058 |
33766 | 1059 case MPLAYER_SET_BRIGHTNESS: |
33555 | 1060 if (guiInfo.sh_video) |
36842 | 1061 set_video_colors(guiInfo.sh_video, "brightness", value); |
33744 | 1062 break; |
32984 | 1063 |
33766 | 1064 case MPLAYER_SET_HUE: |
33555 | 1065 if (guiInfo.sh_video) |
36842 | 1066 set_video_colors(guiInfo.sh_video, "hue", value); |
33744 | 1067 break; |
32984 | 1068 |
33766 | 1069 case MPLAYER_SET_SATURATION: |
33555 | 1070 if (guiInfo.sh_video) |
36842 | 1071 set_video_colors(guiInfo.sh_video, "saturation", value); |
33744 | 1072 break; |
32984 | 1073 |
33766 | 1074 case MPLAYER_SET_EQUALIZER: |
32984 | 1075 { |
23077 | 1076 af_control_ext_t tmp; |
32984 | 1077 |
36461 | 1078 afilter = mpctx_get_afilter(guiInfo.mpcontext); |
1079 | |
32984 | 1080 if (eq) { |
1081 gtkEquChannels[eq->channel][eq->band] = eq->gain; | |
1082 tmp.ch = eq->channel; | |
1083 tmp.arg = gtkEquChannels[eq->channel]; | |
1084 | |
36461 | 1085 if (afilter) |
1086 af_control_any_rev(afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); | |
32984 | 1087 } else { |
33693
006a2db8bd55
Use unsigned index variable for comparison with array size.
ib
parents:
33692
diff
changeset
|
1088 unsigned int i; |
32984 | 1089 |
1090 memset(gtkEquChannels, 0, sizeof(gtkEquChannels)); | |
1091 | |
36461 | 1092 if (afilter) { |
33689
8d0290220239
Replace numeric constants for gtkEquChannels array size.
ib
parents:
33688
diff
changeset
|
1093 for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) { |
32984 | 1094 tmp.ch = i; |
1095 tmp.arg = gtkEquChannels[i]; | |
36461 | 1096 af_control_any_rev(afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); |
32984 | 1097 } |
1098 } | |
1099 } | |
1100 | |
33744 | 1101 break; |
32984 | 1102 } |
33768 | 1103 |
1104 case MPLAYER_EXIT_GUI: | |
33791
8b0c78a85a8c
Cosmetic: Change parameter names of gui() and mplayer().
ib
parents:
33790
diff
changeset
|
1105 exit_player_with_rc((enum exit_reason)value, (enum exit_reason)value >= EXIT_ERROR); |
33768 | 1106 break; |
32984 | 1107 } |
23077 | 1108 } |
1109 | |
33790
ab6d06f5b98b
Add const to some string pointer arguments that will not be modified.
ib
parents:
33775
diff
changeset
|
1110 void mplayerLoadSubtitle(const char *name) |
33745 | 1111 { |
35495 | 1112 if (guiInfo.Playing == GUI_STOP) |
33745 | 1113 return; |
1114 | |
1115 if (subdata) { | |
36694 | 1116 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_RemovingSubtitle); |
33745 | 1117 |
1118 sub_free(subdata); | |
1119 subdata = NULL; | |
1120 vo_sub = NULL; | |
1121 | |
1122 if (vo_osd_list) { | |
1123 int len; | |
1124 mp_osd_obj_t *osd; | |
1125 | |
1126 osd = vo_osd_list; | |
1127 | |
1128 while (osd) { | |
1129 if (osd->type == OSDTYPE_SUBTITLE) | |
1130 break; | |
1131 | |
1132 osd = osd->next; | |
1133 } | |
1134 | |
1135 if (osd && (osd->flags & OSDFLAG_VISIBLE)) { | |
1136 len = osd->stride * (osd->bbox.y2 - osd->bbox.y1); | |
1137 memset(osd->bitmap_buffer, 0, len); | |
1138 memset(osd->alpha_buffer, 0, len); | |
1139 } | |
1140 } | |
1141 } | |
1142 | |
1143 if (name) { | |
36694 | 1144 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_LoadingSubtitle, name); |
33745 | 1145 |
33775 | 1146 subdata = sub_read_file(name, (guiInfo.sh_video ? guiInfo.sh_video->fps : 0)); |
33745 | 1147 |
1148 if (!subdata) | |
1149 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadSub, name); | |
1150 | |
1151 sub_name = (malloc(2 * sizeof(char *))); // when mplayer will be restarted | |
1152 sub_name[0] = strdup(name); // sub_name[0] will be read | |
1153 sub_name[1] = NULL; | |
1154 } | |
1155 | |
1156 update_set_of_subtitles(); | |
1157 } | |
1158 | |
33023 | 1159 // NOTE TO MYSELF: This function is nonsense. |
33289 | 1160 // MPlayer should pass messages to the GUI |
1161 // which must decide then which message has | |
1162 // to be shown (MSGL_FATAL, for example). | |
1163 // But with this function it is at least | |
1164 // possible to show GUI's very critical or | |
1165 // abort messages. | |
33023 | 1166 void gmp_msg(int mod, int lev, const char *format, ...) |
1167 { | |
1168 char msg[512]; | |
1169 va_list va; | |
1170 | |
1171 va_start(va, format); | |
1172 vsnprintf(msg, sizeof(msg), format, va); | |
1173 va_end(va); | |
1174 | |
36644
8d39d6874ec0
Do not use non-literal arguments for mp_msg format string
al
parents:
36461
diff
changeset
|
1175 mp_msg(mod, lev, "%s", msg); |
33023 | 1176 |
1177 if (mp_msg_test(mod, lev)) | |
36036 | 1178 gtkMessageBox(MSGBOX_FATAL, msg); |
33023 | 1179 } |