From 416c03417ebd7538882ee586bb049a25e202a7e6 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 11 Sep 2012 11:58:28 +0200 Subject: vf_rectangle: remove as it is very dirty and we have a replacement now --- DOCS/OUTDATED-tech/libmpcodecs.txt | 1 - Makefile | 1 - command.c | 6 -- input/input.c | 1 - input/input.h | 1 - libmpcodecs/dec_video.c | 14 --- libmpcodecs/dec_video.h | 1 - libmpcodecs/vf.c | 2 - libmpcodecs/vf.h | 1 - libmpcodecs/vf_rectangle.c | 181 ------------------------------------- 10 files changed, 209 deletions(-) delete mode 100644 libmpcodecs/vf_rectangle.c diff --git a/DOCS/OUTDATED-tech/libmpcodecs.txt b/DOCS/OUTDATED-tech/libmpcodecs.txt index b79df93d78..9b627ced50 100644 --- a/DOCS/OUTDATED-tech/libmpcodecs.txt +++ b/DOCS/OUTDATED-tech/libmpcodecs.txt @@ -340,7 +340,6 @@ You can control the filter at runtime from MPlayer/MEncoder/dec_video: #define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ #define VFCTRL_GET_EQUALIZER 8 /* get color options (brightness,contrast etc) */ #define VFCTRL_DRAW_OSD 7 -#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */ void (*get_image)(struct vf_instance *vf, mp_image_t *mpi); diff --git a/Makefile b/Makefile index 879d496964..4ec75eda73 100644 --- a/Makefile +++ b/Makefile @@ -201,7 +201,6 @@ SRCS_COMMON = asxparser.c \ libmpcodecs/vf_pp7.c \ libmpcodecs/vf_pullup.c \ libmpcodecs/vf_qp.c \ - libmpcodecs/vf_rectangle.c \ libmpcodecs/vf_remove_logo.c \ libmpcodecs/vf_rgbtest.c \ libmpcodecs/vf_rotate.c \ diff --git a/command.c b/command.c index 8a7f17dfba..1cffedfd13 100644 --- a/command.c +++ b/command.c @@ -2687,12 +2687,6 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) screenshot_request(mpctx, cmd->args[0].v.i, cmd->args[1].v.i); break; - case MP_CMD_VF_CHANGE_RECTANGLE: - if (!sh_video) - break; - set_rectangle(sh_video, cmd->args[0].v.i, cmd->args[1].v.i); - break; - case MP_CMD_GET_TIME_LENGTH: mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_LENGTH=%.2f\n", get_time_length(mpctx)); diff --git a/input/input.c b/input/input.c index d1136532ed..7f9021e35b 100644 --- a/input/input.c +++ b/input/input.c @@ -189,7 +189,6 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_LOADLIST, "loadlist", { ARG_STRING, OARG_INT(0) } }, { MP_CMD_PLAYLIST_CLEAR, "playlist_clear", }, { MP_CMD_RUN, "run", { ARG_STRING } }, - { MP_CMD_VF_CHANGE_RECTANGLE, "change_rectangle", { ARG_INT, ARG_INT } }, { MP_CMD_GET_VO_FULLSCREEN, "get_vo_fullscreen", }, { MP_CMD_GET_SUB_VISIBILITY, "get_sub_visibility", }, diff --git a/input/input.h b/input/input.h index a055b59138..ddd9016203 100644 --- a/input/input.h +++ b/input/input.h @@ -50,7 +50,6 @@ enum mp_command_type { MP_CMD_LOADFILE, MP_CMD_LOADLIST, MP_CMD_PLAYLIST_CLEAR, - MP_CMD_VF_CHANGE_RECTANGLE, MP_CMD_GAMMA, MP_CMD_SUB_VISIBILITY, MP_CMD_VOBSUB_LANG, // deprecated: combined with SUB_SELECT diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index e328f3e948..e5dcf690c6 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -170,20 +170,6 @@ void set_video_colorspace(struct sh_video *sh) } -int set_rectangle(sh_video_t *sh_video, int param, int value) -{ - vf_instance_t *vf = sh_video->vfilter; - int data[] = { param, value }; - - mp_dbg(MSGT_DECVIDEO, MSGL_V, "set rectangle \n"); - if (vf) { - int ret = vf->control(vf, VFCTRL_CHANGE_RECTANGLE, data); - if (ret) - return 1; - } - return 0; -} - void resync_video_stream(sh_video_t *sh_video) { const struct vd_functions *vd = sh_video->vd_driver; diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h index 878744396c..f871198988 100644 --- a/libmpcodecs/dec_video.h +++ b/libmpcodecs/dec_video.h @@ -42,7 +42,6 @@ int set_video_colors(sh_video_t *sh_video, const char *item, int value); struct mp_csp_details; void get_detected_video_colorspace(struct sh_video *sh, struct mp_csp_details *csp); void set_video_colorspace(struct sh_video *sh); -int set_rectangle(sh_video_t *sh_video, int param, int value); void resync_video_stream(sh_video_t *sh_video); void video_reset_aspect(struct sh_video *sh_video); int get_current_video_decoder_lag(sh_video_t *sh_video); diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 4dc4da1835..f847dd69b8 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -38,7 +38,6 @@ #include "libvo/fastmemcpy.h" extern const vf_info_t vf_info_vo; -extern const vf_info_t vf_info_rectangle; extern const vf_info_t vf_info_bmovl; extern const vf_info_t vf_info_crop; extern const vf_info_t vf_info_expand; @@ -118,7 +117,6 @@ extern const vf_info_t vf_info_dlopen; // list of available filters: static const vf_info_t *const filter_list[] = { - &vf_info_rectangle, #ifdef HAVE_POSIX_SELECT &vf_info_bmovl, #endif diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h index d97e363778..ec8144b22f 100644 --- a/libmpcodecs/vf.h +++ b/libmpcodecs/vf.h @@ -100,7 +100,6 @@ struct vf_ctrl_screenshot { #define VFCTRL_SET_EQUALIZER 6 // set color options (brightness,contrast etc) #define VFCTRL_GET_EQUALIZER 8 // get color options (brightness,contrast etc) #define VFCTRL_DRAW_OSD 7 -#define VFCTRL_CHANGE_RECTANGLE 9 // vf_rectangle control #define VFCTRL_DUPLICATE_FRAME 11 // For encoding - encode zero-change frame #define VFCTRL_SKIP_NEXT_FRAME 12 // For encoding - drop the next frame that passes thru #define VFCTRL_FLUSH_FRAMES 13 // For encoding - flush delayed frames diff --git a/libmpcodecs/vf_rectangle.c b/libmpcodecs/vf_rectangle.c deleted file mode 100644 index c303fc1aba..0000000000 --- a/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 -#include -#include -#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 -}; -- cgit v1.2.3