[MPlayer-users] [PATCH] two video mode (-vm) tweaks

Matthew Fischer futhark at vzavenue.net
Tue Nov 11 05:01:18 CET 2003


I recently discovered the usefulness of the -vm option, but I had a
couple of problems with it:

1. When it switched to a lower resolution, it chose a video mode with a
low refresh rate.

2. It crashed when playing more than one file.

The attached patch will address both those problems. The first part will
choose the first video mode that is the correct size rather than the
last, which is the current behavior. The video modes seem to be sorted
from higher refresh rates to lower refresh rates.

This also has the side-effect of choosing the current video mode if it
is already the correct size (because the first item in the list is the
current mode). I am thinking about possibly modifying it to not even
switch modes if it is switching to the mode it is already in. (It would
just need a trivial "if (j > 0)" when it tries to switch, and it would
need a little more logic when switching back out in vo_vm_close().)

I am not sure if that part would be worthwhile or not, though. Could not
switching modes unnecessarily save wear and tear on the monitor or
anything like that?

Anyway, the second part of the patch fixes the crash when playing
multiple files with -vm by initializing the freed pointer.

As for the usefulness of the -vm option, I was having problems playing
VOB files using -vf pp=lb. I was running at 1024x768 and 24bpp. I found
that switching to a lower resolution or using fewer colors fixed the
problem. Perhaps a note could be added the the "Your system is too SLOW
to play this" message, such as:

- Slow video output
  - Try a different -vo driver (-vo help for a list) or try -framedrop!
  - Try changing video modes (-vm) or try using fewer colors


Matthew


--- libvo/x11_common.c-orig	2003-09-24 02:38:57.000000000 -0500
+++ libvo/x11_common.c	2003-11-10 21:09:55.000000000 -0600
@@ -1326,7 +1326,7 @@

       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) )
+          if ( (vidmodes[i]->hdisplay < *modeline_width ) && (vidmodes[i]->vdisplay < *modeline_height) )
 	    {
 	      *modeline_width=vidmodes[i]->hdisplay;
 	      *modeline_height=vidmodes[i]->vdisplay;
@@ -1366,6 +1366,7 @@
            XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
            XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
            free(vidmodes);
+           vidmodes = NULL;
          }
 }
 #endif



More information about the MPlayer-users mailing list