summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/mp_osd.h2
-rw-r--r--core/mplayer.c29
-rw-r--r--sub/osd_libass.c6
3 files changed, 26 insertions, 11 deletions
diff --git a/core/mp_osd.h b/core/mp_osd.h
index d0ebc02639..0b737f0c22 100644
--- a/core/mp_osd.h
+++ b/core/mp_osd.h
@@ -37,6 +37,8 @@
#define MAX_TERM_OSD_LEVEL 1
#define OSD_LEVEL_INVISIBLE 4
+#define OSD_BAR_SEEK 256
+
struct MPContext;
void set_osd_bar(struct MPContext *mpctx, int type,const char* name,double min,double max,double val);
diff --git a/core/mplayer.c b/core/mplayer.c
index 048d7ab3e1..29e06e0caa 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1376,13 +1376,8 @@ static mp_osd_msg_t *get_osd_msg(struct MPContext *mpctx)
return NULL;
}
-/**
- * \brief Display the OSD bar.
- *
- * Display the OSD bar or fall back on a simple message.
- *
- */
-
+// type: mp_osd_font_codepoints, ASCII, or OSD_BAR_*
+// name: fallback for terminal OSD
void set_osd_bar(struct MPContext *mpctx, int type, const char *name,
double min, double max, double val)
{
@@ -1402,6 +1397,17 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name,
name, ROUND(100 * (val - min) / (max - min)));
}
+// Update a currently displayed bar of the same type, without resetting the
+// timer.
+static void update_osd_bar(struct MPContext *mpctx, int type,
+ double min, double max, double val)
+{
+ if (mpctx->osd->progbar_type == type) {
+ mpctx->osd->progbar_value = 256 * (val - min) / (max - min);
+ vo_osd_changed(OSDTYPE_PROGBAR);
+ }
+}
+
void set_osd_function(struct MPContext *mpctx, int osd_function)
{
mpctx->osd_function = osd_function;
@@ -1467,8 +1473,10 @@ static void sadd_osd_status(char *buffer, int len, struct MPContext *mpctx,
// 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_BAR) {
+ set_osd_bar(mpctx, OSD_BAR_SEEK, "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);
@@ -1539,6 +1547,9 @@ static void update_osd_msg(struct MPContext *mpctx)
sadd_osd_status(text, len, mpctx, osd_level == 3);
osd_set_text(osd, text);
+
+ if (msg && msg->show_position)
+ update_osd_bar(mpctx, OSD_BAR_SEEK, 0, 100, get_percent_pos(mpctx));
return;
}
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 4b695e62a2..051383f78e 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -204,9 +204,11 @@ static void update_progbar(struct osd_state *osd, struct osd_object *obj)
char *text = talloc_strdup(NULL, "{\\q2}");
- if (osd->progbar_type >= 32) {
+ if (osd->progbar_type == 0 || osd->progbar_type >= 256) {
+ // no sym
+ } else if (osd->progbar_type >= 32) {
text = append_utf8_buffer(text, osd->progbar_type);
- } else if (osd->progbar_type > 0) {
+ } else {
text = talloc_strdup_append_buffer(text, ASS_USE_OSD_FONT);
text = append_utf8_buffer(text, OSD_CODEPOINTS + osd->progbar_type);
text = talloc_strdup_append_buffer(text, "{\\r}");