2006-06-06 23:30:23 +00:00
|
|
|
/*
|
2008-05-13 10:16:20 +00:00
|
|
|
* Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2008-05-13 10:16:20 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or modify
|
2008-05-13 10:16:20 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2008-05-13 10:16:20 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
2015-04-13 07:36:54 +00:00
|
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2008-05-13 10:16:20 +00:00
|
|
|
*/
|
2006-06-06 23:30:23 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2013-12-17 01:02:25 +00:00
|
|
|
#include "options/options.h"
|
2006-06-06 23:30:23 +00:00
|
|
|
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/msg.h"
|
2006-06-06 23:30:23 +00:00
|
|
|
#include "vf.h"
|
|
|
|
|
2013-12-03 21:21:24 +00:00
|
|
|
#include "vf_lavfi.h"
|
|
|
|
|
2006-06-06 23:30:23 +00:00
|
|
|
struct vf_priv_s {
|
|
|
|
int mode;
|
2006-11-19 19:17:51 +00:00
|
|
|
int do_deinterlace;
|
2013-12-03 21:21:24 +00:00
|
|
|
struct vf_lw_opts *lw_opts;
|
2006-06-06 23:30:23 +00:00
|
|
|
};
|
|
|
|
|
2013-02-22 22:56:42 +00:00
|
|
|
static const struct vf_priv_s vf_priv_default = {
|
|
|
|
.do_deinterlace = 1,
|
|
|
|
};
|
|
|
|
|
2014-03-16 09:41:14 +00:00
|
|
|
static int vf_open(vf_instance_t *vf)
|
2006-07-06 06:58:17 +00:00
|
|
|
{
|
2013-12-03 21:21:24 +00:00
|
|
|
struct vf_priv_s *p = vf->priv;
|
|
|
|
|
|
|
|
// Earlier libavfilter yadif versions used pure integers for the first
|
|
|
|
// option. We can't/don't handle this, but at least allow usage of the
|
|
|
|
// filter with default settings. So use an empty string for "send_frame".
|
|
|
|
const char *mode[] = {"", "send_field", "send_frame_nospatial",
|
|
|
|
"send_field_nospatial"};
|
|
|
|
|
|
|
|
if (vf_lw_set_graph(vf, p->lw_opts, "yadif", "%s", mode[p->mode]) >= 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2006-06-06 23:30:23 +00:00
|
|
|
|
2015-02-11 16:32:41 +00:00
|
|
|
MP_FATAL(vf, "This version of libavfilter has no 'yadif' filter.\n");
|
2014-03-16 09:41:14 +00:00
|
|
|
return 0;
|
2006-06-06 23:30:23 +00:00
|
|
|
}
|
|
|
|
|
options: use m_config for options instead of m_struct
For some reason, both m_config and m_struct are somewhat similar, except
that m_config is much more powerful. m_config is used for VOs and some
other things, so to unify them. We plan to kick out m_struct and use
m_config for everything. (Unfortunately, m_config is also a bit more
bloated, so this commit isn't all that great, but it will allow to
reduce the option parser mess somewhat.)
This commit also switches all video filters to use the option macros.
One reason is that m_struct and m_config, even though they both use
m_option, store the offsets of the option fields differently (sigh...),
meaning the options defined for either are incompatible. It's easier to
switch everything in one go.
This commit will allow using the -vf option parser for other things,
like VOs and AOs.
2013-07-21 17:33:08 +00:00
|
|
|
#define OPT_BASE_STRUCT struct vf_priv_s
|
2013-02-22 22:56:42 +00:00
|
|
|
static const m_option_t vf_opts_fields[] = {
|
2013-12-03 21:21:24 +00:00
|
|
|
OPT_CHOICE("mode", mode, 0,
|
|
|
|
({"frame", 0},
|
|
|
|
{"field", 1},
|
|
|
|
{"frame-nospatial", 2},
|
|
|
|
{"field-nospatial", 3})),
|
|
|
|
OPT_FLAG("enabled", do_deinterlace, 0),
|
|
|
|
OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0),
|
options: use m_config for options instead of m_struct
For some reason, both m_config and m_struct are somewhat similar, except
that m_config is much more powerful. m_config is used for VOs and some
other things, so to unify them. We plan to kick out m_struct and use
m_config for everything. (Unfortunately, m_config is also a bit more
bloated, so this commit isn't all that great, but it will allow to
reduce the option parser mess somewhat.)
This commit also switches all video filters to use the option macros.
One reason is that m_struct and m_config, even though they both use
m_option, store the offsets of the option fields differently (sigh...),
meaning the options defined for either are incompatible. It's easier to
switch everything in one go.
This commit will allow using the -vf option parser for other things,
like VOs and AOs.
2013-07-21 17:33:08 +00:00
|
|
|
{0}
|
2013-02-22 22:56:42 +00:00
|
|
|
};
|
|
|
|
|
2007-12-02 14:57:15 +00:00
|
|
|
const vf_info_t vf_info_yadif = {
|
2013-10-23 17:06:42 +00:00
|
|
|
.description = "Yet Another DeInterlacing Filter",
|
|
|
|
.name = "yadif",
|
|
|
|
.open = vf_open,
|
options: use m_config for options instead of m_struct
For some reason, both m_config and m_struct are somewhat similar, except
that m_config is much more powerful. m_config is used for VOs and some
other things, so to unify them. We plan to kick out m_struct and use
m_config for everything. (Unfortunately, m_config is also a bit more
bloated, so this commit isn't all that great, but it will allow to
reduce the option parser mess somewhat.)
This commit also switches all video filters to use the option macros.
One reason is that m_struct and m_config, even though they both use
m_option, store the offsets of the option fields differently (sigh...),
meaning the options defined for either are incompatible. It's easier to
switch everything in one go.
This commit will allow using the -vf option parser for other things,
like VOs and AOs.
2013-07-21 17:33:08 +00:00
|
|
|
.priv_size = sizeof(struct vf_priv_s),
|
|
|
|
.priv_defaults = &vf_priv_default,
|
|
|
|
.options = vf_opts_fields,
|
2006-06-06 23:30:23 +00:00
|
|
|
};
|