1
mirror of https://github.com/mpv-player/mpv synced 2025-03-23 00:14:24 +01:00

vf_lavfi: allow setting avopts

This commit is contained in:
wm4 2013-05-25 15:53:55 +02:00
parent 3546188a41
commit c23bf5311f
3 changed files with 22 additions and 1 deletions
DOCS/man/en
core
video/filter

@ -367,7 +367,7 @@ pp[=filter1[:option1[:option2...]]/[-]filter2...]
Horizontal deblocking on luminance only, and switch vertical Horizontal deblocking on luminance only, and switch vertical
deblocking on or off automatically depending on available CPU time. 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. Filter video using ffmpeg's libavfilter.
<graph> <graph>
@ -406,6 +406,14 @@ lavfi=graph[:sws_flags]
See ``http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libswscale/swscale.h``. 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]] noise[=luma[u][t|a][h][p]:chroma[u][t|a][h][p]]
Adds noise. Adds noise.

@ -28,6 +28,10 @@
int parse_avopts(void *v, char *str){ int parse_avopts(void *v, char *str){
char *start; char *start;
if (!str)
return 0;
start= str= strdup(str); start= str= strdup(str);
while(str && *str){ while(str && *str){

@ -38,6 +38,7 @@
#include "core/mp_msg.h" #include "core/mp_msg.h"
#include "core/m_option.h" #include "core/m_option.h"
#include "core/m_struct.h" #include "core/m_struct.h"
#include "core/av_opts.h"
#include "video/img_format.h" #include "video/img_format.h"
#include "video/mp_image.h" #include "video/mp_image.h"
@ -77,6 +78,7 @@ struct vf_priv_s {
// options // options
char *cfg_graph; char *cfg_graph;
int64_t cfg_sws_flags; int64_t cfg_sws_flags;
char *cfg_avopts;
}; };
static const struct vf_priv_s vf_priv_dflt = { 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) if (!graph)
goto error; 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 *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc();
if (!outputs || !inputs) 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[] = { static const m_option_t vf_opts_fields[] = {
{"graph", ST_OFF(cfg_graph), CONF_TYPE_STRING, CONF_MIN, 1}, {"graph", ST_OFF(cfg_graph), CONF_TYPE_STRING, CONF_MIN, 1},
{"sws_flags", ST_OFF(cfg_sws_flags), CONF_TYPE_INT64}, {"sws_flags", ST_OFF(cfg_sws_flags), CONF_TYPE_INT64},
{"o", ST_OFF(cfg_avopts), CONF_TYPE_STRING},
{0} {0}
}; };