diff options
author | wm4 <wm4@nowhere> | 2015-11-22 18:54:22 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-22 18:54:22 +0100 |
commit | 01a2af6c7c98c04e7cc834ea019f31f8c698d125 (patch) | |
tree | 1dedd5cb26e0697ea165b2f614102786ac318bef /player | |
parent | b38094ad919b082e59438ddb8c1c590cd9af3e02 (diff) |
command: export some per-video-frame information
Utterly useless, but requested. Fixes #2444.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c index 7d520d78ac..c6fb5d6fdd 100644 --- a/player/command.c +++ b/player/command.c @@ -2528,6 +2528,30 @@ static int mp_property_vd_imgparams(void *ctx, struct m_property *prop, return M_PROPERTY_UNAVAILABLE; } +static int mp_property_video_frame_info(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + struct mp_image *f = + mpctx->video_out ? vo_get_current_frame(mpctx->video_out) : NULL; + if (!f) + return M_PROPERTY_UNAVAILABLE; + + const char *pict_types[] = {0, "I", "P", "B"}; + const char *pict_type = f->pict_type >= 1 && f->pict_type <= 3 + ? pict_types[f->pict_type] : NULL; + + struct m_sub_property props[] = { + {"picture-type", SUB_PROP_STR(pict_type), .unavailable = !pict_type}, + {"interlaced", SUB_PROP_FLAG(!!(f->fields & MP_IMGFIELD_INTERLACED))}, + {"tff", SUB_PROP_FLAG(!!(f->fields & MP_IMGFIELD_TOP_FIRST))}, + {"repeat", SUB_PROP_FLAG(!!(f->fields & MP_IMGFIELD_REPEAT_FIRST))}, + {0} + }; + + return m_property_read_sub(props, action, arg); +} + static int mp_property_window_scale(void *ctx, struct m_property *prop, int action, void *arg) { @@ -3506,6 +3530,7 @@ static const struct m_property mp_properties[] = { {"video-out-params", mp_property_vo_imgparams}, {"video-params", mp_property_vd_imgparams}, {"video-format", mp_property_video_format}, + {"video-frame-info", mp_property_video_frame_info}, {"video-codec", mp_property_video_codec}, M_PROPERTY_ALIAS("dwidth", "video-out-params/dw"), M_PROPERTY_ALIAS("dheight", "video-out-params/dh"), |