summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-03 23:41:14 +0100
committerwm4 <wm4@nowhere>2013-12-04 00:07:40 +0100
commitfabfb23232799c54019de76a4f1fb33d4adef97e (patch)
treedda3de917604e8c809cdbdfce400a2cfce39043e
parenta605fae6fac98218d18b1f24e78cf307a2b998aa (diff)
downloadmpv-fabfb23232799c54019de76a4f1fb33d4adef97e.tar.bz2
mpv-fabfb23232799c54019de76a4f1fb33d4adef97e.tar.xz
vf_pp: use option parser
-rw-r--r--DOCS/man/en/changes.rst2
-rw-r--r--DOCS/man/en/vf.rst11
-rw-r--r--video/filter/vf_pp.c19
3 files changed, 23 insertions, 9 deletions
diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst
index 6f6818230a..d2f7ed5995 100644
--- a/DOCS/man/en/changes.rst
+++ b/DOCS/man/en/changes.rst
@@ -177,7 +177,7 @@ Command Line Switches
``-af volnorm`` ``--af=drc`` (renamed)
``-zoom`` Inverse available as ``--video-unscaled``
``-panscanrange`` ``--video-zoom``, ``--video-pan-x/y``
- ``-pp`` ``-vf=pp``
+ ``-pp`` ``'--vf=[pp]'``
``-pphelp`` ``--vf=pp:help``
=========================== ========================================
diff --git a/DOCS/man/en/vf.rst b/DOCS/man/en/vf.rst
index 8f5ebc3885..ac9146d7ec 100644
--- a/DOCS/man/en/vf.rst
+++ b/DOCS/man/en/vf.rst
@@ -241,7 +241,7 @@ Available filters are:
``<fmt>``
Format name, e.g. rgb15, bgr24, 420p, etc. (default: 420p).
-``pp[=filter1[:option1[:option2...]]/[-]filter2...]``
+``pp[=[filter1[:option1[:option2...]]/[-]filter2...]]``
Enables the specified chain of postprocessing subfilters. Subfilters must
be separated by '/' and can be disabled by prepending a '-'. Each
subfilter and some options have a short and a long name that can be used
@@ -261,6 +261,11 @@ Available filters are:
``--vf=pp:help`` shows a list of available subfilters.
+ .. note::
+
+ Unlike in MPlayer or in earlier versions, you must quote the pp string
+ if it contains ``:`` characters, e.g. ``'--vf=pp=[...]'``.
+
Available subfilters are:
``hb/hdeblock[:difference[:flatness]]``
@@ -373,10 +378,10 @@ Available filters are:
``--vf=pp=de/-al``
default filters without brightness/contrast correction
- ``--vf=pp=default/tmpnoise:1:2:3``
+ ``--vf=pp=[default/tmpnoise:1:2:3]``
Enable default filters & temporal denoiser.
- ``--vf=pp=hb:y/vb:a``
+ ``--vf=pp=[hb:y/vb:a]``
Horizontal deblocking on luminance only, and switch vertical
deblocking on or off automatically depending on available CPU time.
diff --git a/video/filter/vf_pp.c b/video/filter/vf_pp.c
index 8649372d4b..627f8b27f4 100644
--- a/video/filter/vf_pp.c
+++ b/video/filter/vf_pp.c
@@ -26,6 +26,7 @@
#include "config.h"
#include "mpvcore/mp_msg.h"
#include "mpvcore/cpudetect.h"
+#include "mpvcore/m_option.h"
#include "video/img_format.h"
#include "video/mp_image.h"
@@ -37,6 +38,7 @@ struct vf_priv_s {
pp_mode *ppMode[PP_QUALITY_MAX+1];
void *context;
unsigned int outfmt;
+ char *arg;
};
//===========================================================================//
@@ -132,17 +134,13 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->config=config;
vf->filter=filter;
vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- vf->priv->context=NULL;
// check csp:
vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_420P);
if(!vf->priv->outfmt) return 0; // no csp match :(
- char *name = args ? args : "de";
-
for(i=0; i<=PP_QUALITY_MAX; i++){
- vf->priv->ppMode[i]= pp_get_mode_by_name_and_quality(name, i);
+ vf->priv->ppMode[i]= pp_get_mode_by_name_and_quality(vf->priv->arg, i);
if(vf->priv->ppMode[i]==NULL) return -1;
}
@@ -153,13 +151,24 @@ static int vf_open(vf_instance_t *vf, char *args){
static void print_help(void)
{
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", pp_help);
+ mp_msg(MSGT_CFGPARSER, MSGL_INFO,
+ "Don't forget to quote the filter list, e.g.: '--vf=pp=[tn:64:128:256]'\n\n");
}
+#define OPT_BASE_STRUCT struct vf_priv_s
const vf_info_t vf_info_pp = {
.description = "postprocessing",
.name = "pp",
.open = vf_open,
.print_help = print_help,
+ .priv_size = sizeof(struct vf_priv_s),
+ .priv_defaults = &(const struct vf_priv_s){
+ .arg = "de",
+ },
+ .options = (const struct m_option[]){
+ OPT_STRING("filters", arg, 0),
+ {0}
+ },
};
//===========================================================================//