annotate libmpcodecs/vf_expand.c @ 29507:fc8416cffdcd

Use a buffer of about half a second, instead of sizing it to have a constant number of frames. This improves the behaviour at very small or large sample rates, and gets rid of lots of obsolete code.
author cladisch
date Mon, 24 Aug 2009 07:32:25 +0000
parents d401b1eefcad
children b73705bd899f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
1 #define OSD_SUPPORT
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
2
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
3 #include <stdio.h>
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
4 #include <stdlib.h>
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
5 #include <string.h>
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
6
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16837
diff changeset
7 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16837
diff changeset
8 #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
9 #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
10
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
11 #include "img_format.h"
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5530
diff changeset
12 #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
13 #include "vf.h"
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
14
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16837
diff changeset
15 #include "libvo/fastmemcpy.h"
29437
d401b1eefcad Replace macro: MAX -> FFMAX
ben
parents: 29263
diff changeset
16 #include "libavutil/avutil.h"
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
17
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
18 #ifdef OSD_SUPPORT
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16837
diff changeset
19 #include "libvo/sub.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16837
diff changeset
20 #include "libvo/osd.h"
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
21 #endif
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
22
9594
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
23 #include "m_option.h"
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
24 #include "m_struct.h"
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
25
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
26 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
27 int exp_w,exp_h;
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
28 int exp_x,exp_y;
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
29 int osd;
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
30 double aspect;
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
31 int round;
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
32 unsigned char* fb_ptr;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
33 int passthrough;
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
34 int first_slice;
22027
0b262e00bc99 Mark m_struct_t defaults as const
reimar
parents: 21803
diff changeset
35 } const vf_priv_dflt = {
9594
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
36 -1,-1,
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
37 -1,-1,
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
38 0,
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
39 0.,
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
40 1,
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
41 NULL,
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
42 0,
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
43 0
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
44 };
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
45
6060
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
46 extern int opt_screen_size_x;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
47 extern int opt_screen_size_y;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
48
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
49 //===========================================================================//
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
50 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
51
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
52 static struct vf_instance_s* vf=NULL; // fixme (needs sub.c changes)
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
53 static int orig_w,orig_h;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
54
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
55 static void remove_func_2(int x0,int y0, int w,int h){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
56 // TODO: let's cleanup the place
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
57 //printf("OSD clear: %d;%d %dx%d \n",x0,y0,w,h);
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
58 vf_mpi_clear(vf->dmpi,x0,y0,w,h);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
59 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
60
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
61 static void remove_func(int x0,int y0, int w,int h){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
62 if(!vo_osd_changed_flag) return;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
63 // split it to 4 parts:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
64 if(y0<vf->priv->exp_y){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
65 // it has parts above the image:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
66 int y=y0+h;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
67 if(y>vf->priv->exp_y) y=vf->priv->exp_y;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
68 remove_func_2(x0,y0,w,y-y0);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
69 if(y0+h<=vf->priv->exp_y) return;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
70 h-=y-y0;y0=y;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
71 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
72 if(y0+h>vf->priv->exp_y+orig_h){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
73 // it has parts under the image:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
74 int y=y0;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
75 if(y<vf->priv->exp_y+orig_h) y=vf->priv->exp_y+orig_h;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
76 remove_func_2(x0,y,w,y0+h-y);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
77 if(y0>=vf->priv->exp_y+orig_h) return;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
78 h=y-y0;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
79 }
24243
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
80 if(x0<vf->priv->exp_x){
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
81 // it has parts on the left side of the image:
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
82 int x=x0+w;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
83 if(x>vf->priv->exp_x) x=vf->priv->exp_x;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
84 remove_func_2(x0,y0,x-x0,h);
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
85 if(x0+w<=vf->priv->exp_x) return;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
86 w-=x-x0;x0=x;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
87 }
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
88 if(x0+w>vf->priv->exp_x+orig_w){
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
89 // it has parts on the right side of the image:
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
90 int x=x0;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
91 if(x<vf->priv->exp_x+orig_w) x=vf->priv->exp_x+orig_w;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
92 remove_func_2(x,y0,x0+w-x,h);
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
93 if(x0>=vf->priv->exp_x+orig_w) return;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
94 w=x-x0;
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
95 }
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
96 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
97
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
98 static void draw_func(int x0,int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride){
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
99 unsigned char* dst;
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
100 if(!vo_osd_changed_flag && vf->dmpi->planes[0]==vf->priv->fb_ptr){
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
101 // ok, enough to update the area inside the video, leave the black bands
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
102 // untouched!
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
103 if(x0<vf->priv->exp_x){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
104 int tmp=vf->priv->exp_x-x0;
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
105 w-=tmp; src+=tmp; srca+=tmp; x0+=tmp;
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
106 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
107 if(y0<vf->priv->exp_y){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
108 int tmp=vf->priv->exp_y-y0;
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
109 h-=tmp; src+=tmp*stride; srca+=tmp*stride; y0+=tmp;
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
110 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
111 if(x0+w>vf->priv->exp_x+orig_w){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
112 w=vf->priv->exp_x+orig_w-x0;
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
113 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
114 if(y0+h>vf->priv->exp_y+orig_h){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
115 h=vf->priv->exp_y+orig_h-y0;
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
116 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
117 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
118 if(w<=0 || h<=0) return; // nothing to do...
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
119 // printf("OSD redraw: %d;%d %dx%d \n",x0,y0,w,h);
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
120 dst=vf->dmpi->planes[0]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
121 vf->dmpi->stride[0]*y0+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
122 (vf->dmpi->bpp>>3)*x0;
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
123 switch(vf->dmpi->imgfmt){
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
124 case IMGFMT_BGR15:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
125 case IMGFMT_RGB15:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
126 vo_draw_alpha_rgb15(w,h,src,srca,stride,dst,vf->dmpi->stride[0]);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
127 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
128 case IMGFMT_BGR16:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
129 case IMGFMT_RGB16:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
130 vo_draw_alpha_rgb16(w,h,src,srca,stride,dst,vf->dmpi->stride[0]);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
131 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
132 case IMGFMT_BGR24:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
133 case IMGFMT_RGB24:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
134 vo_draw_alpha_rgb24(w,h,src,srca,stride,dst,vf->dmpi->stride[0]);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
135 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
136 case IMGFMT_BGR32:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
137 case IMGFMT_RGB32:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
138 vo_draw_alpha_rgb32(w,h,src,srca,stride,dst,vf->dmpi->stride[0]);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
139 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
140 case IMGFMT_YV12:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
141 case IMGFMT_I420:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
142 case IMGFMT_IYUV:
6537
ae203145245e yv12 osd drawer is working for y8/y800/yvu9/if09 becouse it uses only Y-plane and Y-plane is the same for all these formats
alex
parents: 6525
diff changeset
143 case IMGFMT_YVU9:
ae203145245e yv12 osd drawer is working for y8/y800/yvu9/if09 becouse it uses only Y-plane and Y-plane is the same for all these formats
alex
parents: 6525
diff changeset
144 case IMGFMT_IF09:
ae203145245e yv12 osd drawer is working for y8/y800/yvu9/if09 becouse it uses only Y-plane and Y-plane is the same for all these formats
alex
parents: 6525
diff changeset
145 case IMGFMT_Y800:
ae203145245e yv12 osd drawer is working for y8/y800/yvu9/if09 becouse it uses only Y-plane and Y-plane is the same for all these formats
alex
parents: 6525
diff changeset
146 case IMGFMT_Y8:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
147 vo_draw_alpha_yv12(w,h,src,srca,stride,dst,vf->dmpi->stride[0]);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
148 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
149 case IMGFMT_YUY2:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
150 vo_draw_alpha_yuy2(w,h,src,srca,stride,dst,vf->dmpi->stride[0]);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
151 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
152 case IMGFMT_UYVY:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
153 vo_draw_alpha_yuy2(w,h,src,srca,stride,dst+1,vf->dmpi->stride[0]);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
154 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
155 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
156 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
157
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
158 static void draw_osd(struct vf_instance_s* vf_,int w,int h){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
159 vf=vf_;orig_w=w;orig_h=h;
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
160 // printf("======================================\n");
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
161 if(vf->priv->exp_w!=w || vf->priv->exp_h!=h ||
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
162 vf->priv->exp_x || vf->priv->exp_y){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
163 // yep, we're expanding image, not just copy.
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
164 if(vf->dmpi->planes[0]!=vf->priv->fb_ptr){
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
165 // double buffering, so we need full clear :(
15099
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
166 if (vf->priv->exp_y > 0)
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
167 remove_func_2(0,0,vf->priv->exp_w,vf->priv->exp_y);
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
168 if (vf->priv->exp_y+h < vf->priv->exp_h)
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
169 remove_func_2(0,vf->priv->exp_y+h,vf->priv->exp_w,vf->priv->exp_h-h-vf->priv->exp_y);
24243
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
170 if (vf->priv->exp_x > 0)
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
171 remove_func_2(0,vf->priv->exp_y,vf->priv->exp_x,h);
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
172 if (vf->priv->exp_x+w < vf->priv->exp_w)
aeffa880c7d6 Add code to clear left and right borders not only top and bottom.
reimar
parents: 22027
diff changeset
173 remove_func_2(vf->priv->exp_x+w,vf->priv->exp_y,vf->priv->exp_w-w-vf->priv->exp_x,h);
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
174 } else {
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
175 // partial clear:
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
176 vo_remove_text(vf->priv->exp_w,vf->priv->exp_h,remove_func);
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
177 }
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
178 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
179 vo_draw_text(vf->priv->exp_w,vf->priv->exp_h,draw_func);
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
180 // save buffer pointer for double buffering detection - yes, i know it's
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
181 // ugly method, but note that codecs with DR support does the same...
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
182 if(vf->dmpi)
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
183 vf->priv->fb_ptr=vf->dmpi->planes[0];
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
184 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
185
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
186 #endif
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
187 //===========================================================================//
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
188
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
189 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
190 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
191 unsigned int flags, unsigned int outfmt){
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
192 if(outfmt == IMGFMT_MPEGPES) {
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
193 vf->priv->passthrough = 1;
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
194 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
195 }
6525
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
196 if (outfmt == IMGFMT_IF09) return 0;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
197 // calculate the missing parameters:
5921
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
198 #if 0
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
199 if(vf->priv->exp_w<width) vf->priv->exp_w=width;
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
200 if(vf->priv->exp_h<height) vf->priv->exp_h=height;
5921
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
201 #else
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
202 if ( vf->priv->exp_w == -1 ) vf->priv->exp_w=width;
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
203 else if (vf->priv->exp_w < -1 ) vf->priv->exp_w=width - vf->priv->exp_w;
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
204 else if ( vf->priv->exp_w<width ) vf->priv->exp_w=width;
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
205 if ( vf->priv->exp_h == -1 ) vf->priv->exp_h=height;
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
206 else if ( vf->priv->exp_h < -1 ) vf->priv->exp_h=height - vf->priv->exp_h;
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
207 else if( vf->priv->exp_h<height ) vf->priv->exp_h=height;
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
208 #endif
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
209 if (vf->priv->aspect) {
20561
b7ed249cbc6e Do not modify parsed command-line values on config,
reimar
parents: 18321
diff changeset
210 float adjusted_aspect = vf->priv->aspect;
b7ed249cbc6e Do not modify parsed command-line values on config,
reimar
parents: 18321
diff changeset
211 adjusted_aspect *= ((double)width/height) / ((double)d_width/d_height);
b7ed249cbc6e Do not modify parsed command-line values on config,
reimar
parents: 18321
diff changeset
212 if (vf->priv->exp_h < vf->priv->exp_w / adjusted_aspect) {
b7ed249cbc6e Do not modify parsed command-line values on config,
reimar
parents: 18321
diff changeset
213 vf->priv->exp_h = vf->priv->exp_w / adjusted_aspect + 0.5;
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
214 } else {
20561
b7ed249cbc6e Do not modify parsed command-line values on config,
reimar
parents: 18321
diff changeset
215 vf->priv->exp_w = vf->priv->exp_h * adjusted_aspect + 0.5;
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
216 }
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
217 }
15941
0e449f0367a4 cosmetics.
ods15
parents: 15939
diff changeset
218 if (vf->priv->round > 1) { // round up.
0e449f0367a4 cosmetics.
ods15
parents: 15939
diff changeset
219 vf->priv->exp_w = (1 + (vf->priv->exp_w - 1) / vf->priv->round) * vf->priv->round;
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
220 vf->priv->exp_h = (1 + (vf->priv->exp_h - 1) / vf->priv->round) * vf->priv->round;
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
221 }
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
222
5687
f19dff1456ed don't allow invalid parameters
arpi
parents: 5671
diff changeset
223 if(vf->priv->exp_x<0 || vf->priv->exp_x+width>vf->priv->exp_w) vf->priv->exp_x=(vf->priv->exp_w-width)/2;
f19dff1456ed don't allow invalid parameters
arpi
parents: 5671
diff changeset
224 if(vf->priv->exp_y<0 || vf->priv->exp_y+height>vf->priv->exp_h) vf->priv->exp_y=(vf->priv->exp_h-height)/2;
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
225 vf->priv->fb_ptr=NULL;
6060
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
226
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
227 if(!opt_screen_size_x && !opt_screen_size_y){
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
228 d_width=d_width*vf->priv->exp_w/width;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
229 d_height=d_height*vf->priv->exp_h/height;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
230 }
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
231 return vf_next_config(vf,vf->priv->exp_w,vf->priv->exp_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
232 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
233
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
234 // there are 4 cases:
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
235 // codec --DR--> expand --DR--> vo
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
236 // codec --DR--> expand -copy-> vo
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
237 // codec -copy-> expand --DR--> vo
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
238 // codec -copy-> expand -copy-> vo (worst case)
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
239
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
240 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
6761
cb1180ccac76 DR1+IPB support (works only with ffmpeg12, as libmpeg2 doesn't accept stride)
arpi
parents: 6539
diff changeset
241 // if(mpi->type==MP_IMGTYPE_IPB) return; // not yet working
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
242 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
243 if(vf->priv->osd && (mpi->flags&MP_IMGFLAG_PRESERVE)){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
244 // check if we have to render osd!
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
245 vo_update_osd(vf->priv->exp_w, vf->priv->exp_h);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
246 if(vo_osd_check_range_update(vf->priv->exp_x,vf->priv->exp_y,
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
247 vf->priv->exp_x+mpi->w,vf->priv->exp_y+mpi->h)) return;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
248 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
249 #endif
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
250 if(vf->priv->exp_w==mpi->width ||
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
251 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) ){
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
252 // try full DR !
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
253 mpi->priv=vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
254 mpi->type, mpi->flags,
29437
d401b1eefcad Replace macro: MAX -> FFMAX
ben
parents: 29263
diff changeset
255 FFMAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x),
d401b1eefcad Replace macro: MAX -> FFMAX
ben
parents: 29263
diff changeset
256 FFMAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y));
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
257 #if 1
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
258 if((vf->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) &&
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
259 !(vf->dmpi->flags & MP_IMGFLAG_DIRECT)){
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
260 mp_msg(MSGT_VFILTER, MSGL_INFO, MSGTR_MPCODECS_FullDRNotPossible);
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
261 return;
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
262 }
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
263 #endif
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
264 // set up mpi as a cropped-down image of dmpi:
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
265 if(mpi->flags&MP_IMGFLAG_PLANAR){
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
266 mpi->planes[0]=vf->dmpi->planes[0]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
267 vf->priv->exp_y*vf->dmpi->stride[0]+vf->priv->exp_x;
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
268 mpi->planes[1]=vf->dmpi->planes[1]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
269 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->dmpi->stride[1]+(vf->priv->exp_x>>mpi->chroma_x_shift);
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
270 mpi->planes[2]=vf->dmpi->planes[2]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
271 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->dmpi->stride[2]+(vf->priv->exp_x>>mpi->chroma_x_shift);
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
272 mpi->stride[1]=vf->dmpi->stride[1];
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
273 mpi->stride[2]=vf->dmpi->stride[2];
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
274 } else {
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
275 mpi->planes[0]=vf->dmpi->planes[0]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
276 vf->priv->exp_y*vf->dmpi->stride[0]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
277 vf->priv->exp_x*(vf->dmpi->bpp/8);
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
278 }
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
279 mpi->stride[0]=vf->dmpi->stride[0];
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
280 mpi->width=vf->dmpi->width;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
281 mpi->flags|=MP_IMGFLAG_DIRECT;
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
282 mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
283 // vf->dmpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
284 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
285 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
286
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
287 static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
288 // printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
289 if(!vf->next->draw_slice){
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
290 mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
291 return;
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
292 }
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
293 // they want slices!!! allocate the buffer.
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
294 if(!mpi->priv)
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
295 mpi->priv=vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
296 // MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
297 MP_IMGTYPE_TEMP, mpi->flags,
29437
d401b1eefcad Replace macro: MAX -> FFMAX
ben
parents: 29263
diff changeset
298 FFMAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x),
d401b1eefcad Replace macro: MAX -> FFMAX
ben
parents: 29263
diff changeset
299 FFMAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y));
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
300 if(!(vf->dmpi->flags&MP_IMGFLAG_DRAW_CALLBACK))
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
301 mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupportSlices); // shouldn't happen.
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
302 vf->priv->first_slice = 1;
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
303 }
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
304
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
305 static void draw_top_blackbar_slice(struct vf_instance_s* vf,
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
306 unsigned char** src, int* stride, int w,int h, int x, int y){
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
307 if(vf->priv->exp_y>0 && y == 0) {
14074
dc5eaa0795d7 call draw_slice in top-down order (fixes crash with -vf expand=...,scale)
henry
parents: 10311
diff changeset
308 vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
dc5eaa0795d7 call draw_slice in top-down order (fixes crash with -vf expand=...,scale)
henry
parents: 10311
diff changeset
309 vf->dmpi->w,vf->priv->exp_y,0,0);
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
310 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
311
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
312 }
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
313
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
314 static void draw_bottom_blackbar_slice(struct vf_instance_s* vf,
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
315 unsigned char** src, int* stride, int w,int h, int x, int y){
15099
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
316 if(vf->priv->exp_y+vf->h<vf->dmpi->h && y+h == vf->h) {
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
317 unsigned char *src2[MP_MAX_PLANES];
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
318 src2[0] = vf->dmpi->planes[0]
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
319 + (vf->priv->exp_y+vf->h)*vf->dmpi->stride[0];
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
320 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
321 src2[1] = vf->dmpi->planes[1]
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
322 + ((vf->priv->exp_y+vf->h)>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[1];
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
323 src2[2] = vf->dmpi->planes[2]
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
324 + ((vf->priv->exp_y+vf->h)>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[2];
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
325 } else {
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
326 src2[1] = vf->dmpi->planes[1]; // passthrough rgb8 palette
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
327 }
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
328 vf_next_draw_slice(vf, src2, vf->dmpi->stride,
14074
dc5eaa0795d7 call draw_slice in top-down order (fixes crash with -vf expand=...,scale)
henry
parents: 10311
diff changeset
329 vf->dmpi->w,vf->dmpi->h-(vf->priv->exp_y+vf->h),
dc5eaa0795d7 call draw_slice in top-down order (fixes crash with -vf expand=...,scale)
henry
parents: 10311
diff changeset
330 0,vf->priv->exp_y+vf->h);
15099
bfb91d085f22 fix displaying of the subtitles when using slices
henry
parents: 14074
diff changeset
331 }
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
332 }
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
333
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
334 static void draw_slice(struct vf_instance_s* vf,
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
335 unsigned char** src, int* stride, int w,int h, int x, int y){
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
336 // printf("draw_slice() called %d at %d\n",h,y);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
337
15252
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
338 if (y == 0 && y+h == vf->h) {
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
339 // special case - only one slice
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
340 draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
341 vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
342 draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
343 return;
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
344 }
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
345 if (vf->priv->first_slice) {
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
346 draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
347 draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
348 }
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
349 vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
350 if (!vf->priv->first_slice) {
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
351 draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
352 draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
353 }
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
354 vf->priv->first_slice = 0;
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
355 }
b5456142675d - preserve ordering of the slices
henry
parents: 15099
diff changeset
356
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17102
diff changeset
357 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
358 if (vf->priv->passthrough) {
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
359 mp_image_t *dmpi = vf_get_image(vf->next, IMGFMT_MPEGPES,
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
360 MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
361 dmpi->planes[0]=mpi->planes[0];
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
362 return vf_next_put_image(vf,dmpi, pts);
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
363 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
364
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
365 if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
366 vf->dmpi=mpi->priv;
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
367 if(!vf->dmpi) { mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_FunWhydowegetNULL); return 0; }
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
368 mpi->priv=NULL;
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
369 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
370 if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
371 #endif
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7052
diff changeset
372 // we've used DR, so we're ready...
9279
12741a866acd fixed palette support
arpi
parents: 8869
diff changeset
373 if(!(mpi->flags&MP_IMGFLAG_PLANAR))
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
374 vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17102
diff changeset
375 return vf_next_put_image(vf,vf->dmpi, pts);
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
376 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
377
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
378 // hope we'll get DR buffer:
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
379 vf->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
380 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
381 vf->priv->exp_w, vf->priv->exp_h);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
382
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
383 // copy mpi->dmpi...
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
384 if(mpi->flags&MP_IMGFLAG_PLANAR){
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
385 memcpy_pic(vf->dmpi->planes[0]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
386 vf->priv->exp_y*vf->dmpi->stride[0]+vf->priv->exp_x,
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
387 mpi->planes[0], mpi->w, mpi->h,
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
388 vf->dmpi->stride[0],mpi->stride[0]);
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
389 memcpy_pic(vf->dmpi->planes[1]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
390 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->dmpi->stride[1]+(vf->priv->exp_x>>mpi->chroma_x_shift),
18321
22be226a5cf5 fixes a bug when copying the image into a destination buffer smaller than the source.
gpoirier
parents: 18004
diff changeset
391 mpi->planes[1], (mpi->w>>mpi->chroma_x_shift), (mpi->h>>mpi->chroma_y_shift),
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
392 vf->dmpi->stride[1],mpi->stride[1]);
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
393 memcpy_pic(vf->dmpi->planes[2]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
394 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->dmpi->stride[2]+(vf->priv->exp_x>>mpi->chroma_x_shift),
18321
22be226a5cf5 fixes a bug when copying the image into a destination buffer smaller than the source.
gpoirier
parents: 18004
diff changeset
395 mpi->planes[2], (mpi->w>>mpi->chroma_x_shift), (mpi->h>>mpi->chroma_y_shift),
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
396 vf->dmpi->stride[2],mpi->stride[2]);
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
397 } else {
10140
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
398 memcpy_pic(vf->dmpi->planes[0]+
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
399 vf->priv->exp_y*vf->dmpi->stride[0]+vf->priv->exp_x*(vf->dmpi->bpp/8),
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
400 mpi->planes[0], mpi->w*(vf->dmpi->bpp/8), mpi->h,
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
401 vf->dmpi->stride[0],mpi->stride[0]);
30cad6ad9dbc fix segfaults with slices. support slice rendering into a filter even
rfelker
parents: 9603
diff changeset
402 vf->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
403 }
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
404 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
405 if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
406 #endif
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17102
diff changeset
407 return vf_next_put_image(vf,vf->dmpi, pts);
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
408 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
409
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
410 //===========================================================================//
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
411
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
412 static int control(struct vf_instance_s* vf, int request, void* data){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
413 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
414 switch(request){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
415 case VFCTRL_DRAW_OSD:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
416 if(vf->priv->osd) return CONTROL_TRUE;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
417 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
418 #endif
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
419 return vf_next_control(vf,request,data);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
420 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
421
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
422 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 25221
diff changeset
423 return vf_next_query_format(vf,fmt);
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
424 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
425
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
426 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
427 vf->config=config;
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
428 vf->control=control;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 20561
diff changeset
429 vf->query_format=query_format;
9495
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
430 vf->start_slice=start_slice;
2837f8da12c4 experimental slices support
arpi
parents: 9279
diff changeset
431 vf->draw_slice=draw_slice;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
432 vf->get_image=get_image;
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
433 vf->put_image=put_image;
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
434 mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, osd: %d, aspect: %lf, round: %d\n",
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
435 vf->priv->exp_w,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
436 vf->priv->exp_h,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
437 vf->priv->exp_x,
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
438 vf->priv->exp_y,
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
439 vf->priv->osd,
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
440 vf->priv->aspect,
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
441 vf->priv->round);
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
442 return 1;
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
443 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
444
9594
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
445 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
446 static m_option_t vf_opts_fields[] = {
9603
f9222b8a5166 And 10L their, i should have started to read vop.txt sooner ;)
albeu
parents: 9594
diff changeset
447 {"w", ST_OFF(exp_w), CONF_TYPE_INT, 0, 0 ,0, NULL},
f9222b8a5166 And 10L their, i should have started to read vop.txt sooner ;)
albeu
parents: 9594
diff changeset
448 {"h", ST_OFF(exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL},
f9222b8a5166 And 10L their, i should have started to read vop.txt sooner ;)
albeu
parents: 9594
diff changeset
449 {"x", ST_OFF(exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
f9222b8a5166 And 10L their, i should have started to read vop.txt sooner ;)
albeu
parents: 9594
diff changeset
450 {"y", ST_OFF(exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
9594
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
451 {"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
15939
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
452 {"aspect", ST_OFF(aspect), CONF_TYPE_DOUBLE, M_OPT_MIN, 0, 0, NULL},
4119b6ef4e87 add 'aspect' and 'round' params to vf_expand.
ods15
parents: 15252
diff changeset
453 {"round", ST_OFF(round), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL},
9594
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
454 { NULL, NULL, 0, 0, 0, 0, NULL }
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
455 };
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
456
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
457 static m_struct_t vf_opts = {
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
458 "expand",
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
459 sizeof(struct vf_priv_s),
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
460 &vf_priv_dflt,
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
461 vf_opts_fields
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
462 };
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
463
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
464
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
465
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 24243
diff changeset
466 const vf_info_t vf_info_expand = {
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
467 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
468 "expanding & osd",
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
469 #else
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
470 "expanding",
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
471 #endif
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
472 "expand",
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
473 "A'rpi",
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
474 "",
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 9582
diff changeset
475 open,
9594
a4b6e7caaa4b Add support for the new option stuff.
albeu
parents: 9593
diff changeset
476 &vf_opts
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
477 };
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
478
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
479 //===========================================================================//