Mercurial > mplayer.hg
changeset 32881:dd3b365972a4
Cosmetic: Format to MPlayer coding style.
author | ib |
---|---|
date | Fri, 25 Feb 2011 12:13:36 +0000 |
parents | 96cbdbf90c42 |
children | bd3ea059fe2d |
files | gui/mplayer/play.c gui/mplayer/play.h |
diffstat | 2 files changed, 385 insertions(+), 309 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/mplayer/play.c Thu Feb 24 23:51:27 2011 +0000 +++ b/gui/mplayer/play.c Fri Feb 25 12:13:36 2011 +0000 @@ -16,371 +16,459 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include <inttypes.h> #include <stdlib.h> -#include <stdio.h> #include <string.h> -#include <unistd.h> -#include <signal.h> +#include "play.h" +#include "gmplayer.h" +#include "gui/app.h" +#include "gui/interface.h" +#include "gui/skin/font.h" +#include "gui/skin/skin.h" +#include "gui/wm/wsxdnd.h" +#include "widgets.h" #include "config.h" #include "help_mp.h" -#include "mp_core.h" +#include "input/input.h" #include "libmpcodecs/vd.h" -#include "libvo/x11_common.h" #include "libvo/video_out.h" -#include "input/input.h" - -#include "gui/wm/ws.h" -#include "gui/wm/wsxdnd.h" - -#include "gui/app.h" -#include "gui/wm/wskeys.h" -#include "gui/interface.h" - -#include "widgets.h" -#include "gmplayer.h" -#include "play.h" - -#include "gui/skin/skin.h" -#include "gui/skin/font.h" - +#include "mp_core.h" #include "stream/stream.h" int mplGotoTheNext = 1; -void mplFullScreen( void ) +void mplFullScreen(void) { - if ( guiIntfStruct.NoWindow && guiIntfStruct.Playing ) return; + if (guiIntfStruct.NoWindow && guiIntfStruct.Playing) + return; + + if (guiIntfStruct.Playing && appMPlayer.subWindow.isFullScreen) { + appMPlayer.subWindow.OldWidth = guiIntfStruct.MovieWidth; + appMPlayer.subWindow.OldHeight = guiIntfStruct.MovieHeight; + + switch (appMPlayer.sub.x) { + case -1: + appMPlayer.subWindow.OldX = wsMaxX / 2 - appMPlayer.subWindow.OldWidth / 2 + wsOrgX; + break; + + case -2: + appMPlayer.subWindow.OldX = wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; + break; + + default: + appMPlayer.subWindow.OldX = appMPlayer.sub.x; + break; + } - if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) ) - { - appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight; - switch ( appMPlayer.sub.x ) - { - case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ) + wsOrgX; break; - case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; break; - default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break; - } - switch ( appMPlayer.sub.y ) - { - case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ) + wsOrgY; break; - case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; break; - default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break; - } - } - if ( guiIntfStruct.Playing || gtkShowVideoWindow ) wsFullScreen( &appMPlayer.subWindow ); - fullscreen=vo_fs=appMPlayer.subWindow.isFullScreen; - wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen ); - if ( appMPlayer.menuIsPresent ) wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen ); + switch (appMPlayer.sub.y) { + case -1: + appMPlayer.subWindow.OldY = wsMaxY / 2 - appMPlayer.subWindow.OldHeight / 2 + wsOrgY; + break; + + case -2: + appMPlayer.subWindow.OldY = wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; + break; - if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); - else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); + default: + appMPlayer.subWindow.OldY = appMPlayer.sub.y; + break; + } + } + + if (guiIntfStruct.Playing || gtkShowVideoWindow) + wsFullScreen(&appMPlayer.subWindow); + + fullscreen = vo_fs = appMPlayer.subWindow.isFullScreen; + wsSetLayer(wsDisplay, appMPlayer.mainWindow.WindowID, appMPlayer.subWindow.isFullScreen); + + if (appMPlayer.menuIsPresent) + wsSetLayer(wsDisplay, appMPlayer.menuWindow.WindowID, appMPlayer.subWindow.isFullScreen); + + if (guiIntfStruct.Playing) + wsSetBackgroundRGB(&appMPlayer.subWindow, 0, 0, 0); + else + wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B); } -void mplEnd( void ) +void mplEnd(void) { - plItem * next; + plItem *next; - if ( !mplGotoTheNext && guiIntfStruct.Playing) { mplGotoTheNext=1; return; } + if (!mplGotoTheNext && guiIntfStruct.Playing) { + mplGotoTheNext = 1; + return; + } - if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next ) - { - plLastPlayed=next; - guiSetDF( guiIntfStruct.Filename,next->path,next->name ); - guiIntfStruct.StreamType=STREAMTYPE_FILE; - guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1; - gfree( (void **)&guiIntfStruct.AudioFile ); - gfree( (void **)&guiIntfStruct.Subtitlename ); - } - else - { - if ( guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay ) return; + if (guiIntfStruct.Playing && (next = gtkSet(gtkGetNextPlItem, 0, NULL)) && (plLastPlayed != next)) { + plLastPlayed = next; + guiSetDF(guiIntfStruct.Filename, next->path, next->name); + guiIntfStruct.StreamType = STREAMTYPE_FILE; + guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1; + gfree((void **)&guiIntfStruct.AudioFile); + gfree((void **)&guiIntfStruct.Subtitlename); + } else { + if (guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay) + return; - guiIntfStruct.TimeSec=0; - guiIntfStruct.Position=0; - guiIntfStruct.AudioType=0; - guiIntfStruct.NoWindow=False; + guiIntfStruct.TimeSec = 0; + guiIntfStruct.Position = 0; + guiIntfStruct.AudioType = 0; + guiIntfStruct.NoWindow = False; #ifdef CONFIG_DVDREAD - guiIntfStruct.DVD.current_title=1; - guiIntfStruct.DVD.current_chapter=1; - guiIntfStruct.DVD.current_angle=1; + guiIntfStruct.DVD.current_title = 1; + guiIntfStruct.DVD.current_chapter = 1; + guiIntfStruct.DVD.current_angle = 1; #endif - if ( !appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow) - { - wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); - wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); - } - else wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); - guiGetEvent( guiCEvent,guiSetStop ); - mplSubRender=1; - wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); - wsClearWindow( appMPlayer.subWindow ); - wsPostRedisplay( &appMPlayer.subWindow ); + if (!appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow) { + wsResizeWindow(&appMPlayer.subWindow, appMPlayer.sub.width, appMPlayer.sub.height); + wsMoveWindow(&appMPlayer.subWindow, True, appMPlayer.sub.x, appMPlayer.sub.y); + } else + wsVisibleWindow(&appMPlayer.subWindow, wsHideWindow); + + guiGetEvent(guiCEvent, guiSetStop); + mplSubRender = 1; + wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B); + wsClearWindow(appMPlayer.subWindow); + wsPostRedisplay(&appMPlayer.subWindow); } } -void mplPlay( void ) +void mplPlay(void) { - if ( ( !guiIntfStruct.Filename )|| - ( guiIntfStruct.Filename[0] == 0 )|| - ( guiIntfStruct.Playing == 1 ) ) return; - if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; } - guiGetEvent( guiCEvent,(void *)guiSetPlay ); - mplSubRender=0; - wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); - wsClearWindow( appMPlayer.subWindow ); -} + if (!guiIntfStruct.Filename || + (guiIntfStruct.Filename[0] == 0) || + (guiIntfStruct.Playing == 1)) + return; -void mplPause( void ) -{ - if ( !guiIntfStruct.Playing ) return; - if ( guiIntfStruct.Playing == 1 ) - { - mp_cmd_t * cmd = calloc( 1,sizeof( *cmd ) ); - cmd->id=MP_CMD_PAUSE; - cmd->name=strdup("pause"); - mp_input_queue_cmd(cmd); - } else guiIntfStruct.Playing=1; + if (guiIntfStruct.Playing == 2) { + mplPause(); + return; + } + + guiGetEvent(guiCEvent, (void *)guiSetPlay); + mplSubRender = 0; + wsSetBackgroundRGB(&appMPlayer.subWindow, 0, 0, 0); + wsClearWindow(appMPlayer.subWindow); } -void mplState( void ) +void mplPause(void) { - if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) ) - { - btnModify( evPlaySwitchToPause,btnReleased ); - btnModify( evPauseSwitchToPlay,btnDisabled ); - } - else - { - btnModify( evPlaySwitchToPause,btnDisabled ); - btnModify( evPauseSwitchToPlay,btnReleased ); - } + if (!guiIntfStruct.Playing) + return; + + if (guiIntfStruct.Playing == 1) { + mp_cmd_t *cmd = calloc(1, sizeof(*cmd)); + cmd->id = MP_CMD_PAUSE; + cmd->name = strdup("pause"); + mp_input_queue_cmd(cmd); + } else + guiIntfStruct.Playing = 1; } -float mplGetPosition( void ) -{ // return 0.0 ... 100.0 - return guiIntfStruct.Position; +void mplState(void) +{ + if (guiIntfStruct.Playing == 0 || guiIntfStruct.Playing == 2) { + btnModify(evPlaySwitchToPause, btnReleased); + btnModify(evPauseSwitchToPlay, btnDisabled); + } else { + btnModify(evPlaySwitchToPause, btnDisabled); + btnModify(evPauseSwitchToPlay, btnReleased); + } } -void mplRelSeek( float s ) -{ // -+s - rel_seek_secs=s; abs_seek_pos=0; +float mplGetPosition(void) +{ + return guiIntfStruct.Position; // 0.0..100.0 } -void mplAbsSeek( float s ) -{ // 0.0 ... 100.0 - if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) return; - rel_seek_secs=0.01*s; abs_seek_pos=3; +void mplRelSeek(float s) +{ + rel_seek_secs = s; // -+s + abs_seek_pos = 0; +} + +void mplAbsSeek(float s) +{ + if (guiIntfStruct.StreamType == STREAMTYPE_STREAM) + return; + + rel_seek_secs = 0.01 * s; // 0.0..100.0 + abs_seek_pos = 3; } listItems tmpList; -void ChangeSkin( char * name ) +void ChangeSkin(char *name) { - int ret; - int prev = appMPlayer.menuIsPresent; - int bprev = appMPlayer.barIsPresent; + int prev, bprev, ret; + + prev = appMPlayer.menuIsPresent; + bprev = appMPlayer.barIsPresent; + + mainVisible = 0; + + appInitStruct(&tmpList); + skinAppMPlayer = &tmpList; + fntFreeFont(); + ret = skinRead(name); - mainVisible=0; + appInitStruct(&tmpList); + skinAppMPlayer = &appMPlayer; + appInitStruct(&appMPlayer); + + if (ret) + name = skinName; - appInitStruct( &tmpList ); - skinAppMPlayer=&tmpList; - fntFreeFont(); - ret=skinRead( name ); + if (skinRead(name)) { + mainVisible = 1; + return; + } + + // reload menu window - appInitStruct( &tmpList ); - skinAppMPlayer=&appMPlayer; - appInitStruct( &appMPlayer ); - if ( ret ) name=skinName; - if ( skinRead( name ) ) - { - mainVisible=1; - return; - } + if (prev && appMPlayer.menuIsPresent) { + free(mplMenuDrawBuffer); + mplMenuDrawBuffer = calloc(1, appMPlayer.menuBase.Bitmap.ImageSize); + + if (!mplMenuDrawBuffer) { + mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_NEMDB); + return; + } -// --- reload menu window + wsResizeWindow(&appMPlayer.menuWindow, appMPlayer.menuBase.width, appMPlayer.menuBase.height); + wsResizeImage(&appMPlayer.menuWindow, appMPlayer.menuBase.width, appMPlayer.menuBase.height); + wsSetShape(&appMPlayer.menuWindow, appMPlayer.menuBase.Mask.Image); + wsVisibleWindow(&appMPlayer.menuWindow, wsHideWindow); + } else + mplMenuInit(); + + // reload sub window - if ( prev && appMPlayer.menuIsPresent ) - { - free( mplMenuDrawBuffer ); - if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) - { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } - wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); - wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); - wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image ); - wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); - } else { mplMenuInit(); } + if (appMPlayer.sub.Bitmap.Image) + wsResizeImage(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Width, appMPlayer.sub.Bitmap.Height); + + if (!appMPlayer.subWindow.isFullScreen && !guiIntfStruct.Playing) { + wsResizeWindow(&appMPlayer.subWindow, appMPlayer.sub.width, appMPlayer.sub.height); + wsMoveWindow(&appMPlayer.subWindow, True, appMPlayer.sub.x, appMPlayer.sub.y); + } + + if (appMPlayer.sub.Bitmap.Image) + wsConvert(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Image, appMPlayer.sub.Bitmap.ImageSize); -// --- reload sub window - if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); - if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) ) - { - wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); - wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); - } - if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); - if ( !guiIntfStruct.Playing ) - { - mplSubRender=1; - wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); - wsClearWindow( appMPlayer.subWindow ); - wsPostRedisplay( &appMPlayer.subWindow ); - } + if (!guiIntfStruct.Playing) { + mplSubRender = 1; + wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B); + wsClearWindow(appMPlayer.subWindow); + wsPostRedisplay(&appMPlayer.subWindow); + } + + // reload play bar + + if (bprev) + wsDestroyWindow(&appMPlayer.barWindow); + + mplPBInit(); -// --- reload play bar - if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow ); - mplPBInit(); + // reload main window + + free(mplDrawBuffer); + mplDrawBuffer = calloc(1, appMPlayer.main.Bitmap.ImageSize); -// --- reload main window - free( mplDrawBuffer ); - if ( ( mplDrawBuffer = calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) - { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } + if (!mplDrawBuffer) { + mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_NEMDB); + return; + } - wsDestroyWindow( &appMPlayer.mainWindow ); + wsDestroyWindow(&appMPlayer.mainWindow); + + wsCreateWindow(&appMPlayer.mainWindow, appMPlayer.main.x, appMPlayer.main.y, appMPlayer.main.width, appMPlayer.main.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsMaxSize | wsHideWindow, "MPlayer"); + wsCreateImage(&appMPlayer.mainWindow, appMPlayer.main.Bitmap.Width, appMPlayer.main.Bitmap.Height); + wsSetShape(&appMPlayer.mainWindow, appMPlayer.main.Mask.Image); + wsSetIcon(wsDisplay, appMPlayer.mainWindow.WindowID, guiIcon, guiIconMask); - wsCreateWindow( &appMPlayer.mainWindow, - appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, - wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" ); - wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height ); - wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); - wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); + appMPlayer.mainWindow.ReDraw = (void *)mplMainDraw; + appMPlayer.mainWindow.MouseHandler = mplMainMouseHandle; + appMPlayer.mainWindow.KeyHandler = mplMainKeyHandle; + appMPlayer.mainWindow.DandDHandler = mplDandDHandler; + + wsXDNDMakeAwareness(&appMPlayer.mainWindow); - appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; - appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; - appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; - appMPlayer.mainWindow.DandDHandler=mplDandDHandler; + if (!appMPlayer.mainDecoration) + wsWindowDecoration(&appMPlayer.mainWindow, 0); + + wsVisibleWindow(&appMPlayer.mainWindow, wsShowWindow); + mainVisible = 1; + + btnModify(evSetVolume, guiIntfStruct.Volume); + btnModify(evSetBalance, guiIntfStruct.Balance); + btnModify(evSetMoviePosition, guiIntfStruct.Position); + btnModify(evFullScreen, !appMPlayer.subWindow.isFullScreen); - wsXDNDMakeAwareness( &appMPlayer.mainWindow ); - if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); - wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); - mainVisible=1; -// --- + wsSetLayer(wsDisplay, appMPlayer.mainWindow.WindowID, appMPlayer.subWindow.isFullScreen); + wsSetLayer(wsDisplay, appMPlayer.menuWindow.WindowID, appMPlayer.subWindow.isFullScreen); +} + +void mplSetFileName(char *dir, char *name, int type) +{ + if (!name) + return; - btnModify( evSetVolume,guiIntfStruct.Volume ); - btnModify( evSetBalance,guiIntfStruct.Balance ); - btnModify( evSetMoviePosition,guiIntfStruct.Position ); - btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); + if (!dir) + guiSetFilename(guiIntfStruct.Filename, name) + else + guiSetDF(guiIntfStruct.Filename, dir, name) - wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen ); - wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen ); - + guiIntfStruct.StreamType = type; + gfree((void **)&guiIntfStruct.AudioFile); + gfree((void **)&guiIntfStruct.Subtitlename); } -void mplSetFileName( char * dir,char * name,int type ) +void mplCurr(void) { - if ( !name ) return; - - if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name ) - else guiSetDF( guiIntfStruct.Filename,dir,name ); + plItem *curr; + int stop = 0; -// filename=guiIntfStruct.Filename; - guiIntfStruct.StreamType=type; - gfree( (void **)&guiIntfStruct.AudioFile ); - gfree( (void **)&guiIntfStruct.Subtitlename ); -} + if (guiIntfStruct.Playing == 2) + return; -void mplCurr( void ) -{ - plItem * curr; - int stop = 0; + switch (guiIntfStruct.StreamType) { +#ifdef CONFIG_DVDREAD + case STREAMTYPE_DVD: + break; - if ( guiIntfStruct.Playing == 2 ) return; - switch ( guiIntfStruct.StreamType ) - { -#ifdef CONFIG_DVDREAD - case STREAMTYPE_DVD: - break; #endif #ifdef CONFIG_VCD - case STREAMTYPE_VCD: - break; + case STREAMTYPE_VCD: + break; + #endif - default: - if ( (curr=gtkSet( gtkGetCurrPlItem,0,NULL)) ) - { - mplSetFileName( curr->path,curr->name,STREAMTYPE_FILE ); - mplGotoTheNext=0; - break; - } - return; - } - if ( stop ) mplEventHandling( evStop,0 ); - if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); + default: + + curr = gtkSet(gtkGetCurrPlItem, 0, NULL); + + if (curr) { + mplSetFileName(curr->path, curr->name, STREAMTYPE_FILE); + mplGotoTheNext = 0; + break; + } + + return; + } + + if (stop) + mplEventHandling(evStop, 0); + + if (guiIntfStruct.Playing == 1) + mplEventHandling(evPlay, 0); } - -void mplPrev( void ) +void mplPrev(void) { - plItem * prev; - int stop = 0; + plItem *prev; + int stop = 0; + + if (guiIntfStruct.Playing == 2) + return; + + switch (guiIntfStruct.StreamType) { +#ifdef CONFIG_DVDREAD + case STREAMTYPE_DVD: - if ( guiIntfStruct.Playing == 2 ) return; - switch ( guiIntfStruct.StreamType ) - { -#ifdef CONFIG_DVDREAD - case STREAMTYPE_DVD: - if ( --guiIntfStruct.DVD.current_chapter == 0 ) - { - guiIntfStruct.DVD.current_chapter=1; - if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; } - } - guiIntfStruct.Track=guiIntfStruct.DVD.current_title; - break; + if (--guiIntfStruct.DVD.current_chapter == 0) { + guiIntfStruct.DVD.current_chapter = 1; + + if (--guiIntfStruct.DVD.current_title <= 0) { + guiIntfStruct.DVD.current_title = 1; + stop = 1; + } + } + + guiIntfStruct.Track = guiIntfStruct.DVD.current_title; + break; + #endif #ifdef CONFIG_VCD - case STREAMTYPE_VCD: - if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; } - break; + case STREAMTYPE_VCD: + if (--guiIntfStruct.Track == 0) { + guiIntfStruct.Track = 1; + stop = 1; + } + break; + #endif - default: - if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) ) - { - mplSetFileName( prev->path,prev->name,STREAMTYPE_FILE ); - mplGotoTheNext=0; - break; - } - return; - } - if ( stop ) mplEventHandling( evStop,0 ); - if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); + default: + + prev = gtkSet(gtkGetPrevPlItem, 0, NULL); + + if (prev) { + mplSetFileName(prev->path, prev->name, STREAMTYPE_FILE); + mplGotoTheNext = 0; + break; + } + + return; + } + + if (stop) + mplEventHandling(evStop, 0); + + if (guiIntfStruct.Playing == 1) + mplEventHandling(evPlay, 0); } -void mplNext( void ) +void mplNext(void) { - int stop = 0; - plItem * next; + int stop = 0; + plItem *next; - if ( guiIntfStruct.Playing == 2 ) return; - switch ( guiIntfStruct.StreamType ) - { + if (guiIntfStruct.Playing == 2) + return; + + switch (guiIntfStruct.StreamType) { #ifdef CONFIG_DVDREAD - case STREAMTYPE_DVD: - if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters ) - { - guiIntfStruct.DVD.current_chapter=1; - if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; } - } - guiIntfStruct.Track=guiIntfStruct.DVD.current_title; - break; + case STREAMTYPE_DVD: + + if (guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters) { + guiIntfStruct.DVD.current_chapter = 1; + + if (++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles) { + guiIntfStruct.DVD.current_title = guiIntfStruct.DVD.titles; + stop = 1; + } + } + + guiIntfStruct.Track = guiIntfStruct.DVD.current_title; + break; + #endif #ifdef CONFIG_VCD - case STREAMTYPE_VCD: - if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; } - break; + case STREAMTYPE_VCD: + if (++guiIntfStruct.Track > guiIntfStruct.VCDTracks) { + guiIntfStruct.Track = guiIntfStruct.VCDTracks; + stop = 1; + } + break; + #endif - default: - if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) ) - { - mplSetFileName( next->path,next->name,STREAMTYPE_FILE ); - mplGotoTheNext=0; - break; - } - return; - } - if ( stop ) mplEventHandling( evStop,0 ); - if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); + default: + + next = gtkSet(gtkGetNextPlItem, 0, NULL); + + if (next) { + mplSetFileName(next->path, next->name, STREAMTYPE_FILE); + mplGotoTheNext = 0; + break; + } + + return; + } + + if (stop) + mplEventHandling(evStop, 0); + + if (guiIntfStruct.Playing == 1) + mplEventHandling(evPlay, 0); }
--- a/gui/mplayer/play.h Thu Feb 24 23:51:27 2011 +0000 +++ b/gui/mplayer/play.h Fri Feb 25 12:13:36 2011 +0000 @@ -21,29 +21,17 @@ extern int mplGotoTheNext; -void mplEnd( void ); -void mplFullScreen( void ); -void mplPlay( void ); -void mplPause( void ); -void mplState( void ); -void mplPrev( void ); -void mplNext( void ); -void mplCurr( void ); - -void mplIncAudioBufDelay( void ); -void mplDecAudioBufDelay( void ); - -void mplRelSeek( float s ); -void mplAbsSeek( float s ); -float mplGetPosition( void ); - -void mplPlayFork( void ); -void mplSigHandler( int s ); -void mplPlayerThread( void ); - -void ChangeSkin( char * name ); -void EventHandling( void ); - -void mplSetFileName( char * dir, char * name, int type ); +void ChangeSkin(char *); +void mplAbsSeek(float); +void mplCurr(void); +void mplEnd(void); +void mplFullScreen(void); +void mplNext(void); +void mplPause(void); +void mplPlay(void); +void mplPrev(void); +void mplRelSeek(float); +void mplSetFileName(char *, char *, int); +void mplState(void); #endif /* MPLAYER_GUI_PLAY_H */