diff -Nur main/cfg-mplayer.h main_sub/cfg-mplayer.h
--- main/cfg-mplayer.h	2002-04-22 18:06:03.000000000 +0200
+++ main_sub/cfg-mplayer.h	2002-04-22 18:05:48.000000000 +0200
@@ -57,6 +57,9 @@
 extern int vo_gamma_blue_intensity;
 extern int vo_directrendering;
 extern int vd_use_slices;
+/* sub box value */
+extern int sub_box;                                                                                             
+extern int auto_sub_box;
 
 #ifdef USE_OSD
 extern int osd_level;
@@ -268,6 +271,8 @@
 	{"vaa_nodr", "Use -nodr, -vaa_nodr was obsoleted\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
 	{"slices", &vd_use_slices, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"noslices", &vd_use_slices, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+	{"subbox",&sub_box,  CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},                                            
+        {"autosubbox",&auto_sub_box,  CONF_TYPE_FLAG, 0, 0, 1, NULL},
 
 #ifdef HAVE_AA
 	{"aa*",	vo_aa_parseoption,  CONF_TYPE_FUNC_FULL, 0, 0, 0 , &vo_aa_revertoption},
diff -Nur main/libvo/sub.c main_sub/libvo/sub.c
--- main/libvo/sub.c	2002-04-22 18:06:03.000000000 +0200
+++ main_sub/libvo/sub.c	2002-04-22 18:05:48.000000000 +0200
@@ -323,7 +323,9 @@
 inline static void vo_draw_text_sub(mp_osd_obj_t* obj,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
    int i,j,c,x,l,font;
    int y=obj->y;
+   extern int sub_y_start,sub_y_end;
 
+   sub_y_start=y;
    i=j=0;
    if ((l=obj->params.subtitle.lines)) for (;;) {
  	 x=obj->params.subtitle.xtbl[i++]; 
@@ -337,7 +339,10 @@
 			     vo_font->pic_a[font]->w);
 	          x+=vo_font->width[c]+vo_font->charspace;
 	 }
-         if (!--l) break;
+         if (!--l){
+	    sub_y_end=y+vo_font->height+10; /*need to add 10 because any chars are below and there are artefacts*/
+	    break;
+	 }
          y+=vo_font->height;
    }
 }
diff -Nur main/libvo/vo_xv.c main_sub/libvo/vo_xv.c
--- main/libvo/vo_xv.c	2002-04-22 18:06:03.000000000 +0200
+++ main_sub/libvo/vo_xv.c	2002-04-22 18:05:48.000000000 +0200
@@ -70,6 +70,11 @@
 static XvAdaptorInfo        *ai;
 static XvImageFormatValues  *fo;
 
+extern int sub_box;
+extern int sub_y_start;
+extern int sub_y_end;
+extern int sub_clear;
+
 static int current_buf=0;
 static int num_buffers=1; // default
 static XvImage* xvimage[NUM_BUFFERS];
@@ -93,6 +98,8 @@
 static uint32_t               drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
 static uint32_t               drwcX,drwcY,dwidth,dheight;
 
+static uint32_t clear_region(int w,int h,int x,int y);
+
 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
 
 static void draw_alpha_yv12(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
@@ -323,9 +330,6 @@
  static uint32_t vm_height;
 #endif
 
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width,d_height);
-
  image_height = height;
  image_width = width;
  image_format=format;
@@ -340,6 +344,11 @@
  flip_flag=flags&8;
  num_buffers=vo_doublebuffering?NUM_BUFFERS:1;
 
+ if(vo_fs) d_height=(d_height*(height+sub_box))/height;                                                         
+                                                                                                                  
+ aspect_save_orig(width,height);                                                                                
+ aspect_save_prescale(d_width,d_height);
+
    /* check image formats */
      fo = XvListImageFormats(mDisplay, xv_port, (int*)&formats);
      xv_format=0;
@@ -404,13 +413,17 @@
    xswamask = CWBackPixel | CWBorderPixel;
 
     if ( WinID>=0 ){
+      if(WinID==0){
+        printf( "-rootwin is curently broken sorry\n");
+	exit(-1);
+      }
       vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay,mScreen);
       XUnmapWindow( mDisplay,vo_window );
       XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa );
     } else 
 
    vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
-       hint.x, hint.y, hint.width, hint.height,
+       hint.x, hint.y , hint.width, hint.height + sub_box,
        0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa);
 
    vo_x11_classhint( mDisplay,vo_window,"xv" );
@@ -501,7 +514,7 @@
   }
  if ( Shmem_Flag ) 
   {
-   xvimage[foo] = XvShmCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height, &Shminfo[foo]);
+   xvimage[foo] = XvShmCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height + sub_box, &Shminfo[foo]);
 
    Shminfo[foo].shmid    = shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777);
    Shminfo[foo].shmaddr  = (char *) shmat(Shminfo[foo].shmid, 0, 0);
@@ -514,7 +527,7 @@
   }
  else
   {
-    xvimage[foo] = XvCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height);
+    xvimage[foo] = XvCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height + sub_box);
     xvimage[foo]->data = malloc(xvimage[foo]->data_size);
     XSync(mDisplay,False);
   }
