summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-03 22:21:24 +0100
committerwm4 <wm4@nowhere>2013-12-04 00:07:38 +0100
commit86ba9a7f24bb977898fd6b802f0165f7c297e2be (patch)
tree0705d34a4014b6abbbefe327692ce58ba62e0003
parent25635a62c346f307f5d319a38c444f91b7928d43 (diff)
downloadmpv-86ba9a7f24bb977898fd6b802f0165f7c297e2be.tar.bz2
mpv-86ba9a7f24bb977898fd6b802f0165f7c297e2be.tar.xz
vf_yadif: change options, reroute to vf_lavfi
Also remove the ability to disable deinterlacing at runtime. You can still disable deinterlacing at runtime by using the ``D`` key and its automatical filter insertion/removal.
-rw-r--r--DOCS/man/en/vf.rst25
-rw-r--r--mpvcore/player/command.c3
-rw-r--r--video/filter/vf_yadif.c39
3 files changed, 38 insertions, 29 deletions
diff --git a/DOCS/man/en/vf.rst b/DOCS/man/en/vf.rst
index ab32cd6907..3bd55d88cb 100644
--- a/DOCS/man/en/vf.rst
+++ b/DOCS/man/en/vf.rst
@@ -682,25 +682,28 @@ Available filters are:
Yet another deinterlacing filter
``<mode>``
- :0: Output 1 frame for each frame.
- :1: Output 1 frame for each field.
- :2: Like 0 but skips spatial interlacing check.
- :3: Like 1 but skips spatial interlacing check.
+ :frame: Output 1 frame for each frame.
+ :field: Output 1 frame for each field.
+ :frame-nospatial: Like ``frame`` but skips spatial interlacing check.
+ :field-nospatial: Like ``field`` but skips spatial interlacing check.
``<enabled>``
:yes: Filter is active (default).
:no: Filter is not active, but can be activated with the ``D`` key
(or any other key that toggles the ``deinterlace`` property).
- .. note::
+ This filter, is automatically inserted when using the ``D`` key (or any
+ other key that toggles the ``deinterlace`` property or when using the
+ ``--deinterlace`` switch), assuming the video output does not have native
+ deinterlacing support.
- Deprecated. Use libavfilter's ``yadif`` filter through ``--vf=lavfi``
- instead.
+ If you just want to set the default mode, put this filter and its options
+ into ``--vf-defaults`` instead, and enable deinterlacing with ``D`` or
+ ``--deinterlace``.
- This filter, or libavfilter's implementation if available, is automatically
- inserted when using the ``D`` key (or any other key that toggles the
- ``deinterlace`` property), assuming the video output does not have native
- deinterlacing support.
+ Also note that the ``D`` key is stupid enough to insert an interlacer twice
+ when inserting yadif with ``--vf``, so using the above methods is
+ recommended.
``down3dright[=lines]``
Reposition and resize stereoscopic images. Extracts both stereo fields and
diff --git a/mpvcore/player/command.c b/mpvcore/player/command.c
index f6eb0b3c7a..6367c17fe5 100644
--- a/mpvcore/player/command.c
+++ b/mpvcore/player/command.c
@@ -1165,9 +1165,6 @@ static int mp_property_fullscreen(m_option_t *prop,
#define VF_DEINTERLACE_LABEL "deinterlace"
static const char *deint_filters[] = {
-#if HAVE_VF_LAVFI
- "lavfi=yadif",
-#endif
"yadif",
#if HAVE_VAAPI_VPP
"vavpp",
diff --git a/video/filter/vf_yadif.c b/video/filter/vf_yadif.c
index b53b1bf594..735f1ac6c8 100644
--- a/video/filter/vf_yadif.c
+++ b/video/filter/vf_yadif.c
@@ -35,6 +35,8 @@
#include "video/memcpy_pic.h"
#include "libavutil/common.h"
+#include "vf_lavfi.h"
+
//===========================================================================//
struct vf_priv_s {
@@ -48,6 +50,8 @@ struct vf_priv_s {
int stride[3];
uint8_t *ref[4][3];
int do_deinterlace;
+ // for when using the lavfi wrapper
+ struct vf_lw_opts *lw_opts;
};
static const struct vf_priv_s vf_priv_default = {
@@ -486,25 +490,25 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance *vf, int request, void* data){
- switch (request){
- case VFCTRL_GET_DEINTERLACE:
- *(int*)data = vf->priv->do_deinterlace;
- return CONTROL_OK;
- case VFCTRL_SET_DEINTERLACE:
- vf->priv->do_deinterlace = 2*!!*(int*)data;
- return CONTROL_OK;
- }
- return vf_next_control (vf, request, data);
-}
-
static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
vf->filter_ext=filter_image;
vf->query_format=query_format;
vf->uninit=uninit;
- vf->control=control;
+
+ struct vf_priv_s *p = vf->priv;
+
+ // Earlier libavfilter yadif versions used pure integers for the first
+ // option. We can't/don't handle this, but at least allow usage of the
+ // filter with default settings. So use an empty string for "send_frame".
+ const char *mode[] = {"", "send_field", "send_frame_nospatial",
+ "send_field_nospatial"};
+
+ if (vf_lw_set_graph(vf, p->lw_opts, "yadif", "%s", mode[p->mode]) >= 0)
+ {
+ return 1;
+ }
vf->priv->parity= -1;
@@ -518,8 +522,13 @@ static int vf_open(vf_instance_t *vf, char *args){
#define OPT_BASE_STRUCT struct vf_priv_s
static const m_option_t vf_opts_fields[] = {
- OPT_INTRANGE("mode", mode, 0, 0, 3),
- OPT_INTRANGE("enabled", do_deinterlace, 0, 0, 1),
+ OPT_CHOICE("mode", mode, 0,
+ ({"frame", 0},
+ {"field", 1},
+ {"frame-nospatial", 2},
+ {"field-nospatial", 3})),
+ OPT_FLAG("enabled", do_deinterlace, 0),
+ OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
{0}
};