annotate libmpcodecs/vf_expand.c @ 9145:ab8238290141

sub_utf8 handling hopefully fixed
author henry
date Tue, 28 Jan 2003 18:45:58 +0000
parents 9df3c03b2ffe
children 12741a866acd
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
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
7 #include "../config.h"
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
8 #include "../mp_msg.h"
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
9
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
10 #include "img_format.h"
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5530
diff changeset
11 #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
12 #include "vf.h"
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
13
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
14 #include "../libvo/fastmemcpy.h"
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
15
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
16 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
17 #include "../libvo/sub.h"
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
18 #include "../libvo/osd.h"
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
19 #endif
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
20
7052
f3b2f31332fc allocating large enough buffer, fixes green stuff on top for encoding of height %16 != 0 videos
michael
parents: 6761
diff changeset
21 #define MAX(a,b) ((a) > (b) ? (a) : (b))
f3b2f31332fc allocating large enough buffer, fixes green stuff on top for encoding of height %16 != 0 videos
michael
parents: 6761
diff changeset
22
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
23 struct vf_priv_s {
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
24 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
25 int exp_x,exp_y;
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
26 mp_image_t *dmpi;
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
27 int osd;
5669
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
28 unsigned char* fb_ptr;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
29 };
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
30
6060
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
31 extern int opt_screen_size_x;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
32 extern int opt_screen_size_y;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
33
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
34 //===========================================================================//
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
35 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
36
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
37 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
38 static int orig_w,orig_h;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
39
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
40 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
41 // 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
42 //printf("OSD clear: %d;%d %dx%d \n",x0,y0,w,h);
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
43 vf_mpi_clear(vf->priv->dmpi,x0,y0,w,h);
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
44 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
45
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
46 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
47 if(!vo_osd_changed_flag) return;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
48 // split it to 4 parts:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
49 if(y0<vf->priv->exp_y){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
50 // it has parts above the image:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
51 int y=y0+h;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
52 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
53 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
54 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
55 h-=y-y0;y0=y;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
56 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
57 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
58 // it has parts under the image:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
59 int y=y0;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
60 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
61 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
62 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
63 h=y-y0;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
64 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
65 if(x0>=vf->priv->exp_x || x0+w<=vf->priv->exp_x+orig_w) return;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
66 // TODO clear left and right side of the image if needed
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
67 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
68
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
69 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
70 unsigned char* dst;
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
71 if(!vo_osd_changed_flag && vf->priv->dmpi->planes[0]==vf->priv->fb_ptr){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
72 // 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
73 // untouched!
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
74 if(x0<vf->priv->exp_x){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
75 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
76 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
77 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
78 if(y0<vf->priv->exp_y){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
79 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
80 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
81 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
82 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
83 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
84 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
85 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
86 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
87 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
88 }
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
89 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
90 // printf("OSD redraw: %d;%d %dx%d \n",x0,y0,w,h);
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
91 dst=vf->priv->dmpi->planes[0]+
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
92 vf->priv->dmpi->stride[0]*y0+
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
93 (vf->priv->dmpi->bpp>>3)*x0;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
94 switch(vf->priv->dmpi->imgfmt){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
95 case IMGFMT_BGR15:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
96 case IMGFMT_RGB15:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
97 vo_draw_alpha_rgb15(w,h,src,srca,stride,dst,vf->priv->dmpi->stride[0]);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
98 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
99 case IMGFMT_BGR16:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
100 case IMGFMT_RGB16:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
101 vo_draw_alpha_rgb16(w,h,src,srca,stride,dst,vf->priv->dmpi->stride[0]);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
102 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
103 case IMGFMT_BGR24:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
104 case IMGFMT_RGB24:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
105 vo_draw_alpha_rgb24(w,h,src,srca,stride,dst,vf->priv->dmpi->stride[0]);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
106 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
107 case IMGFMT_BGR32:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
108 case IMGFMT_RGB32:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
109 vo_draw_alpha_rgb32(w,h,src,srca,stride,dst,vf->priv->dmpi->stride[0]);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
110 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
111 case IMGFMT_YV12:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
112 case IMGFMT_I420:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
113 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
114 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
115 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
116 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
117 case IMGFMT_Y8:
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
118 vo_draw_alpha_yv12(w,h,src,srca,stride,dst,vf->priv->dmpi->stride[0]);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
119 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
120 case IMGFMT_YUY2:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
121 vo_draw_alpha_yuy2(w,h,src,srca,stride,dst,vf->priv->dmpi->stride[0]);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
122 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
123 case IMGFMT_UYVY:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
124 vo_draw_alpha_yuy2(w,h,src,srca,stride,dst+1,vf->priv->dmpi->stride[0]);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
125 break;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
126 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
127 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
128
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
129 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
130 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
131 // printf("======================================\n");
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
132 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
133 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
134 // yep, we're expanding image, not just copy.
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
135 if(vf->priv->dmpi->planes[0]!=vf->priv->fb_ptr){
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
136 // double buffering, so we need full clear :(
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
137 remove_func(0,0,vf->priv->exp_w,vf->priv->exp_h);
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
138 } else {
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
139 // partial clear:
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
140 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
141 }
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
142 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
143 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
144 // 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
145 // ugly method, but note that codecs with DR support does the same...
391931fa79a6 enabled new OSD code in -vop expand, subtitles rendering support to mencoder
arpi
parents: 5644
diff changeset
146 vf->priv->fb_ptr=vf->priv->dmpi->planes[0];
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
147 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
148
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
149 #endif
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
150 //===========================================================================//
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
151
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
152 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
153 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
154 unsigned int flags, unsigned int outfmt){
6525
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
155 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
156 // calculate the missing parameters:
5921
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
157 #if 0
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
158 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
159 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
160 #else
20ccb89222bc expand=-1:-50:0:0 -> mwidth:mheight+50:0:0
pontscho
parents: 5878
diff changeset
161 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
162 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
163 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
164 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
165 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
166 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
167 #endif
5687
f19dff1456ed don't allow invalid parameters
arpi
parents: 5671
diff changeset
168 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
169 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
170 vf->priv->fb_ptr=NULL;
6060
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
171
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
172 if(!opt_screen_size_x && !opt_screen_size_y){
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
173 d_width=d_width*vf->priv->exp_w/width;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
174 d_height=d_height*vf->priv->exp_h/height;
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
175 }
61f39b98ba4d keep aspect ratio - based on Fredrik Kuivinen's idea
arpi
parents: 5921
diff changeset
176 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
177 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
178
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
179 // there are 4 cases:
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
180 // 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
181 // 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
182 // 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
183 // 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
184
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
185 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
186 // 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
187 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
188 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
189 // check if we have to render osd!
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
190 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
191 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
192 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
193 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
194 #endif
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
195 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
196 (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
197 // try full DR !
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
198 vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
7052
f3b2f31332fc allocating large enough buffer, fixes green stuff on top for encoding of height %16 != 0 videos
michael
parents: 6761
diff changeset
199 mpi->type, mpi->flags,
f3b2f31332fc allocating large enough buffer, fixes green stuff on top for encoding of height %16 != 0 videos
michael
parents: 6761
diff changeset
200 MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x),
f3b2f31332fc allocating large enough buffer, fixes green stuff on top for encoding of height %16 != 0 videos
michael
parents: 6761
diff changeset
201 MAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y));
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
202 // 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
203 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
204 mpi->planes[0]=vf->priv->dmpi->planes[0]+
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
205 vf->priv->exp_y*vf->priv->dmpi->stride[0]+vf->priv->exp_x;
6525
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
206 mpi->planes[1]=vf->priv->dmpi->planes[1]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6537
diff changeset
207 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->priv->dmpi->stride[1]+(vf->priv->exp_x>>mpi->chroma_x_shift);
6525
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
208 mpi->planes[2]=vf->priv->dmpi->planes[2]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6537
diff changeset
209 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->priv->dmpi->stride[2]+(vf->priv->exp_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
210 mpi->stride[1]=vf->priv->dmpi->stride[1];
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
211 mpi->stride[2]=vf->priv->dmpi->stride[2];
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
212 } else {
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
213 mpi->planes[0]=vf->priv->dmpi->planes[0]+
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
214 vf->priv->exp_y*vf->priv->dmpi->stride[0]+
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
215 vf->priv->exp_x*(vf->priv->dmpi->bpp/8);
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
216 }
5530
e974e82be748 copy width too
arpi
parents: 5507
diff changeset
217 mpi->stride[0]=vf->priv->dmpi->stride[0];
e974e82be748 copy width too
arpi
parents: 5507
diff changeset
218 mpi->width=vf->priv->dmpi->width;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
219 mpi->flags|=MP_IMGFLAG_DIRECT;
6761
cb1180ccac76 DR1+IPB support (works only with ffmpeg12, as libmpeg2 doesn't accept stride)
arpi
parents: 6539
diff changeset
220 mpi->priv=(void*)vf->priv->dmpi;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
221 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
222 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
223
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7052
diff changeset
224 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
225 if(mpi->flags&MP_IMGFLAG_DIRECT){
6761
cb1180ccac76 DR1+IPB support (works only with ffmpeg12, as libmpeg2 doesn't accept stride)
arpi
parents: 6539
diff changeset
226 vf->priv->dmpi=mpi->priv;
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
227 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
228 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
229 #endif
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7052
diff changeset
230 // we've used DR, so we're ready...
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7052
diff changeset
231 return vf_next_put_image(vf,vf->priv->dmpi);
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 // hope we'll get DR buffer:
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
235 vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
236 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
237 vf->priv->exp_w, vf->priv->exp_h);
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
238
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
239 // copy mpi->dmpi...
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
240 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
241 memcpy_pic(vf->priv->dmpi->planes[0]+
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
242 vf->priv->exp_y*vf->priv->dmpi->stride[0]+vf->priv->exp_x,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
243 mpi->planes[0], mpi->w, mpi->h,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
244 vf->priv->dmpi->stride[0],mpi->stride[0]);
6525
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
245 memcpy_pic(vf->priv->dmpi->planes[1]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6537
diff changeset
246 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->priv->dmpi->stride[1]+(vf->priv->exp_x>>mpi->chroma_x_shift),
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6537
diff changeset
247 mpi->planes[1], mpi->chroma_width, mpi->chroma_height,
6525
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
248 vf->priv->dmpi->stride[1],mpi->stride[1]);
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
249 memcpy_pic(vf->priv->dmpi->planes[2]+
6539
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6537
diff changeset
250 (vf->priv->exp_y>>mpi->chroma_y_shift)*vf->priv->dmpi->stride[2]+(vf->priv->exp_x>>mpi->chroma_x_shift),
79b536a37e40 better planar support, chroma subsampling support and Y8/Y800 support
alex
parents: 6537
diff changeset
251 mpi->planes[2], mpi->chroma_width, mpi->chroma_height,
6525
0a7be46617d8 yvu9 and if09 support
alex
parents: 6060
diff changeset
252 vf->priv->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
253 } else {
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
254 memcpy_pic(vf->priv->dmpi->planes[0]+
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
255 vf->priv->exp_y*vf->priv->dmpi->stride[0]+vf->priv->exp_x*(vf->priv->dmpi->bpp/8),
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
256 mpi->planes[0], mpi->w*(vf->priv->dmpi->bpp/8), mpi->h,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
257 vf->priv->dmpi->stride[0],mpi->stride[0]);
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
258 }
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
259 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
260 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
261 #endif
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7052
diff changeset
262 return vf_next_put_image(vf,vf->priv->dmpi);
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
263 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
264
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
265 //===========================================================================//
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
266
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
267 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
268 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
269 switch(request){
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
270 case VFCTRL_DRAW_OSD:
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
271 if(vf->priv->osd) return CONTROL_TRUE;
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
272 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
273 #endif
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
274 return vf_next_control(vf,request,data);
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
275 }
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
276
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
277 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
278 vf->config=config;
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
279 vf->control=control;
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
280 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
281 vf->put_image=put_image;
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
282 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
283 vf->priv->exp_x=
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
284 vf->priv->exp_y=
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
285 vf->priv->exp_w=
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
286 vf->priv->exp_h=-1;
7768
f5223b78ebf6 10l bug, found by valgrind :)
arpi
parents: 7368
diff changeset
287 vf->priv->osd=0;
f5223b78ebf6 10l bug, found by valgrind :)
arpi
parents: 7368
diff changeset
288 // parse args ->
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
289 if(args) sscanf(args, "%d:%d:%d:%d:%d",
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
290 &vf->priv->exp_w,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
291 &vf->priv->exp_h,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
292 &vf->priv->exp_x,
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
293 &vf->priv->exp_y,
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
294 &vf->priv->osd);
8869
9df3c03b2ffe use mp_msg for messages. prolly more filters need to be fixed like this too
rfelker
parents: 7768
diff changeset
295 mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d (-1=autodetect) osd: %d\n",
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
296 vf->priv->exp_w,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
297 vf->priv->exp_h,
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
298 vf->priv->exp_x,
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
299 vf->priv->exp_y,
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
300 vf->priv->osd);
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
301 return 1;
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
302 }
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
303
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
304 vf_info_t vf_info_expand = {
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
305 #ifdef OSD_SUPPORT
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
306 "expanding & osd",
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
307 #else
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
308 "expanding",
5644
f1465a280612 (buggy) osd support, disabled for now, mencoder needs fixes to compile
arpi
parents: 5607
diff changeset
309 #endif
5507
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
310 "expand",
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
311 "A'rpi",
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
312 "",
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
313 open
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
314 };
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
315
d0d029fda134 video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff changeset
316 //===========================================================================//