summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-03 22:29:30 +0100
committerwm4 <wm4@nowhere>2013-12-04 00:07:39 +0100
commit1acb32201b813b77bd9f1b52ec665567fade0826 (patch)
tree67d1dee66a367171b18f330df9f1fc539eaee484 /video
parent6a2eeedc4c89511938dd2aa727bc3a1898673578 (diff)
downloadmpv-1acb32201b813b77bd9f1b52ec665567fade0826.tar.bz2
mpv-1acb32201b813b77bd9f1b52ec665567fade0826.tar.xz
vf_phase: change options, reroute to vf_lavfi
The option change is probably backwards compatible.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_phase.c83
1 files changed, 48 insertions, 35 deletions
diff --git a/video/filter/vf_phase.c b/video/filter/vf_phase.c
index f2a4a3f4be..46b75b28c4 100644
--- a/video/filter/vf_phase.c
+++ b/video/filter/vf_phase.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "mpvcore/mp_msg.h"
+#include "mpvcore/m_option.h"
#include "video/img_format.h"
#include "video/mp_image.h"
@@ -30,6 +31,8 @@
#include "video/memcpy_pic.h"
+#include "vf_lavfi.h"
+
enum mode { PROGRESSIVE, TOP_FIRST, BOTTOM_FIRST,
TOP_FIRST_ANALYZE, BOTTOM_FIRST_ANALYZE,
ANALYZE, FULL_ANALYZE, AUTO, AUTO_ANALYZE };
@@ -38,9 +41,10 @@ enum mode { PROGRESSIVE, TOP_FIRST, BOTTOM_FIRST,
struct vf_priv_s
{
- enum mode mode;
+ int mode;
int verbose;
unsigned char *buf[3];
+ struct vf_lw_opts *lw_opts;
};
/*
@@ -246,51 +250,60 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
return vf_next_query_format(vf, fmt);
}
+static const char *get_lavfi_mode(int mode)
+{
+ switch (mode) {
+ case PROGRESSIVE: return "p";
+ case TOP_FIRST: return "t";
+ case BOTTOM_FIRST: return "b";
+ case TOP_FIRST_ANALYZE: return "T";
+ case BOTTOM_FIRST_ANALYZE: return "B";
+ case ANALYZE: return "u";
+ case FULL_ANALYZE: return "U";
+ case AUTO: return "a";
+ case AUTO_ANALYZE: return "A";
+ default: return "?";
+ }
+}
+
static int vf_open(vf_instance_t *vf, char *args)
{
vf->filter = filter;
vf->uninit = uninit;
vf->query_format = query_format;
- if(!(vf->priv = calloc(1, sizeof(struct vf_priv_s))))
- {
- uninit(vf);
- return 0;
- }
-
- vf->priv->mode=AUTO_ANALYZE;
- vf->priv->verbose=0;
-
- while(args && *args)
- {
- switch(*args)
- {
- case 't': vf->priv->mode=TOP_FIRST; break;
- case 'a': vf->priv->mode=AUTO; break;
- case 'b': vf->priv->mode=BOTTOM_FIRST; break;
- case 'u': vf->priv->mode=ANALYZE; break;
- case 'T': vf->priv->mode=TOP_FIRST_ANALYZE; break;
- case 'A': vf->priv->mode=AUTO_ANALYZE; break;
- case 'B': vf->priv->mode=BOTTOM_FIRST_ANALYZE; break;
- case 'U': vf->priv->mode=FULL_ANALYZE; break;
- case 'p': vf->priv->mode=PROGRESSIVE; break;
- case 'v': vf->priv->verbose=1; break;
- case ':': break;
-
- default:
- uninit(vf);
- return 0; /* bad args */
- }
-
- if( (args=strchr(args, ':')) ) args++;
- }
+ if (vf_lw_set_graph(vf, vf->priv->lw_opts, "phase", "%s",
+ get_lavfi_mode(vf->priv->mode)) >= 0)
+ {
+ return 1;
+ }
return 1;
}
+#define OPT_BASE_STRUCT struct vf_priv_s
const vf_info_t vf_info_phase =
- {
+{
.description = "phase shift fields",
.name = "phase",
.open = vf_open,
- };
+ .priv_size = sizeof(struct vf_priv_s),
+ .priv_defaults = &(const struct vf_priv_s){
+ .mode = AUTO_ANALYZE,
+ },
+ .options = (const struct m_option[]){
+ OPT_CHOICE("mode", mode, 0,
+ ({"t", TOP_FIRST},
+ {"a", AUTO},
+ {"b", BOTTOM_FIRST},
+ {"u", ANALYZE},
+ {"T", TOP_FIRST_ANALYZE},
+ {"A", AUTO_ANALYZE},
+ {"B", BOTTOM_FIRST_ANALYZE},
+ {"U", FULL_ANALYZE},
+ {"p", PROGRESSIVE})),
+ OPT_FLAG("v", verbose, 0),
+ OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
+ {0}
+ },
+};