Mercurial > mplayer.hg
annotate libmpcodecs/vf_crop.c @ 22299:073bd05d00a6
Remove useless fflush(stdout) calls. mp_msg already flushes output, and
there is no other output before the calls.
author | uau |
---|---|
date | Thu, 22 Feb 2007 23:44:43 +0000 |
parents | 0b262e00bc99 |
children | c2b7ba444ade |
rev | line source |
---|---|
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
1 #include <stdio.h> |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
2 #include <stdlib.h> |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
3 #include <string.h> |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
4 |
17012 | 5 #include "config.h" |
6 #include "mp_msg.h" | |
18004
bcd805923554
Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents:
17906
diff
changeset
|
7 #include "help_mp.h" |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
8 |
8802 | 9 #include "img_format.h" |
5607 | 10 #include "mp_image.h" |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
11 #include "vf.h" |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
12 |
9599 | 13 #include "m_option.h" |
14 #include "m_struct.h" | |
15 | |
16 static struct vf_priv_s { | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
17 int crop_w,crop_h; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
18 int crop_x,crop_y; |
22027 | 19 } const vf_priv_dflt = { |
9599 | 20 -1,-1, |
21 -1,-1 | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
22 }; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
23 |
6060 | 24 extern int opt_screen_size_x; |
25 extern int opt_screen_size_y; | |
26 | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
27 //===========================================================================// |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
28 |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
29 static int config(struct vf_instance_s* vf, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
30 int width, int height, int d_width, int d_height, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
31 unsigned int flags, unsigned int outfmt){ |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
32 // calculate the missing parameters: |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
33 if(vf->priv->crop_w<=0 || vf->priv->crop_w>width) vf->priv->crop_w=width; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
34 if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
35 if(vf->priv->crop_x<0) vf->priv->crop_x=(width-vf->priv->crop_w)/2; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
36 if(vf->priv->crop_y<0) vf->priv->crop_y=(height-vf->priv->crop_h)/2; |
8801
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
37 // rounding: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
38 if(!IMGFMT_IS_RGB(outfmt) && !IMGFMT_IS_BGR(outfmt)){ |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
39 switch(outfmt){ |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
40 case IMGFMT_444P: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
41 case IMGFMT_Y800: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
42 case IMGFMT_Y8: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
43 break; |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
44 case IMGFMT_YVU9: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
45 case IMGFMT_IF09: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
46 vf->priv->crop_y&=~3; |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
47 case IMGFMT_411P: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
48 vf->priv->crop_x&=~3; |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
49 break; |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
50 case IMGFMT_YV12: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
51 case IMGFMT_I420: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
52 case IMGFMT_IYUV: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
53 vf->priv->crop_y&=~1; |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
54 default: |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
55 vf->priv->crop_x&=~1; |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
56 } |
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
57 } |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
58 // check: |
6060 | 59 if(vf->priv->crop_w+vf->priv->crop_x>width || |
60 vf->priv->crop_h+vf->priv->crop_y>height){ | |
18004
bcd805923554
Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents:
17906
diff
changeset
|
61 mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_CropBadPositionWidthHeight); |
6060 | 62 return 0; |
63 } | |
64 if(!opt_screen_size_x && !opt_screen_size_y){ | |
65 d_width=d_width*vf->priv->crop_w/width; | |
66 d_height=d_height*vf->priv->crop_h/height; | |
67 } | |
68 return vf_next_config(vf,vf->priv->crop_w,vf->priv->crop_h,d_width,d_height,flags,outfmt); | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
69 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
70 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
71 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ |
10008
89cb47cb1fc4
at least 100l for me, the last commit was nonsense
rfelker
parents:
10007
diff
changeset
|
72 mp_image_t *dmpi; |
89cb47cb1fc4
at least 100l for me, the last commit was nonsense
rfelker
parents:
10007
diff
changeset
|
73 if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
74 return vf_next_put_image(vf,vf->dmpi, pts); |
10008
89cb47cb1fc4
at least 100l for me, the last commit was nonsense
rfelker
parents:
10007
diff
changeset
|
75 dmpi=vf_get_image(vf->next,mpi->imgfmt, |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
76 MP_IMGTYPE_EXPORT, 0, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
77 vf->priv->crop_w, vf->priv->crop_h); |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
78 if(mpi->flags&MP_IMGFLAG_PLANAR){ |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
79 dmpi->planes[0]=mpi->planes[0]+ |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
80 vf->priv->crop_y*mpi->stride[0]+vf->priv->crop_x; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
81 dmpi->planes[1]=mpi->planes[1]+ |
8801
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
82 (vf->priv->crop_y>>mpi->chroma_y_shift)*mpi->stride[1]+(vf->priv->crop_x>>mpi->chroma_x_shift); |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
83 dmpi->planes[2]=mpi->planes[2]+ |
8801
db98910fea8f
- added x/y rounding for YUV formats (should be moved to mp_image.c|h later)
arpi
parents:
7368
diff
changeset
|
84 (vf->priv->crop_y>>mpi->chroma_y_shift)*mpi->stride[2]+(vf->priv->crop_x>>mpi->chroma_x_shift); |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
85 dmpi->stride[1]=mpi->stride[1]; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
86 dmpi->stride[2]=mpi->stride[2]; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
87 } else { |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
88 dmpi->planes[0]=mpi->planes[0]+ |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
89 vf->priv->crop_y*mpi->stride[0]+ |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
90 vf->priv->crop_x*(mpi->bpp/8); |
9279 | 91 dmpi->planes[1]=mpi->planes[1]; // passthrough rgb8 palette |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
92 } |
5614 | 93 dmpi->stride[0]=mpi->stride[0]; |
94 dmpi->width=mpi->width; | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
95 return vf_next_put_image(vf,dmpi, pts); |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
96 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
97 |
10007
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
98 static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){ |
10140
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
99 vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags, |
10007
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
100 vf->priv->crop_w, vf->priv->crop_h); |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
101 } |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
102 |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
103 static void draw_slice(struct vf_instance_s* vf, |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
104 unsigned char** src, int* stride, int w,int h, int x, int y){ |
10008
89cb47cb1fc4
at least 100l for me, the last commit was nonsense
rfelker
parents:
10007
diff
changeset
|
105 unsigned char *src2[3]; |
10027 | 106 src2[0] = src[0]; |
10140
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
107 if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) { |
10027 | 108 src2[1] = src[1]; |
109 src2[2] = src[2]; | |
10008
89cb47cb1fc4
at least 100l for me, the last commit was nonsense
rfelker
parents:
10007
diff
changeset
|
110 } |
10007
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
111 //mp_msg(MSGT_VFILTER, MSGL_V, "crop slice %d %d %d %d ->", w,h,x,y); |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
112 if ((x -= vf->priv->crop_x) < 0) { |
10027 | 113 x = -x; |
114 src2[0] += x; | |
10140
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
115 if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) { |
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
116 src2[1] += x>>vf->dmpi->chroma_x_shift; |
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
117 src2[2] += x>>vf->dmpi->chroma_x_shift; |
10027 | 118 } |
119 w -= x; | |
10007
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
120 x = 0; |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
121 } |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
122 if ((y -= vf->priv->crop_y) < 0) { |
10027 | 123 y = -y; |
124 src2[0] += y*stride[0]; | |
10140
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
125 if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) { |
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
126 src2[1] += (y>>vf->dmpi->chroma_y_shift)*stride[1]; |
30cad6ad9dbc
fix segfaults with slices. support slice rendering into a filter even
rfelker
parents:
10027
diff
changeset
|
127 src2[2] += (y>>vf->dmpi->chroma_y_shift)*stride[2]; |
10027 | 128 } |
129 h -= y; | |
10007
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
130 y = 0; |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
131 } |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
132 if (x+w > vf->priv->crop_w) w = vf->priv->crop_w-x; |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
133 if (y+h > vf->priv->crop_h) h = vf->priv->crop_h-y; |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
134 //mp_msg(MSGT_VFILTER, MSGL_V, "%d %d %d %d\n", w,h,x,y); |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
135 if ((w < 0) || (h < 0)) return; |
10008
89cb47cb1fc4
at least 100l for me, the last commit was nonsense
rfelker
parents:
10007
diff
changeset
|
136 vf_next_draw_slice(vf,src2,stride,w,h,x,y); |
10007
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
137 } |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
138 |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
139 //===========================================================================// |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
140 |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
141 static int open(vf_instance_t *vf, char* args){ |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
142 vf->config=config; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
143 vf->put_image=put_image; |
10007
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
144 vf->start_slice=start_slice; |
b2d257e35577
slices support for vf_crop. now cropping black borders should make a
rfelker
parents:
9602
diff
changeset
|
145 vf->draw_slice=draw_slice; |
5565
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5507
diff
changeset
|
146 vf->default_reqs=VFCAP_ACCEPT_STRIDE; |
9599 | 147 if(!vf->priv) { |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
148 vf->priv=malloc(sizeof(struct vf_priv_s)); |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
149 // TODO: parse args -> |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
150 vf->priv->crop_x= |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
151 vf->priv->crop_y= |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
152 vf->priv->crop_w= |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
153 vf->priv->crop_h=-1; |
9599 | 154 } //if(!vf->priv) |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
155 if(args) sscanf(args, "%d:%d:%d:%d", |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
156 &vf->priv->crop_w, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
157 &vf->priv->crop_h, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
158 &vf->priv->crop_x, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
159 &vf->priv->crop_y); |
8869
9df3c03b2ffe
use mp_msg for messages. prolly more filters need to be fixed like this too
rfelker
parents:
8802
diff
changeset
|
160 mp_msg(MSGT_VFILTER, MSGL_INFO, "Crop: %d x %d, %d ; %d\n", |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
161 vf->priv->crop_w, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
162 vf->priv->crop_h, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
163 vf->priv->crop_x, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
164 vf->priv->crop_y); |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
165 return 1; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
166 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
167 |
9599 | 168 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) |
169 static m_option_t vf_opts_fields[] = { | |
9602 | 170 {"w", ST_OFF(crop_w), CONF_TYPE_INT, M_OPT_MIN,0 ,0, NULL}, |
171 {"h", ST_OFF(crop_h), CONF_TYPE_INT, M_OPT_MIN,0 ,0, NULL}, | |
172 {"x", ST_OFF(crop_x), CONF_TYPE_INT, M_OPT_MIN,-1 ,0, NULL}, | |
173 {"y", ST_OFF(crop_y), CONF_TYPE_INT, M_OPT_MIN,-1 ,0, NULL}, | |
9599 | 174 { NULL, NULL, 0, 0, 0, 0, NULL } |
175 }; | |
176 | |
177 static m_struct_t vf_opts = { | |
178 "crop", | |
179 sizeof(struct vf_priv_s), | |
180 &vf_priv_dflt, | |
181 vf_opts_fields | |
182 }; | |
183 | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
184 vf_info_t vf_info_crop = { |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
185 "cropping", |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
186 "crop", |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
187 "A'rpi", |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
188 "", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9279
diff
changeset
|
189 open, |
9599 | 190 &vf_opts |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
191 }; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
192 |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
193 //===========================================================================// |