diff options
author | wm4 <wm4@nowhere> | 2013-05-25 15:53:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-26 16:44:18 +0200 |
commit | c23bf5311fce3b59e9111e5de646ee57b48be27f (patch) | |
tree | b467490430dfce982a00d7f92e83df9e4f8e6cd5 | |
parent | 3546188a41aa8c231e563ac89af68edd2798323b (diff) | |
download | mpv-c23bf5311fce3b59e9111e5de646ee57b48be27f.tar.bz2 mpv-c23bf5311fce3b59e9111e5de646ee57b48be27f.tar.xz |
vf_lavfi: allow setting avopts
-rw-r--r-- | DOCS/man/en/vf.rst | 10 | ||||
-rw-r--r-- | core/av_opts.c | 4 | ||||
-rw-r--r-- | video/filter/vf_lavfi.c | 9 |
3 files changed, 22 insertions, 1 deletions
diff --git a/DOCS/man/en/vf.rst b/DOCS/man/en/vf.rst index 846d3ffac6..6d650212fc 100644 --- a/DOCS/man/en/vf.rst +++ b/DOCS/man/en/vf.rst @@ -367,7 +367,7 @@ pp[=filter1[:option1[:option2...]]/[-]filter2...] Horizontal deblocking on luminance only, and switch vertical deblocking on or off automatically depending on available CPU time. -lavfi=graph[:sws_flags] +lavfi=graph[:sws_flags[:o=opts]] Filter video using ffmpeg's libavfilter. <graph> @@ -406,6 +406,14 @@ lavfi=graph[:sws_flags] See ``http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libswscale/swscale.h``. + <o> + Set AVFilterGraph options. These should be documented by ffmpeg. + + *EXAMPLE*: + + ``'--vf=lavfi=yadif:o="threads=2,thread_type=slice"'`` + forces a specific threading configuration. + noise[=luma[u][t|a][h][p]:chroma[u][t|a][h][p]] Adds noise. diff --git a/core/av_opts.c b/core/av_opts.c index bc2e392c5f..777a1eec5a 100644 --- a/core/av_opts.c +++ b/core/av_opts.c @@ -28,6 +28,10 @@ int parse_avopts(void *v, char *str){ char *start; + + if (!str) + return 0; + start= str= strdup(str); while(str && *str){ diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c index 77d85cb603..53e22c21b9 100644 --- a/video/filter/vf_lavfi.c +++ b/video/filter/vf_lavfi.c @@ -38,6 +38,7 @@ #include "core/mp_msg.h" #include "core/m_option.h" #include "core/m_struct.h" +#include "core/av_opts.h" #include "video/img_format.h" #include "video/mp_image.h" @@ -77,6 +78,7 @@ struct vf_priv_s { // options char *cfg_graph; int64_t cfg_sws_flags; + char *cfg_avopts; }; static const struct vf_priv_s vf_priv_dflt = { @@ -131,6 +133,12 @@ static bool recreate_graph(struct vf_instance *vf, int width, int height, if (!graph) goto error; + if (parse_avopts(graph, p->cfg_avopts) < 0) { + mp_msg(MSGT_VFILTER, MSGL_FATAL, "lavfi: could not set opts: '%s'\n", + p->cfg_avopts); + goto error; + } + AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); if (!outputs || !inputs) @@ -323,6 +331,7 @@ static int vf_open(vf_instance_t *vf, char *args) static const m_option_t vf_opts_fields[] = { {"graph", ST_OFF(cfg_graph), CONF_TYPE_STRING, CONF_MIN, 1}, {"sws_flags", ST_OFF(cfg_sws_flags), CONF_TYPE_INT64}, + {"o", ST_OFF(cfg_avopts), CONF_TYPE_STRING}, {0} }; |