changeset 1501:d40f2b686846

changes according to -utf8 option, draw_osd() function added
author atlka
date Mon, 13 Aug 2001 11:08:18 +0000
parents 526047bdda07
children ccb1f3ddb29a
files cfg-mplayer.h libvo/sub.c libvo/video_out.h libvo/video_out_internal.h libvo/vo_3dfx.c libvo/vo_dga.c libvo/vo_fbdev.c libvo/vo_fsdga.c libvo/vo_ggi.c libvo/vo_gl.c libvo/vo_md5.c libvo/vo_mga.c libvo/vo_null.c libvo/vo_png.c libvo/vo_sdl.c libvo/vo_svga.c libvo/vo_syncfb.c libvo/vo_x11.c libvo/vo_xmga.c libvo/vo_xv.c libvo/x11_common.c mplayer.c subreader.c
diffstat 23 files changed, 256 insertions(+), 138 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Mon Aug 13 10:38:01 2001 +0000
+++ b/cfg-mplayer.h	Mon Aug 13 11:08:18 2001 +0000
@@ -35,6 +35,7 @@
 
 #ifdef USE_SUB
 extern int sub_unicode;
+extern int sub_utf8;
 #endif
 
 #ifdef USE_OSD
@@ -92,6 +93,8 @@
         {"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0},
 	{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1},
 	{"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0},
+	{"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1},
+	{"noutf8", &sub_utf8, CONF_TYPE_FLAG, 0, 1, 0},
 #endif
 #ifdef USE_OSD
 	{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0},
--- a/libvo/sub.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/sub.c	Mon Aug 13 11:08:18 2001 +0000
@@ -6,17 +6,19 @@
 
 unsigned char* vo_osd_text="00:00:00";
 int sub_unicode=0;
+int sub_utf8=0;
 
-static void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
-        int len=strlen(vo_osd_text);
-        int j;
+inline static void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
+	unsigned char *cp=vo_osd_text;
+	int c;
+   	int font;
         int y=10;
         int x=20;
 
-        for(j=0;j<len;j++){
-          int c=vo_osd_text[j];
-          int font=vo_font->font[c];
-          if(font>=0)
+        while (*cp){
+          c=*cp;
+	  cp++;
+          if ((font=vo_font->font[c])>=0)
             draw_alpha(x,y,
               vo_font->width[c],
               vo_font->pic_a[font]->h,
@@ -31,9 +33,9 @@
 int vo_osd_progbar_type=-1;
 int vo_osd_progbar_value=100;   // 0..255
 
-static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
+inline static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
         int i;
-        int y=dys/2;
+        int y=(dys-vo_font->height)/2;
         int x;
         int c,font;
         int width=(dxs*2/3-vo_font->width[0x10]-vo_font->width[0x12]);
@@ -42,8 +44,8 @@
         x=(dxs-width)/2;
 //        printf("osd.progbar  width=%d  xpos=%d\n",width,x);
 
-        c=vo_osd_progbar_type;font=vo_font->font[c];
-        if(vo_osd_progbar_type>0 && font>=0)
+        c=vo_osd_progbar_type;
+        if(vo_osd_progbar_type>0 && (font=vo_font->font[c])>=0)
             draw_alpha(x-vo_font->width[c]-vo_font->spacewidth,y,
               vo_font->width[c],
               vo_font->pic_a[font]->h,
@@ -51,8 +53,8 @@
               vo_font->pic_a[font]->bmp+vo_font->start[c],
               vo_font->pic_a[font]->w);
 
-        c=OSD_PB_START;font=vo_font->font[c];
-        if(font>=0)
+        c=OSD_PB_START;
+        if ((font=vo_font->font[c])>=0)
             draw_alpha(x,y,
               vo_font->width[c],
               vo_font->pic_a[font]->h,
@@ -61,20 +63,32 @@
               vo_font->pic_a[font]->w);
         x+=vo_font->width[c];
 
-        for(i=0;i<elems;i++){
-          c=(i<mark)?OSD_PB_0:OSD_PB_1;font=vo_font->font[c];
-          if(font>=0)
-            draw_alpha(x,y,
-              vo_font->width[c],
-              vo_font->pic_a[font]->h,
-              vo_font->pic_b[font]->bmp+vo_font->start[c],
-              vo_font->pic_a[font]->bmp+vo_font->start[c],
-              vo_font->pic_a[font]->w);
-          x+=vo_font->width[c];
-        }
+   	c=OSD_PB_0;
+   	if ((font=vo_font->font[c])>=0)
+     	   for (i=mark;i--;){
+	       draw_alpha(x,y,
+			  vo_font->width[c],
+			  vo_font->pic_a[font]->h,
+			  vo_font->pic_b[font]->bmp+vo_font->start[c],
+			  vo_font->pic_a[font]->bmp+vo_font->start[c],
+			  vo_font->pic_a[font]->w);
+	       x+=vo_font->width[c];
+	   }
 
-        c=OSD_PB_END;font=vo_font->font[c];
-        if(font>=0)
+   	c=OSD_PB_1;
+	if ((font=vo_font->font[c])>=0)
+     	   for (i=elems-mark;i--;){
+	       draw_alpha(x,y,
+			  vo_font->width[c],
+			  vo_font->pic_a[font]->h,
+			  vo_font->pic_b[font]->bmp+vo_font->start[c],
+			  vo_font->pic_a[font]->bmp+vo_font->start[c],
+			  vo_font->pic_a[font]->w);
+	       x+=vo_font->width[c];
+	   }
+
+        c=OSD_PB_END;
+        if ((font=vo_font->font[c])>=0)
             draw_alpha(x,y,
               vo_font->width[c],
               vo_font->pic_a[font]->h,
@@ -90,64 +104,88 @@
 
 subtitle* vo_sub=NULL;
 
-static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
-    int i;
-    int y;
-    y=dys-(1+vo_sub->lines-1)*vo_font->height-10;
+#define MAX_UCS 1600
+#define MAX_UCSLINES 16
 
-    // too long lines divide into smaller ones
-    for(i=0;i<vo_sub->lines;i++){
-        unsigned char* text=vo_sub->text[i];
-        int len=strlen(text);
-	int j;
-        int xsize=-vo_font->charspace;
-	int lastStripPosition=-1;
-	int previousStrip=0;
-	int lastxsize=0;
+inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
+   static int utbl[MAX_UCS+1];
+   static int xtbl[MAX_UCSLINES];
+   static int lines;
+   static subtitle *memsub=NULL;
+   static int memy;
+   static int memdxs;
+   static int memdys;
+   unsigned char *t;
+   int i;
+   int j;
+   int k;
+   int l;
+   int x;
+   int y;
 
-	for(j=0;j<len;j++){
-          int c=text[j];
-          int w;
-          if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
-          w = vo_font->width[c];
-	  if (text[j]==' ' && dxs>xsize)
-	  {
-	    lastStripPosition=j;
-	    lastxsize=xsize;
-	  }
-          xsize+=w+vo_font->charspace;
-	  if (dxs<xsize && lastStripPosition>0)
-	  {
-	    xsize=lastxsize;
-	    j=lastStripPosition;
-            y-=vo_font->height;
-	    previousStrip=lastStripPosition;
-            xsize=-vo_font->charspace;
-	  }
-        }
-    }
+   int c;
+   int len;
+   int line;
+   int font;
+   int lastStripPosition;
+   int xsize;
+   int lastxsize;
+   int lastk;
+   
+   if ((memsub!=vo_sub)||(memdxs!=dxs)||(memdys!=dys)){
+      memsub=vo_sub;
+      memdxs=dxs;
+      memdys=dys;
+      
+      memy=dys-vo_font->height/4;
+      
+      // too long lines divide into smaller ones
+      i=k=lines=0; l=vo_sub->lines;
+      while (l--){
+	  t=vo_sub->text[i++];	  
+	  len=strlen(t)-1;
+	  xsize=lastxsize=-vo_font->charspace;
+	  lastStripPosition=-1;
 
-
-    for(i=0;i<vo_sub->lines;i++){
-        unsigned char* text=vo_sub->text[i];//  "Hello World! HÛDEJÓ!";
-        int len=strlen(text);
-        int j,k;
-        int xsize=-vo_font->charspace;
-        int x=0;
-
-	int lastStripPosition=-1;
-	int previousStrip=0;
-	int lastxsize=xsize;
-
-	for(j=0;j<len;j++){
-          int c=text[j];
-          int w;
-          if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
-          w = vo_font->width[c];
-          if (c==' ' && dxs>xsize)
-	  {
-	    lastStripPosition=j;
-	    lastxsize=xsize;
+	  for (j=0;j<=len;j++){
+	      if ((c=t[j])>=0x80){
+		 if (sub_unicode) 
+		    c = (c<<8) + t[++j]; 
+		 else
+		    if (sub_utf8){
+		       if ((c & 0xe0) == 0xc0)    /* 2 bytes U+00080..U+0007FF*/
+			  c = (c & 0x1f)<<6 | (t[++j] & 0x3f);
+		       else if((c & 0xf0) == 0xe0)/* 3 bytes U+00800..U+00FFFF*/
+			  c = ((c & 0x0f)<<6 |
+			       (t[++j] & 0x3f))<<6 | (t[++j] & 0x3f);
+		    }
+	      }
+	      if (k==MAX_UCS){
+		 utbl[k]=l=0;
+		 break;
+	      } else
+	         utbl[k++]=c;
+	      if (c==' '){
+		 lastk=k;
+		 lastStripPosition=j;
+		 lastxsize=xsize;
+	      }
+	      xsize+=vo_font->width[c]+vo_font->charspace;
+	      if (dxs<xsize && lastStripPosition>0){
+		 j=lastStripPosition;
+		 k=lastk;
+	      } else if (j==len){
+		 lastxsize=xsize;
+	      } else
+	         continue;	       	       	       
+	      utbl[k++]=0;
+	      xtbl[lines++]=(dxs-lastxsize)/2;
+	      if (lines==MAX_UCSLINES||k>MAX_UCS){
+		 l=0;
+		 break;
+	      }
+	      memy-=vo_font->height;
+	      xsize=lastxsize=-vo_font->charspace;
 	  }
           xsize+=w+vo_font->charspace;
 	  if ((dxs<xsize && lastStripPosition>0) || j==len-1)
@@ -179,8 +217,28 @@
             xsize=lastxsize=-vo_font->charspace;
 	  }
         }
-    }
+   }
+   
+   y = memy;
 
+   k=i=0; l=lines;
+   while (l--){
+       x = xtbl[i++];
+       while (utbl[k]){
+	     c=utbl[k]; 
+	     k++;
+	     if (x>=0 && x+vo_font->width[c]<=dxs)
+		if ((font=vo_font->font[c])>=0)
+	           draw_alpha(x,y,
+			      vo_font->width[c],
+			      vo_font->pic_a[font]->h,
+			      vo_font->pic_b[font]->bmp+vo_font->start[c],
+			      vo_font->pic_a[font]->bmp+vo_font->start[c],
+			      vo_font->pic_a[font]->w);
+	  x+=vo_font->width[c]+vo_font->charspace;
+       }
+       y+=vo_font->height;
+   }
 }
 
 static int draw_alpha_init_flag=0;
--- a/libvo/video_out.h	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/video_out.h	Mon Aug 13 11:08:18 2001 +0000
@@ -72,6 +72,11 @@
          */
         uint32_t (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
 
+   	/*
+         * Draws OSD to the screen buffer
+         */
+        void (*draw_osd)(void);
+
         /*
          * Blit/Flip buffer to the screen. Must be called after each frame!
          */
--- a/libvo/video_out_internal.h	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/video_out_internal.h	Mon Aug 13 11:08:18 2001 +0000
@@ -37,6 +37,7 @@
 	get_info,\
 	draw_frame,\
 	draw_slice,\
+     	draw_osd,\
 	flip_page,\
 	check_events,\
 	uninit,\
--- a/libvo/vo_3dfx.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_3dfx.c	Mon Aug 13 11:08:18 2001 +0000
@@ -450,6 +450,10 @@
 	return 0;
 }
 
+static void draw_osd(void)
+{
+}
+
 static void 
 flip_page(void) 
 {
--- a/libvo/vo_dga.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_dga.c	Mon Aug 13 11:08:18 2001 +0000
@@ -23,6 +23,9 @@
  * - works only on x86 architectures
  *
  * $Log$
+ * Revision 1.30  2001/08/13 11:08:18  atlka
+ * changes according to -utf8 option, draw_osd() function added
+ *
  * Revision 1.29  2001/07/16 18:41:52  jkeil
  * vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
  *
@@ -524,10 +527,12 @@
 
 #include "sub.h"
 
+static void draw_osd(void)
+{ vo_draw_text(vo_dga_src_width,vo_dga_src_height,draw_alpha); }
+
 static void flip_page( void ){
 
   if(vo_dga_dbf_mem_offset != 0){
-    vo_draw_text(vo_dga_src_width,vo_dga_src_height,draw_alpha);
 
 #ifdef HAVE_DGA2
     XDGASetViewport (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 
@@ -539,7 +544,6 @@
 #endif
     vo_dga_dbf_current = 1 - vo_dga_dbf_current;
   }
-  check_events();
 }
 
 //---------------------------------------------------------
--- a/libvo/vo_fbdev.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_fbdev.c	Mon Aug 13 11:08:18 2001 +0000
@@ -1130,10 +1130,13 @@
 	}
 }
 
+static void draw_osd(void)
+{
+	vo_draw_text(in_width, in_height, draw_alpha);
+}
+
 static void flip_page(void)
 {
-	vo_draw_text(in_width, in_height, draw_alpha);
-	check_events();
 	put_frame();
 }
 
--- a/libvo/vo_fsdga.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_fsdga.c	Mon Aug 13 11:08:18 2001 +0000
@@ -173,10 +173,12 @@
     int e=vo_x11_check_events(vo_dga_dpy);
 }
 
+static void draw_osd(void)
+{
+}
+
 static void flip_page( void ){
-    check_events(); 
   //  printf("vo_dga: In flippage\n");
-
 }
 
 static unsigned int pix_buf_y[4][2048];
--- a/libvo/vo_ggi.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_ggi.c	Mon Aug 13 11:08:18 2001 +0000
@@ -524,12 +524,15 @@
 }
 #endif
 
-static void flip_page(void)
+static void draw_osd(void)
 {
-    check_events();
 #ifdef GGI_OSD
     vo_draw_text(ggi_conf.width, ggi_conf.height, draw_alpha);
 #endif
+}
+
+static void flip_page(void)
+{
     ggiFlush(ggi_conf.vis);
 }
 
--- a/libvo/vo_gl.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_gl.c	Mon Aug 13 11:08:18 2001 +0000
@@ -332,13 +332,14 @@
     if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight);
 }
 
+static void draw_osd(void)
+{
+}
 
 static void
 flip_page(void)
 {
 
-    check_events();
-
 //  glEnable(GL_TEXTURE_2D);
 //  glBindTexture(GL_TEXTURE_2D, texture_id);
 
--- a/libvo/vo_md5.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_md5.c	Mon Aug 13 11:08:18 2001 +0000
@@ -49,6 +49,10 @@
     return &vo_info;
 }
 
+static void draw_osd(void)
+{
+}
+
 static void flip_page (void)
 {
     char buf2[100];
--- a/libvo/vo_mga.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_mga.c	Mon Aug 13 11:08:18 2001 +0000
@@ -113,9 +113,13 @@
 printf("vo: uninit!\n");
 }
 
+static void draw_osd(void)
+{
+    vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);
+}
+
 static void flip_page(void)
 {
-    vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);
     vo_mga_flip_page();
 }
 
--- a/libvo/vo_null.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_null.c	Mon Aug 13 11:08:18 2001 +0000
@@ -45,6 +45,10 @@
 	return 0;
 }
 
