fix xshape, mixer, fullscreen, etc

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1853 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2001-09-04 15:21:00 +00:00
parent 8ecd9ea906
commit d62c80d3bd
11 changed files with 152 additions and 111 deletions

View File

@ -66,8 +66,8 @@ void mplPlay( void )
( 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 mplPause( void )
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;
}

View File

@ -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 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
}
break;
case wsRLMouseButton:
if ( ( !mplSubMoved )&&( !( SubVisible++%2 ) ) ) wsMoveTopWindow( &appMPlayer.mainWindow );
msButton=0;
mplSubMoved=0;
break;

View File

@ -14,8 +14,23 @@ void cutItem( char * in,char * out,char sep,int num )
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 ) );
}

View File

@ -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
#endif

View File

@ -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 @@ int __base( char * in )
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 @@ int __base( char * in )
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 __base( char * in )
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 @@ int __button( char * in )
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 @@ int __menu( char * in )
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 @@ int __hpotmeter( char * in )
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 @@ int __potmeter( char * in )
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 @@ int __slabel( char * in )
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 @@ int __dlabel( char * in )
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 );

View File

@ -1143,10 +1143,14 @@ void wsScreenSaverOff( Display * mDisplay )
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
}

View File

@ -163,7 +163,7 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
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++){

View File

@ -375,13 +375,11 @@ printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight );
#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 uint32_t query_format( uint32_t format )
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 @@ saver_on(mDisplay); // screen saver back on
free(vidmodes);
}
#endif
XClearWindow( mDisplay,mywindow );
printf("vo: uninit!\n");
}

View File

@ -104,17 +104,12 @@ static void mDrawColorKey( void )
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 @@ static void set_window(){
}
#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 @@ static void set_window(){
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 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
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 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
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 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
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 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
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 const vo_info_t* get_info( void )
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");
}

View File

@ -475,14 +475,15 @@ static uint32_t query_format(uint32_t format)
*/
}
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 );
}

View File

@ -1594,9 +1594,6 @@ if(auto_quality>0){
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 @@ if(auto_quality>0){
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 @@ if(rel_seek_secs || abs_seek_pos){
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 @@ goto_next_file: // don't jump here after ao/vo/getch initialization!
wsPostRedisplay( &appMPlayer.subWindow );
mplShMem->TimeSec=0;
mplShMem->Position=0;
mplShMem->FrameDrop=0;
}
#endif