Mercurial > mplayer.hg
comparison libmpcodecs/vf_expand.c @ 6060:61f39b98ba4d
keep aspect ratio - based on Fredrik Kuivinen's idea
author | arpi |
---|---|
date | Sun, 12 May 2002 19:06:15 +0000 |
parents | 20ccb89222bc |
children | 0a7be46617d8 |
comparison
equal
deleted
inserted
replaced
6059:c0ae8c0eda72 | 6060:61f39b98ba4d |
---|---|
23 int exp_x,exp_y; | 23 int exp_x,exp_y; |
24 mp_image_t *dmpi; | 24 mp_image_t *dmpi; |
25 int osd; | 25 int osd; |
26 unsigned char* fb_ptr; | 26 unsigned char* fb_ptr; |
27 }; | 27 }; |
28 | |
29 extern int opt_screen_size_x; | |
30 extern int opt_screen_size_y; | |
28 | 31 |
29 //===========================================================================// | 32 //===========================================================================// |
30 #ifdef OSD_SUPPORT | 33 #ifdef OSD_SUPPORT |
31 | 34 |
32 static struct vf_instance_s* vf=NULL; // fixme (needs sub.c changes) | 35 static struct vf_instance_s* vf=NULL; // fixme (needs sub.c changes) |
141 //===========================================================================// | 144 //===========================================================================// |
142 | 145 |
143 static int config(struct vf_instance_s* vf, | 146 static int config(struct vf_instance_s* vf, |
144 int width, int height, int d_width, int d_height, | 147 int width, int height, int d_width, int d_height, |
145 unsigned int flags, unsigned int outfmt){ | 148 unsigned int flags, unsigned int outfmt){ |
146 int ret; | |
147 // calculate the missing parameters: | 149 // calculate the missing parameters: |
148 #if 0 | 150 #if 0 |
149 if(vf->priv->exp_w<width) vf->priv->exp_w=width; | 151 if(vf->priv->exp_w<width) vf->priv->exp_w=width; |
150 if(vf->priv->exp_h<height) vf->priv->exp_h=height; | 152 if(vf->priv->exp_h<height) vf->priv->exp_h=height; |
151 #else | 153 #else |
157 else if( vf->priv->exp_h<height ) vf->priv->exp_h=height; | 159 else if( vf->priv->exp_h<height ) vf->priv->exp_h=height; |
158 #endif | 160 #endif |
159 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; | 161 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; |
160 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; | 162 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; |
161 vf->priv->fb_ptr=NULL; | 163 vf->priv->fb_ptr=NULL; |
162 ret=vf_next_config(vf,vf->priv->exp_w,vf->priv->exp_h,d_width,d_height,flags,outfmt); | 164 |
163 return ret; | 165 if(!opt_screen_size_x && !opt_screen_size_y){ |
166 d_width=d_width*vf->priv->exp_w/width; | |
167 d_height=d_height*vf->priv->exp_h/height; | |
168 } | |
169 return vf_next_config(vf,vf->priv->exp_w,vf->priv->exp_h,d_width,d_height,flags,outfmt); | |
164 } | 170 } |
165 | 171 |
166 // there are 4 cases: | 172 // there are 4 cases: |
167 // codec --DR--> expand --DR--> vo | 173 // codec --DR--> expand --DR--> vo |
168 // codec --DR--> expand -copy-> vo | 174 // codec --DR--> expand -copy-> vo |