changes according to -utf8 option, draw_osd() function added

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1502 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
atlka 2001-08-13 11:08:18 +00:00
parent eefce080f0
commit ca99c8dc89
23 changed files with 257 additions and 139 deletions

View File

@ -35,6 +35,7 @@ extern int vo_dbpp;
#ifdef USE_SUB #ifdef USE_SUB
extern int sub_unicode; extern int sub_unicode;
extern int sub_utf8;
#endif #endif
#ifdef USE_OSD #ifdef USE_OSD
@ -92,6 +93,8 @@ struct config conf[]={
{"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0}, {"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0},
{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1}, {"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1},
{"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0}, {"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 #endif
#ifdef USE_OSD #ifdef USE_OSD
{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0}, {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0},

View File

@ -6,17 +6,19 @@ font_desc_t* vo_font=NULL;
unsigned char* vo_osd_text="00:00:00"; unsigned char* vo_osd_text="00:00:00";
int sub_unicode=0; 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)){ 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)){
int len=strlen(vo_osd_text); unsigned char *cp=vo_osd_text;
int j; int c;
int font;
int y=10; int y=10;
int x=20; int x=20;
for(j=0;j<len;j++){ while (*cp){
int c=vo_osd_text[j]; c=*cp;
int font=vo_font->font[c]; cp++;
if(font>=0) if ((font=vo_font->font[c])>=0)
draw_alpha(x,y, draw_alpha(x,y,
vo_font->width[c], vo_font->width[c],
vo_font->pic_a[font]->h, 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_type=-1;
int vo_osd_progbar_value=100; // 0..255 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 i;
int y=dys/2; int y=(dys-vo_font->height)/2;
int x; int x;
int c,font; int c,font;
int width=(dxs*2/3-vo_font->width[0x10]-vo_font->width[0x12]); 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; x=(dxs-width)/2;
// printf("osd.progbar width=%d xpos=%d\n",width,x); // printf("osd.progbar width=%d xpos=%d\n",width,x);
c=vo_osd_progbar_type;font=vo_font->font[c]; c=vo_osd_progbar_type;
if(vo_osd_progbar_type>0 && font>=0) if(vo_osd_progbar_type>0 && (font=vo_font->font[c])>=0)
draw_alpha(x-vo_font->width[c]-vo_font->spacewidth,y, draw_alpha(x-vo_font->width[c]-vo_font->spacewidth,y,
vo_font->width[c], vo_font->width[c],
vo_font->pic_a[font]->h, 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]->bmp+vo_font->start[c],
vo_font->pic_a[font]->w); vo_font->pic_a[font]->w);
c=OSD_PB_START;font=vo_font->font[c]; c=OSD_PB_START;
if(font>=0) if ((font=vo_font->font[c])>=0)
draw_alpha(x,y, draw_alpha(x,y,
vo_font->width[c], vo_font->width[c],
vo_font->pic_a[font]->h, 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); vo_font->pic_a[font]->w);
x+=vo_font->width[c]; x+=vo_font->width[c];
for(i=0;i<elems;i++){ c=OSD_PB_0;
c=(i<mark)?OSD_PB_0:OSD_PB_1;font=vo_font->font[c]; if ((font=vo_font->font[c])>=0)
if(font>=0) for (i=mark;i--;){
draw_alpha(x,y, draw_alpha(x,y,
vo_font->width[c], vo_font->width[c],
vo_font->pic_a[font]->h, vo_font->pic_a[font]->h,
vo_font->pic_b[font]->bmp+vo_font->start[c], 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]->bmp+vo_font->start[c],
vo_font->pic_a[font]->w); vo_font->pic_a[font]->w);
x+=vo_font->width[c]; x+=vo_font->width[c];
} }
c=OSD_PB_END;font=vo_font->font[c]; c=OSD_PB_1;
if(font>=0) 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, draw_alpha(x,y,
vo_font->width[c], vo_font->width[c],
vo_font->pic_a[font]->h, 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; 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)){ #define MAX_UCS 1600
int i; #define MAX_UCSLINES 16
int y;
y=dys-(1+vo_sub->lines-1)*vo_font->height-10;
// too long lines divide into smaller ones 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)){
for(i=0;i<vo_sub->lines;i++){ static int utbl[MAX_UCS+1];
unsigned char* text=vo_sub->text[i]; static int xtbl[MAX_UCSLINES];
int len=strlen(text); static int lines;
int j; static subtitle *memsub=NULL;
int xsize=-vo_font->charspace; static int memy;
int lastStripPosition=-1; static int memdxs;
int previousStrip=0; static int memdys;
int lastxsize=0; unsigned char *t;
int i;
int j;
int k;
int l;
int x;
int y;
for(j=0;j<len;j++){ int c;
int c=text[j]; int len;
int w; int line;
if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j]; int font;
w = vo_font->width[c]; int lastStripPosition;
if (text[j]==' ' && dxs>xsize) int xsize;
{ int lastxsize;
lastStripPosition=j; int lastk;
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;
}
}
}
if ((memsub!=vo_sub)||(memdxs!=dxs)||(memdys!=dys)){
memsub=vo_sub;
memdxs=dxs;
memdys=dys;
for(i=0;i<vo_sub->lines;i++){ memy=dys-vo_font->height/4;
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; // too long lines divide into smaller ones
int previousStrip=0; i=k=lines=0; l=vo_sub->lines;
int lastxsize=xsize; while (l--){
t=vo_sub->text[i++];
len=strlen(t)-1;
xsize=lastxsize=-vo_font->charspace;
lastStripPosition=-1;
for(j=0;j<len;j++){ for (j=0;j<=len;j++){
int c=text[j]; if ((c=t[j])>=0x80){
int w; if (sub_unicode)
if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j]; c = (c<<8) + t[++j];
w = vo_font->width[c]; else
if (c==' ' && dxs>xsize) if (sub_utf8){
{ if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/
lastStripPosition=j; c = (c & 0x1f)<<6 | (t[++j] & 0x3f);
lastxsize=xsize; 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; xsize+=w+vo_font->charspace;
if ((dxs<xsize && lastStripPosition>0) || j==len-1) if ((dxs<xsize && lastStripPosition>0) || 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; 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; static int draw_alpha_init_flag=0;

View File

@ -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); 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! * Blit/Flip buffer to the screen. Must be called after each frame!
*/ */

View File

@ -37,6 +37,7 @@ static uint32_t query_format(uint32_t format);
get_info,\ get_info,\
draw_frame,\ draw_frame,\
draw_slice,\ draw_slice,\
draw_osd,\
flip_page,\ flip_page,\
check_events,\ check_events,\
uninit,\ uninit,\

View File

@ -450,6 +450,10 @@ draw_slice(uint8_t *src[], uint32_t slice_num)
return 0; return 0;
} }
static void draw_osd(void)
{
}
static void static void
flip_page(void) flip_page(void)
{ {

View File

@ -23,6 +23,9 @@
* - works only on x86 architectures * - works only on x86 architectures
* *
* $Log$ * $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 * Revision 1.29 2001/07/16 18:41:52 jkeil
* vo_dga doesn't compile on non-x86 architecture due to x86 asm usage. * 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" #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 ){ static void flip_page( void ){
if(vo_dga_dbf_mem_offset != 0){ if(vo_dga_dbf_mem_offset != 0){
vo_draw_text(vo_dga_src_width,vo_dga_src_height,draw_alpha);
#ifdef HAVE_DGA2 #ifdef HAVE_DGA2
XDGASetViewport (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), XDGASetViewport (vo_dga_dpy, XDefaultScreen(vo_dga_dpy),
@ -539,7 +544,6 @@ static void flip_page( void ){
#endif #endif
vo_dga_dbf_current = 1 - vo_dga_dbf_current; vo_dga_dbf_current = 1 - vo_dga_dbf_current;
} }
check_events();
} }
//--------------------------------------------------------- //---------------------------------------------------------

View File

@ -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); vo_draw_text(in_width, in_height, draw_alpha);
check_events(); }
static void flip_page(void)
{
put_frame(); put_frame();
} }

View File

@ -173,10 +173,12 @@ static void check_events(void)
int e=vo_x11_check_events(vo_dga_dpy); int e=vo_x11_check_events(vo_dga_dpy);
} }
static void flip_page( void ){ static void draw_osd(void)
check_events(); {
// printf("vo_dga: In flippage\n"); }
static void flip_page( void ){
// printf("vo_dga: In flippage\n");
} }
static unsigned int pix_buf_y[4][2048]; static unsigned int pix_buf_y[4][2048];

View File

@ -524,12 +524,15 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
} }
#endif #endif
static void flip_page(void) static void draw_osd(void)
{ {
check_events();
#ifdef GGI_OSD #ifdef GGI_OSD
vo_draw_text(ggi_conf.width, ggi_conf.height, draw_alpha); vo_draw_text(ggi_conf.width, ggi_conf.height, draw_alpha);
#endif #endif
}
static void flip_page(void)
{
ggiFlush(ggi_conf.vis); ggiFlush(ggi_conf.vis);
} }

View File

@ -332,13 +332,14 @@ static void check_events(void)
if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight); if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight);
} }
static void draw_osd(void)
{
}
static void static void
flip_page(void) flip_page(void)
{ {
check_events();
// glEnable(GL_TEXTURE_2D); // glEnable(GL_TEXTURE_2D);
// glBindTexture(GL_TEXTURE_2D, texture_id); // glBindTexture(GL_TEXTURE_2D, texture_id);

View File

@ -49,6 +49,10 @@ get_info(void)
return &vo_info; return &vo_info;
} }
static void draw_osd(void)
{
}
static void flip_page (void) static void flip_page (void)
{ {
char buf2[100]; char buf2[100];

View File

@ -113,9 +113,13 @@ uninit(void)
printf("vo: uninit!\n"); 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); vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);
}
static void flip_page(void)
{
vo_mga_flip_page(); vo_mga_flip_page();
} }

