summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-25 03:24:38 +0200
committerwm4 <wm4@nowhere>2012-10-12 10:10:32 +0200
commite79efd28f8f3f539ca976733ff4209e372dcb5ed (patch)
tree885b7f85ed7d1b074de5042b38624fdeb516b54b /mplayer.c
parent88849fd1d4056bc22305cc4433dc56360dd6d0e9 (diff)
downloadmpv-e79efd28f8f3f539ca976733ff4209e372dcb5ed.tar.bz2
mpv-e79efd28f8f3f539ca976733ff4209e372dcb5ed.tar.xz
commands: more user-control whether a command shows OSD bars/messages
The "no-osd" prefix was introduced earlier to disable OSD selectively based on the key binding. Extend this, and allow the user to force display of an OSD bar ("osd-bar"), OSD message ("osd-msg") or both ("osd-msg-bar"). This changes mainly how property setting functions behave. The default behavior is still the same.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/mplayer.c b/mplayer.c
index 13ce3c5ecc..ab78276a87 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1425,6 +1425,35 @@ static void sadd_osd_status(char *buffer, int len, struct MPContext *mpctx,
}
}
+// OSD messages initated by seeking commands are added lazily with this
+// function, because multiple successive seek commands can be coalesced.
+static void add_seek_osd_messages(struct MPContext *mpctx)
+{
+ if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_BAR)
+ set_osd_bar(mpctx, 0, "Position", 0, 100, get_percent_pos(mpctx));
+ if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_TEXT) {
+ mp_osd_msg_t *msg = add_osd_msg(mpctx, OSD_MSG_TEXT, 1,
+ mpctx->opts.osd_duration);
+ msg->show_position = true;
+ }
+ if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_CHAPTER_TEXT) {
+ char *chapter = chapter_display_name(mpctx, get_current_chapter(mpctx));
+ set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts.osd_duration,
+ "Chapter: %s", chapter);
+ talloc_free(chapter);
+ }
+ assert(mpctx->master_demuxer);
+ if ((mpctx->add_osd_seek_info & OSD_SEEK_INFO_EDITION)
+ && mpctx->master_demuxer)
+ {
+ set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts.osd_duration,
+ "Playing edition %d of %d.",
+ mpctx->master_demuxer->edition + 1,
+ mpctx->master_demuxer->num_editions);
+ }
+ mpctx->add_osd_seek_info = 0;
+}
+
/**
* \brief Update the OSD message line.
*
@@ -1439,10 +1468,7 @@ static void update_osd_msg(struct MPContext *mpctx)
struct MPOpts *opts = &mpctx->opts;
struct osd_state *osd = mpctx->osd;
- if (mpctx->add_osd_seek_info) {
- set_osd_bar(mpctx, 0, "Position", 0, 100, get_percent_pos(mpctx));
- mpctx->add_osd_seek_info = false;
- }
+ add_seek_osd_messages(mpctx);
// Look if we have a msg
mp_osd_msg_t *msg = get_osd_msg(mpctx);
@@ -1483,15 +1509,6 @@ static void update_osd_msg(struct MPContext *mpctx)
}
}
-void mp_show_osd_progression(struct MPContext *mpctx)
-{
- mp_osd_msg_t *msg = add_osd_msg(mpctx, OSD_MSG_TEXT, 1,
- mpctx->opts.osd_duration);
- msg->show_position = true;
-
- set_osd_bar(mpctx, 0, "Position", 0, 100, get_percent_pos(mpctx));
-}
-
void reinit_audio_chain(struct MPContext *mpctx)
{
struct MPOpts *opts = &mpctx->opts;
@@ -3677,6 +3694,8 @@ static void play_current_file(struct MPContext *mpctx)
encode_lavc_discontinuity(mpctx->encode_lavc_ctx);
#endif
+ mpctx->add_osd_seek_info &= OSD_SEEK_INFO_EDITION;
+
m_config_enter_file_local(mpctx->mconfig);
load_per_protocol_config(mpctx->mconfig, mpctx->filename);