From a605fae6fac98218d18b1f24e78cf307a2b998aa Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 3 Dec 2013 23:35:28 +0100 Subject: vf_ilpack: use option parser --- video/filter/vf_ilpack.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'video/filter') diff --git a/video/filter/vf_ilpack.c b/video/filter/vf_ilpack.c index 136e8917ed..f3bef4fa19 100644 --- a/video/filter/vf_ilpack.c +++ b/video/filter/vf_ilpack.c @@ -24,6 +24,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" @@ -408,9 +409,6 @@ static int vf_open(vf_instance_t *vf, char *args) vf->config=config; vf->query_format=query_format; vf->filter=filter; - vf->priv = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->mode = 1; - if (args) sscanf(args, "%d", &vf->priv->mode); pack_nn = pack_nn_C; pack_li_0 = pack_li_0_C; @@ -429,11 +427,6 @@ static int vf_open(vf_instance_t *vf, char *args) case 0: vf->priv->pack[0] = vf->priv->pack[1] = pack_nn; break; - default: - mp_msg(MSGT_VFILTER, MSGL_WARN, - "ilpack: unknown mode %d (fallback to linear)\n", - vf->priv->mode); - /* Fallthrough */ case 1: vf->priv->pack[0] = pack_li_0; vf->priv->pack[1] = pack_li_1; @@ -443,8 +436,17 @@ static int vf_open(vf_instance_t *vf, char *args) return 1; } +#define OPT_BASE_STRUCT struct vf_priv_s const vf_info_t vf_info_ilpack = { .description = "4:2:0 planar -> 4:2:2 packed reinterlacer", .name = "ilpack", .open = vf_open, + .priv_size = sizeof(struct vf_priv_s), + .priv_defaults = &(const struct vf_priv_s){ + .mode = 1, + }, + .options = (const struct m_option[]){ + OPT_INTRANGE("mode", mode, 0, 0, 1), + {0} + }, }; -- cgit v1.2.3