+static void draw_osd(void)
+{
+}
+
 static void
 flip_page(void)
 {
--- a/libvo/vo_png.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_png.c	Mon Aug 13 11:08:18 2001 +0000
@@ -221,6 +221,10 @@
 
 }
 
+static void draw_osd(void)
+{
+}
+
 static void flip_page (void)
 {
     char buf[100];
--- a/libvo/vo_sdl.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_sdl.c	Mon Aug 13 11:08:18 2001 +0000
@@ -1152,9 +1152,15 @@
 	}
 }
 
+static void draw_osd(void)
+{	struct sdl_priv_s *priv = &sdl_priv;
+
+	/* update osd/subtitles */
+	vo_draw_text(priv->width,priv->height,draw_alpha);
+}
 
 /**
- * Display the surface we have written our data to and check for events.
+ * Display the surface we have written our data to
  *
  *   params : mode == index of the desired fullscreen mode
  *  returns : doesn't return
@@ -1164,12 +1170,6 @@
 {
 	struct sdl_priv_s *priv = &sdl_priv;
 
-	/* update osd/subtitles */
-	vo_draw_text(priv->width,priv->height,draw_alpha);	
-		
-	/* check and react on keypresses and window resizes */
-	check_events();
-
 	switch(priv->format) {
 	    case IMGFMT_RGB15:
 	    case IMGFMT_BGR15:	
--- a/libvo/vo_svga.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_svga.c	Mon Aug 13 11:08:18 2001 +0000
@@ -509,7 +509,8 @@
   return (0);
 }
 
