added check_events() interface

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-03-03 21:46:39 +00:00
parent dfefebc412
commit 0661c59b20
18 changed files with 161 additions and 425 deletions

View File

@ -3,8 +3,8 @@ include config.mak
LIBNAME = libvo.a
SRCS=rgb15to16mmx.c yuv2rgb_mmx.c yuv2rgb.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_odivx.c $(OPTIONAL_SRCS)
OBJS=rgb15to16mmx.o yuv2rgb_mmx.o yuv2rgb.o video_out.o vo_null.o vo_pgm.o vo_md5.o vo_odivx.o $(OPTIONAL_OBJS)
SRCS=rgb15to16mmx.c yuv2rgb_mmx.c yuv2rgb.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_odivx.c x11_common.c $(OPTIONAL_SRCS)
OBJS=rgb15to16mmx.o yuv2rgb_mmx.o yuv2rgb.o video_out.o vo_null.o vo_pgm.o vo_md5.o vo_odivx.o x11_common.o $(OPTIONAL_OBJS)
CFLAGS = $(OPTFLAGS) -I. -I.. -DMPG12PLAY
# -I/usr/X11R6/include/

View File

@ -152,7 +152,7 @@ draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
}
static void
flip_page(void)
vo_mga_flip_page(void)
{
#if 0
ioctl(f,MGA_VID_FSEL,&next_frame);

View File

@ -85,121 +85,4 @@ vo_functions_t* video_out_drivers[] =
NULL
};
#ifdef X11_FULLSCREEN
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
int vo_depthonscreen=0;
int vo_screenwidth=0;
int vo_screenheight=0;
int vo_init( void )
{
int CompletionType = -1;
int mScreen;
int bpp;
char * DisplayName = ":0.0";
Display * mDisplay;
XImage * mXImage;
Window mRootWin;
static XWindowAttributes attribs;
if(vo_depthonscreen) return 1; // already called
if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" );
mDisplay=XOpenDisplay( DisplayName );
if ( !mDisplay )
{
fprintf( stderr,"vo: couldn't open the X11 display!\n" );
return 0;
}
mScreen=DefaultScreen( mDisplay ); // Screen ID.
mRootWin=RootWindow( mDisplay,mScreen );// Root window ID.
vo_screenwidth=DisplayWidth( mDisplay,mScreen );
vo_screenheight=DisplayHeight( mDisplay,mScreen );
// get color depth:
// XGetWindowAttributes(mydisplay, DefaultRootWindow(mDisplay), &attribs);
XGetWindowAttributes(mDisplay, mRootWin, &attribs);
vo_depthonscreen=attribs.depth;
// get bits/pixel:
mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap );
bpp=mXImage->bits_per_pixel;
XDestroyImage( mXImage );
if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
XCloseDisplay( mDisplay );
printf("X11 running at %dx%d depth: %d\n",vo_screenwidth,vo_screenheight,vo_depthonscreen);
return 1;
}
#include "../linux/keycodes.h"
extern void mplayer_put_key(int code);
void vo_keyboard( int key )
{
switch ( key )
{
case wsLeft: mplayer_put_key(KEY_LEFT); break;
case wsRight: mplayer_put_key(KEY_RIGHT); break;
case wsUp: mplayer_put_key(KEY_UP); break;
case wsDown: mplayer_put_key(KEY_DOWN); break;
case wsSpace: mplayer_put_key(' '); break;
case wsEscape: mplayer_put_key(KEY_ESC); break;
case wsEnter: mplayer_put_key(KEY_ENTER); break;
case wsq:
case wsQ: mplayer_put_key('q'); break;
case wsp:
case wsP: mplayer_put_key('p'); break;
case wsMinus:
case wsGrayMinus: mplayer_put_key('-'); break;
case wsPlus:
case wsGrayPlus: mplayer_put_key('+'); break;
}
}
// ----- Motif header: -------
#define MWM_HINTS_DECORATIONS 2
typedef struct
{
long flags;
long functions;
long decorations;
long input_mode;
} MotifWmHints;
extern MotifWmHints vo_MotifWmHints;
extern Atom vo_MotifHints;
extern int vo_depthonscreen;
extern int vo_screenwidth;
extern int vo_screenheight;
static MotifWmHints vo_MotifWmHints;
static Atom vo_MotifHints = None;
void vo_decoration( Display * vo_Display,Window w,int d )
{
vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 );
if ( vo_MotifHints != None )
{
vo_MotifWmHints.flags=2;
vo_MotifWmHints.decorations=d;
XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32,
PropModeReplace,(unsigned char *)&vo_MotifWmHints,4 );
}
}
#include <signal.h>
int vo_eventhandler_pid=-1;
void vo_kill_eventhandler(){
if(vo_eventhandler_pid!=-1) kill(vo_eventhandler_pid,SIGTERM);
}
#endif

