[Mplayer-cvslog] CVS: main/libvo vo_directfb2.c,1.12,1.13

Jiri Svoboda CVS zdar at mplayerhq.hu
Sun Sep 7 21:42:59 CEST 2003


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

Modified Files:
	vo_directfb2.c 
Log Message:
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.

Index: vo_directfb2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_directfb2.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- vo_directfb2.c	15 Aug 2003 13:04:37 -0000	1.12
+++ vo_directfb2.c	7 Sep 2003 19:42:35 -0000	1.13
@@ -237,8 +237,10 @@
                     show_help = 1;
                     vo_subdevice += 4;
                     break;
-               }
-               }
+               } else  {
+                    vo_subdevice++;
+	       }
+          }
 	       
           if (show_help) {
                mp_msg( MSGT_VO, MSGL_ERR,
@@ -612,6 +614,25 @@
 	    }
 	} // vm end
 
+// just for sure clear primary layer
+#if DIRECTFBVERSION > 913
+        ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer);
+	if (ret==DFB_OK) {
+	    ret = layer->GetSurface(layer,&primary);
+	    if (ret==DFB_OK) {
+		primary->Clear(primary,0,0,0,0xff);
+		ret = primary->Flip(primary,NULL,0);
+		if (ret==DFB_OK) { 
+		    primary->Clear(primary,0,0,0,0xff);
+		}
+    	    primary->Release(primary);
+	    }
+	primary=NULL;
+        layer->Release(layer);
+	}
+	layer=NULL;
+#endif
+
 // find best layer
 
         mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - looking for suitable layer\n");
@@ -1184,6 +1205,19 @@
 	   mpi->width=width;
 	   mpi->stride[0]=pitch;
        }
+
+       // center image
+       
+       if (!frame) {
+            if(mpi->flags&MP_IMGFLAG_PLANAR){
+		mpi->planes[0]= dst + yoffset * pitch + xoffset;
+		mpi->planes[1]+= (yoffset * pitch) >> 2 + xoffset >> 1;
+		mpi->planes[2]+= (yoffset * pitch) >> 2 + xoffset >> 1;
+	    } else {
+		mpi->planes[0]=dst + yoffset * pitch + xoffset * (mpi->bpp >> 3);
+	    }		   
+       }
+       
        mpi->flags|=MP_IMGFLAG_DIRECT;
 //       if (verbose) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n");
        return VO_TRUE;
@@ -1201,6 +1235,8 @@
         void *srcp;
 	unsigned int p;
 
+//        if (verbose) printf("DirectFB: draw_slice entered\n");
+
 	unlock();
 
 	if (frame) {
@@ -1315,6 +1351,7 @@
             memcpy(dst+i*pitch,src+i*mpi->stride[0],p);
         }
 
+	
 	if (pixel_format == DSPF_YV12) {
 
             dst += pitch*height;
@@ -1353,7 +1390,9 @@
 	unlock();
 
     } else {
+// I had to disable native directfb blit because it wasn't working under some conditions :-(
 
+/*
 	dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED;
 	dsc.preallocated[0].data = mpi->planes[0];
 	dsc.preallocated[0].pitch = mpi->stride[0];
@@ -1374,6 +1413,23 @@
 		DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset));
         };
         tmp->Release(tmp);
+*/
+
+	unsigned int pitch;
+        void *dst;
+
+//        if (verbose) printf("DirectFB: Put_image - non planar branch\n");
+	if (frame) {
+		DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
+		framelocked = 1;
+		mem2agpcpy_pic(dst,mpi->planes[0] + mpi->y * mpi->stride[0] + mpi->x * (mpi->bpp >> 3)  ,mpi->w * (mpi->bpp >> 3),mpi->h,pitch,mpi->stride[0]);
+        } else {
+		DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
+		primarylocked = 1;
+		mem2agpcpy_pic(dst + yoffset * pitch + xoffset * (mpi->bpp >> 3),mpi->planes[0] + mpi->y * mpi->stride[0] + mpi->x * (mpi->bpp >> 3)  ,mpi->w * (mpi->bpp >> 3),mpi->h,pitch,mpi->stride[0]);
+        };
+	unlock();
+
     }
     return VO_TRUE;
 }



More information about the MPlayer-cvslog mailing list