--- MPlayer-1.0rc1/libmpcodecs/vf_expand.c.ori	2006-10-22 19:32:24.000000000 -0300
+++ MPlayer-1.0rc1/libmpcodecs/vf_expand.c	2007-03-18 13:59:52.195493398 -0300
@@ -204,6 +204,35 @@
 	d_width=d_width*vf->priv->exp_w/width;
 	d_height=d_height*vf->priv->exp_h/height;
     }
+    mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, osd: %d, aspect: %lf, round: %d\n",
+       vf->priv->exp_w,
+    vf->priv->exp_h,
+       vf->priv->exp_x,
+    vf->priv->exp_y,
+        vf->priv->osd,
+    vf->priv->aspect,
+        vf->priv->round);
+
+    if (vf->priv->exp_w == width && vf->priv->exp_h == height && vf->priv->exp_x == 0 && vf->priv->exp_y == 0 && vf->priv->osd == 0) {
+       mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: Assuming autoexpand.\n");
+	vf->priv->exp_h=d_height;
+	vf->priv->exp_y=(vf->priv->exp_h-height)/2;
+	d_height=d_width/(double)(4.0/3.0); // TODO: /(double)(monitoraspect)
+       if (vf->priv->exp_y <= 16) { // Ugly heuristic code. TODO: Add code based on video format.
+	vf->priv->exp_h=d_height;
+	vf->priv->exp_y=(vf->priv->exp_h-height)/2;
+	}
+       if (vf->priv->exp_y < 0)
+          vf->priv->exp_y=0;
+    mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, osd: %d, aspect: %lf, round: %d\n",
+       vf->priv->exp_w,
+    vf->priv->exp_h,
+       vf->priv->exp_x,
+    vf->priv->exp_y,
+        vf->priv->osd,
+    vf->priv->aspect,
+        vf->priv->round);
+       }
     return vf_next_config(vf,vf->priv->exp_w,vf->priv->exp_h,d_width,d_height,flags,outfmt);
 }
 

