mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 03:52:22 +02:00
video: deprecate almost all video filters
The plan is to nuke the custom filter chain completely. It's not clear what will happen to the still needed builtin filters (mostly hardware deinterlacing and vf_vapoursynth). Most likely we'll replace them with different filter chain concept (whose main purpose will be providing builtin things and bridging to libavfilter). The undocumented "warn" options are there to disable deprecation warnings when the player inserts filter automatically. The same will be done to audio filters, at a later point.
This commit is contained in:
parent
6b9d3f4f7b
commit
3a9e661e92
@ -55,6 +55,10 @@ normal filter parameters.
|
||||
wrapper, which gives you access to most of libavfilter's filters. This
|
||||
includes all filters that have been ported from MPlayer to libavfilter.
|
||||
|
||||
Most filters are deprecated in some ways, unless they're only available
|
||||
in mpv (such as filters which deal with mpv specifics, or which are
|
||||
implemented in mpv only).
|
||||
|
||||
Video filters are managed in lists. There are a few commands to manage the
|
||||
filter list.
|
||||
|
||||
|
@ -189,7 +189,8 @@ static int probe_deint_filters(struct vo_chain *vo_c)
|
||||
if (check_output_format(vo_c, IMGFMT_D3D11VA) ||
|
||||
check_output_format(vo_c, IMGFMT_D3D11NV12))
|
||||
return try_filter(vo_c, "d3d11vpp", VF_DEINTERLACE_LABEL, NULL);
|
||||
return try_filter(vo_c, "yadif", VF_DEINTERLACE_LABEL, NULL);
|
||||
char *args[] = {"warn", "no", NULL};
|
||||
return try_filter(vo_c, "yadif", VF_DEINTERLACE_LABEL, args);
|
||||
}
|
||||
|
||||
// Reconfigure the filter chain according to the new input format.
|
||||
@ -220,7 +221,7 @@ static void filter_reconfig(struct MPContext *mpctx, struct vo_chain *vo_c)
|
||||
if (params.rotate) {
|
||||
if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90) || params.rotate % 90) {
|
||||
// Try to insert a rotation filter.
|
||||
char *args[] = {"angle", "auto", NULL};
|
||||
char *args[] = {"angle", "auto", "warn", "no", NULL};
|
||||
if (try_filter(vo_c, "rotate", "autorotate", args) < 0)
|
||||
MP_ERR(vo_c, "Can't insert rotation filter.\n");
|
||||
}
|
||||
@ -231,7 +232,7 @@ static void filter_reconfig(struct MPContext *mpctx, struct vo_chain *vo_c)
|
||||
{
|
||||
char *to = (char *)MP_STEREO3D_NAME(params.stereo_out);
|
||||
if (to) {
|
||||
char *args[] = {"in", "auto", "out", to, NULL, NULL};
|
||||
char *args[] = {"in", "auto", "out", to, "warn", "no", NULL, NULL};
|
||||
if (try_filter(vo_c, "stereo3d", "autostereo3d", args) < 0)
|
||||
MP_ERR(vo_c, "Can't insert 3D conversion filter.\n");
|
||||
}
|
||||
|
@ -579,7 +579,11 @@ static void update_formats(struct vf_chain *c, struct vf_instance *vf,
|
||||
}
|
||||
query_formats(fmts, vf);
|
||||
const char *filter = find_conv_filter(fmts, out_formats);
|
||||
struct vf_instance *conv = vf_open(c, filter, NULL);
|
||||
char **args = NULL;
|
||||
char *args_no_warn[] = {"warn", "no", NULL};
|
||||
if (strcmp(filter, "scale") == 0)
|
||||
args = args_no_warn;
|
||||
struct vf_instance *conv = vf_open(c, filter, args);
|
||||
if (conv) {
|
||||
conv->autoinserted = true;
|
||||
conv->next = vf->next;
|
||||
|
@ -65,6 +65,7 @@ static void uninit(vf_instance_t *vf)
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
MP_WARN(vf, "This filter is deprecated. No replacement.\n");
|
||||
vf->filter_ext = filter_ext;
|
||||
vf->control = control;
|
||||
vf->uninit = uninit;
|
||||
|
@ -100,6 +100,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf){
|
||||
MP_WARN(vf, "This filter is deprecated. Use lavfi crop instead.\n");
|
||||
vf->reconfig=reconfig;
|
||||
vf->filter=filter;
|
||||
vf->query_format=query_format;
|
||||
|
@ -263,6 +263,8 @@ static int vf_open(vf_instance_t *vf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
MP_WARN(vf, "This filter is deprecated. No replacement.\n");
|
||||
|
||||
vf->priv->dll = DLLOpen(vf->priv->cfg_dllname);
|
||||
if (!vf->priv->dll) {
|
||||
MP_ERR(vf, "library not found: %s\n",
|
||||
|
@ -83,6 +83,8 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
MP_WARN(vf, "This filter is deprecated. No replacement.\n");
|
||||
|
||||
vf->reconfig = reconfig;
|
||||
return 1;
|
||||
}
|
||||
|
@ -390,6 +390,9 @@ int vf_open(vf_instance_t *vf)
|
||||
vf_eq2_t *eq2;
|
||||
double *par = vf->priv->par;
|
||||
|
||||
MP_WARN(vf, "This filter is deprecated. Use lavfi eq instead.\n"
|
||||
"For interactive eq, there is no replacement.\n");
|
||||
|
||||
vf->control = control;
|
||||
vf->query_format = query_format;
|
||||
vf->filter = filter;
|
||||
|
@ -142,6 +142,8 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf){
|
||||
MP_WARN(vf, "This filter is deprecated. Use lavfi pad instead.\n");
|
||||
|
||||
vf->reconfig=reconfig;
|
||||
vf->query_format=query_format;
|
||||
vf->filter=filter;
|
||||
|
@ -41,6 +41,8 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf){
|
||||
MP_WARN(vf, "This filter is deprecated. Use lavfi vflip instead.\n");
|
||||
|
||||
vf->filter=filter;
|
||||
vf->query_format = query_format;
|
||||
return 1;
|
||||
|
@ -59,6 +59,8 @@ static int lavfi_reconfig(struct vf_instance *vf,
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
MP_WARN(vf, "%s", VF_LW_REPLACE);
|
||||
|
||||
bool have_radius = vf->priv->cfg_radius > -1;
|
||||
bool have_size = vf->priv->cfg_size > -1;
|
||||
|
||||
|
@ -18,4 +18,8 @@ void vf_lw_set_reconfig_cb(struct vf_instance *vf,
|
||||
struct mp_image_params *in,
|
||||
struct mp_image_params *out));
|
||||
|
||||
#define VF_LW_REPLACE "This filter will be replaced by using libavfilter " \
|
||||
"option syntax directly. Parts of the old syntax will stop working, " \
|
||||
"and some defaults may change.\n"
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
MP_WARN(vf, "This filter is deprecated. Use lavfi hflip instead.\n");
|
||||
return vf_lw_set_graph(vf, NULL, NULL, "hflip") >= 0;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf){
|
||||
MP_WARN(vf, "This filter is deprecated and will be removed (no replacement)\n");
|
||||
vf->query_format=query_format;
|
||||
return 1;
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ struct vf_priv_s {
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
MP_WARN(vf, "%s", VF_LW_REPLACE);
|
||||
|
||||
struct vf_priv_s *p = vf->priv;
|
||||
const char *pname[3] = {"y", "u", "v"};
|
||||
if (vf_lw_set_graph(vf, p->lw_opts, "pullup", "%d:%d:%d:%d:%d:%s",
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
struct vf_priv_s {
|
||||
int angle;
|
||||
int warn;
|
||||
struct vf_lw_opts *lw_opts;
|
||||
};
|
||||
|
||||
@ -67,6 +68,9 @@ static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
struct vf_priv_s *p = vf->priv;
|
||||
|
||||
if (p->warn)
|
||||
MP_WARN(vf, "%s", VF_LW_REPLACE);
|
||||
|
||||
if (vf_lw_set_graph(vf, p->lw_opts, NULL, "%s", rot[p->angle]) >= 0) {
|
||||
vf_lw_set_reconfig_cb(vf, lavfi_reconfig);
|
||||
return 1;
|
||||
@ -88,6 +92,7 @@ const vf_info_t vf_info_rotate = {
|
||||
{"180", 2},
|
||||
{"270", 3},
|
||||
{"auto", 4})),
|
||||
OPT_FLAG("warn", warn, 0, OPTDEF_INT(1)),
|
||||
OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
|
||||
{0}
|
||||
},
|
||||
|
@ -39,6 +39,8 @@
|
||||
|
||||
#include "options/m_option.h"
|
||||
|
||||
#include "vf_lavfi.h"
|
||||
|
||||
static struct vf_priv_s {
|
||||
int w, h;
|
||||
int cfg_w, cfg_h;
|
||||
@ -47,11 +49,13 @@ static struct vf_priv_s {
|
||||
struct mp_sws_context *sws;
|
||||
int noup;
|
||||
int accurate_rnd;
|
||||
int warn;
|
||||
} const vf_priv_dflt = {
|
||||
0, 0,
|
||||
-1, -1,
|
||||
0,
|
||||
{SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT},
|
||||
.warn = 1,
|
||||
};
|
||||
|
||||
static int find_best_out(vf_instance_t *vf, int in_format)
|
||||
@ -238,6 +242,8 @@ static int vf_open(vf_instance_t *vf)
|
||||
vf->priv->sws->log = vf->log;
|
||||
vf->priv->sws->params[0] = vf->priv->param[0];
|
||||
vf->priv->sws->params[1] = vf->priv->param[1];
|
||||
if (vf->priv->warn)
|
||||
MP_WARN(vf, "%s", VF_LW_REPLACE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -250,6 +256,7 @@ static const m_option_t vf_opts_fields[] = {
|
||||
OPT_INTRANGE("chr-drop", v_chr_drop, 0, 0, 3),
|
||||
OPT_INTRANGE("noup", noup, 0, 0, 2),
|
||||
OPT_FLAG("arnd", accurate_rnd, 0),
|
||||
OPT_FLAG("warn", warn, 0),
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -72,10 +72,12 @@ struct vf_priv_s {
|
||||
int in_fmt;
|
||||
int out_fmt;
|
||||
bool auto_in;
|
||||
int warn;
|
||||
struct vf_lw_opts *lw_opts;
|
||||
} const vf_priv_default = {
|
||||
SIDE_BY_SIDE_LR,
|
||||
ANAGLYPH_RC_DUBOIS,
|
||||
.warn = 1,
|
||||
};
|
||||
|
||||
const struct m_opt_choice_alternatives stereo_code_names[] = {
|
||||
@ -185,6 +187,9 @@ static void lavfi_init(vf_instance_t *vf)
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
if (vf->priv->warn)
|
||||
MP_WARN(vf, "%s", VF_LW_REPLACE);
|
||||
|
||||
if (vf->priv->out_fmt == STEREO_AUTO) {
|
||||
MP_FATAL(vf, "No autodetection for stereo output.\n");
|
||||
return 0;
|
||||
@ -200,6 +205,7 @@ static int vf_open(vf_instance_t *vf)
|
||||
static const m_option_t vf_opts_fields[] = {
|
||||
OPT_CHOICE_C("in", in_fmt, 0, stereo_code_names),
|
||||
OPT_CHOICE_C("out", out_fmt, 0, stereo_code_names),
|
||||
OPT_FLAG("warn", warn, 0),
|
||||
OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
|
||||
{0}
|
||||
};
|
||||
|
@ -127,6 +127,7 @@ static int control(vf_instance_t *vf, int request, void *data)
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
MP_WARN(vf, "This filter is deprecated and will be removed (no replacement)\n");
|
||||
vf->reconfig = reconfig;
|
||||
vf->query_format = query_format;
|
||||
vf->control = control;
|
||||
|
@ -32,12 +32,16 @@ struct vf_priv_s {
|
||||
int mode;
|
||||
int interlaced_only;
|
||||
struct vf_lw_opts *lw_opts;
|
||||
int warn;
|
||||
};
|
||||
|
||||
static int vf_open(vf_instance_t *vf)
|
||||
{
|
||||
struct vf_priv_s *p = vf->priv;
|
||||
|
||||
if (p->warn)
|
||||
MP_WARN(vf, "%s", VF_LW_REPLACE);
|
||||
|
||||
#if LIBAVFILTER_VERSION_MICRO >= 100
|
||||
const char *mode[] = {"send_frame", "send_field", "send_frame_nospatial",
|
||||
"send_field_nospatial"};
|
||||
@ -69,6 +73,7 @@ static const m_option_t vf_opts_fields[] = {
|
||||
{"frame-nospatial", 2},
|
||||
{"field-nospatial", 3})),
|
||||
OPT_FLAG("interlaced-only", interlaced_only, 0),
|
||||
OPT_FLAG("warn", warn, 0),
|
||||
OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
|
||||
{0}
|
||||
};
|
||||
@ -81,6 +86,7 @@ const vf_info_t vf_info_yadif = {
|
||||
.priv_defaults = &(const struct vf_priv_s){
|
||||
.mode = 1,
|
||||
.interlaced_only = 1,
|
||||
.warn = 1,
|
||||
},
|
||||
.options = vf_opts_fields,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user