-static void flip_page(void) {
+static void draw_osd(void)
+{
   if (y_pos) {
     gl_fillbox(0, 0, WIDTH, y_pos, 0);
     gl_fillbox(0, HEIGHT - y_pos, WIDTH, y_pos, 0);
@@ -520,6 +521,9 @@
   }
 
   vo_draw_text(WIDTH, HEIGHT, draw_alpha);
+}
+
+static void flip_page(void) {
   gl_copyscreen(screen);
 }
 
@@ -538,13 +542,9 @@
     free(scalebuf);
   if (yuvbuf != NULL)
     free(yuvbuf);
-  if (modelist != NULL) {
-    while (modelist->next != NULL) {
-      list = modelist;
-      while (list->next != NULL)
-        list = list->next;
-      free(list);
-    }
-    free(modelist);
+  while (modelist != NULL) {
+       list=modelist;
+       modelist=modelist->next;
+       free(list);
   }
 }
--- a/libvo/vo_syncfb.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_syncfb.c	Mon Aug 13 11:08:18 2001 +0000
@@ -272,8 +272,9 @@
 	return 0;
 }
 
-
-
+static void draw_osd(void)
+{
+}
 
 static void
 flip_page(void)
--- a/libvo/vo_x11.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_x11.c	Mon Aug 13 11:08:18 2001 +0000
@@ -373,7 +373,6 @@
                  0,0,
                  ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
                  myximage->width,myximage->height,True );
