diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 29 | ||||
-rw-r--r-- | player/core.h | 4 | ||||
-rw-r--r-- | player/video.c | 65 |
3 files changed, 9 insertions, 89 deletions
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 <http://www.gnu.org/licenses/>. - * - * Parts under HAVE_GPL are licensed under GNU General Public License. */ #include <stddef.h> @@ -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; |