Mercurial > mplayer.hg
diff gui/interface.c @ 33694:45553d0f65c6
Don't let MPlayer directly call user interface functions.
Provide uiEnd() as the new guiGetEvent type guiEndFile. That way,
access is possible through the official interface function.
author | ib |
---|---|
date | Wed, 29 Jun 2011 14:24:39 +0000 |
parents | 006a2db8bd55 |
children | 60093217cb01 |
line wrap: on
line diff
--- a/gui/interface.c Wed Jun 29 13:37:04 2011 +0000 +++ b/gui/interface.c Wed Jun 29 14:24:39 2011 +0000 @@ -555,6 +555,7 @@ #ifdef CONFIG_DVDREAD dvd_priv_t *dvd; #endif + plItem *next; if (guiInfo.mpcontext) mixer = mpctx_get_mixer(guiInfo.mpcontext); @@ -970,6 +971,50 @@ wsEvents(wsDisplay, arg); gtkEventHandling(); break; + + case guiEndFile: + + if (!uiGotoTheNext && guiInfo.Playing) { + uiGotoTheNext = 1; + break; + } + + if (guiInfo.Playing && (next = gtkSet(gtkGetNextPlItem, 0, NULL)) && (plLastPlayed != next)) { + plLastPlayed = next; + guiSetDF(guiInfo.Filename, next->path, next->name); + guiInfo.StreamType = STREAMTYPE_FILE; + guiInfo.FilenameChanged = guiInfo.NewPlay = 1; + gfree((void **)&guiInfo.AudioFile); + gfree((void **)&guiInfo.Subtitlename); + } else { + if (guiInfo.FilenameChanged || guiInfo.NewPlay) + break; + + guiInfo.TimeSec = 0; + guiInfo.Position = 0; + guiInfo.AudioChannels = 0; + guiInfo.MovieWindow = True; + +#ifdef CONFIG_DVDREAD + guiInfo.DVD.current_title = 1; + guiInfo.DVD.current_chapter = 1; + guiInfo.DVD.current_angle = 1; +#endif + + if (!guiApp.subWindow.isFullScreen && gtkShowVideoWindow) { + wsResizeWindow(&guiApp.subWindow, guiApp.sub.width, guiApp.sub.height); + wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); + } else + wsVisibleWindow(&guiApp.subWindow, wsHideWindow); + + guiGetEvent(guiSetState, (void *)GUI_STOP); + uiSubRender = 1; + wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B); + wsClearWindow(guiApp.subWindow); + wsPostRedisplay(&guiApp.subWindow); + } + + break; } return True;