mirror of
https://github.com/mpv-player/mpv
synced 2025-02-05 22:52:18 +00:00
command: add properties for retrieving OSD dimensions
This commit is contained in:
parent
1be863afdb
commit
fd49edccf8
@ -463,6 +463,9 @@ Name W Comment
|
||||
``dwidth`` video width (after filters and aspect scaling)
|
||||
``dheight`` video height
|
||||
``aspect`` x video aspect
|
||||
``osd-width`` last known OSD width (can be 0)
|
||||
``osd-height`` last known OSD height (can be 0)
|
||||
``osd-par`` last known OSD display pixel aspect (can be 0)
|
||||
``vid`` x current video track (similar to ``--vid``)
|
||||
``video`` x alias for ``vid``
|
||||
``video-align-x`` x see ``--video-align-x``
|
||||
|
@ -1458,6 +1458,25 @@ static int mp_property_dheight(m_option_t *prop, int action, void *arg,
|
||||
return property_vo_wh(prop, action, arg, mpctx, false);
|
||||
}
|
||||
|
||||
static int mp_property_osd_w(m_option_t *prop, int action, void *arg,
|
||||
MPContext *mpctx)
|
||||
{
|
||||
return m_property_int_ro(prop, action, arg, mpctx->osd->last_vo_res.w);
|
||||
}
|
||||
|
||||
static int mp_property_osd_h(m_option_t *prop, int action, void *arg,
|
||||
MPContext *mpctx)
|
||||
{
|
||||
return m_property_int_ro(prop, action, arg, mpctx->osd->last_vo_res.w);
|
||||
}
|
||||
|
||||
static int mp_property_osd_par(m_option_t *prop, int action, void *arg,
|
||||
MPContext *mpctx)
|
||||
{
|
||||
return m_property_double_ro(prop, action, arg,
|
||||
mpctx->osd->last_vo_res.display_par);
|
||||
}
|
||||
|
||||
/// Video fps (RO)
|
||||
static int mp_property_fps(m_option_t *prop, int action, void *arg,
|
||||
MPContext *mpctx)
|
||||
@ -1880,6 +1899,10 @@ static const m_option_t mp_properties[] = {
|
||||
{ "program", mp_property_program, CONF_TYPE_INT,
|
||||
CONF_RANGE, -1, 65535, NULL },
|
||||
|
||||
{ "osd-width", mp_property_osd_w, CONF_TYPE_INT },
|
||||
{ "osd-height", mp_property_osd_h, CONF_TYPE_INT },
|
||||
{ "osd-par", mp_property_osd_par, CONF_TYPE_DOUBLE },
|
||||
|
||||
// Subs
|
||||
M_OPTION_PROPERTY_CUSTOM("sid", mp_property_sub),
|
||||
M_OPTION_PROPERTY_CUSTOM("sub-delay", mp_property_sub_delay),
|
||||
|
@ -222,6 +222,9 @@ void osd_draw(struct osd_state *osd, struct mp_osd_res res,
|
||||
if (draw_flags & OSD_DRAW_SUB_FILTER)
|
||||
draw_flags |= OSD_DRAW_SUB_ONLY;
|
||||
|
||||
if (!(draw_flags & OSD_DRAW_SUB_ONLY))
|
||||
osd->last_vo_res = res;
|
||||
|
||||
for (int n = 0; n < MAX_OSD_PARTS; n++) {
|
||||
struct osd_object *obj = osd->objs[n];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user