aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-10-31 14:39:55 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-10-31 14:46:18 +0100
commit29a9e4d5c97e50114436b93339a93440fb3e2122 (patch)
tree0a75e24678543f726e9394e624f3793df3655750
parent9d478f38cd260ad517a1daad17bae7e68a5ace3a (diff)
downloadffmpeg-29a9e4d5c97e50114436b93339a93440fb3e2122.tar.gz
lavfi/mp: drop the mp=rectangle filter
All the rectangle features have been ported to the native drawbox filter, which has an equivalent syntax.
-rw-r--r--doc/filters.texi1
-rw-r--r--libavfilter/Makefile1
-rw-r--r--libavfilter/libmpcodecs/vf_rectangle.c181
-rw-r--r--libavfilter/version.h2
-rw-r--r--libavfilter/vf_mp.c2
5 files changed, 1 insertions, 186 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 1d6cea95aa..6a11b129cd 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2653,7 +2653,6 @@ The list of the currently supported filters follows:
@item pp7
@item pullup
@item qp
-@item rectangle
@item sab
@item softpulldown
@item softskip
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 47015ee231..5fbfe17574 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -187,7 +187,6 @@ OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_pp.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_pp7.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_pullup.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_qp.o
-OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_rectangle.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_sab.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_softpulldown.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_softskip.o
diff --git a/libavfilter/libmpcodecs/vf_rectangle.c b/libavfilter/libmpcodecs/vf_rectangle.c
deleted file mode 100644
index 21bc209de4..0000000000
--- a/libavfilter/libmpcodecs/vf_rectangle.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * 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.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * 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
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "mp_image.h"
-#include "mp_msg.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-#include "libavutil/common.h"
-
-struct vf_priv_s {
- int x, y, w, h;
-};
-
-static int
-config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- if (vf->priv->w < 0 || width < vf->priv->w)
- vf->priv->w = width;
- if (vf->priv->h < 0 || height < vf->priv->h)
- vf->priv->h = height;
- if (vf->priv->x < 0)
- vf->priv->x = (width - vf->priv->w) / 2;
- if (vf->priv->y < 0)
- vf->priv->y = (height - vf->priv->h) / 2;
- if (vf->priv->w + vf->priv->x > width
- || vf->priv->h + vf->priv->y > height) {
- mp_msg(MSGT_VFILTER,MSGL_WARN,"rectangle: bad position/width/height - rectangle area is out of the original!\n");
- return 0;
- }
- return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
-}
-
-static int
-control(struct vf_instance *vf, int request, void *data)
-{
- const int *const tmp = data;
- switch(request){
- case VFCTRL_CHANGE_RECTANGLE:
- switch (tmp[0]){
- case 0:
- vf->priv->w += tmp[1];
- return 1;
- break;
- case 1:
- vf->priv->h += tmp[1];
- return 1;
- break;
- case 2:
- vf->priv->x += tmp[1];
- return 1;
- break;
- case 3:
- vf->priv->y += tmp[1];
- return 1;
- break;
- default:
- mp_msg(MSGT_VFILTER,MSGL_FATAL,"Unknown param %d \n", tmp[0]);
- return 0;
- }
- }
- return vf_next_control(vf, request, data);
- return 0;
-}
-static int
-put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){
- mp_image_t* dmpi;
- unsigned int bpp = mpi->bpp / 8;
- int x, y, w, h;
- dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->w, mpi->h);
-
- memcpy_pic(dmpi->planes[0],mpi->planes[0],mpi->w*bpp, mpi->h,
- dmpi->stride[0],mpi->stride[0]);
- if(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV){
- memcpy_pic(dmpi->planes[1],mpi->planes[1],
- mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift,
- dmpi->stride[1],mpi->stride[1]);
- memcpy_pic(dmpi->planes[2],mpi->planes[2],
- mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift,
- dmpi->stride[2],mpi->stride[2]);
- }
-
- /* Draw the rectangle */
-
- mp_msg(MSGT_VFILTER,MSGL_INFO, "rectangle: -vf rectangle=%d:%d:%d:%d \n", vf->priv->w, vf->priv->h, vf->priv->x, vf->priv->y);
-
- x = FFMIN(vf->priv->x, dmpi->width);
- x = FFMAX(x, 0);
-
- w = vf->priv->x + vf->priv->w - 1 - x;
- w = FFMIN(w, dmpi->width - x);
- w = FFMAX(w, 0);
-
- y = FFMIN(vf->priv->y, dmpi->height);
- y = FFMAX(y, 0);
-
- h = vf->priv->y + vf->priv->h - 1 - y;
- h = FFMIN(h, dmpi->height - y);
- h = FFMAX(h, 0);
-
- if (0 <= vf->priv->y && vf->priv->y <= dmpi->height) {
- unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp;
- unsigned int count = w * bpp;
- while (count--)
- p[count] = 0xff - p[count];
- }
- if (h != 1 && vf->priv->y + vf->priv->h - 1 <= mpi->height) {
- unsigned char *p = dmpi->planes[0] + (vf->priv->y + vf->priv->h - 1) * dmpi->stride[0] + x * bpp;
- unsigned int count = w * bpp;
- while (count--)
- p[count] = 0xff - p[count];
- }
- if (0 <= vf->priv->x && vf->priv->x <= dmpi->width) {
- unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp;
- unsigned int count = h;
- while (count--) {
- unsigned int i = bpp;
- while (i--)
- p[i] = 0xff - p[i];
- p += dmpi->stride[0];
- }
- }
- if (w != 1 && vf->priv->x + vf->priv->w - 1 <= mpi->width) {
- unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + (vf->priv->x + vf->priv->w - 1) * bpp;
- unsigned int count = h;
- while (count--) {
- unsigned int i = bpp;
- while (i--)
- p[i] = 0xff - p[i];
- p += dmpi->stride[0];
- }
- }
- return vf_next_put_image(vf, dmpi, pts);
-}
-
-static int
-vf_open(vf_instance_t *vf, char *args) {
- vf->config = config;
- vf->control = control;
- vf->put_image = put_image;
- vf->priv = malloc(sizeof(struct vf_priv_s));
- vf->priv->x = -1;
- vf->priv->y = -1;
- vf->priv->w = -1;
- vf->priv->h = -1;
- if (args)
- sscanf(args, "%d:%d:%d:%d",
- &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y);
- return 1;
-}
-
-const vf_info_t vf_info_rectangle = {
- "draw rectangle",
- "rectangle",
- "Kim Minh Kaplan",
- "",
- vf_open,
- NULL
-};
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 19bf4b5c74..d18944f0d6 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 21
-#define LIBAVFILTER_VERSION_MICRO 104
+#define LIBAVFILTER_VERSION_MICRO 105
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_mp.c b/libavfilter/vf_mp.c
index 146041b7dd..fddba3b2a2 100644
--- a/libavfilter/vf_mp.c
+++ b/libavfilter/vf_mp.c
@@ -163,7 +163,6 @@ extern const vf_info_t vf_info_pp7;
extern const vf_info_t vf_info_pp;
extern const vf_info_t vf_info_pullup;
extern const vf_info_t vf_info_qp;
-extern const vf_info_t vf_info_rectangle;
extern const vf_info_t vf_info_sab;
extern const vf_info_t vf_info_scale;
extern const vf_info_t vf_info_softpulldown;
@@ -211,7 +210,6 @@ static const vf_info_t* const filters[]={
&vf_info_pp7,
&vf_info_pullup,
&vf_info_qp,
- &vf_info_rectangle,
&vf_info_sab,
&vf_info_softpulldown,
&vf_info_softskip,