[FFmpeg-cvslog] Remove dependancy of m_option & m_struct from libmpcodecs.

Michael Niedermayer git
Thu Jan 20 03:54:53 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 14 04:55:15 2011 +0100| [8e45c103e9578abfa52c7bd85ec75b288d151e54] | committer: Michael Niedermayer

Remove dependancy of m_option & m_struct from libmpcodecs.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e45c103e9578abfa52c7bd85ec75b288d151e54
---

 libavfilter/libmpcodecs/vf_delogo.c |   42 +++++++++++++---------------------
 libavfilter/libmpcodecs/vf_eq.c     |   26 +++------------------
 libavfilter/libmpcodecs/vf_hue.c    |   27 +++-------------------
 3 files changed, 24 insertions(+), 71 deletions(-)

diff --git a/libavfilter/libmpcodecs/vf_delogo.c b/libavfilter/libmpcodecs/vf_delogo.c
index fb85c55..7a69e57 100644
--- a/libavfilter/libmpcodecs/vf_delogo.c
+++ b/libavfilter/libmpcodecs/vf_delogo.c
@@ -33,17 +33,11 @@
 #include "vf.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;
     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))
@@ -197,12 +191,27 @@ static const unsigned int fmt_list[]={
 };
 
 static int vf_open(vf_instance_t *vf, char *args){
+    int res=0;
     vf->config=config;
     vf->put_image=put_image;
     vf->get_image=get_image;
     vf->query_format=query_format;
     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",
            vf->priv->xoff, vf->priv->yoff,
            vf->priv->lw, vf->priv->lh,
@@ -232,31 +241,12 @@ static int vf_open(vf_instance_t *vf, char *args){
     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 = {
     "simple logo remover",
     "delogo",
     "Jindrich Makovicka, Alex Beregszaszi",
     "",
     vf_open,
-    &vf_opts
 };
 
 //===========================================================================//
diff --git a/libavfilter/libmpcodecs/vf_eq.c b/libavfilter/libmpcodecs/vf_eq.c
index d68e860..df4e851 100644
--- a/libavfilter/libmpcodecs/vf_eq.c
+++ b/libavfilter/libmpcodecs/vf_eq.c
@@ -31,17 +31,10 @@
 
 #include "libvo/video_out.h"
 
-#include "m_option.h"
-#include "m_struct.h"
-
 static struct vf_priv_s {
         unsigned char *buf;
         int brightness;
         int contrast;
-} const vf_priv_dflt = {
-  NULL,
-  0,
-  0
 };
 
 #if HAVE_MMX
@@ -226,6 +219,10 @@ static int vf_open(vf_instance_t *vf, char *args)
         vf->put_image=put_image;
         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;
 #if HAVE_MMX
         if(gCpuCaps.hasMMX) process = process_MMX;
@@ -234,25 +231,10 @@ static int vf_open(vf_instance_t *vf, char *args)
         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 = {
         "soft video equalizer",
         "eq",
         "Richard Felker",
         "",
         vf_open,
-        &vf_opts
 };
diff --git a/libavfilter/libmpcodecs/vf_hue.c b/libavfilter/libmpcodecs/vf_hue.c
index 177142f..9a8fc8b 100644
--- a/libavfilter/libmpcodecs/vf_hue.c
+++ b/libavfilter/libmpcodecs/vf_hue.c
@@ -32,17 +32,10 @@
 
 #include "libvo/video_out.h"
 
-#include "m_option.h"
-#include "m_struct.h"
-
-static struct vf_priv_s {
+struct vf_priv_s {
         uint8_t *buf[2];
         float hue;
         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,
@@ -170,31 +163,19 @@ static int vf_open(vf_instance_t *vf, char *args)
         vf->put_image=put_image;
         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;
 
         process = process_C;
         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 = {
         "hue changer",
         "hue",
         "Michael Niedermayer",
         "",
         vf_open,
-        &vf_opts
 };




More information about the ffmpeg-cvslog mailing list