@@ -578,15 +591,88 @@
   }
 }
 
-static void draw_osd(void)
-{ vo_draw_text(image_width,image_height,draw_alpha_fnc);}
+static uint32_t clear_region(int w,int h,int x,int y)                                                           
+{                                                                                                               
+  uint8_t *dst;                                                                                                  
+  uint16_t count;                                                                                                
+  int i;                                                                                                         
+                                                                                                                 
+ switch (image_format) {                                                                                         
+  case IMGFMT_YUY2:                                                                                              
+  case IMGFMT_UYVY:                                                                                              
+  case IMGFMT_YVYU:                                                                                              
+     dst=xvimage[current_buf]->data+image_width*y*2;                                                             
+     count=(image_width*h)>>1;                                                                                   
+#ifdef ARCH_X86                                                                                                 
+     //longset(dst,2130738944,count); /*WARNING This routine clear full lines (need to upgrade)*/                
+     asm volatile(                                                                                               
+    "rep\n"                                                                                                      
+    "stosl":                                                                                                     
+    "=D" (dst), "=c" (count) :                                                                                   
+    "0" (dst), "1" (count), "a" (2130738944) :                                                                   
+    "memory");                                                                                                   
+#else                                                                                                           
+    for(i=0;i<image_width*h*2;i+=2){                                                                             
+              dst[i]=(uint16_t)(32512);                                                                          
+      }                                                                                                          
+#endif                                                                                                          
+                                                                                                                 
+   break;                                                                                                        
+                                                                                                                 
+  case IMGFMT_YV12:                                                                                              
+  case IMGFMT_I420:                                                                                              
+  case IMGFMT_IYUV:                                                                                              
+                                                                                                                 
+  image_height+=sub_box;                                                                                         
+                                                                                                                 
+  dst = xvimage[current_buf]->data + image_width * y + x;                                                        
+   if(w==image_width) memset(dst,0,w*h);                                                                         
+   else                                                                                                          
+     for(i=0;i<h;i++){                                                                                           
+       memset(dst,0,w);                                                                                          
+       dst+=image_width;                                                                                         
+     }                                                                                                           
+                                                                                                                 
+   x/=2;y/=2;w/=2;h/=2;
+ 
+ dst = xvimage[current_buf]->data + image_width * image_height + image_width/2 * y + x;                        
+  if(w==image_width/2) memset(dst,127,w*h);                                                                     
+  else                                                                                                          
+ for(i=0;i<h;i++){                                                                                           
+     memset(dst,127,w);                                                                                      
+   dst+=image_width/2;                                                                                       
+ }                                                                                                           
+                                                                                                             
+  dst = xvimage[current_buf]->data + image_width * image_height * 5 / 4 + image_width/2 * y + x;                
+  if(w==image_width/2) memset(dst,127,w*h);                                                                     
+  else                                                                                                          
+ for(i=0;i<h;i++){                                                                                           
+     memset(dst,127,w);                                                                                      
+   dst+=image_width/2;                                                                                       
+ }                                                                                                           
+                                                                                                             
+  image_height-=sub_box;                                                                                        
+  break;                                                                                                        
+  }                                                                                                             
+ return 0;                                                                                                      
+}                                                                                                               
+                                                                                                             
+static void draw_osd(void){                                                                                     
+if(sub_clear){                                                                                               
+ if(sub_y_start<image_height) sub_y_start=image_height;                                                  
+ if(sub_y_end>sub_y_start) clear_region(image_width,sub_y_end-sub_y_start,0,sub_y_start);                
+     sub_y_start=sub_y_end=0;                                                                                
+     sub_clear=0;                                                                                            
+ }                                                                                                             
+ vo_draw_text(image_width,image_height+sub_box,draw_alpha_fnc);                                                
+} 
 
 static void flip_page(void)
 {
  if ( Shmem_Flag )
   {
    XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf],
-         0, 0,  image_width, image_height,
+	 0, 0,  image_width, image_height+sub_box,
          drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight),
          False);
   }
@@ -612,6 +698,8 @@
  uint8_t *dst;
  int i;
 
+image_height+=sub_box;
+
  dst = xvimage[current_buf]->data + image_width * y + x;
  src = image[0];
  if(w==stride[0] && w==image_width) memcpy(dst,src,w*h);
@@ -648,6 +736,9 @@
      src+=stride[1];
      dst+=image_width/2;
     }
+    
+    image_height-=sub_box;
+    
  return 0;
 }
 
diff -Nur main/libvo/vo_x11.c main_sub/libvo/vo_x11.c
--- main/libvo/vo_x11.c	2002-04-22 18:06:03.000000000 +0200
+++ main_sub/libvo/vo_x11.c	2002-04-22 18:05:48.000000000 +0200
@@ -91,6 +91,12 @@
 static int srcH=-1;
 static int aspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing
 
