diff options
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/player/command.c b/player/command.c index 85f453e0ef..425f040ff2 100644 --- a/player/command.c +++ b/player/command.c @@ -2258,88 +2258,6 @@ static int mp_property_detected_hwdec(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; } -#define VF_DEINTERLACE_LABEL "deinterlace" - -static bool probe_deint_filter(struct MPContext *mpctx, const char *filt) -{ - char filter[80]; - // add a label so that removing the filter is easier - snprintf(filter, sizeof(filter), "@%s:%s", VF_DEINTERLACE_LABEL, filt); - return edit_filters(mpctx, mp_null_log, STREAM_VIDEO, "pre", filter) >= 0; -} - -static bool check_output_format(struct MPContext *mpctx, int imgfmt) -{ - struct vo_chain *vo_c = mpctx->vo_chain; - if (!vo_c) - return false; - return vo_c->vf->allowed_output_formats[imgfmt - IMGFMT_START]; -} - -static int probe_deint_filters(struct MPContext *mpctx) -{ - if (check_output_format(mpctx, IMGFMT_VDPAU)) { - char filter[80] = "vdpaupp:deint=yes"; - int pref = 0; - vo_control(mpctx->video_out, VOCTRL_GET_PREF_DEINT, &pref); - pref = pref < 0 ? -pref : pref; - if (pref > 0 && pref <= 4) { - const char *types[] = - {"", "first-field", "bob", "temporal", "temporal-spatial"}; - mp_snprintf_cat(filter, sizeof(filter), ":deint-mode=%s", - types[pref]); - } - - probe_deint_filter(mpctx, filter); - return 0; - } - if (check_output_format(mpctx, IMGFMT_VAAPI) && - probe_deint_filter(mpctx, "vavpp")) - return 0; - if ((check_output_format(mpctx, IMGFMT_D3D11VA) || - check_output_format(mpctx, IMGFMT_D3D11NV12)) && - probe_deint_filter(mpctx, "d3d11vpp")) - return 0; - if (probe_deint_filter(mpctx, "yadif")) - return 0; - return -1; -} - -static int get_deinterlacing(struct MPContext *mpctx) -{ - struct vo_chain *vo_c = mpctx->vo_chain; - int enabled = 0; - if (video_vf_vo_control(vo_c, VFCTRL_GET_DEINTERLACE, &enabled) != CONTROL_OK) - enabled = -1; - if (enabled < 0) { - // vf_lavfi doesn't support VFCTRL_GET_DEINTERLACE - if (vf_find_by_label(vo_c->vf, VF_DEINTERLACE_LABEL)) - enabled = 1; - } - return enabled; -} - -void remove_deint_filter(struct MPContext *mpctx) -{ - edit_filters(mpctx, mp_null_log, STREAM_VIDEO, "del", "@" VF_DEINTERLACE_LABEL); -} - -void set_deinterlacing(struct MPContext *mpctx, bool enable) -{ - struct vo_chain *vo_c = mpctx->vo_chain; - if (vf_find_by_label(vo_c->vf, VF_DEINTERLACE_LABEL)) { - if (!enable) - remove_deint_filter(mpctx); - } else { - if ((get_deinterlacing(mpctx) > 0) != enable) { - int arg = enable; - if (video_vf_vo_control(vo_c, VFCTRL_SET_DEINTERLACE, &arg) != CONTROL_OK) - probe_deint_filters(mpctx); - } - } - mpctx->opts->deinterlace = get_deinterlacing(mpctx) > 0; -} - static int mp_property_deinterlace(void *ctx, struct m_property *prop, int action, void *arg) { |