major reindentation of x11 code try #2

note that this is plain ident output, i didnt tweak it by
hand like the last attempt.

if anyone is interested in the indent profile i used, just drop me a mail.

please contact me on irc on how to send me my share of cola,
but be aware that i will only accept swiss or german cola, as the japanese is
way to sweet :)


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12583 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
attila 2004-06-14 04:53:03 +00:00
parent b44c3a048a
commit 0e4e21aac5
6 changed files with 4176 additions and 3249 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,204 +39,259 @@
#ifdef SHOW_TIME
#include "../osdep/timer.h"
static unsigned int timer=0;
static unsigned int timerd=0;
static unsigned int timer = 0;
static unsigned int timerd = 0;
#endif
#ifdef HAVE_NEW_GUI
#include "../Gui/interface.h"
#endif
static vo_info_t info =
{
"Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
"xmga",
"Zoltan Ponekker <pontscho@makacs.poliod.hu>",
""
static vo_info_t info = {
"Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
"xmga",
"Zoltan Ponekker <pontscho@makacs.poliod.hu>",
""
};
LIBVO_EXTERN( xmga )
LIBVO_EXTERN(xmga)
static XGCValues wGCV;
static XGCValues wGCV;
static uint32_t mDepth;
static XWindowAttributes attribs;
static uint32_t mDepth;
static XWindowAttributes attribs;
static int colorkey;
static uint32_t mvHeight;
static uint32_t mvWidth;
static uint32_t mvHeight;
static uint32_t mvWidth;
static Window mRoot;
static Window mRoot;
static XSetWindowAttributes xWAttribs;
static XSetWindowAttributes xWAttribs;
static int inited=0;
static int inited = 0;
#define VO_XMGA
#include "mga_common.c"
#undef VO_XMGA
static void mDrawColorKey( void )
static void mDrawColorKey(void)
{
XSetBackground( mDisplay,vo_gc,0 );
XClearWindow( mDisplay,vo_window );
XSetForeground( mDisplay,vo_gc,colorkey );
XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
XFlush( mDisplay );
XSetBackground(mDisplay, vo_gc, 0);
XClearWindow(mDisplay, vo_window);
XSetForeground(mDisplay, vo_gc, colorkey);
XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
(vo_fs ? drwHeight - 1 : drwHeight));
XFlush(mDisplay);
}
static void check_events(void)
{
int e=vo_x11_check_events(mDisplay);
if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return;
set_window();
mDrawColorKey();
if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
int e = vo_x11_check_events(mDisplay);
if (!(e & VO_EVENT_RESIZE) && !(e & VO_EVENT_EXPOSE))
return;
set_window();
mDrawColorKey();
if (ioctl(f, MGA_VID_CONFIG, &mga_vid_config))
mp_msg(MSGT_VO, MSGL_WARN,
"Error in mga_vid_config ioctl (wrong mga_vid.o version?)");
}
static void flip_page(void){
static void flip_page(void)
{
#ifdef SHOW_TIME
unsigned int t;
t=GetTimer();
mp_msg(MSGT_VO,MSGL_STATUS," [timer: %08X diff: %6d dd: %6d ] \n",t,t-timer,(t-timer)-timerd);
timerd=t-timer;
timer=t;
t = GetTimer();
mp_msg(MSGT_VO, MSGL_STATUS,
" [timer: %08X diff: %6d dd: %6d ] \n", t, t - timer,
(t - timer) - timerd);
timerd = t - timer;
timer = t;
#endif
vo_mga_flip_page();
vo_mga_flip_page();
}
static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
uint32_t d_height, uint32_t flags, char *title,
uint32_t format)
{
char * mTitle=(title == NULL) ? "XMGA render" : title;
XVisualInfo vinfo;
unsigned long xswamask;
int r, g, b;
char *mTitle = (title == NULL) ? "XMGA render" : title;
XVisualInfo vinfo;
unsigned long xswamask;
int r, g, b;
if(mga_init(width,height,format)) return -1; // ioctl errors?
if (mga_init(width, height, format))
return -1; // ioctl errors?
aspect_save_orig(width,height);
aspect_save_prescale(d_width,d_height);
aspect_save_screenres(vo_screenwidth,vo_screenheight);
aspect_save_orig(width, height);
aspect_save_prescale(d_width, d_height);
aspect_save_screenres(vo_screenwidth, vo_screenheight);
mvWidth=width; mvHeight=height;
mvWidth = width;
mvHeight = height;
vo_panscan_x=vo_panscan_y=vo_panscan_amount=0;
vo_panscan_x = vo_panscan_y = vo_panscan_amount = 0;
vo_dx=( vo_screenwidth - d_width ) / 2;
vo_dy=( vo_screenheight - d_height ) / 2;
geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight);
vo_dwidth=d_width; vo_dheight=d_height;
vo_mouse_autohide=1;
vo_dx = (vo_screenwidth - d_width) / 2;
vo_dy = (vo_screenheight - d_height) / 2;
geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth,
vo_screenheight);
vo_dwidth = d_width;
vo_dheight = d_height;
vo_mouse_autohide = 1;
r = (vo_colorkey & 0x00ff0000) >> 16;
g = (vo_colorkey & 0x0000ff00) >> 8;
b = vo_colorkey & 0x000000ff;
switch ( vo_depthonscreen )
{
case 32: colorkey = vo_colorkey; break;
case 24: colorkey = vo_colorkey & 0x00ffffff; break;
case 16: colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); break;
case 15: colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); break;
default: mp_msg(MSGT_VO,MSGL_ERR,"Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
}
mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey);
r = (vo_colorkey & 0x00ff0000) >> 16;
g = (vo_colorkey & 0x0000ff00) >> 8;
b = vo_colorkey & 0x000000ff;
switch (vo_depthonscreen)
{
case 32:
colorkey = vo_colorkey;
break;
case 24:
colorkey = vo_colorkey & 0x00ffffff;
break;
case 16:
colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
break;
case 15:
colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
break;
default:
mp_msg(MSGT_VO, MSGL_ERR,
"Sorry, this (%d) color depth not supported.\n",
vo_depthonscreen);
return -1;
}
mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey);
inited=1;
inited = 1;
aspect(&d_width,&d_height,A_NOZOOM);
aspect(&d_width, &d_height, A_NOZOOM);
#ifdef HAVE_NEW_GUI
if(use_gui)
guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
else
if (use_gui)
guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
else
#endif
{
if ( flags&1 ) aspect(&dwidth,&dheight,A_ZOOM);
{
if (flags & 1)
aspect(&dwidth, &dheight, A_ZOOM);
XGetWindowAttributes( mDisplay,mRootWin,&attribs );
mDepth=attribs.depth;
if ( mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32 ) mDepth=24;
XMatchVisualInfo( mDisplay,mScreen,mDepth,TrueColor,&vinfo );
xWAttribs.colormap=XCreateColormap( mDisplay,mRootWin,vinfo.visual,AllocNone );
xWAttribs.background_pixel=0;
xWAttribs.border_pixel=0;
xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask |
((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask | PropertyChangeMask));
xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
XGetWindowAttributes(mDisplay, mRootWin, &attribs);
mDepth = attribs.depth;
if (mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32)
mDepth = 24;
XMatchVisualInfo(mDisplay, mScreen, mDepth, TrueColor, &vinfo);
xWAttribs.colormap =
XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone);
xWAttribs.background_pixel = 0;
xWAttribs.border_pixel = 0;
xWAttribs.event_mask =
StructureNotifyMask | ExposureMask | KeyPressMask |
((WinID ==
0) ? 0 : (ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | PropertyChangeMask));
xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
if ( WinID>=0 ){
vo_window = WinID ? ((Window)WinID) : mRootWin;
if ( WinID )
{
XUnmapWindow( mDisplay,vo_window );
XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
} else XSelectInput( mDisplay,vo_window,ExposureMask );
} else {
if (WinID >= 0)
{
if ( vo_window == None )
{
vo_window=XCreateWindow( mDisplay,mRootWin,
vo_dx,vo_dy,
vo_dwidth,vo_dheight,
xWAttribs.border_pixel,
mDepth,
InputOutput,
vinfo.visual,xswamask,&xWAttribs );
vo_x11_classhint( mDisplay,vo_window,"xmga" );
vo_hidecursor(mDisplay,vo_window);
vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
vo_window = WinID ? ((Window) WinID) : mRootWin;
if (WinID)
{
XUnmapWindow(mDisplay, vo_window);
XChangeWindowAttributes(mDisplay, vo_window, xswamask,
&xWAttribs);
vo_x11_selectinput_witherr(mDisplay, vo_window,
StructureNotifyMask |
KeyPressMask |
PropertyChangeMask |
PointerMotionMask |
ButtonPressMask |
ButtonReleaseMask |
ExposureMask);
} else
XSelectInput(mDisplay, vo_window, ExposureMask);
XStoreName( mDisplay,vo_window,mTitle );
XMapWindow( mDisplay,vo_window );
if ( flags&1 ) vo_x11_fullscreen();
} else
{
if (vo_window == None)
{
vo_window = XCreateWindow(mDisplay, mRootWin,
vo_dx, vo_dy,
vo_dwidth, vo_dheight,
xWAttribs.border_pixel,
mDepth,
InputOutput,
vinfo.visual, xswamask,
&xWAttribs);
vo_x11_classhint(mDisplay, vo_window, "xmga");
vo_hidecursor(mDisplay, vo_window);
vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0);
XStoreName(mDisplay, vo_window, mTitle);
XMapWindow(mDisplay, vo_window);
if (flags & 1)
vo_x11_fullscreen();
#ifdef HAVE_XINERAMA
vo_x11_xinerama_move(mDisplay,vo_window);
vo_x11_xinerama_move(mDisplay, vo_window);
#endif
} else if ( !(flags&1) ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
}
} else if (!(flags & 1))
XMoveResizeWindow(mDisplay, vo_window, vo_dx, vo_dy,
vo_dwidth, vo_dheight);
}
if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
if (vo_gc != None)
XFreeGC(mDisplay, vo_gc);
vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &wGCV);
} // !GUI
} // !GUI
if ( ( flags&1 )&&( !WinID ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
if ((flags & 1) && (!WinID))
{
vo_dx = 0;
vo_dy = 0;
vo_dwidth = vo_screenwidth;
vo_dheight = vo_screenheight;
vo_fs = 1;
}
panscan_calc();
panscan_calc();
mga_vid_config.colkey_on=1;
mga_vid_config.colkey_red=r;
mga_vid_config.colkey_green=g;
mga_vid_config.colkey_blue=b;
mga_vid_config.colkey_on = 1;
mga_vid_config.colkey_red = r;
mga_vid_config.colkey_green = g;
mga_vid_config.colkey_blue = b;
set_window(); // set up mga_vid_config.dest_width etc
set_window(); // set up mga_vid_config.dest_width etc
saver_off(mDisplay);
saver_off(mDisplay);
if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
if (vo_ontop)
vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
XFlush( mDisplay );
XSync( mDisplay,False );
ioctl(f,MGA_VID_ON,0);
XFlush(mDisplay);
XSync(mDisplay, False);
return 0;
ioctl(f, MGA_VID_ON, 0);
return 0;
}
static void uninit(void){
mp_msg(MSGT_VO,MSGL_V,"vo: uninit!\n");
mga_uninit();
if(!inited) return; // no window?
inited=0;
saver_on(mDisplay);
vo_x11_uninit(); // destroy the window
static void uninit(void)
{
mp_msg(MSGT_VO, MSGL_V, "vo: uninit!\n");
mga_uninit();
if (!inited)
return; // no window?
inited = 0;
saver_on(mDisplay);
vo_x11_uninit(); // destroy the window
}

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,7 @@
#endif
static vo_info_t info =
{
static vo_info_t info = {
"X11 (VIDIX)",
"xvidix",
"Alex Beregszaszi",
@ -47,9 +46,7 @@ static vo_info_t info =
};
LIBVO_EXTERN(xvidix)
#define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
#define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
/* X11 related variables */
/* Colorkey handling */
static XGCValues mGCV;
@ -72,7 +69,7 @@ static uint32_t window_width, window_height;
static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
drwDepth, drwcX, drwcY, dwidth, dheight;
extern void set_video_eq( int cap );
extern void set_video_eq(int cap);
#ifdef HAVE_XINERAMA
extern int xinerama_screen;
@ -81,129 +78,144 @@ extern int xinerama_screen;
static void set_window(int force_update)
{
Window mRoot;
if ( WinID )
{
XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
&drwHeight, &drwBorderWidth, &drwDepth);
drwX = drwY = 0;
XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
&drwcX, &drwcY, &mRoot);
aspect(&dwidth,&dheight,A_NOZOOM);
if (!vo_fs)
mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
if (WinID)
{
XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
&drwHeight, &drwBorderWidth, &drwDepth);
drwX = drwY = 0;
/* following stuff copied from vo_xmga.c */
}
else
{
aspect(&dwidth,&dheight,A_NOZOOM);
drwcX=drwX=vo_dx; drwcY=drwY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight;
}
XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
&drwcX, &drwcY, &mRoot);
aspect(&dwidth, &dheight, A_NOZOOM);
if (!vo_fs)
mp_msg(MSGT_VO, MSGL_V,
"[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
/* following stuff copied from vo_xmga.c */
} else
{
aspect(&dwidth, &dheight, A_NOZOOM);
drwcX = drwX = vo_dx;
drwcY = drwY = vo_dy;
drwWidth = vo_dwidth;
drwHeight = vo_dheight;
}
#if X11_FULLSCREEN
if (vo_fs)
{
aspect(&dwidth,&dheight,A_ZOOM);
drwX = (vo_screenwidth - (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2;
drwcX = drwX;
drwY = (vo_screenheight - (dheight > vo_screenheight ? vo_screenheight : dheight)) / 2;
drwcY = drwY;
drwWidth = (dwidth > vo_screenwidth ? vo_screenwidth : dwidth);
drwHeight = (dheight > vo_screenheight ? vo_screenheight : dheight);
mp_msg(MSGT_VO, MSGL_V, "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
aspect(&dwidth, &dheight, A_ZOOM);
drwX =
(vo_screenwidth -
(dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2;
drwcX = drwX;
drwY =
(vo_screenheight -
(dheight > vo_screenheight ? vo_screenheight : dheight)) / 2;
drwcY = drwY;
drwWidth = (dwidth > vo_screenwidth ? vo_screenwidth : dwidth);
drwHeight =
(dheight > vo_screenheight ? vo_screenheight : dheight);
mp_msg(MSGT_VO, MSGL_V,
"[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
}
#endif
vo_dwidth=drwWidth; vo_dheight=drwHeight;
vo_dwidth = drwWidth;
vo_dheight = drwHeight;
#ifdef HAVE_XINERAMA
if (XineramaIsActive(mDisplay))
{
XineramaScreenInfo *screens;
int num_screens;
int i = 0;
screens = XineramaQueryScreens(mDisplay, &num_screens);
/* find the screen we are on */
while (i<num_screens &&
((screens[i].x_org < drwcX) || (screens[i].y_org < drwcY) ||
(screens[i].x_org + screens[i].width >= drwcX) ||
(screens[i].y_org + screens[i].height >= drwcY)))
{
i++;
}
XineramaScreenInfo *screens;
int num_screens;
int i = 0;
if(i<num_screens)
{
/* save the screen we are on */
xinerama_screen = i;
} else {
/* oops.. couldnt find the screen we are on
* because the upper left corner left the
* visual range. assume we are still on the
* same screen
*/
i = xinerama_screen;
}
screens = XineramaQueryScreens(mDisplay, &num_screens);
/* set drwcX and drwcY to the right values */
drwcX = drwcX - screens[i].x_org;
drwcY = drwcY - screens[i].y_org;
XFree(screens);
/* find the screen we are on */
while (i < num_screens &&
((screens[i].x_org < drwcX) || (screens[i].y_org < drwcY) ||
(screens[i].x_org + screens[i].width >= drwcX) ||
(screens[i].y_org + screens[i].height >= drwcY)))
{
i++;
}
if (i < num_screens)
{
/* save the screen we are on */
xinerama_screen = i;
} else
{
/* oops.. couldnt find the screen we are on
* because the upper left corner left the
* visual range. assume we are still on the
* same screen
*/
i = xinerama_screen;
}
/* set drwcX and drwcY to the right values */
drwcX = drwcX - screens[i].x_org;
drwcY = drwcY - screens[i].y_org;
XFree(screens);
}
#endif
if ( vo_panscan > 0.0f && vo_fs )
{
drwcX-=vo_panscan_x >> 1;
drwcY-=vo_panscan_y >> 1;
drwX-=vo_panscan_x >> 1;
drwY-=vo_panscan_y >> 1;
drwWidth+=vo_panscan_x;
drwHeight+=vo_panscan_y;
}
if (vo_panscan > 0.0f && vo_fs)
{
drwcX -= vo_panscan_x >> 1;
drwcY -= vo_panscan_y >> 1;
drwX -= vo_panscan_x >> 1;
drwY -= vo_panscan_y >> 1;
drwWidth += vo_panscan_x;
drwHeight += vo_panscan_y;
}
/* set new values in VIDIX */
if (force_update || (window_x != drwcX) || (window_y != drwcY) ||
(window_width != drwWidth) || (window_height != drwHeight))
(window_width != drwWidth) || (window_height != drwHeight))
{
// do a backup of window coordinates
window_x = drwcX;
window_y = drwcY;
vo_dx = drwcX;
vo_dy = drwcY;
window_width = drwWidth;
window_height = drwHeight;
// do a backup of window coordinates
window_x = drwcX;
window_y = drwcY;
vo_dx = drwcX;
vo_dy = drwcY;
window_width = drwWidth;
window_height = drwHeight;
/* FIXME: implement runtime resize/move if possible, this way is very ugly! */
vidix_stop();
if (vidix_init(image_width, image_height, vo_dx, vo_dy,
window_width, window_height, image_format, vo_depthonscreen,
vo_screenwidth, vo_screenheight) != 0)
/* FIXME: implement runtime resize/move if possible, this way is very ugly! */
vidix_stop();
if (vidix_init(image_width, image_height, vo_dx, vo_dy,
window_width, window_height, image_format,
vo_depthonscreen, vo_screenwidth,
vo_screenheight) != 0)
{
mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s\n", strerror(errno));
abort();
}
vidix_start();
mp_msg(MSGT_VO, MSGL_FATAL,
"Can't initialize VIDIX driver: %s\n", strerror(errno));
abort();
}
vidix_start();
}
mp_msg(MSGT_VO, MSGL_V, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n",
vo_dx, vo_dy, window_width, window_height);
mp_msg(MSGT_VO, MSGL_V,
"[xvidix] window properties: pos: %dx%d, size: %dx%d\n", vo_dx,
vo_dy, window_width, window_height);
/* mDrawColorKey: */
/* fill drawable with specified color */
if (!(vo_colorkey & 0xff000000))
{
XSetBackground(mDisplay, vo_gc, 0L);
XClearWindow( mDisplay,vo_window );
XSetForeground(mDisplay, vo_gc, colorkey);
XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
(vo_fs ? drwHeight - 1 : drwHeight));
XSetBackground(mDisplay, vo_gc, 0L);
XClearWindow(mDisplay, vo_window);
XSetForeground(mDisplay, vo_gc, colorkey);
XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
(vo_fs ? drwHeight - 1 : drwHeight));
}
/* flush, update drawable */
XFlush(mDisplay);
@ -215,9 +227,11 @@ static void set_window(int force_update)
* allocate colors and (shared) memory
*/
static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
uint32_t d_height, uint32_t flags, char *title, uint32_t format)
uint32_t d_height, uint32_t flags, char *title,
uint32_t format)
{
XVisualInfo vinfo;
// XSizeHints hint;
XSetWindowAttributes xswa;
unsigned long xswamask;
@ -231,7 +245,7 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
image_height = height;
image_width = width;
image_format = format;
vo_mouse_autohide=1;
vo_mouse_autohide = 1;
aspect_save_orig(width, height);
aspect_save_prescale(d_width, d_height);
@ -239,8 +253,10 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
vo_dx = 0;
vo_dy = 0;
vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight);
vo_dx = (vo_screenwidth - d_width) / 2;
vo_dy = (vo_screenheight - d_height) / 2;
geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth,
vo_screenheight);
window_width = d_width;
window_height = d_height;
@ -251,114 +267,146 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
r = (vo_colorkey & 0x00ff0000) >> 16;
g = (vo_colorkey & 0x0000ff00) >> 8;
b = vo_colorkey & 0x000000ff;
switch(vo_depthonscreen)
switch (vo_depthonscreen)
{
case 32:
colorkey = vo_colorkey;
break;
case 24:
colorkey = vo_colorkey & 0x00ffffff;
break;
case 16:
colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
break;
case 15:
colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
break;
default:
mp_msg(MSGT_VO, MSGL_ERR, "Sorry, this (%d) color depth is not supported\n",
vo_depthonscreen);
case 32:
colorkey = vo_colorkey;
break;
case 24:
colorkey = vo_colorkey & 0x00ffffff;
break;
case 16:
colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
break;
case 15:
colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
break;
default:
mp_msg(MSGT_VO, MSGL_ERR,
"Sorry, this (%d) color depth is not supported\n",
vo_depthonscreen);
}
mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey);
aspect(&d_width, &d_height, A_NOZOOM);
vo_dwidth=d_width; vo_dheight=d_height;
vo_dwidth = d_width;
vo_dheight = d_height;
#ifdef HAVE_NEW_GUI
if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
else
{
if (use_gui)
guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
else
{
#endif
#ifdef X11_FULLSCREEN
if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM);
if ((flags & 1) || (flags & 0x04))
aspect(&d_width, &d_height, A_ZOOM);
#endif
dwidth = d_width;
dheight = d_height;
/* Make the window */
XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
dwidth = d_width;
dheight = d_height;
/* Make the window */
XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay),
&attribs);
/* from vo_x11 */
window_depth = attribs.depth;
if ((window_depth != 15) && (window_depth != 16) && (window_depth != 24)
&& (window_depth != 32))
window_depth = 24;
XMatchVisualInfo(mDisplay, mScreen, window_depth, TrueColor, &vinfo);
/* from vo_x11 */
window_depth = attribs.depth;
if ((window_depth != 15) && (window_depth != 16)
&& (window_depth != 24) && (window_depth != 32))
window_depth = 24;
XMatchVisualInfo(mDisplay, mScreen, window_depth, TrueColor,
&vinfo);
xswa.background_pixel = BlackPixel(mDisplay, mScreen);
xswa.border_pixel = 0;
xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen),
vinfo.visual, AllocNone);
xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | PropertyChangeMask |
((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask));
xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
xswa.background_pixel = BlackPixel(mDisplay, mScreen);
xswa.border_pixel = 0;
xswa.colormap =
XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen),
vinfo.visual, AllocNone);
xswa.event_mask =
StructureNotifyMask | ExposureMask | KeyPressMask |
PropertyChangeMask | ((WinID == 0) ? 0
: (ButtonPressMask | ButtonReleaseMask |
PointerMotionMask));
xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
if (WinID >= 0)
{
vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay, mScreen);
if ( WinID )
{
XUnmapWindow(mDisplay, vo_window);
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
} else XSelectInput( mDisplay,vo_window,ExposureMask );
}
else
{
if ( vo_window == None )
{
vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay, mScreen),
vo_dx, vo_dy, window_width, window_height, xswa.border_pixel,
vinfo.depth, InputOutput, vinfo.visual, xswamask, &xswa);
if (WinID >= 0)
{
vo_window =
WinID ? ((Window) WinID) : RootWindow(mDisplay, mScreen);
if (WinID)
{
XUnmapWindow(mDisplay, vo_window);
XChangeWindowAttributes(mDisplay, vo_window, xswamask,
&xswa);
vo_x11_selectinput_witherr(mDisplay, vo_window,
StructureNotifyMask |
KeyPressMask |
PropertyChangeMask |
PointerMotionMask |
ButtonPressMask |
ButtonReleaseMask |
ExposureMask);
} else
XSelectInput(mDisplay, vo_window, ExposureMask);
} else
{
if (vo_window == None)
{
vo_window =
XCreateWindow(mDisplay, RootWindow(mDisplay, mScreen),
vo_dx, vo_dy, window_width,
window_height, xswa.border_pixel,
vinfo.depth, InputOutput, vinfo.visual,
xswamask, &xswa);
vo_x11_classhint(mDisplay, vo_window, "xvidix");
vo_hidecursor(mDisplay, vo_window);
vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
vo_x11_classhint(mDisplay, vo_window, "xvidix");
vo_hidecursor(mDisplay, vo_window);
vo_x11_sizehint(vo_dx, vo_dy, vo_dwidth, vo_dheight, 0);
XStoreName(mDisplay, vo_window, title);
XMapWindow(mDisplay, vo_window);
if (flags & 1)
vo_x11_fullscreen();
XStoreName(mDisplay, vo_window, title);
XMapWindow(mDisplay, vo_window);
if ( flags&1 ) vo_x11_fullscreen();
#ifdef HAVE_XINERAMA
vo_x11_xinerama_move(mDisplay, vo_window);
vo_x11_xinerama_move(mDisplay, vo_window);
#endif
} else if ( !(flags&1) ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
}
if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV);
} else if (!(flags & 1))
XMoveResizeWindow(mDisplay, vo_window, vo_dx, vo_dy,
vo_dwidth, vo_dheight);
}
if (vo_gc != None)
XFreeGC(mDisplay, vo_gc);
vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV);
#ifdef HAVE_NEW_GUI
}
}
#endif
if ( ( !WinID )&&( flags&1 ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
if ((!WinID) && (flags & 1))
{
vo_dx = 0;
vo_dy = 0;
vo_dwidth = vo_screenwidth;
vo_dheight = vo_screenheight;
vo_fs = 1;
}
if (vidix_grkey_support())
{
vidix_grkey_get(&gr_key);
gr_key.key_op = KEYS_PUT;
if (!(vo_colorkey & 0xff000000))
{
gr_key.ckey.op = CKEY_TRUE;
gr_key.ckey.red = r;
gr_key.ckey.green = g;
gr_key.ckey.blue = b;
}
else
gr_key.ckey.op = CKEY_FALSE;
vidix_grkey_set(&gr_key);
vidix_grkey_get(&gr_key);
gr_key.key_op = KEYS_PUT;
if (!(vo_colorkey & 0xff000000))
{
gr_key.ckey.op = CKEY_TRUE;
gr_key.ckey.red = r;
gr_key.ckey.green = g;
gr_key.ckey.blue = b;
} else
gr_key.ckey.op = CKEY_FALSE;
vidix_grkey_set(&gr_key);
}
set_window(1);
@ -368,11 +416,12 @@ else
panscan_calc();
if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
if (vo_ontop)
vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
saver_off(mDisplay); /* turning off screen saver */
saver_off(mDisplay); /* turning off screen saver */
return(0);
return (0);
}
static void check_events(void)
@ -380,7 +429,7 @@ static void check_events(void)
const int event = vo_x11_check_events(mDisplay);
if ((event & VO_EVENT_RESIZE) || (event & VO_EVENT_EXPOSE))
set_window(0);
set_window(0);
return;
}
@ -389,18 +438,20 @@ static void check_events(void)
overwritten with vidix functions (vosub_vidix.c) */
static void draw_osd(void)
{
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_osd!\n");
mp_msg(MSGT_VO, MSGL_FATAL,
"[xvidix] error: didn't used vidix draw_osd!\n");
return;
}
static void flip_page(void)
{
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix flip_page!\n");
mp_msg(MSGT_VO, MSGL_FATAL,
"[xvidix] error: didn't used vidix flip_page!\n");
return;
}
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)
{
UNUSED(src);
UNUSED(stride);
@ -408,34 +459,37 @@ static uint32_t draw_slice(uint8_t *src[], int stride[],
UNUSED(h);
UNUSED(x);
UNUSED(y);
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_slice!\n");
return(-1);
mp_msg(MSGT_VO, MSGL_FATAL,
"[xvidix] error: didn't used vidix draw_slice!\n");
return (-1);
}
static uint32_t draw_frame(uint8_t *src[])
static uint32_t draw_frame(uint8_t * src[])
{
UNUSED(src);
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_frame!\n");
return(-1);
mp_msg(MSGT_VO, MSGL_FATAL,
"[xvidix] error: didn't used vidix draw_frame!\n");
return (-1);
}
static uint32_t query_format(uint32_t format)
{
return(vidix_query_fourcc(format));
return (vidix_query_fourcc(format));
}
static void uninit(void)
{
if ( !vo_config_count ) return;
if (!vo_config_count)
return;
vidix_term();
if (vidix_name)
{
free(vidix_name);
vidix_name = NULL;
free(vidix_name);
vidix_name = NULL;
}
saver_on(mDisplay); /* screen saver back on */
saver_on(mDisplay); /* screen saver back on */
vo_x11_uninit();
}
@ -446,63 +500,69 @@ static uint32_t preinit(const char *arg)
vidix_name = strdup(arg);
else
{
mp_msg(MSGT_VO, MSGL_INFO, "No vidix driver name provided, probing available ones (-v option for details)!\n");
vidix_name = NULL;
mp_msg(MSGT_VO, MSGL_INFO,
"No vidix driver name provided, probing available ones (-v option for details)!\n");
vidix_name = NULL;
}
if (!vo_init()) return(-1);
if (!vo_init())
return (-1);
if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
return(1);
return (1);
return(0);
return (0);
}
static uint32_t control(uint32_t request, void *data, ...)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
case VOCTRL_GUISUPPORT:
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
if ( !vo_config_count || !vo_fs ) return VO_FALSE;
return VO_TRUE;
case VOCTRL_ONTOP:
vo_x11_ontop();
return VO_TRUE;
case VOCTRL_FULLSCREEN:
vo_x11_fullscreen();
case VOCTRL_SET_PANSCAN:
if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
{
panscan_calc();
set_window(0);
}
return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
{
va_list ap;
int value;
va_start(ap, data);
value = va_arg(ap, int);
va_end(ap);
switch (request)
{
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t *) data));
case VOCTRL_GUISUPPORT:
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
if (!vo_config_count || !vo_fs)
return VO_FALSE;
return VO_TRUE;
case VOCTRL_ONTOP:
vo_x11_ontop();
return VO_TRUE;
case VOCTRL_FULLSCREEN:
vo_x11_fullscreen();
case VOCTRL_SET_PANSCAN:
if (vo_fs && (vo_panscan != vo_panscan_amount))
{
panscan_calc();
set_window(0);
}
return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
{
va_list ap;
int value;
return vidix_control(request, data, (int *)value);
}
case VOCTRL_GET_EQUALIZER:
{
va_list ap;
int *value;
va_start(ap, data);
value = va_arg(ap, int*);
va_end(ap);
va_start(ap, data);
value = va_arg(ap, int);
return vidix_control(request, data, value);
}
}
return vidix_control(request, data);
va_end(ap);
return vidix_control(request, data, (int *) value);
}
case VOCTRL_GET_EQUALIZER:
{
va_list ap;
int *value;
va_start(ap, data);
value = va_arg(ap, int *);
va_end(ap);
return vidix_control(request, data, value);
}
}
return vidix_control(request, data);
// return VO_NOTIMPL;
}

File diff suppressed because it is too large Load Diff