[Mplayer-cvslog] CVS: main/libvo vo_directfb2.c,1.7,1.8

Jiri Svoboda CVS zdar at mplayerhq.hu
Sun Mar 2 16:57:02 CET 2003


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv31515

Modified Files:
	vo_directfb2.c 
Log Message:
Layer configuration handling updates

Index: vo_directfb2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_directfb2.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- vo_directfb2.c	9 Feb 2003 20:18:23 -0000	1.7
+++ vo_directfb2.c	2 Mar 2003 15:56:42 -0000	1.8
@@ -217,8 +217,11 @@
    */
 
         DFBCHECK (DirectFBCreate (&dfb));
-        if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
-	    printf("DirectFB: Warning - cannot swith to fullscreen mode");
+        if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_EXCLUSIVE)) {
+	    printf("DirectFB: Warning - cannot swith to exclusive mode");
+            if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
+		printf("DirectFB: Warning - cannot swith to fullscreen mode");
+	    };
 	};
 
   /*
@@ -316,22 +319,22 @@
 
         dlc.flags       = DLCONF_PIXELFORMAT;
 	dlc.pixelformat = convformat(params->format);
-             
+
 	layer->SetOpacity(layer,0);
+             
 	ret = layer->TestConfiguration(layer,&dlc,NULL);
  
         layer->Release(layer);
 
 	if (verbose) printf("DirectFB: Test format - layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
      
-	if (!ret) {
+	if (ret==DFB_OK) {
 //	    printf("Test OK\n");     
 	    if (params->result) {
 	        if  ((!params->scale) && (desc.caps & DLCAPS_SCREEN_LOCATION)) {
 		    params->scale=1;
 		    params->id=id;
 		    if (verbose) printf("DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
-		    
 		}
 	    } else {
 		params->result=1;
@@ -343,7 +346,7 @@
      };
 
     };
-    
+
     return DFENUM_OK;
 }
 
@@ -475,12 +478,12 @@
 	    params.width=0;
 	    params.height=0;
 	    switch (format) {
-		    case IMGFMT_RGB32: 
-    		    case IMGFMT_BGR32: 
+		    case IMGFMT_RGB32:
+    		    case IMGFMT_BGR32:
 					params.bpp=32;
 					break;
-        	    case IMGFMT_RGB24: 
-		    case IMGFMT_BGR24: 
+        	    case IMGFMT_RGB24:
+		    case IMGFMT_BGR24:
 					params.bpp=24;
 					break;
 		    case IMGFMT_RGB16:
@@ -489,9 +492,9 @@
 	    	    case IMGFMT_BGR15:
 					params.bpp=16;
 					break;
-		    default:		params.bpp=0;		
-					
-	    }			
+		    default:		params.bpp=0;
+
+	    }
 	    if (verbose) printf("DirectFB: Config - videomode change\n");
             DFBCHECK (dfb->EnumVideoModes(dfb,video_modes_callback,&params));
 	    ret=dfb->SetVideoMode(dfb,params.width,params.height,params.bpp);
@@ -524,12 +527,12 @@
 	if (!params.result) {
 	    printf("DirectFB: ConfigError - no suitable layer found\n");
 	    params.id = DLID_PRIMARY;
-	}	
+	}
 /*	Uncomment following if you want to use tvout on CRTC2 (requieres patch for DirectFB from Ville Syrjala)
 	params.id=2;
 	params.scale=0;
 	params.result=1;
-*/	
+*/
 	if (verbose) printf("DirectFB: Config - layer %i\n",params.id);
 
 
@@ -543,26 +546,41 @@
             dlc.flags       = DLCONF_WIDTH | DLCONF_HEIGHT;
 	    dlc.width       = s_width;
     	    dlc.height      = s_height;
-	    
+
 	    ret = layer->SetConfiguration(layer,&dlc);
-	    
+
 	    if (ret && (params.scale || verbose)) printf("DirectFB: ConfigError in layer configuration (size)\n");
-	
+
 	}
 
-        dlc.flags       = DLCONF_PIXELFORMAT;
-	dlc.pixelformat = convformat(params.format);
+        // look if we need to change pixel fromat of layer
+	// and just for sure fetch also all layer propreties
+	dlc.flags       = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_OPTIONS | DLCONF_BUFFERMODE;
+	ret = layer->GetConfiguration(layer,&dlc);
+
+	dlc.flags       = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT;
 
-//	printf("DirectFB: Format [%x]\n",dlc.pixelformat);
-             
-        if (verbose) printf("DirectFB: Config - set layer config (format)\n");
-	ret = layer->SetConfiguration(layer,&dlc);
-	
 	if (ret) {
-	    printf("DirectFB: ConfigError in layer configuration (format)\n");
-	    return CONFIG_ERROR;
+	    printf("DirectFB: Warning - could not get layer properties!\n");
+	} else if (verbose) {
+	    printf("DirectFB: Layer reports format:%x\n",dlc.pixelformat);
+	}
+
+	if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) {
+
+    	    dlc.flags       = DLCONF_PIXELFORMAT;
+	    dlc.pixelformat = convformat(params.format);
+
+	    printf("DirectFB: Format [%x]\n",dlc.pixelformat);
+
+    	    if (verbose) printf("DirectFB: Config - set layer config (format)\n");
+	    ret = layer->SetConfiguration(layer,&dlc);
+
+	    if (ret) {
+		printf("DirectFB: ConfigError in layer configuration (format)\n");
+		return CONFIG_ERROR;
+	    };
 	};
-	
 
 // flipping of layer
 



More information about the MPlayer-cvslog mailing list