diff options
author | wm4 <wm4@nowhere> | 2014-09-18 00:12:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-18 00:12:59 +0200 |
commit | a522441bbe6817798ca58b93d7adb180a9598640 (patch) | |
tree | ca089414b5e0880de7678d7d06871342310d3247 /player | |
parent | a173d3a2fba7c2c3d89af20077dec89ed0424030 (diff) | |
download | mpv-a522441bbe6817798ca58b93d7adb180a9598640.tar.bz2 mpv-a522441bbe6817798ca58b93d7adb180a9598640.tar.xz |
command: add osd-sym-cc property
This allows you to reproduce the OSD symbol.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 11 | ||||
-rw-r--r-- | player/core.h | 1 | ||||
-rw-r--r-- | player/osd.c | 21 |
3 files changed, 22 insertions, 11 deletions
diff --git a/player/command.c b/player/command.c index 6c881bcfca..8c2856c360 100644 --- a/player/command.c +++ b/player/command.c @@ -2220,6 +2220,15 @@ static int mp_property_osd_par(void *ctx, struct m_property *prop, return m_property_double_ro(action, arg, vo_res.display_par); } +static int mp_property_osd_sym(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + char temp[20]; + get_current_osd_sym(mpctx, temp, sizeof(temp)); + return m_property_strdup_ro(action, arg, temp); +} + /// Video fps (RO) static int mp_property_fps(void *ctx, struct m_property *prop, int action, void *arg) @@ -2806,6 +2815,8 @@ static const struct m_property mp_properties[] = { {"osd-height", mp_property_osd_h}, {"osd-par", mp_property_osd_par}, + {"osd-sym-cc", mp_property_osd_sym}, + // Subs {"sid", mp_property_sub}, {"secondary-sid", mp_property_sub2}, diff --git a/player/core.h b/player/core.h index 9d9fefee21..434be6e1e9 100644 --- a/player/core.h +++ b/player/core.h @@ -434,6 +434,7 @@ void set_osd_msg(struct MPContext *mpctx, int level, int time, const char* fmt, ...) PRINTF_ATTRIBUTE(4,5); void set_osd_function(struct MPContext *mpctx, int osd_function); void set_osd_subtitle(struct MPContext *mpctx, const char *text); +void get_current_osd_sym(struct MPContext *mpctx, char *buf, size_t buf_size); // playloop.c void mp_wait_events(struct MPContext *mpctx, double sleeptime); diff --git a/player/osd.c b/player/osd.c index 08bf28dd85..04b21a22f2 100644 --- a/player/osd.c +++ b/player/osd.c @@ -443,17 +443,8 @@ void set_osd_subtitle(struct MPContext *mpctx, const char *text) term_osd_set_subs(mpctx, text); } -// sym == mpctx->osd_function -static void saddf_osd_function_sym(char **buffer, int sym) +void get_current_osd_sym(struct MPContext *mpctx, char *buf, size_t buf_size) { - char temp[10]; - osd_get_function_sym(temp, sizeof(temp), sym); - saddf(buffer, "%s ", temp); -} - -static void sadd_osd_status(char **buffer, struct MPContext *mpctx, bool full) -{ - bool fractions = mpctx->opts->osd_fractions; int sym = mpctx->osd_function; if (!sym) { if (mpctx->paused_for_cache && !mpctx->opts->pause) { @@ -464,7 +455,15 @@ static void sadd_osd_status(char **buffer, struct MPContext *mpctx, bool full) sym = OSD_PLAY; } } - saddf_osd_function_sym(buffer, sym); + osd_get_function_sym(buf, buf_size, sym); +} + +static void sadd_osd_status(char **buffer, struct MPContext *mpctx, bool full) +{ + bool fractions = mpctx->opts->osd_fractions; + char sym[10]; + get_current_osd_sym(mpctx, sym, sizeof(sym)); + saddf(buffer, "%s ", sym); char *custom_msg = mpctx->opts->osd_status_msg; if (custom_msg && full) { char *text = mp_property_expand_escaped_string(mpctx, custom_msg); |