diff options
author | wm4 <wm4@nowhere> | 2013-08-24 19:37:34 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-08-24 19:40:18 +0200 |
commit | 47e92b2f884d4dd831e3e59ae9c692b460ef8dc3 (patch) | |
tree | 545d089a4a1be158c135fd43eaa33d4d93538925 /mpvcore | |
parent | ba4654b72977b915e5f09d23ce02e099c2bd9d0f (diff) | |
download | mpv-47e92b2f884d4dd831e3e59ae9c692b460ef8dc3.tar.bz2 mpv-47e92b2f884d4dd831e3e59ae9c692b460ef8dc3.tar.xz |
video: handle video output levels with mp_image_params
Until now, video output levels (obscure feature, like using TV screens
that require RGB output in limited range, similar to YUY) still required
handling of VOCTRL_SET_YUV_COLORSPACE. Simplify this, and use the new
mp_image_params code. This gets rid of some code. VOCTRL_SET_YUV_COLORSPACE
is not needed at all anymore in VOs that use the reconfig callback. The
result of VOCTRL_GET_YUV_COLORSPACE is now used only used for the
colormatrix related properties (basically, for display on OSD). For
other VOs, VOCTRL_SET_YUV_COLORSPACE will be sent only once after config
instead of twice.
Diffstat (limited to 'mpvcore')
-rw-r--r-- | mpvcore/command.c | 22 | ||||
-rw-r--r-- | mpvcore/mplayer.c | 7 |
2 files changed, 11 insertions, 18 deletions
diff --git a/mpvcore/command.c b/mpvcore/command.c index d5b525ff73..a9a96e6ebb 100644 --- a/mpvcore/command.c +++ b/mpvcore/command.c @@ -1164,8 +1164,8 @@ static int mp_property_colormatrix(m_option_t *prop, int action, void *arg, struct MPOpts *opts = mpctx->opts; struct mp_csp_details vo_csp = {0}; - if (mpctx->sh_video && mpctx->sh_video->vfilter) - vf_control(mpctx->sh_video->vfilter, VFCTRL_GET_YUV_COLORSPACE, &vo_csp); + if (mpctx->video_out) + vo_control(mpctx->video_out, VOCTRL_GET_YUV_COLORSPACE, &vo_csp); struct mp_image_params vd_csp = {0}; if (mpctx->sh_video) @@ -1198,8 +1198,8 @@ static int mp_property_colormatrix_input_range(m_option_t *prop, int action, struct MPOpts *opts = mpctx->opts; struct mp_csp_details vo_csp = {0}; - if (mpctx->sh_video && mpctx->sh_video->vfilter) - vf_control(mpctx->sh_video->vfilter, VFCTRL_GET_YUV_COLORSPACE, &vo_csp ); + if (mpctx->video_out) + vo_control(mpctx->video_out, VOCTRL_GET_YUV_COLORSPACE, &vo_csp ); struct mp_image_params vd_csp = {0}; if (mpctx->sh_video) @@ -1226,21 +1226,15 @@ static int mp_property_colormatrix_input_range(m_option_t *prop, int action, static int mp_property_colormatrix_output_range(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - if (action != M_PROPERTY_PRINT) { - int r = mp_property_generic_option(prop, action, arg, mpctx); - if (action == M_PROPERTY_SET) { - if (mpctx->sh_video) - set_video_output_levels(mpctx->sh_video); - } - return r; - } + if (action != M_PROPERTY_PRINT) + return video_refresh_property_helper(prop, action, arg, mpctx); struct MPOpts *opts = mpctx->opts; int req = opts->requested_output_range; struct mp_csp_details actual = {0}; - if (mpctx->sh_video && mpctx->sh_video->vfilter) - vf_control(mpctx->sh_video->vfilter, VFCTRL_GET_YUV_COLORSPACE, &actual); + if (mpctx->video_out) + vo_control(mpctx->video_out, VOCTRL_GET_YUV_COLORSPACE, &actual); char *res = talloc_asprintf(NULL, "%s", mp_csp_levels_names[req]); if (!actual.levels_out) { diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c index ed7fbec15e..2d5265d41b 100644 --- a/mpvcore/mplayer.c +++ b/mpvcore/mplayer.c @@ -1800,10 +1800,9 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl) assert(track && sh_sub); struct dec_sub *dec_sub = sh_sub->dec_sub; - if (mpctx->sh_video) { - struct mp_image_params params; - if (get_video_params(mpctx->sh_video, ¶ms) > 0) - sub_control(dec_sub, SD_CTRL_SET_VIDEO_PARAMS, ¶ms); + if (mpctx->sh_video && mpctx->sh_video->vf_input) { + struct mp_image_params params = *mpctx->sh_video->vf_input; + sub_control(dec_sub, SD_CTRL_SET_VIDEO_PARAMS, ¶ms); } mpctx->osd->video_offset = track->under_timeline ? mpctx->video_offset : 0; |