Skip to content

Commit

Permalink
Replace all playback integer constants by their symbolic constants.
Browse files Browse the repository at this point in the history
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@33703 b3059339-0415-0410-9bf9-f77b7e298cf2
  • Loading branch information
ib committed Jun 22, 2011
1 parent 966e842 commit 8c356e4
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
10 changes: 5 additions & 5 deletions gui/interface.c
Expand Up @@ -354,15 +354,15 @@ void guiInit(void)

guiApp.subWindow.Mapped = wsMapped;
}
guiInfo.Playing = 2; // set pause, because of !gtkShowVideoWindow...
guiInfo.Playing = GUI_PAUSE; // because of !gtkShowVideoWindow...
uiFullScreen(); // ...guiInfo.Playing is required
wsVisibleWindow(&guiApp.subWindow, wsHideWindow);
btnModify(evFullScreen, btnPressed);
}
}
#endif

guiInfo.Playing = 0;
guiInfo.Playing = GUI_STOP;

uiSubRender = 1;

Expand Down Expand Up @@ -576,17 +576,17 @@ int guiGetEvent(int type, void *arg)

switch ((int)arg) {
case GUI_PLAY:
guiInfo.Playing = 1;
// if ( !gtkShowVideoWindow ) wsVisibleWindow( &guiApp.subWindow,wsHideWindow );
guiInfo.Playing = GUI_PLAY;
break;

case GUI_STOP:
guiInfo.Playing = 0;
// if ( !gtkShowVideoWindow ) wsVisibleWindow( &guiApp.subWindow,wsHideWindow );
guiInfo.Playing = GUI_STOP;
break;

case GUI_PAUSE:
guiInfo.Playing = 2;
guiInfo.Playing = GUI_PAUSE;
break;
}

Expand Down
22 changes: 11 additions & 11 deletions gui/ui/actions.c
Expand Up @@ -140,10 +140,10 @@ void uiPlay(void)
{
if (!guiInfo.Filename ||
(guiInfo.Filename[0] == 0) ||
(guiInfo.Playing == 1))
(guiInfo.Playing == GUI_PLAY))
return;

