From ca99c8dc89eba6bb2ebb330beaccea304a930da0 Mon Sep 17 00:00:00 2001 From: atlka Date: Mon, 13 Aug 2001 11:08:18 +0000 Subject: changes according to -utf8 option, draw_osd() function added git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1502 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cfg-mplayer.h | 3 + libvo/sub.c | 232 ++++++++++++++++++++++++++++----------------- libvo/video_out.h | 5 + libvo/video_out_internal.h | 1 + libvo/vo_3dfx.c | 4 + libvo/vo_dga.c | 8 +- libvo/vo_fbdev.c | 7 +- libvo/vo_fsdga.c | 6 +- libvo/vo_ggi.c | 7 +- libvo/vo_gl.c | 5 +- libvo/vo_md5.c | 4 + libvo/vo_mga.c | 6 +- libvo/vo_null.c | 4 + libvo/vo_png.c | 4 + libvo/vo_sdl.c | 14 +-- libvo/vo_svga.c | 18 ++-- libvo/vo_syncfb.c | 5 +- libvo/vo_x11.c | 8 +- libvo/vo_xmga.c | 8 +- libvo/vo_xv.c | 12 ++- libvo/x11_common.c | 3 +- mplayer.c | 34 ++++--- subreader.c | 6 +- 23 files changed, 261 insertions(+), 143 deletions(-) diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 37d82468de..b277989081 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -35,6 +35,7 @@ extern int vo_dbpp; #ifdef USE_SUB extern int sub_unicode; +extern int sub_utf8; #endif #ifdef USE_OSD @@ -92,6 +93,8 @@ struct config conf[]={ {"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}, diff --git a/libvo/sub.c b/libvo/sub.c index 45521da278..610b0d48c0 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -6,17 +6,19 @@ font_desc_t* vo_font=NULL; 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;jfont[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 @@ static void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, i 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 @@ static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y 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 @@ static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y 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 @@ static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y vo_font->pic_a[font]->w); x+=vo_font->width[c]; - for(i=0;ifont[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_END;font=vo_font->font[c]; - if(font>=0) + 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_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 @@ static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y 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; - - // too long lines divide into smaller ones - for(i=0;ilines;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; - - for(j=0;j=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 (dxs0) - { - xsize=lastxsize; - j=lastStripPosition; - y-=vo_font->height; - previousStrip=lastStripPosition; - xsize=-vo_font->charspace; - } - } - } - - - for(i=0;ilines;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=0x80)) c=(c<<8)+text[++j]; - w = vo_font->width[c]; - if (c==' ' && dxs>xsize) - { - lastStripPosition=j; - lastxsize=xsize; +#define MAX_UCS 1600 +#define MAX_UCSLINES 16 + +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; + + 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 (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 (dxs0){ + 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 ((dxs0) || j==len-1) @@ -179,8 +217,28 @@ static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, i 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; diff --git a/libvo/video_out.h b/libvo/video_out.h index b77d18a659..5fe44a4dfd 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -72,6 +72,11 @@ typedef struct vo_functions_s */ 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! */ diff --git a/libvo/video_out_internal.h b/libvo/video_out_internal.h index 2f4895e247..9c8aa733a3 100644 --- a/libvo/video_out_internal.h +++ b/libvo/video_out_internal.h @@ -37,6 +37,7 @@ static uint32_t query_format(uint32_t format); get_info,\ draw_frame,\ draw_slice,\ + draw_osd,\ flip_page,\ check_events,\ uninit,\ diff --git a/libvo/vo_3dfx.c b/libvo/vo_3dfx.c index d9f3419c0d..e0e7cce278 100644 --- a/libvo/vo_3dfx.c +++ b/libvo/vo_3dfx.c @@ -450,6 +450,10 @@ draw_slice(uint8_t *src[], uint32_t slice_num) return 0; } +static void draw_osd(void) +{ +} + static void flip_page(void) { diff --git a/libvo/vo_dga.c b/libvo/vo_dga.c index b212ff7664..dcaa2a1138 100644 --- a/libvo/vo_dga.c +++ b/libvo/vo_dga.c @@ -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 @@ static void check_events(void) #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 @@ static void flip_page( void ){ #endif vo_dga_dbf_current = 1 - vo_dga_dbf_current; } - check_events(); } //--------------------------------------------------------- diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c index 193d419cf2..6a2cda5026 100644 --- a/libvo/vo_fbdev.c +++ b/libvo/vo_fbdev.c @@ -1130,10 +1130,13 @@ static void put_frame(void) } } -static void flip_page(void) +static void draw_osd(void) { vo_draw_text(in_width, in_height, draw_alpha); - check_events(); +} + +static void flip_page(void) +{ put_frame(); } diff --git a/libvo/vo_fsdga.c b/libvo/vo_fsdga.c index 3c636deafa..ab5f26f5f6 100644 --- a/libvo/vo_fsdga.c +++ b/libvo/vo_fsdga.c @@ -173,10 +173,12 @@ static void check_events(void) 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]; diff --git a/libvo/vo_ggi.c b/libvo/vo_ggi.c index c670fe176d..f10b64f8dc 100644 --- a/libvo/vo_ggi.c +++ b/libvo/vo_ggi.c @@ -524,12 +524,15 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, } #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); } diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 10c334d1fd..990671dcc2 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -332,13 +332,14 @@ static void check_events(void) 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); diff --git a/libvo/vo_md5.c b/libvo/vo_md5.c index 9938b551f0..cc904c051d 100644 --- a/libvo/vo_md5.c +++ b/libvo/vo_md5.c @@ -49,6 +49,10 @@ get_info(void) return &vo_info; } +static void draw_osd(void) +{ +} + static void flip_page (void) { char buf2[100]; diff --git a/libvo/vo_mga.c b/libvo/vo_mga.c index 8c92026890..45f7e67d22 100644 --- a/libvo/vo_mga.c +++ b/libvo/vo_mga.c @@ -113,9 +113,13 @@ uninit(void) printf("vo: uninit!\n"); } -static void flip_page(void) +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_mga_flip_page(); } diff --git a/libvo/vo_null.c b/libvo/vo_null.c index 145e092195..b1d2e9a522 100644 --- a/libvo/vo_null.c +++ b/libvo/vo_null.c @@ -45,6 +45,10 @@ static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int return 0; } +static void draw_osd(void) +{ +} + static void flip_page(void) { diff --git a/libvo/vo_png.c b/libvo/vo_png.c index 851d0d4d95..c6ff61c0d0 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -221,6 +221,10 @@ static uint32_t draw_frame(uint8_t * src[]) } +static void draw_osd(void) +{ +} + static void flip_page (void) { char buf[100]; diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index 43de288ffb..7b7a0fc754 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -1152,9 +1152,15 @@ static void check_events (void) } } +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 @@ static void flip_page (void) { 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: diff --git a/libvo/vo_svga.c b/libvo/vo_svga.c index ca251086f2..7f7929261e 100644 --- a/libvo/vo_svga.c +++ b/libvo/vo_svga.c @@ -509,7 +509,8 @@ static uint32_t draw_slice(uint8_t *image[], int stride[], 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 @@ static void flip_page(void) { } vo_draw_text(WIDTH, HEIGHT, draw_alpha); +} + +static void flip_page(void) { gl_copyscreen(screen); } @@ -538,13 +542,9 @@ static void uninit(void) { 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); } } diff --git a/libvo/vo_syncfb.c b/libvo/vo_syncfb.c index e01eb3d3f5..38d6487b54 100644 --- a/libvo/vo_syncfb.c +++ b/libvo/vo_syncfb.c @@ -272,8 +272,9 @@ draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) return 0; } - - +static void draw_osd(void) +{ +} static void flip_page(void) diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c index 41ef08c857..f6bda68162 100644 --- a/libvo/vo_x11.c +++ b/libvo/vo_x11.c @@ -373,7 +373,6 @@ static void Display_Image( XImage *myximage,uint8_t *ImageData ) 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 @@ static void Display_Image( XImage *myximage,uint8_t *ImageData ) 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_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned } } +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 ) diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c index a640c0ea5f..790f1ce6f0 100644 --- a/libvo/vo_xmga.c +++ b/libvo/vo_xmga.c @@ -161,6 +161,9 @@ static void check_events(void) } +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 @@ static void flip_page(void){ 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 ) diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 4c2c1cf224..e748ee6f32 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -328,16 +328,20 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned } +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; } diff --git a/libvo/x11_common.c b/libvo/x11_common.c index d739c230f0..2f0b6ab52a 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -137,7 +137,8 @@ void vo_x11_putkey(int key){ 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); } } diff --git a/mplayer.c b/mplayer.c index 44939562c1..1ec4099ab2 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1216,6 +1216,10 @@ if(1) 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 @@ if(1) 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 @@ if(1) #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 @@ if(auto_quality>0){ 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 @@ if(auto_quality>0){ 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 @@ if(auto_quality>0){ 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 @@ if(auto_quality>0){ 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 @@ if(auto_quality>0){ 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 diff --git a/subreader.c b/subreader.c index ed01176016..132b1f7184 100644 --- a/subreader.c +++ b/subreader.c @@ -437,6 +437,7 @@ char * strreplace( char * in,char * what,char * whereof ) 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 @@ char * sub_filename(char* path, char * fname ) FILE * f; int pos=0; char * sub_exts[] = - { ".sub", + { ".utf", + ".UTF", + ".sub", ".SUB", ".srt", ".SRT", @@ -484,6 +487,7 @@ char * sub_filename(char* path, char * fname ) 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; } } -- cgit v1.2.3