View File

@ -2,29 +2,10 @@
* video_out.h
*
* Copyright (C) Aaron Holtzman - Aug 1999
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* Strongly modified, most parts rewritten: A'rpi/ESP-team - 2000-2001
*
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h>
#define IMGFMT_YV12 0x32315659
@ -40,6 +21,10 @@ extern "C" {
#define IMGFMT_RGB24 (IMGFMT_RGB|24)
#define IMGFMT_RGB32 (IMGFMT_RGB|32)
#define VO_EVENT_EXPOSE 1
#define VO_EVENT_RESIZE 2
#define VO_EVENT_KEYPRESS 4
typedef struct vo_info_s
{
/* driver name ("Matrox Millennium G200/G400" */
@ -52,119 +37,65 @@ typedef struct vo_info_s
const char *comment;
} vo_info_t;
typedef struct vo_image_buffer_s
{
uint32_t height;
uint32_t width;
uint32_t format;
uint8_t *base;
void *private;
} vo_image_buffer_t;
typedef struct vo_functions_s
{
/*
* Initialize the display driver.
*
* params : width == width of video to display.
* height == height of video to display.
* fullscreen == non-zero if driver should attempt to
* render in fullscreen mode. Zero if
* a windowed mode is requested. This is
* merely a request; if the driver can only do
* fullscreen (like fbcon) or windowed (like X11),
* than this param may be disregarded.
* title == string for titlebar of window. May be disregarded
* if there is no such thing as a window to your
* driver. Make a copy of this string, if you need it.
* format == desired fourCC code to use for image buffers
* returns : zero on successful initialization, non-zero on error.
* The program will probably respond to an error condition
* by terminating.
* params:
* width,height: image source size
* d_width,d_height: size of the requested window size, just a hint
* fullscreen: flag, 0=windowd 1=fullscreen, just a hint
* title: window title, if available
* format: fourcc of pixel format
* returns : zero on successful initialization, non-zero on error.
*/
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);
/*
* Query that given pixel format is supported or not.
* params:
* format: fourcc of pixel format
* returns : 1 if supported, 0 if unsupported
*/
uint32_t (*query_format)(uint32_t format);
/*
* Return driver information.
*
* params : none.
* returns : read-only pointer to a vo_info_t structure.
* Fields are non-NULL.
* Should not return NULL.
*/
const vo_info_t* (*get_info)(void);
/*
* Display a new frame of the video to the screen. This may get called very
* rapidly, so the more efficient you can make your implementation of this
* function, the better.
*
* params : *src[] == An array with three elements. This is a YUV
* stream, with the Y plane in src[0], U in src[1],
* and V in src[2]. There is enough data for an image
* that is (WxH) pixels, where W and H are the width
* and height parameters that were previously passed
* to display_init().
* Information on the YUV format can be found at:
* http://www.webartz.com/fourcc/fccyuv.htm#IYUV
*
* returns : zero on successful rendering, non-zero on error.
* The program will probably respond to an error condition
* by terminating.
* Display a new RGB/BGR frame of the video to the screen.
* params:
* src[0] - pointer to the image
*/
uint32_t (*draw_frame)(uint8_t *src[]);
/*
* Update a section of the offscreen buffer. A "slice" is an area of the
* video image that is 16 rows of pixels at the width of the video image.
* Position (0, 0) is the upper left corner of slice #0 (the first slice),
* and position (0, 15) is the lower right. The next slice, #1, is bounded
* by (0, 16) and (0, 31), and so on.
*
* Note that slices are not drawn directly to the screen, and should be
* buffered until your implementation of display_flip_page() (see below)
* is called.
*
* This may get called very rapidly, so the more efficient you can make your
* implementation of this function, the better.
*
* params : *src[] == see display_frame(), above. The data passed in this
* array is just what enough data to contain the
* new slice, and NOT the entire frame.
* slice_num == The index of the slice. Starts at 0, not 1.
*
* returns : zero on successful rendering, non-zero on error.
* The program will probably respond to an error condition
* by terminating.
* Draw a planar YUV slice to the buffer:
* params:
* src[3] = source image planes (Y,U,V)
* stride[3] = source image planes line widths (in bytes)
* w,h = width*height of area to be copied (in Y pixels)
* x,y = position at the destination image (in Y pixels)
*/
// src[3] = source image planes (Y,U,V)
// stride[3] = source image planes line widths (in bytes)
// w,h = width*height of area to be copied (in Y pixels)
// x,y = position at the destination image (in Y pixels)
uint32_t (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
/*
* Draw the current image buffer to the screen. There may be several
* display_slice() calls before display_flip_page() is used. Note that
* display_frame does an implicit page flip, so you might or might not
* want to call this internally from your display_frame() implementation.
*
* This may get called very rapidly, so the more efficient you can make
* your implementation of this function, the better.
*
* params : void.
* returns : void.
* Blit/Flip buffer to the screen. Must be called after each frame!
*/
void (*flip_page)(void);
/*
* This func is called after every frames to handle keyboard and
* other events. It's called in PAUSE mode too!
*/
void (*check_events)(void);
/*
* Closes driver. Should restore the original state of the system.
*/
void (*uninit)(void);
} vo_functions_t;
@ -172,24 +103,3 @@ typedef struct vo_functions_s
// NULL terminated array of all drivers
extern vo_functions_t* video_out_drivers[];
#ifdef X11_FULLSCREEN
// X11 keyboard codes
#include "wskeys.h"
extern int vo_depthonscreen;
extern int vo_screenwidth;
extern int vo_screenheight;
int vo_init( void );
//void vo_decoration( Display * vo_Display,Window w,int d );
extern int vo_eventhandler_pid;
void vo_kill_eventhandler();
#endif
#ifdef __cplusplus
}
#endif