if (guiInfo.Playing == 2) {
if (guiInfo.Playing == GUI_PAUSE) {
uiPause();
return;
}
Expand All @@ -159,18 +159,18 @@ void uiPause(void)
if (!guiInfo.Playing)
return;

if (guiInfo.Playing == 1) {
if (guiInfo.Playing == GUI_PLAY) {
mp_cmd_t *cmd = calloc(1, sizeof(*cmd));
cmd->id = MP_CMD_PAUSE;
cmd->name = strdup("pause");
mp_input_queue_cmd(cmd);
} else
guiInfo.Playing = 1;
guiInfo.Playing = GUI_PLAY;
}

void uiState(void)
{
if (guiInfo.Playing == 0 || guiInfo.Playing == 2) {
if (guiInfo.Playing == GUI_STOP || guiInfo.Playing == GUI_PAUSE) {
btnModify(evPlaySwitchToPause, btnReleased);
btnModify(evPauseSwitchToPlay, btnDisabled);
} else {
Expand Down Expand Up @@ -314,7 +314,7 @@ void uiCurr(void)
plItem *curr;
int stop = 0;

if (guiInfo.Playing == 2)
if (guiInfo.Playing == GUI_PAUSE)
return;

switch (guiInfo.StreamType) {
Expand Down Expand Up @@ -344,7 +344,7 @@ void uiCurr(void)
if (stop)
uiEventHandling(evStop, 0);

if (guiInfo.Playing == 1)
if (guiInfo.Playing == GUI_PLAY)
uiEventHandling(evPlay, 0);
}

Expand All @@ -353,7 +353,7 @@ void uiPrev(void)
plItem *prev;
int stop = 0;

if (guiInfo.Playing == 2)
if (guiInfo.Playing == GUI_PAUSE)
return;

switch (guiInfo.StreamType) {
Expand Down Expand Up @@ -398,7 +398,7 @@ void uiPrev(void)
if (stop)
uiEventHandling(evStop, 0);

if (guiInfo.Playing == 1)
if (guiInfo.Playing == GUI_PLAY)
uiEventHandling(evPlay, 0);
}

Expand All @@ -407,7 +407,7 @@ void uiNext(void)
int stop = 0;
plItem *next;

if (guiInfo.Playing == 2)
if (guiInfo.Playing == GUI_PAUSE)
return;

switch (guiInfo.StreamType) {
Expand Down Expand Up @@ -458,7 +458,7 @@ void uiNext(void)
if (stop)
uiEventHandling(evStop, 0);

if (guiInfo.Playing == 1)
if (guiInfo.Playing == GUI_PLAY)
uiEventHandling(evPlay, 0);
}

Expand Down
8 changes: 4 additions & 4 deletions gui/ui/main.c
Expand Up @@ -153,7 +153,7 @@ void uiEventHandling( int msg,float param )
case evPlaySwitchToPause:
play:

if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == 2 ) ) goto NoPause;
if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause;

if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) )
{
Expand All @@ -173,7 +173,7 @@ void uiEventHandling( int msg,float param )
gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) );
if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
uiSetFileName( NULL,cdrom_device,STREAMTYPE_VCD );
if ( guiInfo.Playing != 2 )
if ( guiInfo.Playing != GUI_PAUSE )
{
if ( !guiInfo.Track )
guiInfo.Track=1;
Expand All @@ -186,7 +186,7 @@ void uiEventHandling( int msg,float param )
gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) );
if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE );
uiSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
if ( guiInfo.Playing != 2 )
if ( guiInfo.Playing != GUI_PAUSE )
{
guiInfo.Title=guiInfo.DVD.current_title;
guiInfo.Chapter=guiInfo.DVD.current_chapter;
Expand Down Expand Up @@ -626,7 +626,7 @@ void uiDandDHandler(int num,char** files)

if (filename) {
uiSetFileName( NULL,filename,STREAMTYPE_FILE );
if ( guiInfo.Playing == 1 ) uiEventHandling( evStop,0 );
if ( guiInfo.Playing == GUI_PLAY ) uiEventHandling( evStop,0 );
uiEventHandling( evPlay,0 );
}
if (subtitles) {
Expand Down
6 changes: 3 additions & 3 deletions gui/ui/render.c
Expand Up @@ -230,17 +230,17 @@ static char *Translate(char *str)
break;

case 's':
if (guiInfo.Playing == 0)
if (guiInfo.Playing == GUI_STOP)
av_strlcat(trbuf, "s", sizeof(trbuf));
break;

case 'l':
if (guiInfo.Playing == 1)
if (guiInfo.Playing == GUI_PLAY)
av_strlcat(trbuf, "p", sizeof(trbuf));
break;

case 'e':
if (guiInfo.Playing == 2)
if (guiInfo.Playing == GUI_PAUSE)
av_strlcat(trbuf, "e", sizeof(trbuf));
break;

Expand Down
2 changes: 1 addition & 1 deletion gui/win32/dialogs.c
Expand Up @@ -159,7 +159,7 @@ void display_opensubtitlewindow(gui_t *gui)
char subtitlefile[MAX_PATH];

/* Safety check */
if (guiInfo.Playing == 0 || !guiInfo.sh_video) return;
if (guiInfo.Playing == GUI_STOP || !guiInfo.sh_video) return;

memset(&subtitleopen, 0, sizeof(OPENFILENAME));
memset(subtitlefile, 0, sizeof(subtitlefile));
Expand Down
4 changes: 2 additions & 2 deletions gui/win32/gui.c
Expand Up @@ -263,7 +263,7 @@ static void updatedisplay(gui_t *gui, HWND hwnd)
{
gui->skin->widgets[i]->value = guiInfo.Playing;
renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
guiInfo.Playing == 1 ? 0 : 1);
guiInfo.Playing == GUI_PLAY ? 0 : 1);
}
if(gui->skin->widgets[i]->msg == evMute)
{
Expand Down Expand Up @@ -607,7 +607,7 @@ static LRESULT CALLBACK SubProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
GetClientRect(hWnd, &rect);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
if(guiInfo.Playing == 0)
if(guiInfo.Playing == GUI_STOP)
{
int i;
window *desc = NULL;
Expand Down
20 changes: 10 additions & 10 deletions gui/win32/interface.c
Expand Up @@ -243,7 +243,7 @@ static void guiSetEvent(int event)
{
float l,r;

if (guiInfo.Playing == 0)
if (guiInfo.Playing == GUI_STOP)
break;

if (guiInfo.Balance == 50.0f)
Expand Down Expand Up @@ -318,7 +318,7 @@ void uiPlay( void )
if((!guiInfo.Filename ) || (guiInfo.Filename[0] == 0))
return;

if(guiInfo.Playing > 0)
if(guiInfo.Playing > GUI_STOP)
{
uiPause();
return;
Expand All @@ -331,18 +331,18 @@ void uiPause( void )
{
if(!guiInfo.Playing) return;

if(guiInfo.Playing == 1)
if(guiInfo.Playing == GUI_PLAY)
{
mp_cmd_t * cmd = calloc(1, sizeof(*cmd));
cmd->id=MP_CMD_PAUSE;
cmd->name=strdup("pause");
mp_input_queue_cmd(cmd);
} else guiInfo.Playing = 1;
} else guiInfo.Playing = GUI_PLAY;
}

void uiNext(void)
{
if(guiInfo.Playing == 2) return;
if(guiInfo.Playing == GUI_PAUSE) return;
switch(guiInfo.StreamType)
{
#ifdef CONFIG_DVDREAD
Expand All @@ -364,7 +364,7 @@ void uiNext(void)

void uiPrev(void)
{
if(guiInfo.Playing == 2) return;
if(guiInfo.Playing == GUI_PAUSE) return;
switch(guiInfo.StreamType)
{
#ifdef CONFIG_DVDREAD
Expand Down Expand Up @@ -667,19 +667,19 @@ int guiGetEvent(int type, void *arg)
{
case GUI_PLAY:
{
guiInfo.Playing = 1;
guiInfo.Playing = GUI_PLAY;
break;
}
case GUI_STOP:
{
guiInfo.Playing = 0;
guiInfo.Playing = GUI_STOP;
if(movie_aspect >= 0)
movie_aspect = -1;
update_subwindow();
break;
}
case GUI_PAUSE:
guiInfo.Playing = 2;
guiInfo.Playing = GUI_PAUSE;
break;
}
break;
Expand Down Expand Up @@ -912,7 +912,7 @@ static int update_subwindow(void)
wp.flags = SWP_NOOWNERZORDER | SWP_SHOWWINDOW;

/* erase the bitmap image if there's video */
if(guiInfo.Playing != 0 && guiInfo.sh_video)
if(guiInfo.Playing != GUI_STOP && guiInfo.sh_video)
SendMessage(mygui->subwindow, WM_ERASEBKGND, (WPARAM)GetDC(mygui->subwindow), 0);

/* reset the window aspect */
Expand Down
6 changes: 3 additions & 3 deletions gui/win32/widgetrender.c
Expand Up @@ -151,9 +151,9 @@ static char *generatetextfromlabel(widget *item)

if(!strcmp(text, "$p") || !strcmp(text, "$s") || !strcmp(text, "$e"))
{
if(guiInfo.Playing == 0) stringreplace(text, NULL, "s");
else if(guiInfo.Playing == 1) stringreplace(text, NULL, "p");
else if(guiInfo.Playing == 2) stringreplace(text, NULL, "e");
if(guiInfo.Playing == GUI_STOP) stringreplace(text, NULL, "s");
else if(guiInfo.Playing == GUI_PLAY) stringreplace(text, NULL, "p");
else if(guiInfo.Playing == GUI_PAUSE) stringreplace(text, NULL, "e");
}

if(guiInfo.AudioType == 0) stringreplace(text, "$a", "n");
Expand Down
10 changes: 5 additions & 5 deletions mplayer.c
Expand Up @@ -2558,7 +2558,7 @@ static void pause_loop(void)
if (use_gui) {
guiEventHandling();
guiGetEvent(guiReDraw, NULL);
if (guiInfo.Playing != 2 || (rel_seek_secs || abs_seek_pos))
if (guiInfo.Playing != GUI_PAUSE || (rel_seek_secs || abs_seek_pos))
break;
}
#endif
Expand Down Expand Up @@ -3052,7 +3052,7 @@ int main(int argc, char *argv[])
if (use_gui) {
guiInit();
guiGetEvent(guiSetContext, mpctx);
guiGetEvent(guiSetState, (char *)((gui_no_filename) ? 0 : 1));
guiGetEvent(guiSetState, (void *)((gui_no_filename) ? GUI_STOP : GUI_PLAY));
}
#endif

Expand Down Expand Up @@ -3091,7 +3091,7 @@ int main(int argc, char *argv[])
if (use_gui) {
mpctx->file_format = DEMUXER_TYPE_UNKNOWN;
guiGetEvent(guiSetDefaults, 0);
while (guiInfo.Playing != 1) {
while (guiInfo.Playing != GUI_PLAY) {
mp_cmd_t *cmd;
usec_sleep(20000);
guiEventHandling();
Expand Down Expand Up @@ -4006,9 +4006,9 @@ int main(int argc, char *argv[])
guiInfo.LengthInSec = demuxer_get_time_length(mpctx->demuxer);
guiGetEvent(guiReDraw, NULL);
guiGetEvent(guiSetVolume, NULL);
if (guiInfo.Playing == 0)
if (guiInfo.Playing == GUI_STOP)
break; // STOP
if (guiInfo.Playing == 2)
if (guiInfo.Playing == GUI_PAUSE)
mpctx->osd_function = OSD_PAUSE;
if (guiInfo.DiskChanged || guiInfo.NewPlay)
goto goto_next_file;
Expand Down

0 comments on commit 8c356e4

Please sign in to comment.