changeset 8137:530d1c5f0c78

Switch containing options for DirectFB library was renamed to dfbopts. Layer selection is done as "subdevice" - integer nuber after -vo directfb: where -1 is autodetection and 0,1,2... are for layers example: mplayer -vo directfb:2 -dfbopts matrox-crtc2,matrox-tv-standard=pal *.avi
author arpi
date Sun, 10 Nov 2002 13:57:42 +0000
parents 1831ce784783
children ca825957ed02
files cfg-mplayer.h libvo/vo_directfb2.c
diffstat 2 files changed, 59 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Sun Nov 10 13:12:53 2002 +0000
+++ b/cfg-mplayer.h	Sun Nov 10 13:57:42 2002 +0000
@@ -21,6 +21,11 @@
 extern char *fb_dev_name;
 #endif
 #endif
+#ifdef HAVE_DIRECTFB
+#if DIRECTFBVERSION > 912
+extern char *dfb_params;
+#endif
+#endif
 #ifdef HAVE_PNG
 extern int z_compression;
 #endif
@@ -237,6 +242,11 @@
 	{"fb", &fb_dev_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
 #endif
 #endif
+#ifdef HAVE_DIRECTFB
+#if DIRECTFBVERSION > 912
+	{"dfbopts", &dfb_params, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#endif
+#endif
 
 	// force window width/height or resolution (with -vm)
 	{"x", &opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL},
--- a/libvo/vo_directfb2.c	Sun Nov 10 13:12:53 2002 +0000
+++ b/libvo/vo_directfb2.c	Sun Nov 10 13:57:42 2002 +0000
@@ -38,7 +38,11 @@
 
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+#ifdef __linux__
 #include <sys/kd.h>
+#else
+#include <linux/kd.h>
+#endif
 
 #include "config.h"
 #include "video_out.h"
@@ -59,7 +63,7 @@
 	"Direct Framebuffer Device",
 	"directfb",
 	"Jiri Svoboda Jiri.Svoboda@seznam.cz",
-	"version 2.0beta"
+	"v 2.0 (for DirectFB version >=0.9.13)"
 };
 
 extern int verbose;
@@ -130,6 +134,8 @@
 #else
 char *fb_dev_name;
 #endif
+char *dfb_params;
+int layer_id = -1;
 
 /******************************
 *	   implementation     *
@@ -148,7 +154,36 @@
 	
 if (verbose) printf("DirectFB: Preinit entered\n");
 
+	if (arg) {
+	    int tmp=-1;
+	    if (sscanf(arg,"%i",&tmp)) {
+		layer_id=tmp;
+		if (verbose) printf("DirectFB: Layer id forced to %i\n",layer_id);
+	    };
+	}
+
+	if (dfb_params)
+	{
+	    int argc = 2;
+	    char arg0[10] = "mplayer";
+	    char arg1[256] = "--dfb:";
+	    char* argv[3];
+	    char ** a;
+	    
+	    a = &argv[0];
+	    
+	    strncat(arg1,dfb_params,249);
+
+	    argv[0]=arg0;
+	    argv[1]=arg1;
+	    argv[2]=NULL;
+	    
+    	    DFBCHECK (DirectFBInit (&argc,&a));
+
+	} else {
+	
         DFBCHECK (DirectFBInit (NULL,NULL));
+	}
 
 	if (((directfb_major_version <= 0) &&
 	    (directfb_minor_version <= 9) &&
@@ -182,7 +217,9 @@
    */
 
         DFBCHECK (DirectFBCreate (&dfb));
-        DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
+        if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
+	    printf("DirectFB: Warning - cannot swith to fullscreen mode");
+	};
 
   /*
    * (Get keyboard)
@@ -255,6 +292,8 @@
      IDirectFBDisplayLayer *layer;
      DFBResult ret;
     
+     if ((layer_id == -1 )||(layer_id == id)) {
+    
      ret = dfb->GetDisplayLayer( dfb, id, &layer);
      if (ret) {
                DirectFBError( "dfb->GetDisplayLayer failed", ret );
@@ -298,6 +337,8 @@
 	};
      };
 
+    };
+    
     return DFENUM_OK;
 }
 
@@ -539,12 +580,16 @@
 
 // test surface for flipping	
 	DFBCHECK(primary->GetCapabilities(primary,&caps));
-//	primary->Clear(primary,0,0,0,0);
+#if DIRECTFBVERSION > 913
+	primary->Clear(primary,0,0,0,0);
+#endif	
         flipping = 0;
 	if (caps & DSCAPS_FLIPPING) {
 	    ret = primary->Flip(primary,NULL,0);
 	    if (ret==DFB_OK) { 
-//		primary->Clear(primary,0,0,0,0);
+#if DIRECTFBVERSION > 913
+		primary->Clear(primary,0,0,0,0);
+#endif	
 		flipping = 1; 
 	    } 
 	};