View File

@ -24,9 +24,9 @@
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 const vo_info_t* get_info(void);
static uint32_t draw_frame(uint8_t *src[]);
//static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num);
static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y);
static void flip_page(void);
static void check_events(void);
static void uninit(void);
static uint32_t query_format(uint32_t format);
@ -38,6 +38,6 @@ static uint32_t query_format(uint32_t format);
draw_frame,\
draw_slice,\
flip_page,\
check_events,\
uninit,\
};

View File

@ -476,3 +476,8 @@ uninit(void)
}
static void check_events(void)
{
}

View File

@ -34,6 +34,7 @@ LIBVO_EXTERN( dga )
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
#include "x11_common.h"
static vo_info_t vo_info =
{
@ -43,28 +44,26 @@ static vo_info_t vo_info =
""
};
int vo_dga_width; // bytes per line in framebuffer
int vo_dga_vp_width; // visible pixels per line in framebuffer
int vo_dga_vp_height; // visible lines in framebuffer
int vo_dga_is_running = 0;
int vo_dga_src_width; // width of video in pixels
int vo_dga_src_height; // height of video in pixels
int vo_dga_bpp; // bytes per pixel in framebuffer
int vo_dga_src_offset=0; // offset in src
int vo_dga_vp_offset=0; // offset in dest
int vo_dga_bytes_per_line; // longwords per line to copy
int vo_dga_src_skip; // bytes to skip after copying one line
static int vo_dga_width; // bytes per line in framebuffer
static int vo_dga_vp_width; // visible pixels per line in framebuffer
static int vo_dga_vp_height; // visible lines in framebuffer
static int vo_dga_is_running = 0;
static int vo_dga_src_width; // width of video in pixels
static int vo_dga_src_height; // height of video in pixels
static int vo_dga_bpp; // bytes per pixel in framebuffer
static int vo_dga_src_offset=0; // offset in src
static int vo_dga_vp_offset=0; // offset in dest
static int vo_dga_bytes_per_line; // longwords per line to copy
static int vo_dga_src_skip; // bytes to skip after copying one line
// (not supported yet) in src
int vo_dga_vp_skip; // dto. for dest
int vo_dga_lines; // num of lines to copy
int vo_dga_src_format;
static int vo_dga_vp_skip; // dto. for dest
static int vo_dga_lines; // num of lines to copy
static int vo_dga_src_format;
unsigned char *vo_dga_base;
Display *vo_dga_dpy;
static unsigned char *vo_dga_base;
static Display *vo_dga_dpy;
extern void vo_decoration( Display * vo_Display,Window w,int d );
#include "mmx.h"
#if defined (HAVE_SSE) || defined (HAVE_3DNOW)
@ -170,8 +169,13 @@ static uint32_t draw_frame( uint8_t *src[] ){
return 0;
}
static void check_events(void)
{
int e=vo_x11_check_events(vo_dga_dpy);
}
static void flip_page( void ){
check_events();
// printf("vo_dga: In flippage\n");
}
@ -314,7 +318,7 @@ static uint32_t init( uint32_t width, uint32_t height,
return 0;
}
#if 0
int vo_dga_query_event(void){
XEvent myevent;
@ -366,6 +370,7 @@ int vo_dga_query_event(void){
}
return retval;
}
#endif

