[MPlayer-cvslog] CVS: main/libaf af.c,1.43,1.44

Jindrich Makovicka CVS syncmail at mplayerhq.hu
Sat Apr 16 18:48:18 CEST 2005


CVS change done by Jindrich Makovicka CVS

Update of /cvsroot/mplayer/main/libaf
In directory mail:/var2/tmp/cvs-serv18667

Modified Files:
	af.c 
Log Message:
change list traversal so the loop begins at the first filter after removing
one, instead at the second


Index: af.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- af.c	25 Feb 2005 11:11:07 -0000	1.43
+++ af.c	16 Apr 2005 16:48:15 -0000	1.44
@@ -224,13 +224,18 @@
    failure */
 int af_reinit(af_stream_t* s, af_instance_t* af)
 {
-  if(!af)
-    return AF_ERROR;
-
   do{
     af_data_t in; // Format of the input to current filter
     int rv=0; // Return value
 
+    // Check if there are any filters left in the list
+    if(NULL == af){
+      if(!(af=af_append(s,s->first,"dummy"))) 
+	return AF_UNKNOWN; 
+      else
+	return AF_ERROR;
+    }
+
     // Check if this is the first filter 
     if(!af->prev) 
       memcpy(&in,&(s->input),sizeof(af_data_t));
@@ -243,6 +248,7 @@
     rv = af->control(af,AF_CONTROL_REINIT,&in);
     switch(rv){
     case AF_OK:
+	af = af->next;
       break;
     case AF_FALSE:{ // Configuration filter is needed
       // Do auto insertion only if force is not specified
@@ -286,7 +292,7 @@
 		 "This error should never uccur, please send bugreport.\n");
 	  return AF_ERROR;
 	}
-	af=new;
+	af=new->next;
       }
       break;
     }
@@ -296,7 +302,7 @@
 	af_instance_t* aft=af->prev;
 	af_remove(s,af);
 	if(aft)
-	  af=aft;
+	  af=aft->next;
 	else
 	  af=s->first; // Restart configuration
       }
@@ -307,13 +313,6 @@
 	     " filter '%s' returned error code %i\n",af->info->name,rv);
       return AF_ERROR;
     }
-    // Check if there are any filters left in the list
-    if(NULL == af){
-      if(!(af=af_append(s,s->first,"dummy"))) 
-	return -1; 
-    }
-    else
-      af=af->next;
   }while(af);
   return AF_OK;
 }
@@ -402,7 +401,7 @@
 	    af = af_append(s,s->last,resampler);
 	}
       // Init the new filter
-      if(!af || (AF_OK != af->control(af,AF_CONTROL_RESAMPLE_RATE,
+      if(!af || (AF_OK != af->control(af,AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET,
 				      &(s->output.rate))))
 	return -1;
       // Use lin int if the user wants fast




More information about the MPlayer-cvslog mailing list