summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-11 17:32:41 +0100
committerwm4 <wm4@nowhere>2015-02-11 17:35:58 +0100
commit2522bff5657c7566ac956998bcb32a0c9c3d2667 (patch)
tree5619032a1a103f1d101868c1843dca23b69ce8fb
parent73d23a94059e40fd1209912d9365a2fb910eb8b1 (diff)
downloadmpv-2522bff5657c7566ac956998bcb32a0c9c3d2667.tar.bz2
mpv-2522bff5657c7566ac956998bcb32a0c9c3d2667.tar.xz
video/filters: simplify libavfilter bridge
Remove the confusing crap that allowed a filter using the libavfilter bridge to be compiled without libavfilter. Instead, compile the wrappers only if libavfilter is enabled at compile time. The only filter which still requires it is vf_stereo3d (unfortunately). Special-case this one. (The whole filter and how it interacts with lavfi is pure braindeath anyway.)
-rw-r--r--old-makefile16
-rw-r--r--video/filter/vf.c16
-rw-r--r--video/filter/vf_delogo.c2
-rw-r--r--video/filter/vf_gradfun.c2
-rw-r--r--video/filter/vf_hqdn3d.c2
-rw-r--r--video/filter/vf_lavfi.c1
-rw-r--r--video/filter/vf_lavfi.h27
-rw-r--r--video/filter/vf_pullup.c2
-rw-r--r--video/filter/vf_rotate.c3
-rw-r--r--video/filter/vf_stereo3d.c41
-rw-r--r--video/filter/vf_unsharp.c2
-rw-r--r--video/filter/vf_yadif.c2
-rw-r--r--wscript_build.py16
13 files changed, 61 insertions, 71 deletions
diff --git a/old-makefile b/old-makefile
index 0aec7b4b73..c9eb218fca 100644
--- a/old-makefile
+++ b/old-makefile
@@ -100,6 +100,14 @@ SOURCES-$(WAYLAND) += video/out/vo_wayland.c \
video/out/wayland/memfile.c
SOURCES-$(LIBAVFILTER) += video/filter/vf_lavfi.c \
+ video/filter/vf_delogo.c \
+ video/filter/vf_gradfun.c \
+ video/filter/vf_hqdn3d.c \
+ video/filter/vf_noise.c \
+ video/filter/vf_pullup.c \
+ video/filter/vf_rotate.c \
+ video/filter/vf_unsharp.c \
+ video/filter/vf_yadif.c \
audio/filter/af_lavfi.c
SOURCES-$(LUA) += player/lua.c
@@ -251,25 +259,17 @@ SOURCES = audio/audio.c \
video/filter/vf.c \
video/filter/vf_buffer.c \
video/filter/vf_crop.c \
- video/filter/vf_delogo.c \
video/filter/vf_dsize.c \
video/filter/vf_eq.c \
video/filter/vf_expand.c \
video/filter/vf_flip.c \
video/filter/vf_format.c \
- video/filter/vf_gradfun.c \
- video/filter/vf_hqdn3d.c \
video/filter/vf_mirror.c \
video/filter/vf_noformat.c \
- video/filter/vf_noise.c \
- video/filter/vf_pullup.c \
- video/filter/vf_rotate.c \
video/filter/vf_scale.c \
video/filter/vf_screenshot.c \
video/filter/vf_stereo3d.c \
video/filter/vf_sub.c \
- video/filter/vf_unsharp.c \
- video/filter/vf_yadif.c \
video/out/bitmap_packer.c \
video/out/aspect.c \
video/out/filter_kernels.c \
diff --git a/video/filter/vf.c b/video/filter/vf.c
index d60379ca6b..a228ba3a76 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -77,25 +77,25 @@ static const vf_info_t *const filter_list[] = {
&vf_info_format,
&vf_info_noformat,
&vf_info_flip,
- &vf_info_rotate,
&vf_info_mirror,
#if HAVE_LIBAVFILTER
&vf_info_lavfi,
-#endif
-
- &vf_info_screenshot,
-
+ &vf_info_rotate,
&vf_info_noise,
- &vf_info_eq,
&vf_info_gradfun,
&vf_info_unsharp,
&vf_info_hqdn3d,
- &vf_info_dsize,
&vf_info_pullup,
&vf_info_delogo,
- &vf_info_sub,
&vf_info_yadif,
+#endif
+
+ &vf_info_screenshot,
+
+ &vf_info_eq,
+ &vf_info_dsize,
+ &vf_info_sub,
&vf_info_stereo3d,
&vf_info_buffer,
#if HAVE_DLOPEN
diff --git a/video/filter/vf_delogo.c b/video/filter/vf_delogo.c
index e7da8d1aa5..8fdbd77fa2 100644
--- a/video/filter/vf_delogo.c
+++ b/video/filter/vf_delogo.c
@@ -48,7 +48,7 @@ static int vf_open(vf_instance_t *vf){
return 1;
}
- MP_FATAL(vf, "Requires libavfilter.\n");
+ MP_FATAL(vf, "This version of libavfilter has no 'delogo' filter.\n");
return 0;
}
diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c
index b352521001..4831bcc214 100644
--- a/video/filter/vf_gradfun.c
+++ b/video/filter/vf_gradfun.c
@@ -79,7 +79,7 @@ static int vf_open(vf_instance_t *vf)
return 1;
}
- MP_FATAL(vf, "Requires libavfilter.\n");
+ MP_FATAL(vf, "This version of libavfilter has no 'gradfun' filter.\n");
return 0;
}
diff --git a/video/filter/vf_hqdn3d.c b/video/filter/vf_hqdn3d.c
index b06bf2e42c..063bf44908 100644
--- a/video/filter/vf_hqdn3d.c
+++ b/video/filter/vf_hqdn3d.c
@@ -42,7 +42,7 @@ static int vf_open(vf_instance_t *vf)
return 1;
}
- MP_FATAL(vf, "Requires libavfilter.\n");
+ MP_FATAL(vf, "This version of libavfilter has no 'hqdn3' filter.\n");
return 0;
}
diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c
index a356229a30..cb4c348552 100644
--- a/video/filter/vf_lavfi.c
+++ b/video/filter/vf_lavfi.c
@@ -38,6 +38,7 @@
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
+#include "config.h"
#include "common/av_common.h"
#include "common/msg.h"
#include "options/m_option.h"
diff --git a/video/filter/vf_lavfi.h b/video/filter/vf_lavfi.h
index d28d7e55d6..0b1f49323a 100644
--- a/video/filter/vf_lavfi.h
+++ b/video/filter/vf_lavfi.h
@@ -1,15 +1,11 @@
#ifndef MP_VF_LAVFI_H_
#define MP_VF_LAVFI_H_
-#include "config.h"
-
#include "common/common.h"
#include "vf.h"
struct vf_lw_opts;
-#if HAVE_LIBAVFILTER
-
extern const struct m_sub_options vf_lw_conf;
int vf_lw_set_graph(struct vf_instance *vf, struct vf_lw_opts *lavfi_opts,
@@ -21,28 +17,5 @@ void vf_lw_set_reconfig_cb(struct vf_instance *vf,
int (*reconfig)(struct vf_instance *vf,
struct mp_image_params *in,
struct mp_image_params *out));
-#else
-static inline
-int vf_lw_set_graph(struct vf_instance *vf, struct vf_lw_opts *lavfi_opts,
- char *filter, char *opts, ...)
-{
- return -1;
-}
-static void *vf_lw_old_priv(struct vf_instance *vf)
-{
- return 0;
-}
-static void vf_lw_update_graph(struct vf_instance *vf, char *filter, char *opts, ...)
-{
-}
-static void vf_lw_set_reconfig_cb(struct vf_instance *vf,
- int (*reconfig)(struct vf_instance *vf,
- struct mp_image_params *in,
- struct mp_image_params *out))
-{
-}
-#include "options/m_option.h"
-static const struct m_sub_options vf_lw_conf = {0};
-#endif
#endif
diff --git a/video/filter/vf_pullup.c b/video/filter/vf_pullup.c
index fbf500d8cd..86aaf54fc5 100644
--- a/video/filter/vf_pullup.c
+++ b/video/filter/vf_pullup.c
@@ -48,7 +48,7 @@ static int vf_open(vf_instance_t *vf)
return 1;
}
- MP_FATAL(vf, "Requires libavfilter.\n");
+ MP_FATAL(vf, "This version of libavfilter has no 'pullup' filter.\n");
return 0;
}
diff --git a/video/filter/vf_rotate.c b/video/filter/vf_rotate.c
index 9f0c60dd44..2df8f94591 100644
--- a/video/filter/vf_rotate.c
+++ b/video/filter/vf_rotate.c
@@ -66,8 +66,7 @@ static int vf_open(vf_instance_t *vf)
return 1;
}
- MP_FATAL(vf, "Requires libavfilter.\n");
- return 1;
+ return 0;
}
#define OPT_BASE_STRUCT struct vf_priv_s
diff --git a/video/filter/vf_stereo3d.c b/video/filter/vf_stereo3d.c
index e5a84f4ffc..886483cfe5 100644
--- a/video/filter/vf_stereo3d.c
+++ b/video/filter/vf_stereo3d.c
@@ -510,6 +510,8 @@ static bool handle_auto_in(struct vf_instance *vf)
return true;
}
+#if HAVE_LIBAVFILTER
+
static int lavfi_reconfig(struct vf_instance *vf,
struct mp_image_params *in,
struct mp_image_params *out)
@@ -528,6 +530,32 @@ static int lavfi_reconfig(struct vf_instance *vf,
return 0;
}
+static void lavfi_init(vf_instance_t *vf)
+{
+ if (vf->priv->in.fmt == STEREO_AUTO &&
+ vf_lw_set_graph(vf, vf->priv->lw_opts, "stereo3d", "null") >= 0)
+ {
+ vf_lw_set_reconfig_cb(vf, lavfi_reconfig);
+ return;
+ }
+
+ if (vf_lw_set_graph(vf, vf->priv->lw_opts, "stereo3d", "%s:%s",
+ rev_map_name(vf->priv->in.fmt),
+ rev_map_name(vf->priv->out.fmt)) >= 0)
+ return;
+}
+
+#else
+
+const struct m_sub_options vf_lw_conf = {0};
+
+static void lavfi_init(vf_instance_t *vf)
+{
+ // doing nothing will make it use the internal implementation
+}
+
+#endif
+
static int vf_open(vf_instance_t *vf)
{
vf->config = config;
@@ -541,18 +569,7 @@ static int vf_open(vf_instance_t *vf)
if (vf->priv->in.fmt == STEREO_AUTO)
vf->priv->auto_in = 1;
- if (vf->priv->in.fmt == STEREO_AUTO &&
- vf_lw_set_graph(vf, vf->priv->lw_opts, "stereo3d", "null") >= 0)
- {
- vf_lw_set_reconfig_cb(vf, lavfi_reconfig);
- return 1;
- }
-
- if (vf_lw_set_graph(vf, vf->priv->lw_opts, "stereo3d", "%s:%s",
- rev_map_name(vf->priv->in.fmt),
- rev_map_name(vf->priv->out.fmt)) >= 0)
- return 1;
-
+ lavfi_init(vf);
return 1;
}
diff --git a/video/filter/vf_unsharp.c b/video/filter/vf_unsharp.c
index cfd490f9fa..81ffbb73c4 100644
--- a/video/filter/vf_unsharp.c
+++ b/video/filter/vf_unsharp.c
@@ -55,7 +55,7 @@ static int vf_open(vf_instance_t *vf)
return 1;
}
- MP_FATAL(vf, "Requires libavfilter.\n");
+ MP_FATAL(vf, "This version of libavfilter has no 'unsharp' filter.\n");
return 0;
}
diff --git a/video/filter/vf_yadif.c b/video/filter/vf_yadif.c
index b8ae679ab4..428188c0e1 100644
--- a/video/filter/vf_yadif.c
+++ b/video/filter/vf_yadif.c
@@ -52,7 +52,7 @@ static int vf_open(vf_instance_t *vf)
return 1;
}
- MP_FATAL(vf, "Requires libavfilter.\n");
+ MP_FATAL(vf, "This version of libavfilter has no 'yadif' filter.\n");
return 0;
}
diff --git a/wscript_build.py b/wscript_build.py
index ab92cd3466..ebcab9d618 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -298,30 +298,30 @@ def build(ctx):
( "video/filter/vf.c" ),
( "video/filter/vf_buffer.c" ),
( "video/filter/vf_crop.c" ),
- ( "video/filter/vf_delogo.c" ),
+ ( "video/filter/vf_delogo.c", "libavfilter"),
( "video/filter/vf_dlopen.c", "dlopen" ),
( "video/filter/vf_dsize.c" ),
( "video/filter/vf_eq.c" ),
( "video/filter/vf_expand.c" ),
( "video/filter/vf_flip.c" ),
( "video/filter/vf_format.c" ),
- ( "video/filter/vf_gradfun.c" ),
- ( "video/filter/vf_hqdn3d.c" ),
+ ( "video/filter/vf_gradfun.c", "libavfilter"),
+ ( "video/filter/vf_hqdn3d.c", "libavfilter"),
( "video/filter/vf_lavfi.c", "libavfilter"),
( "video/filter/vf_mirror.c" ),
( "video/filter/vf_noformat.c" ),
- ( "video/filter/vf_noise.c" ),
- ( "video/filter/vf_pullup.c" ),
- ( "video/filter/vf_rotate.c" ),
+ ( "video/filter/vf_noise.c", "libavfilter"),
+ ( "video/filter/vf_pullup.c", "libavfilter"),
+ ( "video/filter/vf_rotate.c", "libavfilter"),
( "video/filter/vf_scale.c" ),
( "video/filter/vf_screenshot.c" ),
( "video/filter/vf_stereo3d.c" ),
( "video/filter/vf_sub.c" ),
- ( "video/filter/vf_unsharp.c" ),
+ ( "video/filter/vf_unsharp.c", "libavfilter"),
( "video/filter/vf_vapoursynth.c", "vapoursynth-core" ),
( "video/filter/vf_vavpp.c", "vaapi-vpp"),
( "video/filter/vf_vdpaupp.c", "vdpau" ),
- ( "video/filter/vf_yadif.c" ),
+ ( "video/filter/vf_yadif.c", "libavfilter"),
( "video/out/aspect.c" ),
( "video/out/bitmap_packer.c" ),
( "video/out/cocoa/video_view.m", "cocoa" ),