2003-09-03 22:44:28 +00:00
|
|
|
/*
|
2008-05-13 10:16:20 +00:00
|
|
|
* Copyright (C) 2002 Jindrich Makovicka <makovick@gmail.com>
|
|
|
|
*
|
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
|
|
|
*/
|
2003-09-03 22:44:28 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/msg.h"
|
2003-09-03 22:44:28 +00:00
|
|
|
#include "vf.h"
|
2013-12-03 21:22:35 +00:00
|
|
|
#include "vf_lavfi.h"
|
2003-09-03 22:44:28 +00:00
|
|
|
|
2013-12-17 01:02:25 +00:00
|
|
|
#include "options/m_option.h"
|
2003-09-05 16:04:40 +00:00
|
|
|
|
|
|
|
static struct vf_priv_s {
|
2003-09-03 22:44:28 +00:00
|
|
|
int xoff, yoff, lw, lh, band, show;
|
2013-12-03 21:22:35 +00:00
|
|
|
struct vf_lw_opts *lw_opts;
|
2007-01-28 16:48:01 +00:00
|
|
|
} const vf_priv_dflt = {
|
2013-12-07 18:32:03 +00:00
|
|
|
.band = 1,
|
2003-09-03 22:44:28 +00:00
|
|
|
};
|
|
|
|
|
2013-12-03 23:01:38 +00:00
|
|
|
static int vf_open(vf_instance_t *vf){
|
2013-12-03 21:22:35 +00:00
|
|
|
struct vf_priv_s *p = vf->priv;
|
2003-09-03 22:44:28 +00:00
|
|
|
|
2013-12-03 21:22:35 +00:00
|
|
|
int band = p->band;
|
|
|
|
int show = p->show;
|
|
|
|
if (band < 0) {
|
|
|
|
band = 4;
|
|
|
|
show = 1;
|
|
|
|
}
|
|
|
|
if (vf_lw_set_graph(vf, p->lw_opts, "delogo", "%d:%d:%d:%d:%d:%d",
|
|
|
|
p->xoff, p->yoff, p->lw, p->lh, band, show) >= 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-02-11 16:32:41 +00:00
|
|
|
MP_FATAL(vf, "This version of libavfilter has no 'delogo' filter.\n");
|
2014-03-16 09:46:45 +00:00
|
|
|
return 0;
|
2003-09-03 22:44:28 +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
|
2008-04-26 13:35:40 +00:00
|
|
|
static const m_option_t vf_opts_fields[] = {
|
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
|
|
|
OPT_INT("x", xoff, 0),
|
|
|
|
OPT_INT("y", yoff, 0),
|
|
|
|
OPT_INT("w", lw, 0),
|
|
|
|
OPT_INT("h", lh, 0),
|
|
|
|
OPT_INT("t", band, 0),
|
|
|
|
OPT_INT("band", band, 0), // alias
|
2013-12-03 21:22:35 +00:00
|
|
|
OPT_FLAG("show", show, 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}
|
2003-09-05 16:04:40 +00:00
|
|
|
};
|
|
|
|
|
2007-12-02 14:57:15 +00:00
|
|
|
const vf_info_t vf_info_delogo = {
|
2013-10-23 17:06:42 +00:00
|
|
|
.description = "simple logo remover",
|
|
|
|
.name = "delogo",
|
|
|
|
.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_dflt,
|
|
|
|
.options = vf_opts_fields,
|
2003-09-03 22:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//===========================================================================//
|