diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 17e9997c57..5fdfa2e162 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -44,6 +44,21 @@ Interface changes deprecation was to make sure no API user gets broken by a sudden behavior change) - remove previously deprecated vf_eq + - remove that hardware deinterlace filters (vavpp, d3d11vpp, vdpaupp) + changed their deinterlacing-enabled setting depending on what the + --deinterlace option or property was set to. Now, a filter always does + what its filter options and defaults imply. The --deinterlace option and + property strictly add/remove its own filters. For example, if you run + "mpv --vf=vavpp --deinterlace=yes", this will insert another, redundant + filter, which is probably not what you want. For toggling a deinterlace + filter manually, use the "vf toggle" command, and do not set the + deinterlace option/property. To customize the filter that will be + inserted automatically, use the "@deinterlace" filter label with + --vf-defaults. Details how this works will probably change in the future. + - remove deinterlace=auto (this was not deprecated, but had only a very + obscure use that stopped working with the change above. It was also + prone to be confused with a feature not implemented by it: auto did _not_ + mean that deinterlacing was enabled on demand.) --- mpv 0.26.0 --- - remove remaining deprecated audio device options, like --alsa-device Some of them were removed in earlier releases. diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index b612e04b48..1bc033ea00 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -2167,12 +2167,6 @@ caveats with some properties (due to historical reasons): Option changes at runtime are affected by this as well. -``deinterlace`` - While video is active, this behaves differently from the option. It will - never return the ``auto`` value (but the state as observed by the video - chain). If you set ``auto``, the property will set this as the option value, - and will return the actual video chain state as observed instead of auto. - ``video-aspect`` While video is active, always returns the effective aspect ratio. Setting a special value (like ``no``, values ``<= 0``) will make the property diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index d4b8261fb6..598fe8084c 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -966,8 +966,8 @@ Video Works in ``--no-correct-pts`` mode only. -``--deinterlace=`` - Enable or disable interlacing (default: auto, which usually means no). +``--deinterlace=`` + Enable or disable interlacing (default: no). Interlaced video shows ugly comb-like artifacts, which are visible on fast movement. Enabling this typically inserts the yadif video filter in order to deinterlace the video, or lets the video output apply deinterlacing @@ -976,10 +976,11 @@ Video This behaves exactly like the ``deinterlace`` input property (usually mapped to ``d``). - ``auto`` is a technicality. Strictly speaking, the default for this option - is deinterlacing disabled, but the ``auto`` case is needed if ``yadif`` was - added to the filter chain manually with ``--vf``. Then the core shouldn't - disable deinterlacing just because the ``--deinterlace`` was not set. + Keep in mind that this **will** conflict with manually inserted + deinterlacing filters, unless you take care. (Since mpv 0.27.0, even the + hardware deinterlace filters will conflict. Also since that version, + ``--deinterlace=auto`` was removed, which used to mean that the default + interlacing option of possibly inserted video filters was used.) ``--frames=`` Play/convert only first ```` video frames, then quit. diff --git a/options/m_option.h b/options/m_option.h index cfc5f6bb15..ad6dfe6698 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -397,7 +397,8 @@ struct m_option { // The following are also part of the M_OPT_* flags, and are used to update // certain groups of options. #define UPDATE_OPT_FIRST (1 << 7) -#define UPDATE_TERM (1 << 7) // terminal options +#define UPDATE_TERM (1 << 7) // terminal options +#define UPDATE_DEINT (1 << 8) // --deinterlace #define UPDATE_OSD (1 << 10) // related to OSD rendering #define UPDATE_BUILTIN_SCRIPTS (1 << 11) // osc/ytdl #define UPDATE_IMGPAR (1 << 12) // video image params overrides diff --git a/options/options.c b/options/options.c index 258cba0d31..355d482543 100644 --- a/options/options.c +++ b/options/options.c @@ -423,10 +423,7 @@ const m_option_t mp_opts[] = { OPT_SETTINGSLIST("vf-defaults", vf_defs, 0, &vf_obj_list, ), OPT_SETTINGSLIST("vf", vf_settings, 0, &vf_obj_list, ), - OPT_CHOICE("deinterlace", deinterlace, 0, - ({"auto", -1}, - {"no", 0}, - {"yes", 1})), + OPT_FLAG("deinterlace", deinterlace, UPDATE_DEINT), OPT_STRING("ad", audio_decoders, 0), OPT_STRING("vd", video_decoders, 0), @@ -835,7 +832,6 @@ const struct MPOpts mp_default_opts = { .audio_driver_list = NULL, .audio_decoders = NULL, .video_decoders = NULL, - .deinterlace = -1, .softvol = SOFTVOL_AUTO, .softvol_max = 130, .softvol_volume = 100, diff --git a/player/command.c b/player/command.c index d94f819992..124b029c3d 100644 --- a/player/command.c +++ b/player/command.c @@ -2481,29 +2481,6 @@ static int mp_property_hwdec_interop(void *ctx, struct m_property *prop, return m_property_strdup_ro(action, arg, name); } -#if HAVE_GPL -// Possibly GPL due to 7b25afd7423e9056782993cbd1b32ead64ac1462. -static int mp_property_deinterlace(void *ctx, struct m_property *prop, - int action, void *arg) -{ - MPContext *mpctx = ctx; - if (!mpctx->vo_chain) - return mp_property_generic_option(mpctx, prop, action, arg); - switch (action) { - case M_PROPERTY_GET: - *(int *)arg = get_deinterlacing(mpctx) > 0; - return M_PROPERTY_OK; - case M_PROPERTY_GET_CONSTRICTED_TYPE: - *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_FLAG}; - return M_PROPERTY_OK; - case M_PROPERTY_SET: - set_deinterlacing(mpctx, *(int *)arg); - return M_PROPERTY_OK; - } - return mp_property_generic_option(mpctx, prop, action, arg); -} -#endif - /// Helper to set vo flags. /** \ingroup PropertyImplHelper */ @@ -4005,9 +3982,6 @@ static const struct m_property mp_properties_base[] = { // Video {"fullscreen", mp_property_fullscreen}, -#if HAVE_GPL - {"deinterlace", mp_property_deinterlace}, -#endif {"taskbar-progress", mp_property_taskbar_progress}, {"ontop", mp_property_ontop}, {"border", mp_property_border}, @@ -5816,6 +5790,9 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags) if (flags & UPDATE_TERM) mp_update_logging(mpctx, false); + if (flags & UPDATE_DEINT) + recreate_auto_filters(mpctx); + if (flags & UPDATE_OSD) { osd_changed(mpctx->osd); for (int n = 0; n < NUM_PTRACKS; n++) { diff --git a/player/core.h b/player/core.h index ea7e0c1ec1..1b08fed55b 100644 --- a/player/core.h +++ b/player/core.h @@ -612,7 +612,6 @@ bool update_subtitles(struct MPContext *mpctx, double video_pts); // video.c int video_get_colors(struct vo_chain *vo_c, const char *item, int *value); int video_set_colors(struct vo_chain *vo_c, const char *item, int value); -int video_vf_vo_control(struct vo_chain *vo_c, int vf_cmd, void *data); void reset_video_state(struct MPContext *mpctx); int init_video_decoder(struct MPContext *mpctx, struct track *track); void reinit_video_chain(struct MPContext *mpctx); @@ -624,8 +623,7 @@ void uninit_video_out(struct MPContext *mpctx); void uninit_video_chain(struct MPContext *mpctx); double calc_average_frame_duration(struct MPContext *mpctx); int init_video_decoder(struct MPContext *mpctx, struct track *track); -int get_deinterlacing(struct MPContext *mpctx); -void set_deinterlacing(struct MPContext *mpctx, int opt_val); +void recreate_auto_filters(struct MPContext *mpctx); // Values of MPOpts.softvol enum { diff --git a/player/video.c b/player/video.c index 1fdf69042e..e1034c46f0 100644 --- a/player/video.c +++ b/player/video.c @@ -13,8 +13,6 @@ * * You should have received a copy of the GNU Lesser General Public * License along with mpv. If not, see . - * - * Parts under HAVE_GPL are licensed under GNU General Public License. */ #include @@ -70,18 +68,6 @@ static const char av_desync_help_text[] = "position will not match to the video (see A-V status field).\n" "\n"; -// Send a VCTRL, or if it doesn't work, translate it to a VOCTRL and try the VO. -int video_vf_vo_control(struct vo_chain *vo_c, int vf_cmd, void *data) -{ - if (vo_c->vf->initialized > 0) { - int r = vf_control_any(vo_c->vf, vf_cmd, data); - if (r != CONTROL_UNKNOWN) - return r; - } - - return CONTROL_UNKNOWN; -} - static void set_allowed_vo_formats(struct vo_chain *vo_c) { vo_query_formats(vo_c->vo, vo_c->vf->allowed_output_formats); @@ -111,16 +97,6 @@ static bool check_output_format(struct vo_chain *vo_c, int imgfmt) static int probe_deint_filters(struct vo_chain *vo_c) { -#if HAVE_GPL - // Usually, we prefer inserting/removing deint filters. But If there's VO - // support, or the user inserted a filter that supports swichting deint and - // that has no VF_DEINTERLACE_LABEL, or if the filter was auto-inserted - // for other reasons and supports switching deint (like vf_d3d11vpp), then - // use the runtime switching method. - if (video_vf_vo_control(vo_c, VFCTRL_SET_DEINTERLACE, &(int){1}) == CONTROL_OK) - return 0; -#endif - if (check_output_format(vo_c, IMGFMT_VDPAU)) { char *args[5] = {"deint", "yes"}; int pref = 0; @@ -165,12 +141,6 @@ static void filter_reconfig(struct MPContext *mpctx, struct vo_chain *vo_c) return; } -#if HAVE_GPL - // Make sure to reset this even if runtime deint switching is used. - if (mpctx->opts->deinterlace >= 0) - video_vf_vo_control(vo_c, VFCTRL_SET_DEINTERLACE, &(int){0}); -#endif - if (params.rotate) { if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90) || params.rotate % 90) { // Try to insert a rotation filter. @@ -191,12 +161,15 @@ static void filter_reconfig(struct MPContext *mpctx, struct vo_chain *vo_c) } } - if (mpctx->opts->deinterlace == 1) + if (mpctx->opts->deinterlace) probe_deint_filters(vo_c); } -static void recreate_auto_filters(struct MPContext *mpctx) +void recreate_auto_filters(struct MPContext *mpctx) { + if (!mpctx->vo_chain) + return; + filter_reconfig(mpctx, mpctx->vo_chain); mp_force_video_refresh(mpctx); @@ -204,34 +177,6 @@ static void recreate_auto_filters(struct MPContext *mpctx) mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL); } -int get_deinterlacing(struct MPContext *mpctx) -{ - struct vo_chain *vo_c = mpctx->vo_chain; - int enabled = 0; -#if HAVE_GPL - if (video_vf_vo_control(vo_c, VFCTRL_GET_DEINTERLACE, &enabled) != CONTROL_OK) - enabled = -1; -#endif - 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 set_deinterlacing(struct MPContext *mpctx, int opt_val) -{ - if ((opt_val < 0 && mpctx->opts->deinterlace == opt_val) || - (opt_val == (get_deinterlacing(mpctx) > 0))) - return; - - mpctx->opts->deinterlace = opt_val; - recreate_auto_filters(mpctx); - if (opt_val >= 0) - mpctx->opts->deinterlace = get_deinterlacing(mpctx) > 0; -} - static void recreate_video_filters(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; diff --git a/video/filter/vf.h b/video/filter/vf.h index 8a9815078d..5146a4d15b 100644 --- a/video/filter/vf.h +++ b/video/filter/vf.h @@ -13,8 +13,6 @@ * * You should have received a copy of the GNU Lesser General Public * License along with mpv. If not, see . - * - * Parts under HAVE_GPL are licensed under GNU General Public License. */ #ifndef MPLAYER_VF_H @@ -22,8 +20,6 @@ #include -#include "config.h" - #include "video/mp_image.h" #include "common/common.h" @@ -143,10 +139,6 @@ struct vf_chain { enum vf_ctrl { VFCTRL_SEEK_RESET = 1, // reset on picture and PTS discontinuities -#if HAVE_GPL - VFCTRL_SET_DEINTERLACE, // Set deinterlacing status - VFCTRL_GET_DEINTERLACE, // Get deinterlacing status -#endif VFCTRL_GET_METADATA, // Get frame metadata from lavfi filters (e.g., cropdetect) /* Hack to make the OSD state object available to vf_sub which * access OSD/subtitle state outside of normal OSD draw time. */ diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c index 92999be639..cbd59fef93 100644 --- a/video/filter/vf_d3d11vpp.c +++ b/video/filter/vf_d3d11vpp.c @@ -465,12 +465,6 @@ static int control(struct vf_instance *vf, int request, void* data) { struct vf_priv_s *p = vf->priv; switch (request){ - case VFCTRL_GET_DEINTERLACE: - *(int*)data = !!p->deint_enabled; - return true; - case VFCTRL_SET_DEINTERLACE: - p->deint_enabled = !!*(int*)data; - return true; case VFCTRL_SEEK_RESET: flush_frames(vf); return true; diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c index e3c107c91d..4b225aa466 100644 --- a/video/filter/vf_vavpp.c +++ b/video/filter/vf_vavpp.c @@ -368,14 +368,7 @@ static int query_format(struct vf_instance *vf, unsigned int imgfmt) static int control(struct vf_instance *vf, int request, void* data) { - struct vf_priv_s *p = vf->priv; switch (request){ - case VFCTRL_GET_DEINTERLACE: - *(int*)data = !!p->do_deint; - return true; - case VFCTRL_SET_DEINTERLACE: - p->do_deint = *(int*)data; - return true; case VFCTRL_SEEK_RESET: flush_frames(vf); return true; diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c index 92a40ec8c2..a583e386f2 100644 --- a/video/filter/vf_vdpaupp.c +++ b/video/filter/vf_vdpaupp.c @@ -151,13 +151,6 @@ static int control(vf_instance_t *vf, int request, void *data) case VFCTRL_SEEK_RESET: mp_refqueue_flush(p->queue); return CONTROL_OK; - case VFCTRL_GET_DEINTERLACE: - *(int *)data = !!p->deint_enabled; - return true; - case VFCTRL_SET_DEINTERLACE: - p->deint_enabled = !!*(int *)data; - p->opts.deint = p->deint_enabled ? p->def_deintmode : 0; - return true; } return CONTROL_UNKNOWN; }