Mercurial > mplayer.hg
changeset 1852:58dd326fcc4a
fix xshape, mixer, fullscreen, etc
author | pontscho |
---|---|
date | Tue, 04 Sep 2001 15:21:00 +0000 |
parents | 2ce062156969 |
children | f380ebc3ba89 |
files | Gui/mplayer/play.c Gui/mplayer/sw.h Gui/skin/cut.c Gui/skin/cut.h Gui/skin/skin.c Gui/wm/ws.c libvo/sub.c libvo/vo_x11.c libvo/vo_xmga.c libvo/vo_xv.c mplayer.c |
diffstat | 11 files changed, 152 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/mplayer/play.c Mon Sep 03 16:32:03 2001 +0000 +++ b/Gui/mplayer/play.c Tue Sep 04 15:21:00 2001 +0000 @@ -66,8 +66,8 @@ ( mplShMem->Playing == 1 ) ) return; if ( mplShMem->Playing == 2 ) { mplPause(); return; } mplShMem->Playing=1; - wsClearWindow( appMPlayer.subWindow ); mplSubRender=0; + wsPostRedisplay( &appMPlayer.subWindow ); } void mplPause( void ) @@ -90,7 +90,7 @@ void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) { - printf( "----resize---> %dx%d --- \n",width,height ); +// printf( "----resize---> %dx%d --- \n",width,height ); vo_setwindowsize( width,height ); vo_resize=1; }
--- a/Gui/mplayer/sw.h Mon Sep 03 16:32:03 2001 +0000 +++ b/Gui/mplayer/sw.h Tue Sep 04 15:21:00 2001 +0000 @@ -2,25 +2,30 @@ // sub window int mplSubRender = 1; +int SubVisible = 0; void mplSubDraw( wsParamDisplay ) { + if ( appMPlayer.subWindow.State == wsFocused || + appMPlayer.subWindow.State == + + ) SubVisible=0; + + if ( !appMPlayer.subWindow.Mapped || + appMPlayer.subWindow.Visible == wsWindowNotVisible ) return; -// if ( ( appMPlayer.subWindow.Visible == wsWindowNotVisible )|| -// ( appMPlayer.subWindow.State != wsWindowExpose ) ) return; - - if ( ( mplShMem->Playing ) )//&&( appMPlayer.subWindow.State == wsWindowExpose ) ) + if ( mplShMem->Playing ) { + wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); + wsClearWindow( appMPlayer.subWindow ); vo_expose=1; mplSubRender=0; } if ( mplSubRender ) { - wsSetForegroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); - XFillRectangle( wsDisplay,appMPlayer.subWindow.WindowID,appMPlayer.subWindow.wGC,0,0, - appMPlayer.subWindow.Width,appMPlayer.subWindow.Height ); - if ( appMPlayer.sub.Bitmap.Image ) + wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); + if ( appMPlayer.sub.Bitmap.Image ) { wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); wsPutImage( &appMPlayer.subWindow ); @@ -67,6 +72,7 @@ } break; case wsRLMouseButton: + if ( ( !mplSubMoved )&&( !( SubVisible++%2 ) ) ) wsMoveTopWindow( &appMPlayer.mainWindow ); msButton=0; mplSubMoved=0; break;
--- a/Gui/skin/cut.c Mon Sep 03 16:32:03 2001 +0000 +++ b/Gui/skin/cut.c Tue Sep 04 15:21:00 2001 +0000 @@ -14,8 +14,23 @@ out[c]=0; } +int cutItemToInt( char * in,char sep,int num ) +{ + char tmp[512]; + cutItem( in,tmp,sep,num ); + return atoi( tmp ); +} + +float cutItemToFloat( char * in,char sep,int num ) +{ + char tmp[512]; + cutItem( in,tmp,sep,num ); + return atof( tmp ); +} + void cutChunk( char * in,char * s1 ) { cutItem( in,s1,'=',0 ); memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) ); } +
--- a/Gui/skin/cut.h Mon Sep 03 16:32:03 2001 +0000 +++ b/Gui/skin/cut.h Tue Sep 04 15:21:00 2001 +0000 @@ -1,9 +1,10 @@ -#ifndef _MYCUTS -#define _MYCUTS +#ifndef _CUT_H +#define _CUT_H -extern void cutItem( char * in,char * out,char sep,int num ); +extern void cutItem( char * in,char * out,char sep,int num ); +extern int cutItemToInt( char * in,char sep,int num ); +extern float cutItemToFloat( char * in,char sep,int num ); +extern void cutChunk( char * in,char * s1 ); -extern void cutChunk( char * in,char * s1 ); - -#endif \ No newline at end of file +#endif
--- a/Gui/skin/skin.c Mon Sep 03 16:32:03 2001 +0000 +++ b/Gui/skin/skin.c Tue Sep 04 15:21:00 2001 +0000 @@ -10,12 +10,12 @@ #include "../language.h" #include "../../config.h" -char SkinDir[] = "/.mplayer/Skin/"; -char * Skin; +//char SkinDir[] = "/.mplayer/Skin/"; +//char * Skin; listItems * skinAppMPlayer = &appMPlayer; -listItems * skinAppTV = &appTV; -listItems * skinAppRadio = &appRadio; +//listItems * skinAppTV = &appTV; +//listItems * skinAppRadio = &appRadio; int linenumber; @@ -118,8 +118,8 @@ CHECKWINLIST( "base" ); cutItem( in,fname,',',0 ); - cutItem( in,tmp,',',1 ); x=atoi( tmp ); - cutItem( in,tmp,',',2 ); y=atoi( tmp ); + x=cutItemToInt( in,',',1 ); + y=cutItemToInt( in,',',2 ); #ifdef DEBUG dbprintf( 3,"\n[skin] base: %s x: %d y: %d\n",fname,x,y ); #endif @@ -140,18 +140,19 @@ defList->main.Mask.Image=(char *)calloc( 1,defList->main.Mask.ImageSize ); if ( defList->main.Mask.Image == NULL ) message( True,langNEMFMM ); { - int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; + int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1; buf=(unsigned long *)defList->main.Bitmap.Image; for ( b=0,i=0;i < defList->main.Mask.Width * defList->main.Mask.Height;i++ ) { if ( buf[i] != 0x00ff00ff ) tmp=( tmp >> 1 )|128; - else { tmp=tmp >> 1; buf[i]=0; } - if ( b++ == 7 ) { defList->main.Mask.Image[c++]=tmp; tmp=0; b=0; } + else { tmp=tmp >> 1; buf[i]=nothaveshape=0; } + if ( b++ == 7 ) { defList->main.Mask.Image[c++]=tmp; tmp=b=0; } } - if (b) defList->main.Mask.Image[c++]=tmp; + if ( b ) defList->main.Mask.Image[c]=tmp; + if ( nothaveshape ) { free( defList->main.Mask.Image ); defList->main.Mask.Image=NULL; } } #ifdef DEBUG - dbprintf( 3,"[skin] mask: %dX%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); + dbprintf( 3,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); #endif #else defList->main.Mask.Image=NULL; @@ -204,16 +205,14 @@ int __background( char * in ) { - unsigned char tmp[512]; - CHECKDEFLIST( "background" ); CHECKWINLIST( "background" ); if ( !strcmp( winList,"sub" ) ) { - cutItem( in,tmp,',',0 ); defList->subR=atoi( tmp ); - cutItem( in,tmp,',',1 ); defList->subG=atoi( tmp ); - cutItem( in,tmp,',',2 ); defList->subB=atoi( tmp ); + defList->subR=cutItemToInt( in,',',0 ); + defList->subG=cutItemToInt( in,',',1 ); + defList->subB=cutItemToInt( in,',',2 ); #ifdef DEBUG dbprintf( 3,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB ); #endif @@ -231,13 +230,11 @@ CHECKDEFLIST( "button" ); CHECKWINLIST( "button" ); -// button=prev,17,89,23,18,Up,evPrev - cutItem( in,fname,',',0 ); - cutItem( in,tmp,',',1 ); x=atoi( tmp ); - cutItem( in,tmp,',',2 ); y=atoi( tmp ); - cutItem( in,tmp,',',3 ); sx=atoi( tmp ); - cutItem( in,tmp,',',4 ); sy=atoi( tmp ); + x=cutItemToInt( in,',',1 ); + y=cutItemToInt( in,',',2 ); + sx=cutItemToInt( in,',',3 ); + sy=cutItemToInt( in,',',4 ); cutItem( in,msg,',',5 ); defList->NumberOfItems++; @@ -302,10 +299,10 @@ CHECKDEFLIST( "menu" ); CHECKWINLIST( "menu" ); - cutItem( in,tmp,',',0 ); x=atoi( tmp ); - cutItem( in,tmp,',',1 ); y=atoi( tmp ); - cutItem( in,tmp,',',2 ); sx=atoi( tmp ); - cutItem( in,tmp,',',3 ); sy=atoi( tmp ); + x=cutItemToInt( in,',',0 ); + y=cutItemToInt( in,',',1 ); + sx=cutItemToInt( in,',',2 ); + sy=cutItemToInt( in,',',3 ); cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp ); defList->NumberOfMenuItems++; @@ -342,15 +339,15 @@ CHECKWINLIST( "hpotmeter" ); cutItem( in,pfname,',',0 ); - cutItem( in,tmp,',',1 ); psx=atoi( tmp ); - cutItem( in,tmp,',',2 ); psy=atoi( tmp ); + psx=cutItemToInt( in,',',1 ); + psy=cutItemToInt( in,',',2 ); cutItem( in,phfname,',',3 ); - cutItem( in,tmp,',',4 ); ph=atoi( tmp ); - cutItem( in,tmp,',',5 ); d=atoi( tmp ); - cutItem( in,tmp,',',6 ); x=atoi( tmp ); - cutItem( in,tmp,',',7 ); y=atoi( tmp ); - cutItem( in,tmp,',',8 ); sx=atoi( tmp ); - cutItem( in,tmp,',',9 ); sy=atoi( tmp ); + ph=cutItemToInt( in,',',4 ); + d=cutItemToInt( in,',',5 ); + x=cutItemToInt( in,',',6 ); + y=cutItemToInt( in,',',7 ); + sx=cutItemToInt( in,',',8 ); + sy=cutItemToInt( in,',',9 ); cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); #ifdef DEBUG @@ -400,12 +397,12 @@ CHECKWINLIST( "potmeter" ); cutItem( in,phfname,',',0 ); - cutItem( in,tmp,',',1 ); ph=atoi( tmp ); - cutItem( in,tmp,',',2 ); d=atoi( tmp ); - cutItem( in,tmp,',',3 ); x=atoi( tmp ); - cutItem( in,tmp,',',4 ); y=atoi( tmp ); - cutItem( in,tmp,',',5 ); sx=atoi( tmp ); - cutItem( in,tmp,',',6 ); sy=atoi( tmp ); + ph=cutItemToInt( in,',',1 ); + d=cutItemToInt( in,',',2 ); + x=cutItemToInt( in,',',3 ); + y=cutItemToInt( in,',',4 ); + sx=cutItemToInt( in,',',5 ); + sy=cutItemToInt( in,',',6 ); cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp ); #ifdef DEBUG @@ -488,8 +485,8 @@ dbprintf( 3,"\n[skin] slabel\n" ); #endif - cutItem( in,tmp,',',0 ); x=atoi( tmp ); - cutItem( in,tmp,',',1 ); y=atoi( tmp ); + x=cutItemToInt( in,',',0 ); + y=cutItemToInt( in,',',1 ); cutItem( in,sid,',',2 ); id=fntFindID( sid ); if ( id < 0 ) { ERRORMESSAGE( "nonexistent font id. ( %s )\n",sid ); return 1; } cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 ); @@ -526,10 +523,10 @@ dbprintf( 3,"\n[skin] dlabel\n" ); #endif - cutItem( in,tmp,',',0 ); x=atoi( tmp ); - cutItem( in,tmp,',',1 ); y=atoi( tmp ); - cutItem( in,tmp,',',2 ); sx=atoi( tmp ); - cutItem( in,tmp,',',3 ); a=atoi( tmp ); + x=cutItemToInt( in,',',0 ); + y=cutItemToInt( in,',',1 ); + sx=cutItemToInt( in,',',2 ); + a=cutItemToInt( in,',',3 ); cutItem( in,sid,',',4 ); id=fntFindID( sid ); if ( id < 0 ) { ERRORMESSAGE( "nonexistent font id. ( %s )\n",sid ); return 1; } cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 );
--- a/Gui/wm/ws.c Mon Sep 03 16:32:03 2001 +0000 +++ b/Gui/wm/ws.c Tue Sep 04 15:21:00 2001 +0000 @@ -1143,10 +1143,14 @@ void wsSetShape( wsTWindow * win,char * data ) { #ifdef HAVE_XSHAPE - if ( ( !wsUseXShape )||( !data ) ) return; - win->Mask=XCreateBitmapFromData( wsDisplay,win->WindowID,data,win->Width,win->Height ); - XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,win->Mask,ShapeSet ); - XFreePixmap( wsDisplay,win->Mask ); + if ( !wsUseXShape ) return; + if ( data ) + { + win->Mask=XCreateBitmapFromData( wsDisplay,win->WindowID,data,win->Width,win->Height ); + XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,win->Mask,ShapeSet ); + XFreePixmap( wsDisplay,win->Mask ); + } + else XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,None,ShapeSet ); #endif }
--- a/libvo/sub.c Mon Sep 03 16:32:03 2001 +0000 +++ b/libvo/sub.c Tue Sep 04 15:21:00 2001 +0000 @@ -163,7 +163,7 @@ t=vo_sub->text[i++]; len=strlen(t)-1; - printf("sub(%d) '%s'\n",len,t); +// printf("sub(%d) '%s'\n",len,t); // if(len<0) memy -=h; // according to max of vo_font->pic_a[font]->h // else for (j=0;j<=len;j++){
--- a/libvo/vo_x11.c Mon Sep 03 16:32:03 2001 +0000 +++ b/libvo/vo_x11.c Tue Sep 04 15:21:00 2001 +0000 @@ -375,13 +375,11 @@ #ifdef HAVE_NEW_GUI if ( vo_window == None ) #endif - XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask ); - + { + XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask ); + saver_off(mDisplay); + } X_already_started++; - -// vo_initthread( mThread ); - - saver_off(mDisplay); return 0; } @@ -553,9 +551,16 @@ static void uninit(void) { -saver_on(mDisplay); // screen saver back on +#ifdef HAVE_NEW_GUI + if ( vo_window == None ) +#endif + saver_on(mDisplay); // screen saver back on #ifdef HAVE_XF86VM + #ifdef HAVE_NEW_GUI + if ((vidmodes!=NULL)&&( vo_window == None ) ) + #else if (vidmodes!=NULL) + #endif { int screen; screen=DefaultScreen( mDisplay ); XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]); @@ -563,7 +568,7 @@ free(vidmodes); } #endif - + XClearWindow( mDisplay,mywindow ); printf("vo: uninit!\n"); }
--- a/libvo/vo_xmga.c Mon Sep 03 16:32:03 2001 +0000 +++ b/libvo/vo_xmga.c Tue Sep 04 15:21:00 2001 +0000 @@ -104,17 +104,12 @@ static void set_window(){ - XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); - drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight; - XTranslateCoordinates( mDisplay,mWindow,mRoot,0,0,&drwcX,&drwcY,&mRoot ); - fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); - #ifdef HAVE_NEW_GUI if ( vo_window != None ) { mFullscreen=0; dwidth=mdwidth; dheight=mdheight; - if ( ( drwWidth == vo_screenwidth )&&( drwHeight == vo_screenheight ) ) + if ( ( vo_dwidth == vo_screenwidth )&&( vo_dheight == vo_screenheight ) ) { mFullscreen=1; dwidth=vo_screenwidth; @@ -123,6 +118,11 @@ } #endif + XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); + drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight; + XTranslateCoordinates( mDisplay,mWindow,mRoot,0,0,&drwcX,&drwcY,&mRoot ); + fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + if ( mFullscreen ) { drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; @@ -131,7 +131,7 @@ drwcY+=drwY; drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); - //fprintf( stderr,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + fprintf( stderr,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); } mDrawColorKey(); @@ -235,7 +235,8 @@ wndWidth=d_width; wndHeight=d_height; dwidth=d_width; dheight=d_height; #ifdef HAVE_NEW_GUI - mdwidth=d_width; mdheight=d_height; +// mdwidth=d_width; mdheight=d_height; + mdwidth=width; mdheight=height; #endif mFullscreen=fullscreen&1; @@ -294,13 +295,13 @@ else { mWindow=vo_window; - fprintf( stderr,"[xmga] width: %d height: %d d_width: %d d_height: %d\n",width,height,d_width,d_height ); - if ( vo_screenwidth != d_width ) - { - XMoveWindow( mDisplay,mWindow,( vo_screenwidth - d_width ) / 2,( vo_screenheight - d_height ) / 2 ); - XResizeWindow( mDisplay,mWindow,d_width,d_height ); - } - else mFullscreen=1; +// fprintf( stderr,"[xmga] width: %d height: %d d_width: %d d_height: %d\n",width,height,d_width,d_height ); +// if ( vo_screenwidth != d_width ) +// { +// XMoveWindow( mDisplay,mWindow,( vo_screenwidth - d_width ) / 2,( vo_screenheight - d_height ) / 2 ); +// XResizeWindow( mDisplay,mWindow,d_width,d_height ); +// } +// else mFullscreen=1; mGC=vo_gc; //XCreateGC( mDisplay,mWindow,GCForeground,&wGCV ); } #endif @@ -316,6 +317,8 @@ mga_vid_config.colkey_blue=255; if(mga_init()) return -1; + + set_window(); #ifdef HAVE_NEW_GUI if ( vo_window == None ) @@ -324,7 +327,11 @@ XFlush( mDisplay ); XSync( mDisplay,False ); } - saver_off(mDisplay); + +#ifdef HAVE_NEW_GUI + if ( vo_window == None ) +#endif + saver_off(mDisplay); return 0; } @@ -336,7 +343,11 @@ static void uninit(void) { - saver_on(mDisplay); +#ifdef HAVE_NEW_GUI + if ( vo_window == None ) +#endif + saver_on(mDisplay); mga_uninit(); + XClearWindow( mDisplay,mWindow ); printf("vo: uninit!\n"); }
--- a/libvo/vo_xv.c Mon Sep 03 16:32:03 2001 +0000 +++ b/libvo/vo_xv.c Tue Sep 04 15:21:00 2001 +0000 @@ -475,14 +475,15 @@ */ } -static void uninit(void) { -int i; +static void uninit(void) +{ + int i; #ifdef HAVE_NEW_GUI - if ( vo_window == None ) + if ( vo_window == None ) #endif - saver_on(mDisplay); // screen saver back on -for( i=0;i<num_buffers;i++ ) - deallocate_xvimage( i ); + saver_on(mDisplay); // screen saver back on + for( i=0;i<num_buffers;i++ ) deallocate_xvimage( i ); + XClearWindow( mDisplay,mywindow ); }
--- a/mplayer.c Mon Sep 03 16:32:03 2001 +0000 +++ b/mplayer.c Tue Sep 04 15:21:00 2001 +0000 @@ -1594,9 +1594,6 @@ case '/': { float mixer_l, mixer_r; mixer_getvolume( &mixer_l,&mixer_r ); - #ifdef HAVE_NEW_GUI - if ( use_gui ) mplShMem->Volume=( mixer_l + mixer_r ) / 2; - #endif if(c=='*' || c=='0'){ if ( ++mixer_l > 100 ) mixer_l = 100; if ( ++mixer_r > 100 ) mixer_r = 100; @@ -1611,7 +1608,7 @@ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_VOLUME; vo_osd_progbar_value=((mixer_l+mixer_r)*256.0)/200.0; - // printf("volume: %d\n",vo_osd_progbar_value); + //printf("volume: %d\n",vo_osd_progbar_value); } #endif } @@ -1789,19 +1786,22 @@ mplShMem->Position=(len<=0)?0:((float)(pos-demuxer->movi_start) / len * 100.0f); } mplShMem->TimeSec=d_video->pts; -// printf("mplShMem->Playing=%d \n",mplShMem->Playing); if(mplShMem->Playing==0) break; // STOP if(mplShMem->Playing==2) osd_function=OSD_PAUSE; -#ifdef USE_OSD - if ( ( osd_level )&&( mplShMem->VolumeChanged ) ) + if ( mplShMem->VolumeChanged ) { - osd_visible=sh_video->fps; // 1 sec - vo_osd_progbar_type=OSD_VOLUME; - vo_osd_progbar_value=((mplShMem->Volume )*256.0)/100.0; - } + mixer_setvolume( mplShMem->Volume,mplShMem->Volume ); + mplShMem->VolumeChanged=0; +#ifdef USE_OSD + if ( osd_level ) + { + osd_visible=sh_video->fps; // 1 sec + vo_osd_progbar_type=OSD_VOLUME; + vo_osd_progbar_value=( ( mplShMem->Volume ) * 256.0 ) / 100.0; + } #endif - mixer_setvolume( mplShMem->Volume,mplShMem->Volume ); - mplShMem->VolumeChanged=0; + } + mplShMem->Volume=(float)mixer_getbothvolume(); } #endif @@ -1883,6 +1883,7 @@ wsPostRedisplay( &appMPlayer.subWindow ); mplShMem->TimeSec=0; mplShMem->Position=0; + mplShMem->FrameDrop=0; } #endif