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