[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[75] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2010-01-05 14:26:35
|
Revision: 75 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=75&view=rev Author: nickols_k Date: 2010-01-05 14:26:28 +0000 (Tue, 05 Jan 2010) Log Message: ----------- minor renaming Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libvo/img_format.c mplayerxp/libvo/img_format.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/vosub_vidix.h mplayerxp/libvo/x11_common.c mplayerxp/libvo/x11_common.h mplayerxp/mplayer.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_vo.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libmpcodecs/dec_video.c 2010-01-05 14:26:28 UTC (rev 75) @@ -219,7 +219,7 @@ if(drop_frame) return 0; update_subtitle(pts); -vo_flush_frame(); +vo_flush_pages(); if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ MSG_DBG2("Put whole frame\n"); Modified: mplayerxp/libvo/img_format.c =================================================================== --- mplayerxp/libvo/img_format.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/img_format.c 2010-01-05 14:26:28 UTC (rev 75) @@ -158,7 +158,7 @@ return -1; } -int rgbfmt_depth(int fmt) +unsigned rgbfmt_depth(unsigned fmt) { switch(pixfmt_from_fourcc(fmt)) { case PIX_FMT_RGB48BE: Modified: mplayerxp/libvo/img_format.h =================================================================== --- mplayerxp/libvo/img_format.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/img_format.h 2010-01-05 14:26:28 UTC (rev 75) @@ -164,6 +164,6 @@ const char * __FASTCALL__ vo_format_name(int format); int pixfmt_from_fourcc(uint32_t fourcc); uint32_t fourcc_from_pixfmt(int pixfmt); -extern int rgbfmt_depth(int fmt); +extern unsigned rgbfmt_depth(unsigned fmt); #endif Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/video_out.c 2010-01-05 14:26:28 UTC (rev 75) @@ -670,7 +670,7 @@ { MSG_DBG3("dri_vo_dbg: vo_set_active_frame(%u)\n",*fr); active_frame = *fr; - vo_flip_page(); + vo_change_frame(); return VO_TRUE; } @@ -723,23 +723,23 @@ return -1; } -void vo_flip_page(void) +void vo_change_frame(void) { - MSG_DBG3("dri_vo_dbg: vo_flip_page [active_frame=%u]\n",active_frame); + MSG_DBG3("dri_vo_dbg: vo_change_frame [active_frame=%u]\n",active_frame); if(vo_doublebuffering || (dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) { - video_out->flip_page(active_frame); + video_out->change_frame(active_frame); active_frame = (active_frame+1)%dri_nframes; if(!dri_has_thread) xp_frame = (xp_frame+1)%dri_nframes; } } -void vo_flush_frame(void) +void vo_flush_pages(void) { - MSG_DBG3("dri_vo_dbg: vo_flush_frame [active_frame=%u]\n",active_frame); + MSG_DBG3("dri_vo_dbg: vo_flush_pages [active_frame=%u]\n",active_frame); frame_counter++; if((dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) - video_out->control(VOCTRL_FLUSH_FRAME,&xp_frame); + video_out->control(VOCTRL_FLUSH_PAGES,&xp_frame); } /* DRAW OSD */ Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/video_out.h 2010-01-05 14:26:28 UTC (rev 75) @@ -34,7 +34,7 @@ #define VOCTRL_CHECK_EVENTS 9 /**< Notification that user performs key pressing. Takes (vo_resize_t *)&vrest as arg. Must return at least VO_EVENT_RESIZE */ #define VOCTRL_GET_NUM_FRAMES 10/**< Query total number of allocated frames (multibuffering) */ #define VOCTRL_UNUSED3 12 -#define VOCTRL_FLUSH_FRAME 13 /**< Flush frame from RAM into video memory (bus mastering) */ +#define VOCTRL_FLUSH_PAGES 13 /**< Flush pages of frame from RAM into video memory (bus mastering) */ #define VOCTRL_UNUSED4 14 #define VOCTRL_SET_EQUALIZER 1000 /**< Set video equalizer */ #define VOCTRL_GET_EQUALIZER 1001 /**< Get video equalizer */ @@ -141,7 +141,7 @@ /** Blit/Flip buffer to the screen. Must be called after each frame! * @param idex index of frame to be selected as active frame **/ - void (* __FASTCALL__ flip_page)(unsigned idx); + void (* __FASTCALL__ change_frame)(unsigned idx); /** Closes driver. Should restore the original state of the system. **/ @@ -176,8 +176,8 @@ extern uint32_t __FASTCALL__ vo_draw_frame(const uint8_t *src[]); extern uint32_t __FASTCALL__ vo_draw_slice(const uint8_t *src[], unsigned stride[], unsigned w,unsigned h,unsigned x,unsigned y); -extern void vo_flip_page(void); -extern void vo_flush_frame(void); +extern void vo_change_frame(void); +extern void vo_flush_pages(void); extern void vo_draw_osd(void); extern void vo_uninit( void ); extern uint32_t __FASTCALL__ vo_control(uint32_t request, void *data); Modified: mplayerxp/libvo/video_out_internal.h =================================================================== --- mplayerxp/libvo/video_out_internal.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/video_out_internal.h 2010-01-05 14:26:28 UTC (rev 75) @@ -27,7 +27,7 @@ uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *); static const vo_info_t* get_info(void); -static void __FASTCALL__ flip_page(unsigned idx); +static void __FASTCALL__ change_frame(unsigned idx); static void uninit(void); static uint32_t __FASTCALL__ preinit(const char *); @@ -37,7 +37,7 @@ config,\ control,\ get_info,\ - flip_page,\ + change_frame,\ uninit\ }; Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_dga.c 2010-01-05 14:26:28 UTC (rev 75) @@ -240,7 +240,7 @@ #include "sub.h" -static void __FASTCALL__ flip_page( unsigned idx ) +static void __FASTCALL__ change_frame( unsigned idx ) { #ifdef HAVE_DGA2 XDGASetViewport (mDisplay, XDefaultScreen(mDisplay), Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_fbdev.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1148,7 +1148,7 @@ return &vo_info; } -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { unsigned i, out_offset = 0, in_offset = 0; Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_null.c 2010-01-05 14:26:28 UTC (rev 75) @@ -56,7 +56,7 @@ static uint32_t offset_y,offset_u,offset_v; -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { UNUSED(idx); } @@ -231,7 +231,7 @@ case DRI_GET_SURFACE: null_dri_get_surface(data); return VO_TRUE; - case VOCTRL_FLUSH_FRAME: + case VOCTRL_FLUSH_PAGES: return VO_TRUE; } return VO_NOTIMPL; Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_opengl.c 2010-01-05 14:26:28 UTC (rev 75) @@ -79,24 +79,9 @@ static XVisualInfo vinfo; static unsigned depth,bpp,gl_out_mode; static unsigned num_buffers=1; // default -static XImage *myximage[MAX_DRI_BUFFERS]; static void *glx_context; static uint32_t gl_out_format=0,out_format=0; -#ifdef HAVE_SHM -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> - -static int Shmem_Flag; -static XShmSegmentInfo Shminfo[MAX_DRI_BUFFERS]; -static int gXErrorFlag; -static int CompletionType=-1; - -/* since it doesn't seem to be defined on some platforms */ -extern int XShmGetEventBase( Display* ); -#endif - static XVisualInfo *get_visual_info(Display *dpy, Window win) { XWindowAttributes wattr; @@ -108,103 +93,6 @@ return XGetVisualInfo(dpy, VisualIDMask, &vi_template, &dummy); } -/* local data */ -#define ImageData(idx) ( uint8_t * ) myximage[idx]->data - -static void __FASTCALL__ getMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; - else - { - Shmem_Flag=0; - MSG_V( "Shared memory not supported\nReverting to normal Xlib\n" ); - } - if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; - - if ( Shmem_Flag ) - { - myximage[idx]=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[idx],image_width,image_height ); - if ( myximage[idx] == NULL ) - { - if ( myximage[idx] != NULL ) XDestroyImage( myximage[idx] ); - MSG_V( "Shared memory error,disabling ( Ximage error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmid=shmget( IPC_PRIVATE, - myximage[idx]->bytes_per_line * myximage[idx]->height , - IPC_CREAT | 0777 ); - if ( Shminfo[idx].shmid < 0 ) - { - XDestroyImage( myximage[idx] ); - MSG_V( "%s\n",strerror( errno ) ); - MSG_V( "Shared memory error,disabling ( seg id error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmaddr=( char * ) shmat( Shminfo[idx].shmid,0,0 ); - - if ( Shminfo[idx].shmaddr == ( ( char * ) -1 ) ) - { - XDestroyImage( myximage[idx] ); - if ( Shminfo[idx].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling ( address error )\n" ); - goto shmemerror; - } - myximage[idx]->data=Shminfo[idx].shmaddr; - Shminfo[idx].readOnly=False; - XShmAttach( mDisplay,&Shminfo[idx] ); - - XSync( mDisplay,False ); - - if ( gXErrorFlag ) - { - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling.\n" ); - gXErrorFlag=0; - goto shmemerror; - } - else - shmctl( Shminfo[idx].shmid,IPC_RMID,0 ); - - { - static int firstTime=1; - if (firstTime){ - MSG_V( "Sharing memory.\n" ); - firstTime=0; - } - } - } - else - { - shmemerror: - Shmem_Flag=0; -#endif - myximage[idx]=XGetImage( mDisplay,vo_window,0,0, - image_width,image_height,AllPlanes,ZPixmap ); -#ifdef HAVE_SHM - } -#endif -} - -static void __FASTCALL__ freeMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( Shmem_Flag ) - { - XShmDetach( mDisplay,&Shminfo[idx] ); - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - } - else -#endif - { - XDestroyImage( myximage[idx] ); - } - myximage[idx]=NULL; -} - - static void gl_init_fb(unsigned x,unsigned y,unsigned d_width,unsigned d_height) { float sx = (GLfloat) (d_width-x) / (GLfloat)image_width; @@ -329,7 +217,7 @@ 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); vo_x11_classhint( mDisplay,vo_window,"opengl" ); - vo_hidecursor(mDisplay,vo_window); + vo_x11_hidecursor(mDisplay,vo_window); XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | ((WinID==0) ? 0 : (PointerMotionMask @@ -379,11 +267,11 @@ #endif gl_init_fb(0,0,d_width,d_height); /* allocate multibuffers */ - for(i=0;i<num_buffers;i++) getMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_getMyXImage(i,vinfo.visual,depth,image_width,image_height,0); gl_out_mode=GL_RGB; - is_bgr=(myximage[0]->blue_mask&0x01)!=0; - switch ((bpp=myximage[0]->bits_per_pixel)){ + is_bgr=(vo_x11_myximage[0]->blue_mask&0x01)!=0; + switch ((bpp=vo_x11_myximage[0]->bits_per_pixel)){ case 32:gl_out_mode=GL_RGBA; gl_out_format=is_bgr?GL_UNSIGNED_INT_8_8_8_8_REV:GL_UNSIGNED_INT_8_8_8_8; out_format = IMGFMT_RGB32; @@ -419,8 +307,8 @@ myximage->data); } -static void flip_page(unsigned idx) { - gl_display_Image( myximage[idx] ); +static void change_frame(unsigned idx) { + gl_display_Image( vo_x11_myximage[idx] ); if (num_buffers>1) glXSwapBuffers(mDisplay, vo_window); glFlush(); return; @@ -448,7 +336,7 @@ glFinish(); glXMakeCurrent(mDisplay, None, NULL); glXDestroyContext(mDisplay, glx_context); - for(i=0;i<num_buffers;i++) freeMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_freeMyXImage(i); saver_on(mDisplay); // screen saver back on #ifdef HAVE_XF86VM vo_vm_close(mDisplay); @@ -481,7 +369,7 @@ static void __FASTCALL__ gl_dri_get_surface(dri_surface_t *surf) { - surf->planes[0] = ImageData(surf->idx); + surf->planes[0] = vo_x11_ImageData(surf->idx); surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_sdl.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1155,7 +1155,7 @@ * returns : doesn't return **/ -static void __FASTCALL__ flip_page (unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { struct sdl_priv_s *priv = &sdl_priv; Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_vesa.c 2010-01-05 14:26:28 UTC (rev 75) @@ -245,9 +245,9 @@ } } -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { - MSG_DBG3("vo_vesa: flip_page was called\n"); + MSG_DBG3("vo_vesa: change_frame was called\n"); if(!HAS_DGA()) __vbeCopyData(dga_buffer); else { Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_x11.c 2010-01-05 14:26:28 UTC (rev 75) @@ -62,37 +62,25 @@ "" }; + +#ifdef HAVE_SHM +#include <sys/ipc.h> +#include <sys/shm.h> +#include <X11/extensions/XShm.h> +#endif /* private prototypes */ static void __FASTCALL__ Display_Image ( XImage * myximage ); -/* local data */ -#define ImageData(idx) ( uint8_t * ) myximage[idx]->data - /*** X11 related variables ***/ /* xp related variables */ static unsigned num_buffers=1; // default -static XImage *myximage[MAX_DRI_BUFFERS]; -static int depth,bpp,mode; +static unsigned depth,bpp,mode; static XWindowAttributes attribs; static int Flip_Flag; static int zoomFlag; -#ifdef HAVE_SHM -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> - -static int Shmem_Flag; -static XShmSegmentInfo Shminfo[MAX_DRI_BUFFERS]; -static int gXErrorFlag; -static int CompletionType=-1; - -/* since it doesn't seem to be defined on some platforms */ -extern int XShmGetEventBase( Display* ); -#endif - static uint32_t image_width; static uint32_t image_height; static uint32_t in_format; @@ -100,100 +88,6 @@ static int baseAspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing static XVisualInfo vinfo; -static void __FASTCALL__ getMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; - else - { - Shmem_Flag=0; - MSG_V( "Shared memory not supported\nReverting to normal Xlib\n" ); - } - if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; - - if ( Shmem_Flag ) - { - myximage[idx]=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[idx],image_width,image_height ); - if ( myximage[idx] == NULL ) - { - if ( myximage[idx] != NULL ) XDestroyImage( myximage[idx] ); - MSG_V( "Shared memory error,disabling ( Ximage error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmid=shmget( IPC_PRIVATE, - myximage[idx]->bytes_per_line * myximage[idx]->height , - IPC_CREAT | 0777 ); - if ( Shminfo[idx].shmid < 0 ) - { - XDestroyImage( myximage[idx] ); - MSG_V( "%s\n",strerror( errno ) ); - MSG_V( "Shared memory error,disabling ( seg id error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmaddr=( char * ) shmat( Shminfo[idx].shmid,0,0 ); - - if ( Shminfo[idx].shmaddr == ( ( char * ) -1 ) ) - { - XDestroyImage( myximage[idx] ); - if ( Shminfo[idx].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling ( address error )\n" ); - goto shmemerror; - } - myximage[idx]->data=Shminfo[idx].shmaddr; - Shminfo[idx].readOnly=False; - XShmAttach( mDisplay,&Shminfo[idx] ); - - XSync( mDisplay,False ); - - if ( gXErrorFlag ) - { - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling.\n" ); - gXErrorFlag=0; - goto shmemerror; - } - else - shmctl( Shminfo[idx].shmid,IPC_RMID,0 ); - - { - static int firstTime=1; - if (firstTime){ - MSG_V( "Sharing memory.\n" ); - firstTime=0; - } - } - } - else - { - shmemerror: - Shmem_Flag=0; -#endif - myximage[idx]=XGetImage( mDisplay,vo_window,0,0, - image_width,image_height,AllPlanes,ZPixmap ); -#ifdef HAVE_SHM - } -#endif -} - -static void __FASTCALL__ freeMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( Shmem_Flag ) - { - XShmDetach( mDisplay,&Shminfo[idx] ); - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - } - else -#endif - { - XDestroyImage( myximage[idx] ); - } - myximage[idx]=NULL; -} - - static uint32_t __FASTCALL__ check_events(int (* __FASTCALL__ adjust_size)(unsigned cw,unsigned ch,unsigned *w,unsigned *h)) { uint32_t ret = vo_x11_check_events(mDisplay,adjust_size); @@ -214,8 +108,8 @@ if(enable_xp) LOCK_VDECODING(); for(idx=0;idx<num_buffers;idx++) { - freeMyXImage(idx); - getMyXImage(idx); + vo_x11_freeMyXImage(idx); + vo_x11_getMyXImage(idx,vinfo.visual,depth,image_width,image_height,1); } } return ret; @@ -317,7 +211,7 @@ xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); vo_x11_classhint( mDisplay,vo_window,"x11" ); - vo_hidecursor(mDisplay,vo_window); + vo_x11_hidecursor(mDisplay,vo_window); if ( fullscreen ) vo_x11_decoration( mDisplay,vo_window,0 ); XSelectInput( mDisplay,vo_window,StructureNotifyMask ); XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint ); @@ -347,9 +241,9 @@ XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); } #endif - for(i=0;i<num_buffers;i++) getMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_getMyXImage(i,vinfo.visual,depth,image_width,image_height,1); - switch ((bpp=myximage[0]->bits_per_pixel)){ + switch ((bpp=vo_x11_myximage[0]->bits_per_pixel)){ case 24: out_format= IMGFMT_BGR24; break; case 32: out_format= IMGFMT_BGR32; break; case 15: out_format= IMGFMT_BGR15; break; @@ -358,14 +252,14 @@ } /* If we have blue in the lowest bit then obviously RGB */ - mode=( ( myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR; + mode=( ( vo_x11_myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR; #ifdef WORDS_BIGENDIAN - if ( myximage[0]->byte_order != MSBFirst ) + if ( vo_x11_myximage[0]->byte_order != MSBFirst ) #else - if ( myximage[0]->byte_order != LSBFirst ) + if ( vo_x11_myximage[0]->byte_order != LSBFirst ) #endif { - mode=( ( myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB; + mode=( ( vo_x11_myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB; } #ifdef WORDS_BIGENDIAN @@ -382,7 +276,7 @@ MSG_ERR("BGR not supported, please contact the developers\n"); return -1; } -#endif +#endif saver_off(mDisplay); return 0; } @@ -394,7 +288,7 @@ { #ifdef DISP #ifdef HAVE_SHM - if ( Shmem_Flag ) + if ( vo_x11_Shmem_Flag ) { XShmPutImage( mDisplay,vo_window,vo_gc,myximage, 0,0, @@ -412,8 +306,8 @@ #endif } -static void __FASTCALL__ flip_page( unsigned idx ){ - Display_Image( myximage[idx] ); +static void __FASTCALL__ change_frame( unsigned idx ){ + Display_Image( vo_x11_myximage[idx] ); if (num_buffers>1) XFlush(mDisplay); else XSync(mDisplay, False); return; @@ -440,7 +334,7 @@ static void uninit(void) { unsigned i; - for(i=0;i<num_buffers;i++) freeMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_freeMyXImage(i); saver_on(mDisplay); // screen saver back on #ifdef HAVE_XF86VM @@ -489,7 +383,7 @@ static void __FASTCALL__ x11_dri_get_surface(dri_surface_t *surf) { - surf->planes[0] = ImageData(surf->idx); + surf->planes[0] = vo_x11_ImageData(surf->idx); surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_xv.c 2010-01-05 14:26:28 UTC (rev 75) @@ -369,7 +369,7 @@ 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); vo_x11_classhint( mDisplay,vo_window,"xv" ); - vo_hidecursor(mDisplay,vo_window); + vo_x11_hidecursor(mDisplay,vo_window); XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | ((WinID==0) ? 0 : (PointerMotionMask @@ -557,7 +557,7 @@ return e|VO_EVENT_FORCE_UPDATE; } -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { expose_idx=idx; XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[idx], Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_xvidix.c 2010-01-05 14:26:28 UTC (rev 75) @@ -301,7 +301,7 @@ vinfo.depth, InputOutput, vinfo.visual, xswamask, &xswa); vo_x11_classhint(mDisplay, vo_window, "xvidix"); - vo_hidecursor(mDisplay, vo_window); + vo_x11_hidecursor(mDisplay, vo_window); #ifdef X11_FULLSCREEN if (vo_fs) /* fullscreen */ @@ -382,12 +382,12 @@ return event; } -/* flip_page should be overwritten with vidix functions (vosub_vidix.c) */ +/* change_frame should be overwritten with vidix functions (vosub_vidix.c) */ -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { UNUSED(idx); - MSG_FATAL( "[xvidix] error: didn't used vidix flip_page!\n"); + MSG_FATAL( "[xvidix] error: didn't used vidix change_frame!\n"); return; } Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vosub_vidix.c 2010-01-05 14:26:28 UTC (rev 75) @@ -199,9 +199,9 @@ } } -void __FASTCALL__ vidix_flip_page(unsigned idx) +void __FASTCALL__ vidix_change_frame(unsigned idx) { - MSG_DBG2("vidix_flip_page() was called\n"); + MSG_DBG2("vidix_change_frame() was called\n"); if(vo_use_bm == 1) vidix_copy_dma(idx,0); else vdlPlaybackFrameSelect(vidix_handler,idx); } @@ -627,10 +627,10 @@ case DRI_GET_SURFACE_CAPS: vidix_dri_get_surface_caps(data); return VO_TRUE; - case DRI_GET_SURFACE: + case DRI_GET_SURFACE: vidix_dri_get_surface(data); return VO_TRUE; - case VOCTRL_FLUSH_FRAME: + case VOCTRL_FLUSH_PAGES: if(vo_use_bm > 1) vidix_copy_dma(*(uint32_t *)data,1); return VO_TRUE; case VOCTRL_GET_EQUALIZER: @@ -672,7 +672,7 @@ else MSG_V("Driver capability: %X\n",vidix_cap->flags); MSG_V("Using: %s by %s\n",vidix_cap->name,vidix_cap->author); /* we are able to tune up this stuff depend on fourcc format */ - ((vo_functions_t *)server)->flip_page=vidix_flip_page; + ((vo_functions_t *)server)->change_frame=vidix_change_frame; if(!reent) { server_control = ((vo_functions_t *)server)->control; Modified: mplayerxp/libvo/vosub_vidix.h =================================================================== --- mplayerxp/libvo/vosub_vidix.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vosub_vidix.h 2010-01-05 14:26:28 UTC (rev 75) @@ -22,7 +22,7 @@ int vidix_stop(void); void vidix_term( void ); uint32_t __FASTCALL__ vidix_query_fourcc(vo_query_fourcc_t* fourcc); -void __FASTCALL__ vidix_flip_page(unsigned idx); +void __FASTCALL__ vidix_change_frame(unsigned idx); #include <vidix/vidix.h> /* graphic keys */ Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/x11_common.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1,4 +1,4 @@ - +#include <errno.h> #include <stdio.h> #include <stdlib.h> @@ -64,13 +64,118 @@ XF86VidModeModeLine modeline; #endif -void __FASTCALL__ vo_hidecursor ( Display *disp , Window win ) +#ifdef HAVE_SHM +#include <sys/ipc.h> +#include <sys/shm.h> +#include <X11/extensions/XShm.h> + +int vo_x11_Shmem_Flag=0; +static XShmSegmentInfo Shminfo[MAX_DRI_BUFFERS]; +static int gXErrorFlag; +static int CompletionType=-1; + +/* since it doesn't seem to be defined on some platforms */ +extern int XShmGetEventBase( Display* ); +#endif + +XImage *vo_x11_myximage[MAX_DRI_BUFFERS]; + +void __FASTCALL__ vo_x11_getMyXImage(unsigned idx,Visual *visual,unsigned depth,unsigned w,unsigned h,int use_shmem) { +#ifdef HAVE_SHM + if ( mLocalDisplay && XShmQueryExtension( mDisplay )&& use_shmem ) vo_x11_Shmem_Flag=1; + else { + vo_x11_Shmem_Flag=0; + if(use_shmem) MSG_V( "Shared memory not supported\nReverting to normal Xlib\n" ); + } + if ( vo_x11_Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; + if ( vo_x11_Shmem_Flag ) { + vo_x11_myximage[idx]=XShmCreateImage( mDisplay,visual,depth,ZPixmap,NULL,&Shminfo[idx],w,h); + if ( vo_x11_myximage[idx] == NULL ) { + if ( vo_x11_myximage[idx] != NULL ) XDestroyImage( vo_x11_myximage[idx] ); + MSG_V( "Shared memory error,disabling ( Ximage error )\n" ); + goto shmemerror; + } + Shminfo[idx].shmid=shmget( IPC_PRIVATE, + vo_x11_myximage[idx]->bytes_per_line * vo_x11_myximage[idx]->height , + IPC_CREAT | 0777 ); + if ( Shminfo[idx].shmid < 0 ) { + XDestroyImage( vo_x11_myximage[idx] ); + MSG_V( "%s\n",strerror( errno ) ); + MSG_V( "Shared memory error,disabling ( seg id error )\n" ); + goto shmemerror; + } + Shminfo[idx].shmaddr=( char * ) shmat( Shminfo[idx].shmid,0,0 ); + + if ( Shminfo[idx].shmaddr == ( ( char * ) -1 ) ) + { + XDestroyImage( vo_x11_myximage[idx] ); + if ( Shminfo[idx].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[idx].shmaddr ); + MSG_V( "Shared memory error,disabling ( address error )\n" ); + goto shmemerror; + } + vo_x11_myximage[idx]->data=Shminfo[idx].shmaddr; + Shminfo[idx].readOnly=False; + XShmAttach( mDisplay,&Shminfo[idx] ); + + XSync( mDisplay,False ); + + if ( gXErrorFlag ) + { + XDestroyImage( vo_x11_myximage[idx] ); + shmdt( Shminfo[idx].shmaddr ); + MSG_V( "Shared memory error,disabling.\n" ); + gXErrorFlag=0; + goto shmemerror; + } + else + shmctl( Shminfo[idx].shmid,IPC_RMID,0 ); + + { + static int firstTime=1; + if (firstTime){ + MSG_V( "Sharing memory.\n" ); + firstTime=0; + } + } + } + else + { + shmemerror: + vo_x11_Shmem_Flag=0; +#endif + vo_x11_myximage[idx]=XGetImage( mDisplay,vo_window,0,0, + w,h,AllPlanes,ZPixmap ); +#ifdef HAVE_SHM + } +#endif +} + +void __FASTCALL__ vo_x11_freeMyXImage(unsigned idx) +{ +#ifdef HAVE_SHM + if ( vo_x11_Shmem_Flag ) + { + XShmDetach( mDisplay,&Shminfo[idx] ); + XDestroyImage( vo_x11_myximage[idx] ); + shmdt( Shminfo[idx].shmaddr ); + } + else +#endif + { + XDestroyImage( vo_x11_myximage[idx] ); + } + vo_x11_myximage[idx]=NULL; +} + + +void __FASTCALL__ vo_x11_hidecursor ( Display *disp , Window win ) +{ Cursor no_ptr; Pixmap bm_no; XColor black,dummy; Colormap colormap; - static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; + static char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; if(WinID==0) return; // do not hide, if we're playing at rootwin @@ -596,9 +701,9 @@ vo_dheight=nh; { Window root; - int foo; + unsigned foo; Window win; - XGetGeometry(mydisplay, vo_window, &root, &foo, &foo, + XGetGeometry(mydisplay, vo_window, &root, &foo, &foo, &foo/*width*/, &foo/*height*/, &foo, &foo); XTranslateCoordinates(mydisplay, vo_window, root, 0, 0, &vo_dx, &vo_dy, &win); @@ -780,12 +885,12 @@ #ifdef HAVE_XF86VM void __FASTCALL__ vo_vm_switch(uint32_t X, uint32_t Y, int* modeline_width, int* modeline_height) { - unsigned int vm_event, vm_error; - unsigned int vm_ver, vm_rev; + int vm_event, vm_error; + int vm_ver, vm_rev; int i,j,have_vm=0; int modecount; - + if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) { XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); MSG_V("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); @@ -799,7 +904,7 @@ j=0; *modeline_width=vidmodes[0]->hdisplay; *modeline_height=vidmodes[0]->vdisplay; - + for (i=1; i<modecount; i++) if ((vidmodes[i]->hdisplay >= X) && (vidmodes[i]->vdisplay >= Y)) if ( (vidmodes[i]->hdisplay <= *modeline_width ) && (vidmodes[i]->vdisplay <= *modeline_height) ) @@ -808,7 +913,7 @@ *modeline_height=vidmodes[i]->vdisplay; j=i; } - + MSG_V("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y); XF86VidModeLockModeSwitch(mDisplay,mScreen,0); XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); Modified: mplayerxp/libvo/x11_common.h =================================================================== --- mplayerxp/libvo/x11_common.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/x11_common.h 2010-01-05 14:26:28 UTC (rev 75) @@ -6,6 +6,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#include "dri_vo.h" extern int vo_fs; @@ -15,9 +16,15 @@ extern int mScreen; extern int mLocalDisplay; extern int WinID; +extern XImage *vo_x11_myximage[MAX_DRI_BUFFERS]; +extern int vo_x11_Shmem_Flag; int vo_x11_init( void ); -void __FASTCALL__ vo_hidecursor ( Display* , Window ); +/* local data */ +#define vo_x11_ImageData(idx) ( uint8_t * ) vo_x11_myximage[idx]->data +void __FASTCALL__ vo_x11_getMyXImage(unsigned idx,Visual *visual,unsigned depth,unsigned w,unsigned h,int use_shmem); +void __FASTCALL__ vo_x11_freeMyXImage(unsigned idx); +void __FASTCALL__ vo_x11_hidecursor ( Display* , Window ); void __FASTCALL__ vo_x11_decoration( Display * vo_Display,Window w,int d ); void __FASTCALL__ vo_x11_classhint( Display * display,Window window,char *name ); int __FASTCALL__ vo_x11_uninit(Display *display, Window window); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/mplayer.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1376,7 +1376,7 @@ //====================== FLIP PAGE (VIDEO BLT): ========================= - pinfo[xp_id].current_module="flip_page1"; + pinfo[xp_id].current_module="change_frame1"; vo_check_events(); /* check events AST */ if(blit_frame && !frame_time_remaining){ @@ -1393,14 +1393,14 @@ vstat->too_slow_frame_cnt++; /* printf ("PANIC: too slow frame (%.3f)!\n", j); */ - vo_flip_page(); + vo_change_frame(); // usec_sleep(50000); // test only! t2=GetTimer()-t2; tt = t2*0.000001f; vout_time_usage+=tt; if(benchmark) { - /* we need compute draw_slice+flip_page here */ + /* we need compute draw_slice+change_frame here */ cur_vout_time_usage+=tt; if(cur_vout_time_usage > max_vout_time_usage) max_vout_time_usage = cur_vout_time_usage; if(cur_vout_time_usage < min_vout_time_usage) min_vout_time_usage = cur_vout_time_usage; @@ -1623,7 +1623,7 @@ pinfo[xp_id].current_module="sleep_usleep"; time_frame=SleepTime(rtc_fd,softsleep,time_frame); } - pinfo[xp_id].current_module="flip_page2"; + pinfo[xp_id].current_module="change_frame2"; vo_check_events(); /* don't flip if there is nothing new to display */ if(!blit_frame) @@ -1650,7 +1650,7 @@ { unsigned int t2=GetTimer(); double tt; - vo_flip_page(); + vo_change_frame(); MSG_D("\ndec_ahead_main: schedule %u on screen (abs_active: %u loc_active: %u abs_blitted %u)\n",dec_ahead_active_frame,abs_dec_ahead_active_frame,loc_dec_ahead_active_frame,ada_blitted_frame); LOCK_VDEC_ACTIVE(); dec_ahead_active_frame=(dec_ahead_active_frame+1)%xp_num_frames; @@ -1668,7 +1668,7 @@ vout_time_usage+=tt; if(benchmark) { - /* we need compute draw_slice+flip_page here */ + /* we need compute draw_slice+change_frame here */ cur_vout_time_usage+=tt; if((cur_video_time_usage + cur_vout_time_usage + cur_audio_time_usage)*vo_fps > 1) bench_dropped_frames ++; Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/postproc/vf.h 2010-01-05 14:26:28 UTC (rev 75) @@ -76,16 +76,16 @@ int value; } vf_equalizer_t; -#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ -#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ -#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ -#define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */ -#define VFCTRL_START_FRAME 7 -#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */ -#define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */ -#define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */ -#define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */ -#define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */ +#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ +#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ +#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ +#define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */ +#define VFCTRL_START_FRAME 7 +#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */ +#define VFCTRL_CHANGE_FRAME 10 /* Tell the vo to flip pages */ +#define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */ +#define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */ +#define VFCTRL_FLUSH_PAGES 13 /* For encoding - flush delayed frames */ #include "vfcap.h" Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/postproc/vf_vo.c 2010-01-05 14:26:28 UTC (rev 75) @@ -73,10 +73,10 @@ static int __FASTCALL__ control(struct vf_instance_s* vf, int request, void* data) { switch(request){ - case VFCTRL_FLIP_PAGE: + case VFCTRL_CHANGE_FRAME: { if(!vo_config_count) return CONTROL_FALSE; // vo not configured? - vo_flip_page(); + vo_change_frame(); return CONTROL_TRUE; } case VFCTRL_SET_EQUALIZER: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |