[MPlayer-cvslog] r30436 - in trunk: DOCS/man/en/mplayer.1 libmpcodecs/vf_cropdetect.c

reimar subversion at mplayerhq.hu
Tue Jan 26 19:15:58 CET 2010


Author: reimar
Date: Tue Jan 26 19:15:58 2010
New Revision: 30436

Log:
Add an option to cropdetect to periodically reset the detected area.
Patch by [quetschke scytek de] with modifications by me.

Modified:
   trunk/libmpcodecs/vf_cropdetect.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/libmpcodecs/vf_cropdetect.c
==============================================================================
--- trunk/libmpcodecs/vf_cropdetect.c	Tue Jan 26 09:03:28 2010	(r30435)
+++ trunk/libmpcodecs/vf_cropdetect.c	Tue Jan 26 19:15:58 2010	(r30436)
@@ -15,6 +15,7 @@ struct vf_priv_s {
     int x1,y1,x2,y2;
     int limit;
     int round;
+    int reset_count;
     int fno;
 };
 
@@ -49,7 +50,7 @@ static int config(struct vf_instance_s* 
     vf->priv->y1=height - 1;
     vf->priv->x2=0;
     vf->priv->y2=0;
-    vf->priv->fno=0;
+    vf->priv->fno=-2;
     return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
 }
 
@@ -72,7 +73,16 @@ static int put_image(struct vf_instance_
     dmpi->width=mpi->width;
     dmpi->height=mpi->height;
 
-if(++vf->priv->fno>2){	// ignore first 2 frames - they may be empty
+if(++vf->priv->fno>0){	// ignore first 2 frames - they may be empty
+
+    // Reset the crop area every reset_count frames, if reset_count is > 0
+    if(vf->priv->reset_count > 0 && vf->priv->fno > vf->priv->reset_count){
+	vf->priv->x1=mpi->w-1;
+	vf->priv->y1=mpi->h-1;
+	vf->priv->x2=0;
+	vf->priv->y2=0;
+	vf->priv->fno=1;
+    }
 
     for(y=0;y<vf->priv->y1;y++){
 	if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){
@@ -153,9 +163,11 @@ static int open(vf_instance_t *vf, char*
     vf->priv=malloc(sizeof(struct vf_priv_s));
     vf->priv->limit=24; // should be option
     vf->priv->round = 0;
-    if(args) sscanf(args, "%d:%d",
+    vf->priv->reset_count = 0;
+    if(args) sscanf(args, "%d:%d:%d",
     &vf->priv->limit,
-    &vf->priv->round);
+    &vf->priv->round,
+    &vf->priv->reset_count);
     return 1;
 }
 


More information about the MPlayer-cvslog mailing list