2002-01-12 23:28:22 +00:00
|
|
|
/*
|
|
|
|
VIDIX accelerated overlay in a X window
|
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
(C) Alex Beregszaszi & Zoltan Ponekker & Nick Kurshev
|
2002-01-12 23:28:22 +00:00
|
|
|
|
|
|
|
WS window manager by Pontscho/Fresh!
|
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
Based on vo_gl.c and vo_vesa.c and vo_xmga.c (.so mastah! ;))
|
2002-01-12 23:28:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "video_out.h"
|
|
|
|
#include "video_out_internal.h"
|
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
//#include <X11/keysym.h>
|
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
#ifdef HAVE_XINERAMA
|
|
|
|
#include <X11/extensions/Xinerama.h>
|
|
|
|
#endif
|
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
#include "x11_common.h"
|
|
|
|
#include "aspect.h"
|
|
|
|
#include "mp_msg.h"
|
|
|
|
|
|
|
|
#include "vosub_vidix.h"
|
2002-01-18 18:15:43 +00:00
|
|
|
#include "../vidix/vidixlib.h"
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-05-07 13:31:29 +00:00
|
|
|
#ifdef HAVE_NEW_GUI
|
|
|
|
#include "../Gui/interface.h"
|
|
|
|
#endif
|
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-11-11 15:22:10 +00:00
|
|
|
static vo_info_t info =
|
2002-01-12 23:28:22 +00:00
|
|
|
{
|
|
|
|
"X11 (VIDIX)",
|
|
|
|
"xvidix",
|
|
|
|
"Alex Beregszaszi",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2002-11-11 15:22:10 +00:00
|
|
|
LIBVO_EXTERN(xvidix)
|
|
|
|
|
2002-01-19 22:43:19 +00:00
|
|
|
#define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
|
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
/* X11 related variables */
|
2002-01-26 19:42:21 +00:00
|
|
|
/* Colorkey handling */
|
2002-01-18 18:15:43 +00:00
|
|
|
static XGCValues mGCV;
|
|
|
|
static uint32_t fgColor;
|
2002-04-20 22:58:15 +00:00
|
|
|
static uint32_t bgColor;
|
2002-01-26 19:42:21 +00:00
|
|
|
static vidix_grkey_t gr_key;
|
2002-01-18 18:15:43 +00:00
|
|
|
|
2002-01-26 19:42:21 +00:00
|
|
|
/* VIDIX related */
|
|
|
|
static char *vidix_name;
|
2002-01-12 23:28:22 +00:00
|
|
|
|
|
|
|
/* Image parameters */
|
|
|
|
static uint32_t image_width;
|
|
|
|
static uint32_t image_height;
|
|
|
|
static uint32_t image_format;
|
|
|
|
|
|
|
|
/* Window parameters */
|
2002-06-04 18:39:16 +00:00
|
|
|
static uint32_t window_x, window_y;
|
2002-01-12 23:28:22 +00:00
|
|
|
static uint32_t window_width, window_height;
|
|
|
|
|
2002-01-26 19:42:21 +00:00
|
|
|
/* used by XGetGeometry & XTranslateCoordinates for moving/resizing window */
|
2002-01-12 23:28:22 +00:00
|
|
|
static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
|
2002-03-07 17:50:25 +00:00
|
|
|
drwDepth, drwcX, drwcY, dwidth, dheight;
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-07-19 20:51:48 +00:00
|
|
|
extern void set_video_eq( int cap );
|
|
|
|
|
2003-01-18 15:05:06 +00:00
|
|
|
#ifdef HAVE_XINERAMA
|
|
|
|
extern int xinerama_screen;
|
|
|
|
#endif
|
|
|
|
|
2002-08-28 21:32:32 +00:00
|
|
|
static void set_window(int force_update)
|
2002-01-12 23:28:22 +00:00
|
|
|
{
|
2002-05-14 23:44:35 +00:00
|
|
|
Window mRoot;
|
2002-05-11 14:57:41 +00:00
|
|
|
if ( WinID )
|
|
|
|
{
|
|
|
|
XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
|
|
|
|
&drwHeight, &drwBorderWidth, &drwDepth);
|
|
|
|
drwX = drwY = 0;
|
2002-06-05 19:35:54 +00:00
|
|
|
|
2002-05-11 14:57:41 +00:00
|
|
|
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);
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
/* following stuff copied from vo_xmga.c */
|
2002-05-11 14:57:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aspect(&dwidth,&dheight,A_NOZOOM);
|
|
|
|
drwcX=drwX=vo_dx; drwcY=drwY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight;
|
|
|
|
}
|
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
#if X11_FULLSCREEN
|
2002-03-07 17:50:25 +00:00
|
|
|
if (vo_fs)
|
2002-01-18 18:15:43 +00:00
|
|
|
{
|
2002-03-24 21:22:16 +00:00
|
|
|
aspect(&dwidth,&dheight,A_ZOOM);
|
2002-01-18 18:15:43 +00:00
|
|
|
drwX = (vo_screenwidth - (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2;
|
2002-05-11 14:57:41 +00:00
|
|
|
drwcX = drwX;
|
2002-01-18 18:15:43 +00:00
|
|
|
drwY = (vo_screenheight - (dheight > vo_screenheight ? vo_screenheight : dheight)) / 2;
|
2002-05-11 14:57:41 +00:00
|
|
|
drwcY = drwY;
|
2002-01-18 18:15:43 +00:00
|
|
|
drwWidth = (dwidth > vo_screenwidth ? vo_screenwidth : dwidth);
|
|
|
|
drwHeight = (dheight > vo_screenheight ? vo_screenheight : dheight);
|
2002-01-19 22:43:19 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_V, "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
|
2002-01-18 18:15:43 +00:00
|
|
|
drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-06-05 19:35:54 +00:00
|
|
|
vo_dwidth=drwWidth; vo_dheight=drwHeight;
|
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
#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 */
|
2003-01-18 15:05:06 +00:00
|
|
|
while (i<num_screens &&
|
|
|
|
((screens[i].x_org < drwcX) || (screens[i].y_org < drwcY) ||
|
2002-01-18 18:15:43 +00:00
|
|
|
(screens[i].x_org + screens[i].width >= drwcX) ||
|
2003-01-18 15:05:06 +00:00
|
|
|
(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;
|
|
|
|
}
|
2002-01-18 18:15:43 +00:00
|
|
|
|
|
|
|
/* set drwcX and drwcY to the right values */
|
|
|
|
drwcX = drwcX - screens[i].x_org;
|
|
|
|
drwcY = drwcY - screens[i].y_org;
|
|
|
|
XFree(screens);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-06-10 18:40:19 +00:00
|
|
|
if ( vo_panscan > 0.0f && vo_fs )
|
2002-06-05 19:35:54 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
/* set new values in VIDIX */
|
2002-06-04 18:39:16 +00:00
|
|
|
if (force_update || (window_x != drwcX) || (window_y != drwcY) ||
|
2002-01-19 22:43:19 +00:00
|
|
|
(window_width != drwWidth) || (window_height != drwHeight))
|
2002-01-12 23:28:22 +00:00
|
|
|
{
|
2002-06-04 18:39:16 +00:00
|
|
|
// do a backup of window coordinates
|
|
|
|
window_x = drwcX;
|
|
|
|
window_y = drwcY;
|
2002-05-11 14:57:41 +00:00
|
|
|
vo_dx = drwcX;
|
|
|
|
vo_dy = drwcY;
|
2002-01-16 09:18:43 +00:00
|
|
|
window_width = drwWidth;
|
|
|
|
window_height = drwHeight;
|
2002-01-16 15:22:45 +00:00
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
/* FIXME: implement runtime resize/move if possible, this way is very ugly! */
|
2002-01-16 15:22:45 +00:00
|
|
|
vidix_stop();
|
2002-05-11 14:57:41 +00:00
|
|
|
if (vidix_init(image_width, image_height, vo_dx, vo_dy,
|
2002-01-31 10:23:39 +00:00
|
|
|
window_width, window_height, image_format, vo_depthonscreen,
|
2002-08-28 21:32:32 +00:00
|
|
|
vo_screenwidth, vo_screenheight) != 0)
|
2002-01-12 23:28:22 +00:00
|
|
|
{
|
2002-06-29 10:52:04 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s\n", strerror(errno));
|
2003-08-31 18:33:02 +00:00
|
|
|
abort();
|
2002-01-12 23:28:22 +00:00
|
|
|
}
|
2002-01-16 15:22:45 +00:00
|
|
|
vidix_start();
|
2002-01-12 23:28:22 +00:00
|
|
|
}
|
|
|
|
|
2002-06-24 11:51:55 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_V, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n",
|
2002-05-11 14:57:41 +00:00
|
|
|
vo_dx, vo_dy, window_width, window_height);
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-01-19 22:43:19 +00:00
|
|
|
/* mDrawColorKey: */
|
|
|
|
|
|
|
|
/* fill drawable with specified color */
|
2002-04-20 22:58:15 +00:00
|
|
|
XSetBackground( mDisplay,vo_gc,bgColor );
|
2002-02-22 15:22:27 +00:00
|
|
|
XClearWindow( mDisplay,vo_window );
|
|
|
|
XSetForeground(mDisplay, vo_gc, fgColor);
|
|
|
|
XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
|
2002-03-07 17:50:25 +00:00
|
|
|
(vo_fs ? drwHeight - 1 : drwHeight));
|
2002-01-19 22:43:19 +00:00
|
|
|
/* flush, update drawable */
|
|
|
|
XFlush(mDisplay);
|
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* connect to server, create and map window,
|
|
|
|
* allocate colors and (shared) memory
|
|
|
|
*/
|
2002-01-31 09:57:13 +00:00
|
|
|
static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
2002-08-28 21:32:32 +00:00
|
|
|
uint32_t d_height, uint32_t flags, char *title, uint32_t format)
|
2002-01-12 23:28:22 +00:00
|
|
|
{
|
|
|
|
XVisualInfo vinfo;
|
2002-11-06 23:54:29 +00:00
|
|
|
// XSizeHints hint;
|
2002-01-12 23:28:22 +00:00
|
|
|
XSetWindowAttributes xswa;
|
|
|
|
unsigned long xswamask;
|
|
|
|
XWindowAttributes attribs;
|
|
|
|
int window_depth;
|
2002-01-13 00:23:47 +00:00
|
|
|
|
2002-04-20 22:58:15 +00:00
|
|
|
title = "MPlayer VIDIX X11 Overlay";
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-06-05 19:35:54 +00:00
|
|
|
panscan_init();
|
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
image_height = height;
|
|
|
|
image_width = width;
|
|
|
|
image_format = format;
|
2002-05-11 14:57:41 +00:00
|
|
|
vo_mouse_autohide=1;
|
2002-02-01 10:20:00 +00:00
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
aspect_save_orig(width, height);
|
|
|
|
aspect_save_prescale(d_width, d_height);
|
|
|
|
aspect_save_screenres(vo_screenwidth, vo_screenheight);
|
|
|
|
|
2002-05-11 14:57:41 +00:00
|
|
|
vo_dx = 0;
|
|
|
|
vo_dy = 0;
|
2003-04-20 15:09:19 +00:00
|
|
|
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);
|
2002-01-18 18:15:43 +00:00
|
|
|
window_width = d_width;
|
|
|
|
window_height = d_height;
|
|
|
|
|
2002-05-07 13:31:29 +00:00
|
|
|
// vo_fs = flags&0x01;
|
|
|
|
// if (vo_fs)
|
|
|
|
// { vo_old_width=d_width; vo_old_height=d_height; }
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
/* from xmga.c */
|
2002-04-20 22:58:15 +00:00
|
|
|
bgColor = 0x0L;
|
2002-01-18 18:15:43 +00:00
|
|
|
switch(vo_depthonscreen)
|
|
|
|
{
|
|
|
|
case 32:
|
|
|
|
case 24:
|
|
|
|
fgColor = 0x00ff00ffL;
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
fgColor = 0xf81fL;
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
fgColor = 0x7c1fL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "Sorry, this (%d) color depth is not supported\n",
|
|
|
|
vo_depthonscreen);
|
|
|
|
}
|
2002-01-12 23:28:22 +00:00
|
|
|
|
|
|
|
aspect(&d_width, &d_height, A_NOZOOM);
|
2002-05-11 14:57:41 +00:00
|
|
|
|
2002-05-07 13:31:29 +00:00
|
|
|
vo_dwidth=d_width; vo_dheight=d_height;
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
#ifdef HAVE_NEW_GUI
|
2002-05-07 13:31:29 +00:00
|
|
|
if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
|
|
|
|
else
|
2002-01-18 18:15:43 +00:00
|
|
|
{
|
|
|
|
#endif
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-01-18 18:15:43 +00:00
|
|
|
#ifdef X11_FULLSCREEN
|
2002-05-11 14:57:41 +00:00
|
|
|
if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM);
|
2002-01-18 18:15:43 +00:00
|
|
|
#endif
|
2002-03-11 09:24:09 +00:00
|
|
|
dwidth = d_width;
|
|
|
|
dheight = d_height;
|
2002-01-12 23:28:22 +00:00
|
|
|
/* 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);
|
|
|
|
|
2002-05-04 22:52:56 +00:00
|
|
|
xswa.background_pixel = BlackPixel(mDisplay, mScreen);
|
2002-01-18 18:15:43 +00:00
|
|
|
xswa.border_pixel = 0;
|
2002-01-12 23:28:22 +00:00
|
|
|
xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen),
|
|
|
|
vinfo.visual, AllocNone);
|
2002-05-11 14:57:41 +00:00
|
|
|
xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | PropertyChangeMask |
|
2002-04-24 23:15:17 +00:00
|
|
|
((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask));
|
2002-01-18 18:15:43 +00:00
|
|
|
xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
2002-01-12 23:28:22 +00:00
|
|
|
|
|
|
|
if (WinID >= 0)
|
|
|
|
{
|
2002-02-22 15:22:27 +00:00
|
|
|
vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay, mScreen);
|
2002-05-11 14:57:41 +00:00
|
|
|
if ( WinID )
|
|
|
|
{
|
|
|
|
XUnmapWindow(mDisplay, vo_window);
|
|
|
|
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
|
2002-08-09 17:43:49 +00:00
|
|
|
vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
|
2002-05-11 14:57:41 +00:00
|
|
|
} else XSelectInput( mDisplay,vo_window,ExposureMask );
|
2002-01-12 23:28:22 +00:00
|
|
|
}
|
|
|
|
else
|
2002-05-11 14:57:41 +00:00
|
|
|
{
|
2002-10-17 09:49:25 +00:00
|
|
|
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 );
|
|
|
|
|
|
|
|
XStoreName(mDisplay, vo_window, title);
|
|
|
|
XMapWindow(mDisplay, vo_window);
|
2002-05-07 13:31:29 +00:00
|
|
|
|
2002-10-17 09:49:25 +00:00
|
|
|
if ( flags&1 ) vo_x11_fullscreen();
|
2002-05-07 13:31:29 +00:00
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
#ifdef HAVE_XINERAMA
|
2002-10-17 09:49:25 +00:00
|
|
|
vo_x11_xinerama_move(mDisplay, vo_window);
|
2002-01-13 00:23:47 +00:00
|
|
|
#endif
|
2002-10-17 09:49:25 +00:00
|
|
|
} else if ( !(flags&1) ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
|
2002-05-11 14:57:41 +00:00
|
|
|
}
|
2002-10-17 09:49:25 +00:00
|
|
|
|
|
|
|
if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
|
2002-02-22 15:22:27 +00:00
|
|
|
vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &mGCV);
|
2002-01-18 18:15:43 +00:00
|
|
|
#ifdef HAVE_NEW_GUI
|
|
|
|
}
|
2002-01-12 23:28:22 +00:00
|
|
|
#endif
|
|
|
|
|
2002-05-11 14:57:41 +00:00
|
|
|
if ( ( !WinID )&&( flags&1 ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
|
2002-01-19 22:43:19 +00:00
|
|
|
|
2002-01-19 16:58:33 +00:00
|
|
|
if (vidix_grkey_support())
|
|
|
|
{
|
|
|
|
vidix_grkey_get(&gr_key);
|
|
|
|
gr_key.key_op = KEYS_PUT;
|
|
|
|
gr_key.ckey.op = CKEY_TRUE;
|
|
|
|
gr_key.ckey.red = 255;
|
|
|
|
gr_key.ckey.green = 0;
|
|
|
|
gr_key.ckey.blue = 255;
|
|
|
|
vidix_grkey_set(&gr_key);
|
|
|
|
}
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-08-28 21:32:32 +00:00
|
|
|
set_window(1);
|
2002-07-19 20:51:48 +00:00
|
|
|
|
2002-02-22 15:22:27 +00:00
|
|
|
XFlush(mDisplay);
|
|
|
|
XSync(mDisplay, False);
|
2002-01-12 23:28:22 +00:00
|
|
|
|
2002-06-10 18:40:19 +00:00
|
|
|
panscan_calc();
|
|
|
|
|
2002-01-12 23:28:22 +00:00
|
|
|
saver_off(mDisplay); /* turning off screen saver */
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void check_events(void)
|
|
|
|
{
|
|
|
|
const int event = vo_x11_check_events(mDisplay);
|
2002-01-13 00:23:47 +00:00
|
|
|
|
2002-01-19 22:43:19 +00:00
|
|
|
if ((event & VO_EVENT_RESIZE) || (event & VO_EVENT_EXPOSE))
|
2002-08-28 21:32:32 +00:00
|
|
|
set_window(0);
|
2002-01-18 18:15:43 +00:00
|
|
|
|
2002-01-13 00:23:47 +00:00
|
|
|
return;
|
2002-01-12 23:28:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw_osd, flip_page, draw_slice, draw_frame should be
|
|
|
|
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");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void flip_page(void)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2002-01-19 22:43:19 +00:00
|
|
|
UNUSED(src);
|
|
|
|
UNUSED(stride);
|
|
|
|
UNUSED(w);
|
|
|
|
UNUSED(h);
|
|
|
|
UNUSED(x);
|
|
|
|
UNUSED(y);
|
2002-01-12 23:28:22 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_slice!\n");
|
2002-06-24 11:51:55 +00:00
|
|
|
return(-1);
|
2002-01-12 23:28:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t draw_frame(uint8_t *src[])
|
|
|
|
{
|
2002-01-19 22:43:19 +00:00
|
|
|
UNUSED(src);
|
2002-01-12 23:28:22 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_frame!\n");
|
2002-06-24 11:51:55 +00:00
|
|
|
return(-1);
|
2002-01-12 23:28:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t query_format(uint32_t format)
|
|
|
|
{
|
2002-01-26 19:42:21 +00:00
|
|
|
return(vidix_query_fourcc(format));
|
2002-01-12 23:28:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uninit(void)
|
|
|
|
{
|
2002-06-25 19:10:03 +00:00
|
|
|
if ( !vo_config_count ) return;
|
2002-01-18 18:15:43 +00:00
|
|
|
vidix_term();
|
2002-12-27 16:42:11 +00:00
|
|
|
|
|
|
|
if (vidix_name)
|
|
|
|
{
|
|
|
|
free(vidix_name);
|
|
|
|
vidix_name = NULL;
|
|
|
|
}
|
2002-01-19 22:43:19 +00:00
|
|
|
|
2002-01-31 11:49:30 +00:00
|
|
|
saver_on(mDisplay); /* screen saver back on */
|
2002-05-14 23:44:35 +00:00
|
|
|
vo_x11_uninit();
|
2002-01-19 22:43:19 +00:00
|
|
|
}
|
2002-01-26 16:01:26 +00:00
|
|
|
|
|
|
|
static uint32_t preinit(const char *arg)
|
|
|
|
{
|
2002-05-08 20:24:35 +00:00
|
|
|
|
2002-01-26 19:42:21 +00:00
|
|
|
if (arg)
|
|
|
|
vidix_name = strdup(arg);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "No vidix driver name provided, probing available ones!\n");
|
|
|
|
vidix_name = NULL;
|
|
|
|
}
|
|
|
|
|
2002-10-27 03:16:21 +00:00
|
|
|
if (!vo_init()) return(-1);
|
2002-10-17 09:49:25 +00:00
|
|
|
|
2002-01-26 19:42:21 +00:00
|
|
|
if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
|
|
|
|
return(1);
|
|
|
|
|
|
|
|
return(0);
|
2002-01-26 16:01:26 +00:00
|
|
|
}
|
|
|
|
|
2002-02-09 01:21:48 +00:00
|
|
|
static uint32_t control(uint32_t request, void *data, ...)
|
2002-01-26 16:01:26 +00:00
|
|
|
{
|
2002-02-09 00:47:26 +00:00
|
|
|
switch (request) {
|
|
|
|
case VOCTRL_QUERY_FORMAT:
|
|
|
|
return query_format(*((uint32_t*)data));
|
2002-04-20 22:58:15 +00:00
|
|
|
case VOCTRL_GUISUPPORT:
|
|
|
|
return VO_TRUE;
|
2002-06-05 19:35:54 +00:00
|
|
|
case VOCTRL_GET_PANSCAN:
|
2002-06-06 07:13:57 +00:00
|
|
|
if ( !vo_config_count || !vo_fs ) return VO_FALSE;
|
2002-06-05 19:35:54 +00:00
|
|
|
return VO_TRUE;
|
2002-06-10 18:40:19 +00:00
|
|
|
case VOCTRL_FULLSCREEN:
|
|
|
|
vo_x11_fullscreen();
|
2002-06-05 19:35:54 +00:00
|
|
|
case VOCTRL_SET_PANSCAN:
|
|
|
|
if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
|
|
|
|
{
|
|
|
|
panscan_calc();
|
2002-08-28 21:32:32 +00:00
|
|
|
set_window(0);
|
2002-06-05 19:35:54 +00:00
|
|
|
}
|
|
|
|
return VO_TRUE;
|
2002-07-25 13:12:23 +00:00
|
|
|
case VOCTRL_SET_EQUALIZER:
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int value;
|
|
|
|
|
|
|
|
va_start(ap, data);
|
|
|
|
value = va_arg(ap, int);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
return vidix_control(request, data, (int *)value);
|
|
|
|
}
|
|
|
|
case VOCTRL_GET_EQUALIZER:
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int *value;
|
|
|
|
|
|
|
|
va_start(ap, data);
|
2002-07-30 16:40:42 +00:00
|
|
|
value = va_arg(ap, int*);
|
2002-07-25 13:12:23 +00:00
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
return vidix_control(request, data, value);
|
|
|
|
}
|
2002-02-09 00:47:26 +00:00
|
|
|
}
|
2002-06-24 11:51:55 +00:00
|
|
|
return vidix_control(request, data);
|
2002-06-23 18:00:42 +00:00
|
|
|
// return VO_NOTIMPL;
|
2002-01-26 16:01:26 +00:00
|
|
|
}
|