+/*extern values*/
+extern int sub_box;
+extern int sub_clear;
+extern int sub_y_start;
+extern int sub_y_end;
+
 static void check_events(){
   int ret = vo_x11_check_events(mDisplay);
   
@@ -139,7 +145,7 @@
 
  if ( Shmem_Flag )
   {
-   myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],image_width,image_height );
+   myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],image_width,image_height+sub_box );
    if ( myximage == NULL )
     {
      if ( myximage != NULL ) XDestroyImage( myximage );
@@ -201,7 +207,7 @@
    Shmem_Flag=0;
 #endif
    myximage=XGetImage( mDisplay,vo_window,0,0,
-   image_width,image_height,AllPlanes,ZPixmap );
+   image_width,image_height + sub_box,AllPlanes,ZPixmap );
    ImageData=myximage->data;
 #ifdef HAVE_SHM
   }
@@ -341,7 +347,7 @@
     else
       vo_window=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
                          hint.x,hint.y,
-                         hint.width,hint.height,
+                         hint.width,hint.height + sub_box,
                          xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
 
     vo_x11_classhint( mDisplay,vo_window,"x11" );
@@ -350,6 +356,7 @@
     XSelectInput( mDisplay,vo_window,StructureNotifyMask );
     XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint );
     XMapWindow( mDisplay,vo_window );
+	XResizeWindow(mDisplay,vo_window,hint.width+1,hint.height +sub_box+1); /*Because of bad film position when using subbox*/
 #ifdef HAVE_XINERAMA
    vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
@@ -455,8 +462,13 @@
 #endif
 }
 
-static void draw_osd(void)
-{ vo_draw_text(image_width,image_height,draw_alpha_fnc); }
+static void draw_osd(void){
+if(sub_clear){                                                                                                
+ bzero(ImageData+image_width*(image_height)*bpp/8,image_width*sub_box*bpp/8);
+ sub_clear=0;
+ }
+vo_draw_text(image_width,image_height + sub_box,draw_alpha_fnc);
+}
 
 static void flip_page( void ){
     Display_Image( myximage,ImageData );
diff -Nur main/mencoder.c main_sub/mencoder.c
--- main/mencoder.c	2002-04-22 18:06:03.000000000 +0200
+++ main_sub/mencoder.c	2002-04-22 18:05:48.000000000 +0200
@@ -158,6 +158,8 @@
 float sub_delay=0;
 float sub_fps=0;
 int   sub_auto = 0;
+int sub_y_start=0;                                                                                               
+int sub_y_end=0;
 
 #ifdef USE_SUB
 static subtitle* subtitles=NULL;
diff -Nur main/mplayer.c main_sub/mplayer.c
--- main/mplayer.c	2002-04-22 18:06:03.000000000 +0200
+++ main_sub/mplayer.c	2002-04-22 18:05:48.000000000 +0200
@@ -257,6 +257,11 @@
 float sub_fps=0;
 int   sub_auto = 1;
 char *vobsub_name=NULL;
+int sub_box=0;
+int auto_sub_box=0;
+int sub_y_start=0;
+int sub_y_end=0;
+int sub_clear=0;
 /*DSP!!char *dsp=NULL;*/
 
 extern char *vo_subdevice;
@@ -1219,6 +1224,28 @@
 
 current_module="preinit_libvo";
 
+if(sub_box>100) sub_box=0;                                                                                      
+                                                                                                                 
+  sub_box=(sub_box*sh_video->disp_h)/100;                                                                        
+                                                                                                                 
+   if(auto_sub_box){                                                                                             
+      if(sub_box>(((float)sh_video->disp_w/monitor_aspect)-sh_video->disp_h) || sub_box==0) sub_box=((float)sh_video->disp_w/monitor_aspect)-sh_video->disp_h;
+      if(sub_box>sh_video->disp_h) sub_box=0; /*film have bad w/h*/                                              
+      }                                                                                                          
+                                                                                                                 
+   if(sub_box>0 && sub_pos==100){                                                                                
+      sub_pos=(sh_video->disp_h*100)/(sh_video->disp_h+sub_box);                                                 
+      printf("sub_pos changed to: %i \n",sub_pos);                                                               
+      }                                                                                                          
+                                                                                                                 
+   printf("SUB_BOX value: %i\n",sub_box);                                                                        
+   sub_box=(sub_box>>1)<<1;                                                                                      
+   sub_y_start=sh_video->disp_h;                                                                                 
+   sub_y_end=sh_video->disp_h+sub_box;                                                                           
+#ifdef HAVE_NEW_GUI                                                                                             
+   if( use_gui ) sub_box=0;                                                                                      
+#endif  
+
 vo_config_count=0;
 if((video_out->preinit(vo_subdevice))!=0){
     mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error opening/initializing the selected video_out (-vo) device!\n");
@@ -1495,6 +1522,7 @@
     while(1)
     {   unsigned char* start=NULL;
 	int in_size;
+	extern int sub_clear;
 	// get it!
 	current_module="video_read_frame";
         in_size=video_read_frame(sh_video,&frame_time,&start,force_fps);
@@ -1526,7 +1554,8 @@
     }
     vdecode_time=video_time_usage-vdecode_time;
     //------------------------ frame decoded. --------------------
-
+    
+    sub_clear=1;
     mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"*** ftime=%5.3f ***\n",frame_time);
 
 // ==========================================================================
