Mercurial > mplayer.hg
changeset 33771:6e774a02d00c
Remove gtkClearStruct code from mplayer() in interface.c.
Move it as static function guiInfoMediumClear() where it is used
and rename the symbolic constants used with this code.
author | ib |
---|---|
date | Sat, 09 Jul 2011 11:48:13 +0000 |
parents | 6134493605c6 |
children | 6673b85049fa |
files | gui/interface.c gui/interface.h gui/ui/main.c |
diffstat | 3 files changed, 29 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/interface.c Sat Jul 09 11:11:52 2011 +0000 +++ b/gui/interface.c Sat Jul 09 11:48:13 2011 +0000 @@ -986,29 +986,6 @@ break; #endif - // misc - // NOTE TO MYSELF: This should rather be in app.c. - case gtkClearStruct: - - if ((unsigned int)vparam & guiFilenames) { - nfree(guiInfo.Filename); - nfree(guiInfo.Subtitlename); - nfree(guiInfo.AudioFile); - listSet(gtkDelPl, NULL); - } - -#ifdef CONFIG_DVDREAD - if ((unsigned int)vparam & guiDVD) - memset(&guiInfo.DVD, 0, sizeof(guiDVDStruct)); -#endif - -#ifdef CONFIG_VCD - if ((unsigned int)vparam & guiVCD) - guiInfo.VCDTracks = 0; -#endif - - break; - case MPLAYER_SET_EXTRA_STEREO: gtkAOExtraStereoMul = fparam; if (guiInfo.afilter)
--- a/gui/interface.h Sat Jul 09 11:11:52 2011 +0000 +++ b/gui/interface.h Sat Jul 09 11:48:13 2011 +0000 @@ -56,13 +56,6 @@ #define GUI_PLAY 1 #define GUI_PAUSE 2 -// NOTE TO MYSELF: This should rather be in app.h. -#define guiDVD 1 -#define guiVCD 2 -#define guiFilenames 4 -#define guiALL 0xffffffff -#define gtkClearStruct 99 - enum { MPLAYER_EXIT_GUI, MPLAYER_SET_AUTO_QUALITY,
--- a/gui/ui/main.c Sat Jul 09 11:11:52 2011 +0000 +++ b/gui/ui/main.c Sat Jul 09 11:48:13 2011 +0000 @@ -55,6 +55,11 @@ #include "mp_core.h" #include "mpcommon.h" +#define CLEAR_FILE 1 +#define CLEAR_DVD 2 +#define CLEAR_VCD 4 +#define CLEAR_ALL (CLEAR_FILE + CLEAR_DVD + CLEAR_VCD) + #define GUI_REDRAW_WAIT 375 #include "actions.h" @@ -98,6 +103,25 @@ // XFlush( wsDisplay ); } +static void guiInfoMediumClear (int what) +{ + if (what & CLEAR_FILE) + { + nfree(guiInfo.Filename); + nfree(guiInfo.Subtitlename); + nfree(guiInfo.AudioFile); + listSet(gtkDelPl, NULL); + } + +#ifdef CONFIG_DVDREAD + if (what & CLEAR_DVD) memset(&guiInfo.DVD, 0, sizeof(guiDVDStruct)); +#endif + +#ifdef CONFIG_VCD + if (what & CLEAR_VCD) guiInfo.VCDTracks = 0; +#endif +} + static unsigned last_redraw_time = 0; void uiEventHandling( int msg,float param ) @@ -139,7 +163,7 @@ case evSetVCDTrack: guiInfo.Track=iparam; case evPlayVCD: - mplayer( gtkClearStruct,0,(void *)guiALL ); + guiInfoMediumClear ( CLEAR_ALL ); guiInfo.StreamType=STREAMTYPE_VCD; goto play; #endif @@ -149,7 +173,7 @@ guiInfo.DVD.current_chapter=1; guiInfo.DVD.current_angle=1; play_dvd_2: - mplayer( gtkClearStruct,0,(void *)(guiALL - guiDVD) ); + guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD ); guiInfo.StreamType=STREAMTYPE_DVD; goto play; #endif @@ -170,11 +194,11 @@ { case STREAMTYPE_STREAM: case STREAMTYPE_FILE: - mplayer( gtkClearStruct,0,(void *)(guiALL - guiFilenames) ); + guiInfoMediumClear( CLEAR_ALL - CLEAR_FILE ); break; #ifdef CONFIG_VCD case STREAMTYPE_VCD: - mplayer( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) ); + guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE ); if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE ); uiSetFileName( NULL,cdrom_device,STREAMTYPE_VCD ); if ( guiInfo.Playing != GUI_PAUSE ) @@ -187,7 +211,7 @@ #endif #ifdef CONFIG_DVDREAD case STREAMTYPE_DVD: - mplayer( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) ); + guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD - CLEAR_FILE ); if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE ); uiSetFileName( NULL,dvd_device,STREAMTYPE_DVD ); if ( guiInfo.Playing != GUI_PAUSE )