View File

@ -45,6 +45,10 @@ static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int
return 0; return 0;
} }
static void draw_osd(void)
{
}
static void static void
flip_page(void) flip_page(void)
{ {

View File

@ -221,6 +221,10 @@ static uint32_t draw_frame(uint8_t * src[])
} }
static void draw_osd(void)
{
}
static void flip_page (void) static void flip_page (void)
{ {
char buf[100]; char buf[100];

View File

@ -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 * params : mode == index of the desired fullscreen mode
* returns : doesn't return * returns : doesn't return
@ -1164,12 +1170,6 @@ static void flip_page (void)
{ {
struct sdl_priv_s *priv = &sdl_priv; 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) { switch(priv->format) {
case IMGFMT_RGB15: case IMGFMT_RGB15:
case IMGFMT_BGR15: case IMGFMT_BGR15:

View File

@ -509,7 +509,8 @@ static uint32_t draw_slice(uint8_t *image[], int stride[],
return (0); return (0);
} }
static void flip_page(void) { static void draw_osd(void)
{
if (y_pos) { if (y_pos) {
gl_fillbox(0, 0, WIDTH, y_pos, 0); gl_fillbox(0, 0, WIDTH, y_pos, 0);
gl_fillbox(0, HEIGHT - y_pos, 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); vo_draw_text(WIDTH, HEIGHT, draw_alpha);
}
static void flip_page(void) {
gl_copyscreen(screen); gl_copyscreen(screen);
} }
@ -538,13 +542,9 @@ static void uninit(void) {
free(scalebuf); free(scalebuf);
if (yuvbuf != NULL) if (yuvbuf != NULL)
free(yuvbuf); free(yuvbuf);
if (modelist != NULL) { while (modelist != NULL) {
while (modelist->next != NULL) { list=modelist;
list = modelist; modelist=modelist->next;
while (list->next != NULL) free(list);
list = list->next;
free(list);
}
free(modelist);
} }
} }

View File

@ -272,8 +272,9 @@ draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
return 0; return 0;
} }
static void draw_osd(void)
{
}
static void static void
flip_page(void) flip_page(void)

View File

@ -373,7 +373,6 @@ static void Display_Image( XImage *myximage,uint8_t *ImageData )
0,0, 0,0,
( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2, ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
myximage->width,myximage->height,True ); myximage->width,myximage->height,True );
XFlush( mDisplay );
} }
else else
#endif #endif
@ -382,7 +381,6 @@ static void Display_Image( XImage *myximage,uint8_t *ImageData )
0,0, 0,0,
( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2, ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
myximage->width,myximage->height ); myximage->width,myximage->height );
XFlush( mDisplay );
} }
#endif #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 ){ static void flip_page( void ){
vo_draw_text(image_width,image_height,draw_alpha);
check_events();
Display_Image( myximage,ImageData ); 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 ) static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y )

