From 876a3bafc5a0cb491ee1f1d5e928cd6e6ef530a8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 8 Mar 2016 21:54:17 +0100 Subject: osd: cleanup: make OSDTYPE_ constants private to OSD code No need to have them everywhere. The only exception/annoyance is MAX_OSD_PARTS, which is now basically duplicated (and at runtime initialization is checked with an assert()). --- player/command.c | 6 +++--- player/lua.c | 4 ++-- player/osd.c | 2 +- player/sub.c | 6 ++---- 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 950d6dd80c..42938af140 100644 --- a/player/command.c +++ b/player/command.c @@ -2719,7 +2719,7 @@ static int mp_property_osd_w(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_OSD); + struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd); return m_property_int_ro(action, arg, vo_res.w); } @@ -2727,7 +2727,7 @@ static int mp_property_osd_h(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_OSD); + struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd); return m_property_int_ro(action, arg, vo_res.h); } @@ -2735,7 +2735,7 @@ static int mp_property_osd_par(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_OSD); + struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd); return m_property_double_ro(action, arg, vo_res.display_par); } diff --git a/player/lua.c b/player/lua.c index 680577554c..84d7295640 100644 --- a/player/lua.c +++ b/player/lua.c @@ -978,7 +978,7 @@ static int script_set_osd_ass(lua_State *L) static int script_get_osd_size(lua_State *L) { struct MPContext *mpctx = get_mpctx(L); - struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_EXTERNAL); + struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd); double aspect = 1.0 * vo_res.w / MPMAX(vo_res.h, 1) / (vo_res.display_par ? vo_res.display_par : 1); lua_pushnumber(L, vo_res.w); @@ -990,7 +990,7 @@ static int script_get_osd_size(lua_State *L) static int script_get_osd_margins(lua_State *L) { struct MPContext *mpctx = get_mpctx(L); - struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd, OSDTYPE_EXTERNAL); + struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd); lua_pushnumber(L, vo_res.ml); lua_pushnumber(L, vo_res.mt); lua_pushnumber(L, vo_res.mr); diff --git a/player/osd.c b/player/osd.c index 2a09911ac7..1baf9fb45e 100644 --- a/player/osd.c +++ b/player/osd.c @@ -561,6 +561,6 @@ void update_osd_msg(struct MPContext *mpctx) text = talloc_asprintf_append(text, "%s%s", text ? "\n" : "", mpctx->osd_msg_text); } - osd_set_text(osd, OSDTYPE_OSD, text); + osd_set_text(osd, text); talloc_free(text); } diff --git a/player/sub.c b/player/sub.c index 69c1dbbd19..6d01e0ca5d 100644 --- a/player/sub.c +++ b/player/sub.c @@ -71,8 +71,7 @@ void uninit_sub(struct MPContext *mpctx, struct track *track) reset_subtitles(mpctx, track); sub_select(track->d_sub, false); int order = get_order(mpctx, track); - if (order >= 0 && order <= 1) - osd_set_sub(mpctx->osd, OSDTYPE_SUB + order, NULL); + osd_set_sub(mpctx->osd, order, NULL); } } @@ -182,8 +181,7 @@ void reinit_sub(struct MPContext *mpctx, struct track *track) sub_select(track->d_sub, true); int order = get_order(mpctx, track); - if (order >= 0 && order <= 1) - osd_set_sub(mpctx->osd, OSDTYPE_SUB + order, track->d_sub); + osd_set_sub(mpctx->osd, order, track->d_sub); sub_control(track->d_sub, SD_CTRL_SET_TOP, &(bool){!!order}); } -- cgit v1.2.3