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