[MPlayer-dev-eng] vo_x11: More than 1 video to play

Uwe Reder Uwe.Reder at 3SOFT.de
Mon Nov 5 17:18:24 CET 2001


Hi!

If you give more than one file on the command line, mplayer (**ONLY** vo=x11 
!!!!) plays the first file and exits with an error. There was a 
misunderstanding in libvo/vo_x11.c what value to return in case of error/ok. 
Fixing this, brought up further problems...

When looking more into the code, I wondered why vo_x11.c tracks if X is 
already initialized (see places where the variable 'X_already_started' is 
used). The video driver's uninit() gets called after each video always, 
although it might not be the last video to play. In my opinion init() and 
uninit() should be called only once for all videos to play. Changing this 
behaviour would force some work in all libvo drivers. The appended patch 
doesn't address this.

However, the attached patch fixes the initial problem. After applying the 
patch, vo_x11 always does a full init() and a full unint(), plus some cleanup 
in init/uninit.

Bye,
Uwe.


--- MPlayer-20011105/libvo/vo_x11.c	Tue Oct 30 18:04:31 2001
+++ vo_x11.c	Mon Nov  5 16:40:06 2001
@@ -71,7 +71,6 @@
 static XImage *myximage;
 static int depth,bpp,mode;
 static XWindowAttributes attribs;
-static int X_already_started=0;
 
 //static int vo_dwidth,vo_dheight;
 
@@ -192,8 +191,7 @@
   else
 #endif   
    {
-    if ( X_already_started ) return -1;
-    if( !vo_init() ) return 0; // Can't open X11
+    if( !vo_init() ) return -1; // Can't open X11
 
     hint.x=0;
     hint.y=0;
@@ -222,13 +220,9 @@
       j=0;
       modeline_width=vidmodes[0]->hdisplay;
       modeline_height=vidmodes[0]->vdisplay;
-      if ((d_width==0) && (d_height==0))
-        { X=image_width; Y=image_height; }
-      else
-        { X=d_width; Y=d_height; }
 
       for (i=1; i<modecount; i++)
-        if ((vidmodes[i]->hdisplay >= X) && (vidmodes[i]->vdisplay >= Y))
+        if ((vidmodes[i]->hdisplay >= image_width) && (vidmodes[i]->vdisplay 
>= image_height))
           if ( (vidmodes[i]->hdisplay < modeline_width ) && 
(vidmodes[i]->vdisplay < modeline_height) )
           {
              modeline_width=vidmodes[i]->hdisplay;
@@ -428,7 +422,6 @@
    XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask );
    saver_off(mDisplay);
   }
- X_already_started++;
  return 0;
 }
 
@@ -448,7 +441,6 @@
 #endif
  XDestroyWindow( mDisplay,mywindow );
  XCloseDisplay( mDisplay );
- X_already_started=0;
 }
 
 static void Display_Image( XImage *myximage,uint8_t *ImageData )
@@ -590,10 +582,9 @@
           XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]);
           XF86VidModeSwitchToMode(mDisplay,screen,vidmodes[0]);
           free(vidmodes);
+          vidmodes=NULL; // when playing more than 1 file, init() is called 
again
         }
 #endif
 printf("vo: uninit!\n");
 }
-
-
 
-- 
  ---------------------------------------------------- 
  Uwe Reder, Dipl.-Inf. (Univ.), mobile applications
  3SOFT GmbH, Frauenweiherstr. 14, 91058 Erlangen, Germany
  Tel. +49-9131-7701-133   mailto:Uwe.Reder at 3SOFT.de
  Fax +49-9131-7701-333    http://www.3SOFT.de




More information about the MPlayer-dev-eng mailing list