[MPlayer-dev-eng] patch for mplayer x11/xv video mode bug
Nilmoni Deb
ndeb at ece.cmu.edu
Sun Mar 10 01:55:02 CET 2002
Hi,
I compiled mplayer (current cvs) with --enable-gui but ran it
without gui. My default display mode is 1024x768. Other options in
XF86Config are 800x600 and 640x480.
I run any of these commands in my default display mode (1024x768) ->
./mplayer -v -vo x11 -vm file.mpg
./mplayer -v -vo xv -vm file.mpg
and then press 'q'. Mplayer quits but the display size remains resized
at 640x480. It should go back to what it was before mplayer was started
which is 1024x768. Only way out is ctrl.alt.+/- which is annoying.
Also, the current code returns to the 1st mode which may not necessarily
be the mode being used by the user at that point of time.
Both these problems are solved by this patch ->
--- x11_common.c.old Sat Mar 9 19:35:19 2002
+++ x11_common.c Sat Mar 9 19:47:29 2002
@@ -672,16 +672,27 @@
void vo_vm_close(Display *dpy)
{
#ifdef HAVE_NEW_GUI
- if ((vidmodes!=NULL)&&( vo_window == None ) )
+ if (vidmodes!=NULL && vo_window != None)
#else
if (vidmodes!=NULL)
#endif
- {
- int screen; screen=DefaultScreen( dpy );
- XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]);
- XF86VidModeSwitchToMode(dpy,screen,vidmodes[0]);
- free(vidmodes);
- }
+ {
+ int i, modecount;
+ int screen; screen=DefaultScreen( dpy );
+
+ free(vidmodes); vidmodes=NULL;
+ XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes);
+ for (i=0; i<modecount; i++)
+ if ((vidmodes[i]->hdisplay == vo_screenwidth) && (vidmodes[i]->vdisplay == vo_screenheight))
+ {
+ printf("\nReturning to original mode %dx%d\n", vo_screenwidth, vo_screenheight);
+ break;
+ }
+
+ XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
+ XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
+ free(vidmodes);
+ }
}
#endif
thanks
- Nil
More information about the MPlayer-dev-eng
mailing list