Mercurial > mplayer.hg
changeset 7777:ed7b05575aab
-fixed-vo support
author | pontscho |
---|---|
date | Thu, 17 Oct 2002 09:49:25 +0000 |
parents | 75c5762e7b55 |
children | f804db78f704 |
files | libvo/mga_common.c libvo/vo_gl.c libvo/vo_xmga.c libvo/vo_xvidix.c |
diffstat | 4 files changed, 61 insertions(+), 101 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/mga_common.c Thu Oct 17 00:54:13 2002 +0000 +++ b/libvo/mga_common.c Thu Oct 17 09:49:25 2002 +0000 @@ -380,7 +380,9 @@ //clear the buffer memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames); +#ifndef VO_XMGA ioctl(f,MGA_VID_ON,0); +#endif return 0; }
--- a/libvo/vo_gl.c Thu Oct 17 00:54:13 2002 +0000 +++ b/libvo/vo_gl.c Thu Oct 17 09:49:25 2002 +0000 @@ -5,12 +5,6 @@ #define TEXTUREFORMAT_32BPP -/* - * video_out_gl.c, X11/OpenGL interface - * based on video_out_x11 by Aaron Holtzman, - * and WS opengl window manager by Pontscho/Fresh! - */ - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -44,28 +38,14 @@ "" }; -/* private prototypes */ -// static void Display_Image (unsigned char *ImageData); - /* local data */ static unsigned char *ImageData=NULL; -/* X11 related variables */ -//static Display *mydisplay; -//static Window vo_window; -//static GC mygc; -//static XImage *myximage; -//static int depth,mode; -//static XWindowAttributes attribs; -//static int texture_id=1; - static GLXContext wsGLXContext; -//XVisualInfo * wsVisualInfo; static int wsGLXAttrib[] = { GLX_RGBA, GLX_RED_SIZE,1, GLX_GREEN_SIZE,1, GLX_BLUE_SIZE,1, -// GLX_DEPTH_SIZE,16, GLX_DOUBLEBUFFER, None }; @@ -113,8 +93,6 @@ image_width = width; image_format = format; - if(!vo_init()) return -1; - aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); aspect_save_screenres(vo_screenwidth,vo_screenheight); @@ -138,9 +116,6 @@ /* Make the window */ -// XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); - -// XMatchVisualInfo(mDisplay, screen, depth, TrueColor, &vinfo); vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib ); if (vinfo == NULL) { @@ -150,66 +125,49 @@ xswa.background_pixel = 0; xswa.border_pixel = 1; -// xswa.colormap = XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone); xswa.colormap = XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone); xswamask = CWBackPixel | CWBorderPixel | CWColormap; -// xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWCursor | CWOverrideRedirect | CWSaveUnder | CWX | CWY | CWWidth | CWHeight; - - vo_window = XCreateWindow(mDisplay, mRootWin, - hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa); - vo_x11_classhint( mDisplay,vo_window,"gl" ); - vo_hidecursor(mDisplay,vo_window); + if ( vo_window == None ) + { + vo_window = XCreateWindow(mDisplay, mRootWin, + hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa); - wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True ); -// XStoreName( wsDisplay,wsMyWin,wsSysName ); - -// printf("GLXcontext ok\n"); + vo_x11_classhint( mDisplay,vo_window,"gl" ); + vo_hidecursor(mDisplay,vo_window); -// if ( flags&0x01 ) vo_x11_decoration( mDisplay,vo_window,0 ); - - XSelectInput(mDisplay, vo_window, StructureNotifyMask); - - /* Tell other applications about this window */ - - XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); - - /* Map window. */ - - XMapWindow(mDisplay, vo_window); - if ( flags&1 ) vo_x11_fullscreen(); +// if ( flags&0x01 ) vo_x11_decoration( mDisplay,vo_window,0 ); + XSelectInput(mDisplay, vo_window, StructureNotifyMask); + /* Tell other applications about this window */ + XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); + /* Map window. */ + 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 - /* Wait for map. */ - do - { + /* Wait for map. */ + do + { XNextEvent(mDisplay, &xev); - } - while (xev.type != MapNotify || xev.xmap.event != vo_window); + } + while (xev.type != MapNotify || xev.xmap.event != vo_window); - XSelectInput(mDisplay, vo_window, NoEventMask); + XSelectInput(mDisplay, vo_window, NoEventMask); + } - glXMakeCurrent( mDisplay,vo_window,wsGLXContext ); + if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext ); + wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True ); + glXMakeCurrent( mDisplay,vo_window,wsGLXContext ); XFlush(mDisplay); XSync(mDisplay, False); -// mygc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); - -// myximage = XGetImage(mDisplay, vo_window, 0, 0, -// width, image_height, AllPlanes, ZPixmap); -// ImageData = myximage->data; -// bpp = myximage->bits_per_pixel; - - //XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!! vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask ); -// printf("Window setup ok\n"); - #if 0 // If we have blue in the lowest bit then obviously RGB mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_RGB : MODE_BGR; @@ -250,6 +208,7 @@ image_bytes=(image_bpp+7)/8; } + if ( ImageData ) free( ImageData ); ImageData=malloc(texture_width*texture_height*image_bytes); memset(ImageData,128,texture_width*texture_height*image_bytes); @@ -334,8 +293,6 @@ yuv2rgb(ImageData, src[0], src[1], src[2], w,h, dstride, stride[0],stride[1]); -// emms (); - for(i=0;i<h;i++){ glTexSubImage2D( GL_TEXTURE_2D, // target 0, // level @@ -359,9 +316,6 @@ yuv2rgb(ImageData, src[0], src[1], src[2], image_width, image_height, image_width*BYTES_PP, image_width, image_width/2 ); -// printf("Ready!\n"); - -// emms (); for(i=0;i<image_height;i++){ glTexSubImage2D( GL_TEXTURE_2D, // target @@ -375,7 +329,6 @@ ImageData+i*BYTES_PP*image_width ); // *pixels } -// Display_Image(ImageData); return 0; } @@ -407,7 +360,6 @@ ImageData); // *pixels } -// Display_Image(ImageData); return 0; } @@ -430,7 +382,6 @@ ImageData+i*image_bytes*image_width ); // *pixels } -// Display_Image(ImageData); return 0; } @@ -476,6 +427,9 @@ printf("[gl] Unknown subdevice: %s\n",arg); return ENOSYS; } + + if(!vo_init()) return 1; + return 0; }
--- a/libvo/vo_xmga.c Thu Oct 17 00:54:13 2002 +0000 +++ b/libvo/vo_xmga.c Thu Oct 17 09:49:25 2002 +0000 @@ -247,7 +247,9 @@ } else { - vo_window=XCreateWindow( mDisplay,mRootWin, + if ( vo_window == None ) + { + vo_window=XCreateWindow( mDisplay,mRootWin, vo_dx,vo_dy, vo_dwidth,vo_dheight, xWAttribs.border_pixel, @@ -255,20 +257,22 @@ 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_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 ); + XStoreName( mDisplay,vo_window,mTitle ); + XMapWindow( mDisplay,vo_window ); - if ( flags&1 ) vo_x11_fullscreen(); + 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,&wGCV ); } // !GUI @@ -288,6 +292,8 @@ XFlush( mDisplay ); XSync( mDisplay,False ); + + ioctl(f,MGA_VID_ON,0); return 0; }
--- a/libvo/vo_xvidix.c Thu Oct 17 00:54:13 2002 +0000 +++ b/libvo/vo_xvidix.c Thu Oct 17 09:49:25 2002 +0000 @@ -201,8 +201,6 @@ XWindowAttributes attribs; int window_depth; -// if (title) -// free(title); title = "MPlayer VIDIX X11 Overlay"; panscan_init(); @@ -212,9 +210,6 @@ image_format = format; vo_mouse_autohide=1; - if (!vo_init()) - return(-1); - aspect_save_orig(width, height); aspect_save_prescale(d_width, d_height); aspect_save_screenres(vo_screenwidth, vo_screenheight); @@ -258,9 +253,6 @@ { #endif - /* destroy window before creating one */ - if (vo_window) XDestroyWindow(mDisplay, vo_window); - #ifdef X11_FULLSCREEN if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM); #endif @@ -296,24 +288,28 @@ } else { - 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 ( 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); + XStoreName(mDisplay, vo_window, title); + XMapWindow(mDisplay, vo_window); - if ( flags&1 ) vo_x11_fullscreen(); + 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); #ifdef HAVE_NEW_GUI } @@ -420,6 +416,8 @@ vidix_name = NULL; } + if (!vo_init()) return(1); + if (vidix_preinit(vidix_name, &video_out_xvidix) != 0) return(1);