1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../mplayer/vf-crop-relative.patch
5 # Copyright (C) 2006 - 2010 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 It got on my nerves for some time that I have to compute the resulting width and
18 height manually all the itme - a task screaming for a computer. Also just
19 cutting off the overscan noise usually on DVB broadcasts requires multiple
20 parameter sets depending on the actual broadcast format (e.g. classic 4:3
21 vs. a real (black border-less) 16:9) transmission).
23 Allow relative cuts using negative values, e.g. crop="20:82:-20:-82".
25 - Rene Rebe <rene@exactcode.de>
27 --- MPlayer-1.0pre7try2/libmpcodecs/vf_crop.c 2003-05-20 19:42:33.000000000 +0200
28 +++ MPlayer-1.0pre7try2-fixed/libmpcodecs/vf_crop.c 2006-02-13 13:35:19.927524500 +0100
30 static int config(struct vf_instance_s* vf,
31 int width, int height, int d_width, int d_height,
32 unsigned int flags, unsigned int outfmt){
33 + if (vf->priv->crop_w < 0)
34 + vf->priv->crop_w = width + vf->priv->crop_w;
35 + if (vf->priv->crop_h < 0)
36 + vf->priv->crop_h = height + vf->priv->crop_h;
37 // calculate the missing parameters:
38 - if(vf->priv->crop_w<=0 || vf->priv->crop_w>width) vf->priv->crop_w=width;
39 - if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height;
40 + if(vf->priv->crop_w>width) vf->priv->crop_w=width;
41 + if(vf->priv->crop_h>height) vf->priv->crop_h=height;
42 if(vf->priv->crop_x<0) vf->priv->crop_x=(width-vf->priv->crop_w)/2;
43 if(vf->priv->crop_y<0) vf->priv->crop_y=(height-vf->priv->crop_h)/2;
46 vf->start_slice=start_slice;
47 vf->draw_slice=draw_slice;
48 vf->default_reqs=VFCAP_ACCEPT_STRIDE;
49 - mp_msg(MSGT_VFILTER, MSGL_INFO, "Crop: %d x %d, %d ; %d\n",
50 + mp_msg(MSGT_VFILTER, MSGL_INFO, "Crop: %d x %d @%d,%d\n",
56 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
57 static const m_option_t vf_opts_fields[] = {
58 - {"w", ST_OFF(crop_w), CONF_TYPE_INT, M_OPT_MIN,0 ,0, NULL},
59 - {"h", ST_OFF(crop_h), CONF_TYPE_INT, M_OPT_MIN,0 ,0, NULL},
60 - {"x", ST_OFF(crop_x), CONF_TYPE_INT, M_OPT_MIN,-1 ,0, NULL},
61 - {"y", ST_OFF(crop_y), CONF_TYPE_INT, M_OPT_MIN,-1 ,0, NULL},
62 + {"w", ST_OFF(crop_w), CONF_TYPE_INT, 0, 0, 0, NULL},
63 + {"h", ST_OFF(crop_h), CONF_TYPE_INT, 0, 0, 0, NULL},
64 + {"x", ST_OFF(crop_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
65 + {"y", ST_OFF(crop_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
66 { NULL, NULL, 0, 0, 0, 0, NULL }