-   XFlush( mDisplay );
   }
   else
 #endif
@@ -382,7 +381,6 @@
                0,0,
                ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
                myximage->width,myximage->height );
-    XFlush( mDisplay );
   }
 #endif
 }
@@ -405,10 +403,12 @@
     }
 }
 
+static void draw_osd(void)
+{ vo_draw_text(image_width,image_height,draw_alpha); }
+
 static void flip_page( void ){
-    vo_draw_text(image_width,image_height,draw_alpha);
-    check_events();
     Display_Image( myximage,ImageData );
+    XSync(mDisplay, False);
 }
 
 static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y )
--- a/libvo/vo_xmga.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_xmga.c	Mon Aug 13 11:08:18 2001 +0000
@@ -161,6 +161,9 @@
 
 }
 
+static void draw_osd(void)
+{ vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);}
+
 static void flip_page(void){
 #ifdef SHOW_TIME
     unsigned int t;
@@ -170,10 +173,7 @@
     timer=t;
 #endif
 
-    vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);
-
-    check_events();
-    vo_mga_flip_page();
+   vo_mga_flip_page();
 }
 
 static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format )
--- a/libvo/vo_xv.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/vo_xv.c	Mon Aug 13 11:08:18 2001 +0000
@@ -328,16 +328,20 @@
 
 }
 
