Mercurial > mplayer.hg
annotate gui/ui/actions.c @ 35744:bfe51acc36fb
Cosmetic: Rename wsImageConvert() wsImageRender().
author | ib |
---|---|
date | Wed, 23 Jan 2013 17:10:33 +0000 |
parents | 6b82e3079aea |
children | 9c7bab18690c |
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 |
35437 | 19 /** |
20 * @file | |
21 * @brief User interface actions | |
22 */ | |
23 | |
23077 | 24 #include <stdlib.h> |
25 #include <string.h> | |
26 | |
33556 | 27 #include "actions.h" |
35528 | 28 #include "ui.h" |
35525 | 29 #include "gui/app/app.h" |
30 #include "gui/app/gui.h" | |
32881 | 31 #include "gui/interface.h" |
32 #include "gui/skin/skin.h" | |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33740
diff
changeset
|
33 #include "gui/util/list.h" |
33739 | 34 #include "gui/util/mem.h" |
33737 | 35 #include "gui/util/string.h" |
35435 | 36 #include "gui/wm/ws.h" |
32881 | 37 #include "gui/wm/wsxdnd.h" |
23077 | 38 |
26382
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
39 #include "help_mp.h" |
32881 | 40 #include "input/input.h" |
35431 | 41 #include "libmpdemux/demuxer.h" |
26382
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
42 #include "libvo/video_out.h" |
32881 | 43 #include "mp_core.h" |
35435 | 44 #include "mp_msg.h" |
45 #include "mplayer.h" | |
23077 | 46 |
35437 | 47 /** |
48 * @brief Switch video window fullscreen mode. | |
49 * | |
50 * Switch normal video to fullscreen and fullscreen video to normal. | |
51 */ | |
33555 | 52 void uiFullScreen(void) |
23077 | 53 { |
33960 | 54 if (!guiInfo.VideoWindow) |
32881 | 55 return; |
56 | |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
57 wsWindowFullscreen(&guiApp.videoWindow); |
23077 | 58 |
34697 | 59 vo_fs = guiApp.videoWindow.isFullScreen; |
23077 | 60 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
61 wsWindowLayer(wsDisplay, guiApp.mainWindow.WindowID, guiApp.videoWindow.isFullScreen); |
32881 | 62 |
33555 | 63 if (guiApp.menuIsPresent) |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
64 wsWindowLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen); |
23077 | 65 } |
66 | |
35437 | 67 /** |
68 * @brief Switch to play mode. | |
69 */ | |
33555 | 70 void uiPlay(void) |
23077 | 71 { |
34401
af8838c2b60b
Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents:
34400
diff
changeset
|
72 if (guiInfo.Playing == GUI_PLAY) |
af8838c2b60b
Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents:
34400
diff
changeset
|
73 return; |
af8838c2b60b
Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents:
34400
diff
changeset
|
74 |
af8838c2b60b
Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents:
34400
diff
changeset
|
75 if (guiInfo.StreamType != STREAMTYPE_CDDA && |
af8838c2b60b
Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents:
34400
diff
changeset
|
76 guiInfo.StreamType != STREAMTYPE_VCD && |
af8838c2b60b
Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents:
34400
diff
changeset
|
77 guiInfo.StreamType != STREAMTYPE_DVD && |
af8838c2b60b
Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents:
34400
diff
changeset
|
78 (!guiInfo.Filename || (guiInfo.Filename[0] == 0))) |
32881 | 79 return; |
23077 | 80 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
81 if (guiInfo.Playing == GUI_PAUSE) { |
33555 | 82 uiPause(); |
32881 | 83 return; |
84 } | |
85 | |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33725
diff
changeset
|
86 gui(GUI_SET_STATE, (void *)GUI_PLAY); |
35493 | 87 uiVideoRender = False; |
23077 | 88 } |
89 | |
35437 | 90 /** |
91 * @brief Switch to pause mode. | |
92 */ | |
33555 | 93 void uiPause(void) |
23077 | 94 { |
33555 | 95 if (!guiInfo.Playing) |
32881 | 96 return; |
97 | |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
98 if (guiInfo.Playing == GUI_PLAY) { |
32881 | 99 mp_cmd_t *cmd = calloc(1, sizeof(*cmd)); |
35433 | 100 |
35432 | 101 if (cmd) { |
35433 | 102 cmd->id = MP_CMD_PAUSE; |
103 cmd->name = strdup("pause"); | |
104 mp_input_queue_cmd(cmd); | |
35432 | 105 } |
32881 | 106 } else |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
107 guiInfo.Playing = GUI_PLAY; |
23077 | 108 } |
109 | |
35437 | 110 /** |
111 * @brief Adjust GUI items to reflect current state (i.e. current playing mode). | |
112 */ | |
33555 | 113 void uiState(void) |
32881 | 114 { |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
115 if (guiInfo.Playing == GUI_STOP || guiInfo.Playing == GUI_PAUSE) { |
33978 | 116 btnSet(evPlaySwitchToPause, btnReleased); |
117 btnSet(evPauseSwitchToPlay, btnDisabled); | |
32881 | 118 } else { |
35434 | 119 btnSet(evPauseSwitchToPlay, btnReleased); |
33978 | 120 btnSet(evPlaySwitchToPause, btnDisabled); |
32881 | 121 } |
23077 | 122 } |
123 | |
35437 | 124 /** |
125 * @brief Seek new playback position. | |
126 * | |
35438 | 127 * The new position is a relative one. |
35437 | 128 * |
129 * @param sec seconds to seek (either forward (> 0) or backward (< 0)) | |
130 */ | |
33555 | 131 void uiRelSeek(float sec) |
32881 | 132 { |
32971 | 133 rel_seek_secs = sec; |
32881 | 134 abs_seek_pos = 0; |
135 } | |
136 | |
35437 | 137 /** |
138 * @brief Seek new playback position. | |
139 * | |
35438 | 140 * The new position is an absolute one. |
35437 | 141 * |
142 * @param percent percentage of playback time to position to | |
143 */ | |
33555 | 144 void uiAbsSeek(float percent) |
32881 | 145 { |
32971 | 146 rel_seek_secs = percent / 100.0; |
35431 | 147 abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR; |
23077 | 148 } |
149 | |
35437 | 150 /** |
151 * @brief Change to a different skin. | |
152 * | |
153 * @param name name of the skin to change to | |
154 */ | |
33555 | 155 void uiChangeSkin(char *name) |
23077 | 156 { |
32893 | 157 int prev, bprev; |
32881 | 158 |
33555 | 159 prev = guiApp.menuIsPresent; |
160 bprev = guiApp.playbarIsPresent; | |
32881 | 161 |
35493 | 162 mainVisible = False; |
32881 | 163 |
32893 | 164 if (skinRead(name) != 0) { |
165 if (skinRead(skinName) != 0) { | |
35493 | 166 mainVisible = True; |
32894 | 167 return; |
32893 | 168 } |
32881 | 169 } |
170 | |
34684 | 171 /* reload menu window */ |
23077 | 172 |
33555 | 173 if (prev && guiApp.menuIsPresent) { |
174 free(menuDrawBuffer); | |
175 menuDrawBuffer = calloc(1, guiApp.menu.Bitmap.ImageSize); | |
32881 | 176 |
33555 | 177 if (!menuDrawBuffer) { |
33530 | 178 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB); |
33768 | 179 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); |
32881 | 180 } |
23077 | 181 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
182 wsWindowResize(&guiApp.menuWindow, guiApp.menu.width, guiApp.menu.height); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
183 wsImageResize(&guiApp.menuWindow, guiApp.menu.width, guiApp.menu.height); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
184 wsWindowShape(&guiApp.menuWindow, guiApp.menu.Mask.Image); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
185 wsWindowVisibility(&guiApp.menuWindow, wsHideWindow); |
32881 | 186 } else |
33555 | 187 uiMenuInit(); |
32881 | 188 |
34697 | 189 /* reload video window */ |
23077 | 190 |
34697 | 191 if (guiApp.video.Bitmap.Image) |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
192 wsImageResize(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height); |
32881 | 193 |
34697 | 194 if (!guiApp.videoWindow.isFullScreen && !guiInfo.Playing) { |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
195 wsWindowResize(&guiApp.videoWindow, guiApp.video.width, guiApp.video.height); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
196 wsWindowMove(&guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y); |
32881 | 197 } |
198 | |
34697 | 199 if (guiApp.video.Bitmap.Image) |
35744 | 200 wsImageRender(&guiApp.videoWindow, guiApp.video.Bitmap.Image); |
23077 | 201 |
33555 | 202 if (!guiInfo.Playing) { |
35493 | 203 uiVideoRender = True; |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
204 wsWindowRedraw(&guiApp.videoWindow); |
32881 | 205 } |
206 | |
34684 | 207 /* reload playbar */ |
32881 | 208 |
209 if (bprev) | |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
210 wsWindowDestroy(&guiApp.playbarWindow); |
32881 | 211 |
33555 | 212 uiPlaybarInit(); |
23077 | 213 |
34684 | 214 /* reload main window */ |
32881 | 215 |
33555 | 216 free(mainDrawBuffer); |
217 mainDrawBuffer = calloc(1, guiApp.main.Bitmap.ImageSize); | |
23077 | 218 |
33555 | 219 if (!mainDrawBuffer) { |
33530 | 220 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB); |
33768 | 221 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); |
32881 | 222 } |
23077 | 223 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
224 wsWindowDestroy(&guiApp.mainWindow); |
32881 | 225 |
35697 | 226 wsWindowCreate(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, (guiApp.mainDecoration ? wsShowFrame : 0) | wsMinSize | wsMaxSize | wsHideWindow, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer"); |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
227 wsImageCreate(&guiApp.mainWindow, guiApp.main.Bitmap.Width, guiApp.main.Bitmap.Height); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
228 wsWindowShape(&guiApp.mainWindow, guiApp.main.Mask.Image); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
229 wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon); |
23077 | 230 |
33555 | 231 guiApp.mainWindow.ReDraw = (void *)uiMainDraw; |
232 guiApp.mainWindow.MouseHandler = uiMainMouseHandle; | |
233 guiApp.mainWindow.KeyHandler = uiMainKeyHandle; | |
234 guiApp.mainWindow.DandDHandler = uiDandDHandler; | |
32881 | 235 |
33555 | 236 wsXDNDMakeAwareness(&guiApp.mainWindow); |
23077 | 237 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
238 wsWindowVisibility(&guiApp.mainWindow, wsShowWindow); |
35493 | 239 mainVisible = True; |
32881 | 240 |
33555 | 241 btnModify(evSetVolume, guiInfo.Volume); |
242 btnModify(evSetBalance, guiInfo.Balance); | |
243 btnModify(evSetMoviePosition, guiInfo.Position); | |
34697 | 244 btnSet(evFullScreen, (guiApp.videoWindow.isFullScreen ? btnPressed : btnReleased)); |
23077 | 245 |
35681
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
246 wsWindowLayer(wsDisplay, guiApp.mainWindow.WindowID, guiApp.videoWindow.isFullScreen); |
80c5c89f77d6
Cosmetic: Rename ws functions for the sake of consistency.
ib
parents:
35658
diff
changeset
|
247 wsWindowLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen); |
32881 | 248 } |
249 | |
35437 | 250 /** |
35452 | 251 * @brief Set the file to be played. |
35437 | 252 * |
253 * @param dir directory (optional, else NULL) | |
254 * @param name filename | |
255 * @param type stream type of the file | |
35483
8ac7761bcb7c
Clear information associated with a file when setting a new one.
ib
parents:
35462
diff
changeset
|
256 * |
8ac7761bcb7c
Clear information associated with a file when setting a new one.
ib
parents:
35462
diff
changeset
|
257 * @note All #guiInfo members associated with the file will be cleared. |
35437 | 258 */ |
35452 | 259 void uiSetFile(char *dir, char *name, int type) |
32881 | 260 { |
261 if (!dir) | |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
262 setdup(&guiInfo.Filename, name); |
32881 | 263 else |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
264 setddup(&guiInfo.Filename, dir, name); |
23077 | 265 |
34064 | 266 filename = guiInfo.Filename; |
34399
f2c03009068d
Don't explicitly set stream type if the type doesn't change.
ib
parents:
34387
diff
changeset
|
267 |
35483
8ac7761bcb7c
Clear information associated with a file when setting a new one.
ib
parents:
35462
diff
changeset
|
268 if (type != SAME_STREAMTYPE) { |
34400 | 269 guiInfo.StreamType = type; |
35568 | 270 uiUnsetMedia(False); |
35483
8ac7761bcb7c
Clear information associated with a file when setting a new one.
ib
parents:
35462
diff
changeset
|
271 } |
23077 | 272 } |
273 | |
35437 | 274 /** |
35453 | 275 * @brief Unset the file being played. |
276 */ | |
277 void uiUnsetFile(void) | |
278 { | |
279 uiSetFile(NULL, NULL, STREAMTYPE_DUMMY); | |
280 } | |
281 | |
282 /** | |
35562 | 283 * @brief Unset media information. |
35568 | 284 * |
285 * @param totals whether to unset number of chapters and angles (#True) or | |
286 * just track, chapter and angle (#False) as well | |
35562 | 287 */ |
35568 | 288 void uiUnsetMedia(int totals) |
35562 | 289 { |
290 guiInfo.VideoWidth = 0; | |
291 guiInfo.VideoHeight = 0; | |
292 guiInfo.AudioChannels = 0; | |
293 guiInfo.RunningTime = 0; | |
35568 | 294 |
295 if (totals) { | |
296 guiInfo.Chapters = 0; | |
297 guiInfo.Angles = 0; | |
298 } else { | |
35569 | 299 guiInfo.Track = 0; |
300 guiInfo.Chapter = 0; | |
301 guiInfo.Angle = 0; | |
35568 | 302 } |
35562 | 303 |
304 nfree(guiInfo.CodecName); | |
305 nfree(guiInfo.AudioFilename); | |
306 nfree(guiInfo.SubtitleFilename); | |
307 } | |
308 | |
309 /** | |
35437 | 310 * @brief Set file to be played to current playlist entry. |
311 */ | |
33555 | 312 void uiCurr(void) |
23077 | 313 { |
32881 | 314 plItem *curr; |
23077 | 315 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
316 if (guiInfo.Playing == GUI_PAUSE) |
32881 | 317 return; |
23077 | 318 |
33555 | 319 switch (guiInfo.StreamType) { |
34387 | 320 case STREAMTYPE_CDDA: |
34077 | 321 case STREAMTYPE_VCD: |
322 case STREAMTYPE_DVD: | |
35433 | 323 |
32881 | 324 break; |
325 | |
326 default: | |
327 | |
34663 | 328 curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0); |
32881 | 329 |
330 if (curr) { | |
35452 | 331 uiSetFile(curr->path, curr->name, STREAMTYPE_FILE); |
35493 | 332 guiInfo.PlaylistNext = False; |
35485 | 333 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, curr); |
32881 | 334 break; |
335 } | |
336 | |
337 return; | |
338 } | |
339 | |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
340 if (guiInfo.Playing == GUI_PLAY) |
33555 | 341 uiEventHandling(evPlay, 0); |
23077 | 342 } |
343 | |
35437 | 344 /** |
345 * @brief Switch to previous playback track. | |
346 */ | |
33555 | 347 void uiPrev(void) |
23077 | 348 { |
35571
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
349 int stop = False, unset = True; |
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
350 plItem *prev = NULL; |
32881 | 351 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
352 if (guiInfo.Playing == GUI_PAUSE) |
32881 | 353 return; |
354 | |
33555 | 355 switch (guiInfo.StreamType) { |
34387 | 356 case STREAMTYPE_CDDA: |
35426 | 357 |
34387 | 358 if (--guiInfo.Track == 0) { |
359 guiInfo.Track = 1; | |
35493 | 360 stop = True; |
34387 | 361 } |
35426 | 362 |
34387 | 363 break; |
364 | |
34077 | 365 case STREAMTYPE_VCD: |
35426 | 366 |
34077 | 367 if (--guiInfo.Track == 1) { |
368 guiInfo.Track = 2; | |
35493 | 369 stop = True; |
34077 | 370 } |
35426 | 371 |
34077 | 372 break; |
373 | |
32881 | 374 case STREAMTYPE_DVD: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27370
diff
changeset
|
375 |
33876
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
376 if (--guiInfo.Chapter == 0) { |
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
377 guiInfo.Chapter = 1; |
32881 | 378 |
35428 | 379 if (--guiInfo.Track == 0) { |
33876
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
380 guiInfo.Track = 1; |
35493 | 381 stop = True; |
32881 | 382 } |
35571
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
383 } else |
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
384 unset = False; |
32881 | 385 |
386 break; | |
387 | |
388 default: | |
389 | |
34663 | 390 prev = listMgr(PLAYLIST_ITEM_GET_PREV, 0); |
32881 | 391 |
392 if (prev) { | |
35452 | 393 uiSetFile(prev->path, prev->name, STREAMTYPE_FILE); |
35500 | 394 guiInfo.PlaylistNext = !guiInfo.Playing; |
35458 | 395 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, prev); |
32881 | 396 break; |
397 } | |
398 | |
399 return; | |
400 } | |
401 | |
402 if (stop) | |
33555 | 403 uiEventHandling(evStop, 0); |
32881 | 404 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
405 if (guiInfo.Playing == GUI_PLAY) |
33555 | 406 uiEventHandling(evPlay, 0); |
35571
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
407 else if (!stop && !prev && unset) |
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
408 uiUnsetMedia(True); |
23077 | 409 } |
410 | |
35437 | 411 /** |
412 * @brief Switch to next playback track. | |
413 */ | |
33555 | 414 void uiNext(void) |
23077 | 415 { |
35571
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
416 int stop = False, unset = True; |
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
417 plItem *next = NULL; |
23077 | 418 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
419 if (guiInfo.Playing == GUI_PAUSE) |
32881 | 420 return; |
421 | |
33555 | 422 switch (guiInfo.StreamType) { |
34387 | 423 case STREAMTYPE_CDDA: |
35425 | 424 case STREAMTYPE_VCD: |
34387 | 425 |
426 if (++guiInfo.Track > guiInfo.Tracks) { | |
427 guiInfo.Track = guiInfo.Tracks; | |
35493 | 428 stop = True; |
34387 | 429 } |
430 | |
431 break; | |
432 | |
32881 | 433 case STREAMTYPE_DVD: |
434 | |
35570 | 435 if (guiInfo.Chapter++ >= guiInfo.Chapters) { |
33876
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
436 guiInfo.Chapter = 1; |
32881 | 437 |
33876
4789b8eed97e
Get rid of a bunch of needless or redundant guiInfo members.
ib
parents:
33874
diff
changeset
|
438 if (++guiInfo.Track > guiInfo.Tracks) { |
35561 | 439 guiInfo.Track = guiInfo.Tracks; |
35560
1a2200a93ea8
Make DVD stop if manually advancing beyond last chapter of last track.
ib
parents:
35528
diff
changeset
|
440 guiInfo.Chapter = guiInfo.Chapters; |
35493 | 441 stop = True; |
32881 | 442 } |
35571
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
443 } else |
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
444 unset = False; |
32881 | 445 |
446 break; | |
447 | |
448 default: | |
449 | |
34663 | 450 next = listMgr(PLAYLIST_ITEM_GET_NEXT, 0); |
32881 | 451 |
452 if (next) { | |
35452 | 453 uiSetFile(next->path, next->name, STREAMTYPE_FILE); |
35500 | 454 guiInfo.PlaylistNext = !guiInfo.Playing; |
35458 | 455 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, next); |
32881 | 456 break; |
457 } | |
458 | |
459 return; | |
460 } | |
461 | |
462 if (stop) | |
33555 | 463 uiEventHandling(evStop, 0); |
32881 | 464 |
33615
1f9a31d4f114
Replace all playback integer constants by their symbolic constants.
ib
parents:
33614
diff
changeset
|
465 if (guiInfo.Playing == GUI_PLAY) |
33555 | 466 uiEventHandling(evPlay, 0); |
35571
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
467 else if (!stop && !next && unset) |
29761b2b8cb0
Reset media information while changing tracks in stop mode.
ib
parents:
35570
diff
changeset
|
468 uiUnsetMedia(True); |
23077 | 469 } |