View File

@ -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){ static void flip_page(void){
#ifdef SHOW_TIME #ifdef SHOW_TIME
unsigned int t; unsigned int t;
@ -170,10 +173,7 @@ static void flip_page(void){
timer=t; timer=t;
#endif #endif
vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha); vo_mga_flip_page();
check_events();
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 ) 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 )

View File

@ -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) 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], XvShmPutImage(mDisplay, xv_port, mywindow, mygc, xvimage[current_buf],
0, 0, image_width, image_height, 0, 0, image_width, image_height,
drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight), drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
False); False);
XFlush(mDisplay); if (num_buffers>1){
current_buf=(current_buf+1)%num_buffers; current_buf=(current_buf+1)%num_buffers;
XFlush(mDisplay);
} else
XSync(mDisplay, False);
return; return;
} }

View File

@ -137,7 +137,8 @@ void vo_x11_putkey(int key){
case wsM: mplayer_put_key('m'); break; case wsM: mplayer_put_key('m'); break;
case wso: case wso:
case wsO: mplayer_put_key('o'); break; 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);
} }
} }

View File

@ -1216,6 +1216,10 @@ if(1)
vdecode_time=video_time_usage-vdecode_time; vdecode_time=video_time_usage-vdecode_time;
//------------------------ frame decoded. -------------------- //------------------------ frame decoded. --------------------
//------------------------ add OSD to frame contents ---------
#ifndef USE_LIBVO2
video_out->draw_osd();
#endif
// Increase video timers: // Increase video timers:
sh_video->num_frames+=frame_time; sh_video->num_frames+=frame_time;
@ -1255,7 +1259,7 @@ if(1)
printf("\nstill dropping, %.2f\n", time_frame); printf("\nstill dropping, %.2f\n", time_frame);
} }
} }
video_out->check_events(); // check events AST
} else { } else {
// It's time to sleep... // It's time to sleep...
current_module="sleep"; current_module="sleep";
@ -1304,6 +1308,7 @@ if(1)
#ifdef USE_LIBVO2 #ifdef USE_LIBVO2
if(blit_frame) vo2_flip(video_out,0); if(blit_frame) vo2_flip(video_out,0);
#else #else
video_out->check_events();
if(blit_frame) video_out->flip_page(); if(blit_frame) video_out->flip_page();
#endif #endif
// usec_sleep(50000); // test only! // usec_sleep(50000); // test only!
@ -1532,16 +1537,19 @@ if(auto_quality>0){
case 'x': case 'x':
sub_delay += 0.1; sub_delay += 0.1;
break; break;
case '9': c='/'; goto _jump1;
case '0': c='*';
_jump1:
case '*': case '*':
case '/': { case '/': {
float mixer_l, mixer_r; float mixer_l, mixer_r;
mixer_getvolume( &mixer_l,&mixer_r ); mixer_getvolume( &mixer_l,&mixer_r );
if(c=='*'){ if(c=='*'){
mixer_l++; if ( mixer_l > 100 ) mixer_l = 100; if ( ++mixer_l > 100 ) mixer_l = 100;
mixer_r++; if ( mixer_r > 100 ) mixer_r = 100; if ( ++mixer_r > 100 ) mixer_r = 100;
} else { } else {
mixer_l--; if ( mixer_l < 0 ) mixer_l = 0; if ( --mixer_l < 0 ) mixer_l = 0;
mixer_r--; if ( mixer_r < 0 ) mixer_r = 0; if ( --mixer_r < 0 ) mixer_r = 0;
} }
mixer_setvolume( mixer_l,mixer_r ); mixer_setvolume( mixer_l,mixer_r );
@ -1563,9 +1571,9 @@ if(auto_quality>0){
case '1': case '1':
case '2': case '2':
if(c=='2'){ if(c=='2'){
if ( v_cont++ > 100 ) v_cont = 100; if ( ++v_cont > 100 ) v_cont = 100;
} else { } else {
if ( v_cont-- < 0 ) v_cont = 0; if ( --v_cont < 0 ) v_cont = 0;
} }
if(set_video_colors(sh_video,"Contrast",v_cont)){ if(set_video_colors(sh_video,"Contrast",v_cont)){
#ifdef USE_OSD #ifdef USE_OSD
@ -1582,9 +1590,9 @@ if(auto_quality>0){
case '3': case '3':
case '4': case '4':
if(c=='4'){ if(c=='4'){
if ( v_bright++ > 100 ) v_bright = 100; if ( ++v_bright > 100 ) v_bright = 100;
} else { } else {
if ( v_bright-- < 0 ) v_bright = 0; if ( --v_bright < 0 ) v_bright = 0;
} }
if(set_video_colors(sh_video,"Brightness",v_bright)){ if(set_video_colors(sh_video,"Brightness",v_bright)){
#ifdef USE_OSD #ifdef USE_OSD
@ -1601,9 +1609,9 @@ if(auto_quality>0){
case '5': case '5':
case '6': case '6':
if(c=='6'){ if(c=='6'){
if ( v_hue++ > 100 ) v_hue = 100; if ( ++v_hue > 100 ) v_hue = 100;
} else { } else {
if ( v_hue-- < 0 ) v_hue = 0; if ( --v_hue < 0 ) v_hue = 0;
} }
if(set_video_colors(sh_video,"Hue",v_hue)){ if(set_video_colors(sh_video,"Hue",v_hue)){
#ifdef USE_OSD #ifdef USE_OSD
@ -1620,9 +1628,9 @@ if(auto_quality>0){
case '7': case '7':
case '8': case '8':
if(c=='8'){ if(c=='8'){
if ( v_saturation++ > 100 ) v_saturation = 100; if ( ++v_saturation > 100 ) v_saturation = 100;
} else { } else {
if ( v_saturation-- < 0 ) v_saturation = 0; if ( --v_saturation < 0 ) v_saturation = 0;
} }
if(set_video_colors(sh_video,"Saturation",v_saturation)){ if(set_video_colors(sh_video,"Saturation",v_saturation)){
#ifdef USE_OSD #ifdef USE_OSD

View File

@ -437,6 +437,7 @@ char * strreplace( char * in,char * what,char * whereof )
char * sub_filename(char* path, char * fname ) char * sub_filename(char* path, char * fname )
{ {
extern int sub_utf8;
char * sub_name1; char * sub_name1;
char * sub_name2; char * sub_name2;
char * aviptr1, * aviptr2, * tmp; char * aviptr1, * aviptr2, * tmp;
@ -444,7 +445,9 @@ char * sub_filename(char* path, char * fname )
FILE * f; FILE * f;
int pos=0; int pos=0;
char * sub_exts[] = char * sub_exts[] =
{ ".sub", { ".utf",
".UTF",
".sub",
".SUB", ".SUB",
".srt", ".srt",
".SRT", ".SRT",
@ -484,6 +487,7 @@ char * sub_filename(char* path, char * fname )
if((f=fopen( sub_name,"rt" ))) { if((f=fopen( sub_name,"rt" ))) {
fclose( f ); fclose( f );
printf( "SUB: Detected sub file: %s\n",sub_name ); printf( "SUB: Detected sub file: %s\n",sub_name );
if (i<2) sub_utf8=1;
return sub_name; return sub_name;
} }
} }