+static void draw_osd(void)
+{ vo_draw_text(image_width,image_height,draw_alpha);}
+
 static void flip_page(void)
 {
- vo_draw_text(image_width,image_height,draw_alpha);
- check_events();
  XvShmPutImage(mDisplay, xv_port, mywindow, mygc, xvimage[current_buf],
          0, 0,  image_width, image_height,
          drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
          False);
- XFlush(mDisplay);
- current_buf=(current_buf+1)%num_buffers;
+ if (num_buffers>1){
+    current_buf=(current_buf+1)%num_buffers;
+    XFlush(mDisplay);
+ } else
+    XSync(mDisplay, False);   
  return;
 }
 
--- a/libvo/x11_common.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/libvo/x11_common.c	Mon Aug 13 11:08:18 2001 +0000
@@ -137,7 +137,8 @@
    case wsM:	     mplayer_put_key('m'); break;
    case wso:
    case wsO:         mplayer_put_key('o'); break;
-   default: if((key>='a' && key<='z')||(key>='A' && key<='Z')) mplayer_put_key(key);
+   default: if((key>='a' && key<='z')||(key>='A' && key<='Z')||
+	       (key>='0' && key<='9')) mplayer_put_key(key);
   }
 
 }
--- a/mplayer.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/mplayer.c	Mon Aug 13 11:08:18 2001 +0000
@@ -1216,6 +1216,10 @@
   vdecode_time=video_time_usage-vdecode_time;
 
 //------------------------ frame decoded. --------------------
+//------------------------ add OSD to frame contents ---------
+#ifndef USE_LIBVO2
+    video_out->draw_osd();
+#endif
 
     // Increase video timers:
     sh_video->num_frames+=frame_time;
@@ -1255,7 +1259,7 @@
 	      printf("\nstill dropping, %.2f\n", time_frame);
 	  }
       }