View File

@ -32,6 +32,8 @@ LIBVO_EXTERN(gl)
#include <GL/gl.h>
#include "x11_common.h"
static vo_info_t vo_info =
{
"X11 (OpenGL)",
@ -89,8 +91,6 @@ static resize(int x,int y){
glLoadIdentity();
}
extern void vo_decoration( Display * vo_Display,Window w,int d );
/* connect to server, create and map window,
* allocate colors and (shared) memory
*/
@ -189,7 +189,7 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
// printf("GLXcontext ok\n");
if ( fullscreen ) vo_decoration( mydisplay,mywindow,0 );
if ( fullscreen ) vo_x11_decoration( mydisplay,mywindow,0 );
XSelectInput(mydisplay, mywindow, StructureNotifyMask);
@ -317,30 +317,19 @@ Terminate_Display_Process(void)
X_already_started = 0;
}
static void
FlipImage()
{
int i;
XEvent Event;
char buf[100];
KeySym keySym;
XComposeStatus stat;
unsigned long vo_KeyTable[512];
while ( XPending( mydisplay ) )
{
XNextEvent( mydisplay,&Event );
switch( Event.type )
{
case ConfigureNotify:
resize( Event.xconfigure.width,Event.xconfigure.height );
break;
case KeyPress:
XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat );
vo_keyboard( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
break;
}
}
static void check_events(void)
{
int e=vo_x11_check_events(mydisplay);
if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight);
}
static void
flip_page(void)
{
check_events();
// glEnable(GL_TEXTURE_2D);
// glBindTexture(GL_TEXTURE_2D, texture_id);
@ -359,12 +348,6 @@ FlipImage()
}
static void
flip_page(void)
{
FlipImage();
}
//static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num)
static uint32_t draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
{
@ -418,7 +401,6 @@ int i;
}
// Display_Image(ImageData);
// FlipImage();
return 0;
}
@ -452,7 +434,6 @@ uint8_t *de=&ImageData[3*image_width];
}
// Display_Image(ImageData);
// FlipImage();
return 0;
}
@ -476,7 +457,6 @@ uint8_t *ImageData=src[0];
}
// Display_Image(ImageData);
// FlipImage();
return 0;
}
@ -509,7 +489,5 @@ query_format(uint32_t format)
static void
uninit(void)
{
vo_kill_eventhandler();
}

View File

@ -104,3 +104,8 @@ uninit(void)
}
static void check_events(void)
{
}

View File

@ -124,4 +124,15 @@ printf("vo: uninit!\n");
}
static void flip_page(void)
{
vo_mga_flip_page();
}
static void check_events(void)
{
}

View File

@ -82,4 +82,9 @@ uninit(void)
}
static void check_events(void)
{
}

View File

@ -232,3 +232,8 @@ uninit(void)
static void check_events(void)
{
}

View File

@ -112,4 +112,9 @@ uninit(void)
}
static void check_events(void)
{
}

View File

@ -603,5 +603,3 @@ uninit(void)
sdl_close();
}

View File

@ -441,6 +441,7 @@ uninit(void)
}
static void check_events(void)
{
}

View File

