Commit 8e45c103 authored by Michael Niedermayer's avatar Michael Niedermayer

Remove dependancy of m_option & m_struct from libmpcodecs.

parent 4d463614
...@@ -33,17 +33,11 @@ ...@@ -33,17 +33,11 @@
#include "vf.h" #include "vf.h"
#include "libvo/fastmemcpy.h" #include "libvo/fastmemcpy.h"
#include "m_option.h"
#include "m_struct.h"
//===========================================================================// //===========================================================================//
static struct vf_priv_s { struct vf_priv_s {
unsigned int outfmt; unsigned int outfmt;
int xoff, yoff, lw, lh, band, show; int xoff, yoff, lw, lh, band, show;
} const vf_priv_dflt = {
0,
0, 0, 0, 0, 0, 0
}; };
#define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MIN(a,b) (((a) < (b)) ? (a) : (b))
...@@ -197,12 +191,27 @@ static const unsigned int fmt_list[]={ ...@@ -197,12 +191,27 @@ static const unsigned int fmt_list[]={
}; };
static int vf_open(vf_instance_t *vf, char *args){ static int vf_open(vf_instance_t *vf, char *args){
int res=0;
vf->config=config; vf->config=config;
vf->put_image=put_image; vf->put_image=put_image;
vf->get_image=get_image; vf->get_image=get_image;
vf->query_format=query_format; vf->query_format=query_format;
vf->uninit=uninit; vf->uninit=uninit;
vf->priv=malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
if (args) res = sscanf(args, "%d:%d:%d:%d:%d",
&vf->priv->xoff, &vf->priv->yoff,
&vf->priv->lw, &vf->priv->lh,
&vf->priv->band);
if (res != 5) {
mp_msg(MSGT_VFILTER, MSGL_ERR, "deLogo: syntax is \"delogo=xoff:yoff:width:height:band\"\n");
uninit(vf);
return 0;
}
mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n", mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n",
vf->priv->xoff, vf->priv->yoff, vf->priv->xoff, vf->priv->yoff,
vf->priv->lw, vf->priv->lh, vf->priv->lw, vf->priv->lh,
...@@ -232,31 +241,12 @@ static int vf_open(vf_instance_t *vf, char *args){ ...@@ -232,31 +241,12 @@ static int vf_open(vf_instance_t *vf, char *args){
return 1; return 1;
} }
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
static const m_option_t vf_opts_fields[] = {
{ "x", ST_OFF(xoff), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "y", ST_OFF(yoff), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "w", ST_OFF(lw), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "h", ST_OFF(lh), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "t", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "band", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL }, // alias
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
static const m_struct_t vf_opts = {
"delogo",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
vf_opts_fields
};
const vf_info_t vf_info_delogo = { const vf_info_t vf_info_delogo = {
"simple logo remover", "simple logo remover",
"delogo", "delogo",
"Jindrich Makovicka, Alex Beregszaszi", "Jindrich Makovicka, Alex Beregszaszi",
"", "",
vf_open, vf_open,
&vf_opts
}; };
//===========================================================================// //===========================================================================//
...@@ -31,17 +31,10 @@ ...@@ -31,17 +31,10 @@
#include "libvo/video_out.h" #include "libvo/video_out.h"
#include "m_option.h"
#include "m_struct.h"
static struct vf_priv_s { static struct vf_priv_s {
unsigned char *buf; unsigned char *buf;
int brightness; int brightness;
int contrast; int contrast;
} const vf_priv_dflt = {
NULL,
0,
0
}; };
#if HAVE_MMX #if HAVE_MMX
...@@ -226,6 +219,10 @@ static int vf_open(vf_instance_t *vf, char *args) ...@@ -226,6 +219,10 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->put_image=put_image; vf->put_image=put_image;
vf->uninit=uninit; vf->uninit=uninit;
vf->priv = malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
if (args) sscanf(args, "%d:%d", &vf->priv->brightness, &vf->priv->contrast);
process = process_C; process = process_C;
#if HAVE_MMX #if HAVE_MMX
if(gCpuCaps.hasMMX) process = process_MMX; if(gCpuCaps.hasMMX) process = process_MMX;
...@@ -234,25 +231,10 @@ static int vf_open(vf_instance_t *vf, char *args) ...@@ -234,25 +231,10 @@ static int vf_open(vf_instance_t *vf, char *args)
return 1; return 1;
} }
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
static const m_option_t vf_opts_fields[] = {
{"brightness", ST_OFF(brightness), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
{"contrast", ST_OFF(contrast), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
static const m_struct_t vf_opts = {
"eq",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
vf_opts_fields
};
const vf_info_t vf_info_eq = { const vf_info_t vf_info_eq = {
"soft video equalizer", "soft video equalizer",
"eq", "eq",
"Richard Felker", "Richard Felker",
"", "",
vf_open, vf_open,
&vf_opts
}; };
...@@ -32,17 +32,10 @@ ...@@ -32,17 +32,10 @@
#include "libvo/video_out.h" #include "libvo/video_out.h"
#include "m_option.h" struct vf_priv_s {
#include "m_struct.h"
static struct vf_priv_s {
uint8_t *buf[2]; uint8_t *buf[2];
float hue; float hue;
float saturation; float saturation;
} const vf_priv_dflt = {
{NULL, NULL},
0.0,
1.0,
}; };
static void process_C(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsrc, int dststride, int srcstride, static void process_C(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsrc, int dststride, int srcstride,
...@@ -170,31 +163,19 @@ static int vf_open(vf_instance_t *vf, char *args) ...@@ -170,31 +163,19 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->put_image=put_image; vf->put_image=put_image;
vf->uninit=uninit; vf->uninit=uninit;
vf->priv = malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
sscanf(args, "%f:%f", &vf->priv->hue, &vf->priv->saturation);
vf->priv->hue *= M_PI / 180.0; vf->priv->hue *= M_PI / 180.0;
process = process_C; process = process_C;
return 1; return 1;
} }
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
static const m_option_t vf_opts_fields[] = {
{"hue", ST_OFF(hue), CONF_TYPE_FLOAT, M_OPT_RANGE,-180.0 ,180.0, NULL},
{"saturation", ST_OFF(saturation), CONF_TYPE_FLOAT, M_OPT_RANGE,-10.0 ,10.0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
static const m_struct_t vf_opts = {
"hue",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
vf_opts_fields
};
const vf_info_t vf_info_hue = { const vf_info_t vf_info_hue = {
"hue changer", "hue changer",
"hue", "hue",
"Michael Niedermayer", "Michael Niedermayer",
"", "",
vf_open, vf_open,
&vf_opts
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment