From 72743ef6fe6da5d053590e0c8647d5f6c55538ca Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 9 Jan 2014 21:19:19 +0100 Subject: command: don't access VO for output parameters Use the video chain for this instead. This is for facilitating coming changes, which will clean up the vo->aspdat stuff, and this code would be in the way. --- player/command.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 89887d3af7..f6f3e43a63 100644 --- a/player/command.c +++ b/player/command.c @@ -1502,37 +1502,43 @@ static int mp_property_height(m_option_t *prop, int action, void *arg, vd->vf_input.h ? vd->vf_input.h : sh->disp_h); } -static int property_vo_wh(m_option_t *prop, int action, void *arg, - MPContext *mpctx, bool get_w) +static struct mp_image_params get_video_out_params(struct MPContext *mpctx) { - struct vo *vo = mpctx->video_out; - if (!mpctx->d_video || !vo || !vo->hasframe) - return M_PROPERTY_UNAVAILABLE; - return m_property_int_ro(prop, action, arg, - get_w ? vo->aspdat.prew : vo->aspdat.preh); + if (!mpctx->d_video || !mpctx->d_video->vfilter || + mpctx->d_video->vfilter->initialized < 1) + return (struct mp_image_params){0}; + + return mpctx->d_video->vfilter->output_params; } static int mp_property_dwidth(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - return property_vo_wh(prop, action, arg, mpctx, true); + struct mp_image_params params = get_video_out_params(mpctx); + if (!params.imgfmt) + return M_PROPERTY_UNAVAILABLE; + return m_property_int_ro(prop, action, arg, params.d_w); } static int mp_property_dheight(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - return property_vo_wh(prop, action, arg, mpctx, false); + struct mp_image_params params = get_video_out_params(mpctx); + if (!params.imgfmt) + return M_PROPERTY_UNAVAILABLE; + return m_property_int_ro(prop, action, arg, params.d_h); } static int mp_property_window_scale(m_option_t *prop, int action, void *arg, MPContext *mpctx) { struct vo *vo = mpctx->video_out; - if (!vo || !vo->hasframe) + if (!vo) return M_PROPERTY_UNAVAILABLE; - int vid_w = vo->aspdat.prew; - int vid_h = vo->aspdat.preh; + struct mp_image_params params = get_video_out_params(mpctx); + int vid_w = params.d_w; + int vid_h = params.d_h; if (vid_w < 1 || vid_h < 1) return M_PROPERTY_UNAVAILABLE; -- cgit v1.2.3