summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/command.c10
-rw-r--r--core/mp_core.h2
-rw-r--r--core/mp_osd.h3
-rw-r--r--core/mplayer.c21
4 files changed, 22 insertions, 14 deletions
diff --git a/core/command.c b/core/command.c
index 739f0feb13..7f2940fbaa 100644
--- a/core/command.c
+++ b/core/command.c
@@ -1756,23 +1756,21 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
float v = cmd->args[0].v.f;
int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
int exact = (cmd->nargs > 2) ? cmd->args[2].v.i : 0;
- int function;
if (abs == 2) { // Absolute seek to a timestamp in seconds
queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact);
- function = v > get_current_time(mpctx) ? OSD_FFW : OSD_REW;
+ set_osd_function(mpctx,
+ v > get_current_time(mpctx) ? OSD_FFW : OSD_REW);
} else if (abs) { /* Absolute seek by percentage */
queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, exact);
- function = OSD_FFW; // Direction isn't set correctly
+ set_osd_function(mpctx, OSD_FFW); // Direction isn't set correctly
} else {
queue_seek(mpctx, MPSEEK_RELATIVE, v, exact);
- function = (v > 0) ? OSD_FFW : OSD_REW;
+ set_osd_function(mpctx, (v > 0) ? OSD_FFW : OSD_REW);
}
if (bar_osd)
mpctx->add_osd_seek_info |= OSD_SEEK_INFO_BAR;
if (msg_osd && !auto_osd)
mpctx->add_osd_seek_info |= OSD_SEEK_INFO_TEXT;
- if (mpctx->add_osd_seek_info)
- mpctx->osd_function = function;
break;
}
diff --git a/core/mp_core.h b/core/mp_core.h
index 0439ca13f5..dac4dd26d0 100644
--- a/core/mp_core.h
+++ b/core/mp_core.h
@@ -137,8 +137,8 @@ typedef struct MPContext {
int add_osd_seek_info; // bitfield of enum mp_osd_seek_info
unsigned int osd_visible;
-
int osd_function;
+
struct playlist *playlist;
char *filename; // currently playing file
struct mp_resolve_result *resolve_result;
diff --git a/core/mp_osd.h b/core/mp_osd.h
index 444b54736c..78957fb3bf 100644
--- a/core/mp_osd.h
+++ b/core/mp_osd.h
@@ -42,4 +42,7 @@ void set_osd_msg(struct MPContext *mpctx, int id, int level, int time, const cha
void set_osd_tmsg(struct MPContext *mpctx, int id, int level, int time, const char* fmt, ...);
void rm_osd_msg(struct MPContext *mpctx, int id);
+// osd_function is the symbol appearing in the video status, such as OSD_PLAY
+void set_osd_function(struct MPContext *mpctx, int osd_function);
+
#endif /* MPLAYER_MP_OSD_H */
diff --git a/core/mplayer.c b/core/mplayer.c
index ebe6d8f9db..32c86d2dc7 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1335,7 +1335,7 @@ static mp_osd_msg_t *get_osd_msg(struct MPContext *mpctx)
mpctx->osd_visible = 0;
mpctx->osd->progbar_type = -1; // disable
vo_osd_changed(OSDTYPE_PROGBAR);
- mpctx->osd_function = mpctx->paused ? OSD_PAUSE : OSD_PLAY;
+ mpctx->osd_function = 0;
}
}
@@ -1403,6 +1403,12 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name,
name, ROUND(100 * (val - min) / (max - min)));
}
+void set_osd_function(struct MPContext *mpctx, int osd_function)
+{
+ mpctx->osd_function = osd_function;
+ mpctx->osd_visible = (GetTimerMS() + 1000) | 1;
+}
+
/**
* \brief Display text subtitles on the OSD
*/
@@ -1439,7 +1445,10 @@ static void sadd_osd_status(char *buffer, int len, struct MPContext *mpctx,
bool full)
{
bool fractions = mpctx->opts.osd_fractions;
- saddf_osd_function_sym(buffer, len, mpctx->osd_function);
+ int sym = mpctx->osd_function;
+ if (!sym)
+ sym = mpctx->paused || mpctx->step_frames ? OSD_PAUSE : OSD_PLAY;
+ saddf_osd_function_sym(buffer, len, sym);
sadd_hhmmssff(buffer, len, get_current_time(mpctx), fractions);
if (full) {
saddf(buffer, len, " / ");
@@ -2537,7 +2546,7 @@ void pause_player(struct MPContext *mpctx)
mpctx->paused = 1;
mpctx->step_frames = 0;
mpctx->time_frame -= get_relative_time(mpctx);
- mpctx->osd_function = OSD_PAUSE;
+ mpctx->osd_function = 0;
if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok)
vo_control(mpctx->video_out, VOCTRL_PAUSE, NULL);
@@ -2558,8 +2567,7 @@ void unpause_player(struct MPContext *mpctx)
if (!mpctx->paused)
return;
mpctx->paused = 0;
- if (!mpctx->step_frames)
- mpctx->osd_function = OSD_PLAY;
+ mpctx->osd_function = 0;
if (mpctx->ao && mpctx->sh_audio)
ao_resume(mpctx->ao);
@@ -3393,7 +3401,7 @@ static void run_playloop(struct MPContext *mpctx)
// handle -sstep
if (step_sec > 0 && !mpctx->paused && !mpctx->restart_playback) {
- mpctx->osd_function = OSD_FFW;
+ set_osd_function(mpctx, OSD_FFW);
queue_seek(mpctx, MPSEEK_RELATIVE, step_sec, 0);
}
@@ -4316,7 +4324,6 @@ int main(int argc, char *argv[])
struct MPContext *mpctx = talloc(NULL, MPContext);
*mpctx = (struct MPContext){
- .osd_function = OSD_PLAY,
.begin_skip = MP_NOPTS_VALUE,
.file_format = DEMUXER_TYPE_UNKNOWN,
.last_dvb_step = 1,