[Mplayer-cvslog] CVS: main/libmpcodecs vf_scale.c,1.31,1.32

Arpi of Ize arpi at mplayerhq.hu
Sun Feb 23 21:40:50 CET 2003


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

Modified Files:
	vf_scale.c 
Log Message:
draw_slice support


Index: vf_scale.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_scale.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- vf_scale.c	21 Feb 2003 20:35:08 -0000	1.31
+++ vf_scale.c	23 Feb 2003 20:40:46 -0000	1.32
@@ -20,6 +20,7 @@
     unsigned int fmt;
     SwsContext *ctx;
     unsigned char* palette;
+    mp_image_t *dmpi;
 };
 
 extern int opt_screen_size_x;
@@ -199,15 +200,43 @@
     return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best);
 }
 
+static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+//    printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
+    if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen
+    // they want slices!!! allocate the buffer.
+    mpi->priv=vf->priv->dmpi=vf_get_image(vf->next,vf->priv->fmt,
+//	mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK),
+	MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
+	vf->priv->w, vf->priv->h);
+}
+
+static void draw_slice(struct vf_instance_s* vf,
+        unsigned char** src, int* stride, int w,int h, int x, int y){
+    mp_image_t *dmpi=vf->priv->dmpi;
+    if(!dmpi){
+	mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image??)\n");
+	return;
+    }
+//    printf("vf_scale::draw_slice() y=%d h=%d\n",y,h);
+    vf->priv->ctx->swScale(vf->priv->ctx,src,stride,y,h,dmpi->planes,dmpi->stride);
+}
+
 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
-    mp_image_t *dmpi;
+    mp_image_t *dmpi=mpi->priv;
 
+//    printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
+//	dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
+    
+  if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){
+  
     // hope we'll get DR buffer:
     dmpi=vf_get_image(vf->next,vf->priv->fmt,
 	MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
 	vf->priv->w, vf->priv->h);
     vf->priv->ctx->swScale(vf->priv->ctx,mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride);
 
+  }
+
     if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){
 	// just conversion, no scaling -> keep postprocessing data
 	// this way we can apply pp filter to non-yv12 source using scaler
@@ -314,6 +343,8 @@
 
 static int open(vf_instance_t *vf, char* args){
     vf->config=config;
+    vf->start_slice=start_slice;
+    vf->draw_slice=draw_slice;
     vf->put_image=put_image;
     vf->query_format=query_format;
     vf->control= control;



More information about the MPlayer-cvslog mailing list