@ -31,6 +31,8 @@ LIBVO_EXTERN( x11 )
#include <errno.h>
#include "yuv2rgb.h"
#include "x11_common.h"
static vo_info_t vo_info =
{
"X11 ( XImage/Shm )",
@ -57,7 +59,7 @@ static int depth,bpp,mode;
static XWindowAttributes attribs;
static int X_already_started=0;
static int windowwidth,windowheight;
//static int vo_dwidth,vo_dheight;
#define SH_MEM
@ -95,32 +97,10 @@ static uint32_t image_width;
static uint32_t image_height;
static uint32_t image_format;
extern void vo_decoration( Display * vo_Display,Window w,int d );
static Bool mEvents( Display * display,XEvent * Event,XPointer arg )
{
int i;
char buf[100];
KeySym keySym;
XComposeStatus stat;
unsigned long vo_KeyTable[512];
switch( Event->type )
{
case ConfigureNotify:
windowwidth=Event->xconfigure.width;
windowheight=Event->xconfigure.height;
break;
case KeyPress:
XLookupString( &Event->xkey,buf,sizeof(buf),&keySym,&stat );
vo_keyboard( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
break;
}
return 0;
static void check_events(){
int e=vo_x11_check_events(mDisplay);
}
static XEvent mEvent;
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 )
{
int screen;
@ -163,8 +143,8 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
hint.width=vo_screenwidth;
hint.height=vo_screenheight;
}
windowwidth=hint.width;
windowheight=hint.height;
vo_dwidth=hint.width;
vo_dheight=hint.height;
hint.flags=PPosition | PSize;
bg=WhitePixel( mDisplay,screen );
@ -189,7 +169,7 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
hint.width,hint.height,
xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
if ( fullscreen ) vo_decoration( mDisplay,mywindow,0 );
if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
XSelectInput( mDisplay,mywindow,StructureNotifyMask );
XSetStandardProperties( mDisplay,mywindow,hello,hello,None,NULL,0,&hint );
XMapWindow( mDisplay,mywindow );
@ -302,11 +282,6 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
// vo_initthread( mThread );
if((vo_eventhandler_pid=fork())==0){
XIfEvent( mDisplay,&mEvent,mEvents,NULL );
exit(0);
}
return 0;
}
@ -337,7 +312,7 @@ static void Display_Image( XImage *myximage,uint8_t *ImageData )
{
XShmPutImage( mDisplay,mywindow,mygc,myximage,
0,0,
( windowwidth - myximage->width ) / 2,( windowheight - myximage->height ) / 2,
( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
myximage->width,myximage->height,True );
XFlush( mDisplay );
}
@ -346,15 +321,17 @@ static void Display_Image( XImage *myximage,uint8_t *ImageData )
{
XPutImage( mDisplay,mywindow,mygc,myximage,
0,0,
( windowwidth - myximage->width ) / 2,( windowheight - myximage->height ) / 2,
( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
myximage->width,myximage->height );
XFlush( mDisplay );
}
#endif
}
static void flip_page( void )
{ Display_Image( myximage,ImageData ); }
static void flip_page( void ){
check_events();
Display_Image( myximage,ImageData );
}
static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y )
{
@ -469,7 +446,6 @@ static void
uninit(void)
{
printf("vo: uninit!\n");
vo_kill_eventhandler();
}

View File

@ -43,6 +43,8 @@ LIBVO_EXTERN( xmga )
#include <X11/Xutil.h>
#include <errno.h>
#include "x11_common.h"
static vo_info_t vo_info =
{
"X11 (Matrox G200/G400 overlay in window using /dev/mga_vid)",
@ -88,6 +90,7 @@ static XSetWindowAttributes xWAttribs;
#include "mga_common.c"
static void mDrawColorKey( void )
{
XClearWindow( mDisplay,mWindow );
@ -96,20 +99,11 @@ static void mDrawColorKey( void )
XFlush( mDisplay );
}
static Bool mEvents( Display * display,XEvent * Event,XPointer arg )
static void check_events(void)
{
int i;
char buf[100];
KeySym keySym;
XComposeStatus stat;
unsigned long vo_KeyTable[512];
int e=vo_x11_check_events(mDisplay);
switch( Event->type )
{
case Expose:
mDrawColorKey();
break;
case ConfigureNotify:
if(e&VO_EVENT_RESIZE){
XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
drwX=0; drwY=0;
XTranslateCoordinates( mDisplay,mWindow,mRoot,0,0,&drwcX,&drwcY,&mRoot );
@ -134,18 +128,18 @@ static Bool mEvents( Display * display,XEvent * Event,XPointer arg )
if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) )
{
fprintf( stderr,"Error in mga_vid_config ioctl" );
exit( 0 );
// exit( 0 );
}
break;
case KeyPress:
XLookupString( &Event->xkey,buf,sizeof(buf),&keySym,&stat );
vo_keyboard( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
break;
}
return 0;
} else
if(e&VO_EVENT_EXPOSE) mDrawColorKey();
}
static XEvent mEvent;
static void flip_page(void){
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 )
{
@ -229,7 +223,7 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
InputOutput,
vinfo.visual,xswamask,&xWAttribs );
if ( fullscreen ) vo_decoration( mDisplay,mWindow,0 );
if ( fullscreen ) vo_x11_decoration( mDisplay,mWindow,0 );
XGetNormalHints( mDisplay,mWindow,&hint );
hint.x=wndX; hint.y=wndY;
@ -295,11 +289,6 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
// vo_initthread( mThread );
if((vo_eventhandler_pid=fork())==0){
XIfEvent( mDisplay,&mEvent,mEvents,NULL );
exit(0);
}
return 0;
}
@ -312,7 +301,6 @@ uninit(void)
{
ioctl( f,MGA_VID_OFF,0 );
printf("vo: uninit!\n");
vo_kill_eventhandler();
}

View File

@ -31,6 +31,8 @@ LIBVO_EXTERN(xv)
#include <errno.h>
#include "yuv2rgb.h"
#include "x11_common.h"
static vo_info_t vo_info =
{
"X11/Xv",
@ -59,7 +61,7 @@ static XWindowAttributes attribs;
static void allocate_xvimage(int);
static unsigned int ver,rel,req,ev,err;
static unsigned int formats, adaptors,i,xv_port,xv_format;
static int win_width,win_height;
//static int vo_dwidth,vo_dheight;
static XvAdaptorInfo *ai;
static XvImageFormatValues *fo;
static XvImage *xvimage[1];
@ -92,8 +94,6 @@ static int get_depth(){
return depth;
}
extern void vo_decoration( Display * vo_Display,Window w,int d );
/* connect to server, create and map window,
* allocate colors and (shared) memory
*/
@ -191,7 +191,7 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
XSetStandardProperties(mydisplay, mywindow, hello, hello, None, NULL, 0, &hint);
if ( fullscreen ) vo_decoration( mydisplay,mywindow,0 );
if ( fullscreen ) vo_x11_decoration( mydisplay,mywindow,0 );
/* Map window. */
@ -256,8 +256,8 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
/* catch window resizes */
XSelectInput(mydisplay, mywindow, StructureNotifyMask | KeyPressMask);
// XSelectInput(mydisplay, mywindow, StructureNotifyMask);
win_width = image_width;
win_height = image_height;
vo_dwidth = image_width;
vo_dheight = image_height;
// resize:
XMoveResizeWindow(mydisplay,mywindow,0,0,d_width,d_height);
@ -299,56 +299,20 @@ allocate_xvimage(int foo)
return;
}
#if 0
static void
check_events(void)
static void check_events(void)
{
Window root;
XEvent event;
int x, y;
unsigned int w, h, b, d;
int e=vo_x11_check_events(mydisplay);
if (XCheckWindowEvent(mydisplay, mywindow, StructureNotifyMask, &event))
{
XGetGeometry(mydisplay, mywindow, &root, &x, &y, &w, &h, &b, &d);
win_width = w;
win_height = h;
}
}
#endif
static void
flip_page(void)
{
int i;
XEvent Event;
char buf[100];
KeySym keySym;
XComposeStatus stat;
unsigned long vo_KeyTable[512];
while ( XPending( mydisplay ) )
{
XNextEvent( mydisplay,&Event );
switch( Event.type )
{
case ConfigureNotify:
win_width = Event.xconfigure.width;
win_height = Event.xconfigure.height;
break;
case KeyPress:
XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat );
vo_keyboard( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
break;
}
}
// check_events();
check_events();
#ifdef DISP
XvShmPutImage(mydisplay, xv_port, mywindow, mygc, xvimage[0],
0, 0, image_width, image_height,
0, 0, win_width, win_height,
0, 0, vo_dwidth, vo_dheight,
False);
XFlush(mydisplay);
#endif
@ -407,8 +371,6 @@ draw_frame(uint8_t *src[])
{
int foo;
// check_events();
if(xv_format==IMGFMT_YUY2){
// YUY2 packed, flipped
#if 0
@ -450,7 +412,6 @@ query_format(uint32_t format)
static void
uninit(void)
{
vo_kill_eventhandler();
}