[MPlayer-cvslog] CVS: main/libmpcodecs vf_expand.c,1.28,1.29

Jindrich Makovicka CVS syncmail at mplayerhq.hu
Sun Apr 24 11:29:03 CEST 2005


CVS change done by Jindrich Makovicka CVS

Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv11185

Modified Files:
	vf_expand.c 
Log Message:
- preserve ordering of the slices
- make sure that the black buffer is actually allocated to avoid sig11


Index: vf_expand.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_expand.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- vf_expand.c	10 Apr 2005 15:37:43 -0000	1.28
+++ vf_expand.c	24 Apr 2005 09:29:01 -0000	1.29
@@ -28,11 +28,13 @@
     int exp_x,exp_y;
     int osd;
     unsigned char* fb_ptr;
+    int first_slice;
 } vf_priv_dflt = {
   -1,-1,
   -1,-1,
   0,
-  NULL
+  NULL,
+  0
 };
 
 extern int opt_screen_size_x;
@@ -250,20 +252,25 @@
     if(!mpi->priv)
 	mpi->priv=vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
 //	MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
-	    mpi->type, mpi->flags, 
+	    MP_IMGTYPE_TEMP, mpi->flags, 
             MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x), 
             MAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y));
     if(!(vf->dmpi->flags&MP_IMGFLAG_DRAW_CALLBACK))
 	printf("WARNING! next filter doesn't support SLICES, get ready for sig11...\n"); // shouldn't happen.
+    vf->priv->first_slice = 1;
 }
 
-static void draw_slice(struct vf_instance_s* vf,
-        unsigned char** src, int* stride, int w,int h, int x, int y){
-//    printf("draw_slice() called %d at %d\n",h,y);
-    if(vf->priv->exp_y>0 && y == 0)
+static void draw_top_blackbar_slice(struct vf_instance_s* vf,
+				    unsigned char** src, int* stride, int w,int h, int x, int y){
+    if(vf->priv->exp_y>0 && y == 0) {
 	vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
 			   vf->dmpi->w,vf->priv->exp_y,0,0);
-    vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
+    }
+    
+}
+
+static void draw_bottom_blackbar_slice(struct vf_instance_s* vf,
+				    unsigned char** src, int* stride, int w,int h, int x, int y){
     if(vf->priv->exp_y+vf->h<vf->dmpi->h && y+h == vf->h) {
 	unsigned char *src2[MP_MAX_PLANES];
 	src2[0] = vf->dmpi->planes[0]
@@ -276,13 +283,35 @@
 	} else {
 	    src2[1] = vf->dmpi->planes[1]; // passthrough rgb8 palette
 	}
-	
 	vf_next_draw_slice(vf, src2, vf->dmpi->stride,
 			   vf->dmpi->w,vf->dmpi->h-(vf->priv->exp_y+vf->h),
 			   0,vf->priv->exp_y+vf->h);
     }
 }
 
+static void draw_slice(struct vf_instance_s* vf,
+        unsigned char** src, int* stride, int w,int h, int x, int y){
+//    printf("draw_slice() called %d at %d\n",h,y);
+    
+    if (y == 0 && y+h == vf->h) {
+	// special case - only one slice
+	draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
+	vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
+	draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
+	return;
+    }
+    if (vf->priv->first_slice) {
+	draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
+	draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
+    }
+    vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
+    if (!vf->priv->first_slice) {
+	draw_top_blackbar_slice(vf, src, stride, w, h, x, y);
+	draw_bottom_blackbar_slice(vf, src, stride, w, h, x, y);
+    }
+    vf->priv->first_slice = 0;
+}
+
 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
     if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
 	vf->dmpi=mpi->priv;




More information about the MPlayer-cvslog mailing list