-
+      video_out->check_events(); // check events AST
     } else {
       // It's time to sleep...
       current_module="sleep";
@@ -1304,6 +1308,7 @@
 #ifdef USE_LIBVO2
         if(blit_frame) vo2_flip(video_out,0);
 #else
+	video_out->check_events();
         if(blit_frame) video_out->flip_page();
 #endif
 //        usec_sleep(50000); // test only!
@@ -1532,16 +1537,19 @@
     case 'x':
       sub_delay += 0.1;
       break;
+    case '9': c='/'; goto _jump1;
+    case '0': c='*';
+_jump1:
     case '*':
     case '/': {
         float mixer_l, mixer_r;
         mixer_getvolume( &mixer_l,&mixer_r );
         if(c=='*'){
-            mixer_l++; if ( mixer_l > 100 ) mixer_l = 100;
-            mixer_r++; if ( mixer_r > 100 ) mixer_r = 100;
+            if ( ++mixer_l > 100 ) mixer_l = 100;
+            if ( ++mixer_r > 100 ) mixer_r = 100;
         } else {
-            mixer_l--; if ( mixer_l < 0 ) mixer_l = 0;
-            mixer_r--; if ( mixer_r < 0 ) mixer_r = 0;
+            if ( --mixer_l < 0 ) mixer_l = 0;
+            if ( --mixer_r < 0 ) mixer_r = 0;
         }
         mixer_setvolume( mixer_l,mixer_r );
 
@@ -1563,9 +1571,9 @@
     case '1':
     case '2':
         if(c=='2'){
-	    if ( v_cont++ > 100 ) v_cont = 100;
+	    if ( ++v_cont > 100 ) v_cont = 100;
         } else {
-    	    if ( v_cont-- < 0 ) v_cont = 0;	    
+    	    if ( --v_cont < 0 ) v_cont = 0;	    
         }
 	if(set_video_colors(sh_video,"Contrast",v_cont)){
 #ifdef USE_OSD
@@ -1582,9 +1590,9 @@
     case '3':
     case '4':
         if(c=='4'){
-	    if ( v_bright++ > 100 ) v_bright = 100;
+	    if ( ++v_bright > 100 ) v_bright = 100;
         } else {
-    	    if ( v_bright-- < 0 ) v_bright = 0;	    
+    	    if ( --v_bright < 0 ) v_bright = 0;	    
         }
 	if(set_video_colors(sh_video,"Brightness",v_bright)){
 #ifdef USE_OSD
@@ -1601,9 +1609,9 @@
     case '5':
     case '6':
         if(c=='6'){
-	    if ( v_hue++ > 100 ) v_hue = 100;
+	    if ( ++v_hue > 100 ) v_hue = 100;
         } else {
-    	    if ( v_hue-- < 0 ) v_hue = 0;	    
+    	    if ( --v_hue < 0 ) v_hue = 0;	    
         }
 	if(set_video_colors(sh_video,"Hue",v_hue)){
 #ifdef USE_OSD
@@ -1620,9 +1628,9 @@
     case '7':
     case '8':
         if(c=='8'){
-	    if ( v_saturation++ > 100 ) v_saturation = 100;
+	    if ( ++v_saturation > 100 ) v_saturation = 100;
         } else {
-    	    if ( v_saturation-- < 0 ) v_saturation = 0;	    
+    	    if ( --v_saturation < 0 ) v_saturation = 0;	    
         }
 	if(set_video_colors(sh_video,"Saturation",v_saturation)){
 #ifdef USE_OSD
--- a/subreader.c	Mon Aug 13 10:38:01 2001 +0000
+++ b/subreader.c	Mon Aug 13 11:08:18 2001 +0000
@@ -437,6 +437,7 @@
 
 char * sub_filename(char* path,  char * fname )
 {
+ extern int sub_utf8;
  char * sub_name1;
  char * sub_name2;
  char * aviptr1, * aviptr2, * tmp;
@@ -444,7 +445,9 @@
  FILE * f;
  int pos=0;
  char * sub_exts[] = 
-  { ".sub",
+  { ".utf",
+    ".UTF",
+    ".sub",
     ".SUB",
     ".srt",
     ".SRT",
@@ -484,6 +487,7 @@
    if((f=fopen( sub_name,"rt" ))) {
      fclose( f );
      printf( "SUB: Detected sub file: %s\n",sub_name );
+     if (i<2) sub_utf8=1;
      return sub_name;
    }
   }