[MPlayer-cvslog] CVS: main/libaf af_extrastereo.c, 1.2, 1.3 af_hrtf.c, 1.1, 1.2 af_lavcresample.c, 1.4, 1.5 af_sweep.c, 1.1, 1.2 af_volnorm.c, 1.2, 1.3

Reimar Döffinger CVS syncmail at mplayerhq.hu
Wed Dec 22 01:12:03 CET 2004


CVS change done by Reimar Döffinger CVS

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

Modified Files:
	af_extrastereo.c af_hrtf.c af_lavcresample.c af_sweep.c 
	af_volnorm.c 
Log Message:
Make filters request a supported input format instead of failing.


Index: af_extrastereo.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_extrastereo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- af_extrastereo.c	10 Oct 2004 14:20:42 -0000	1.2
+++ af_extrastereo.c	22 Dec 2004 00:12:00 -0000	1.3
@@ -35,10 +35,6 @@
     // Sanity check
     if(!arg) return AF_ERROR;
     
-    if(((af_data_t*)arg)->format != (AF_FORMAT_SI | AF_FORMAT_NE) ||
-       (((af_data_t*)arg)->nch != 2))
-       return AF_ERROR;
-
     af->data->rate   = ((af_data_t*)arg)->rate;
     af->data->nch    = 2;
     af->data->format = AF_FORMAT_SI | AF_FORMAT_NE;

Index: af_hrtf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_hrtf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- af_hrtf.c	20 Nov 2004 14:40:52 -0000	1.1
+++ af_hrtf.c	22 Dec 2004 00:12:00 -0000	1.2
@@ -108,6 +108,8 @@
     case AF_CONTROL_REINIT:
 	af->data->rate   = ((af_data_t*)arg)->rate;
 	if(af->data->rate != 48000) {
+	    // automatic samplerate adjustment in the filter chain
+	    // is not yet supported.
 	    af_msg(AF_MSG_ERROR,
 		   "[hrtf] ERROR: Sampling rate is not 48000 Hz (%d)!\n",
 		   af->data->rate);
@@ -115,14 +117,11 @@
 	}
 	af->data->nch    = ((af_data_t*)arg)->nch;
 	if(af->data->nch < 5) {
-	    af_msg(AF_MSG_ERROR,
-		   "[hrtf] ERROR: Insufficient channels (%d < 5).\n",
-		   af->data->nch);
-	    return AF_ERROR;
+	    af->data->nch = 5;
 	}
 	af->data->format = AF_FORMAT_SI | AF_FORMAT_NE;
 	af->data->bps    = 2;
-	return AF_OK;
+	return af_test_output(af, (af_data_t*)arg);
     case AF_CONTROL_COMMAND_LINE:
 	sscanf((char*)arg, "%c", &mode);
 	switch(mode) {

Index: af_lavcresample.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_lavcresample.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- af_lavcresample.c	19 Dec 2004 16:28:34 -0000	1.4
+++ af_lavcresample.c	22 Dec 2004 00:12:00 -0000	1.5
@@ -43,16 +43,15 @@
   int g;
   af_resample_t* s   = (af_resample_t*)af->setup; 
   af_data_t *data= (af_data_t*)arg;
+  int out_rate, test_output_res; // helpers for checking input format
 
   switch(cmd){
   case AF_CONTROL_REINIT:
     if((af->data->rate == data->rate) || (af->data->rate == 0))
         return AF_DETACH;
 
-    if(data->format != (AF_FORMAT_SI | AF_FORMAT_NE) || data->nch > CHANS)
-       return AF_ERROR;
-
     af->data->nch    = data->nch;
+    if (af->data->nch > CHANS) af->data->nch = CHANS;
     af->data->format = AF_FORMAT_SI | AF_FORMAT_NE;
     af->data->bps    = 2;
     g= ff_gcd(af->data->rate, data->rate);
@@ -63,7 +62,12 @@
     if(s->avrctx) av_resample_close(s->avrctx);
     s->avrctx= av_resample_init(af->mul.n, /*in_rate*/af->mul.d, s->filter_length, s->phase_shift, s->linear, s->cutoff);
 
-    return AF_OK;
+    // hack to make af_test_output ignore the samplerate change
+    out_rate = af->data->rate;
+    af->data->rate = data->rate;
+    test_output_res = af_test_output(af, (af_data_t*)arg);
+    af->data->rate = out_rate;
+    return test_output_res;
   case AF_CONTROL_COMMAND_LINE:{
     sscanf((char*)arg,"%d:%d:%d:%d:%lf", &af->data->rate, &s->filter_length, &s->linear, &s->phase_shift, &s->cutoff);
     if(s->cutoff <= 0.0) s->cutoff= max(1.0 - 1.0/s->filter_length, 0.80);

Index: af_sweep.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_sweep.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- af_sweep.c	21 Oct 2004 12:10:55 -0000	1.1
+++ af_sweep.c	22 Dec 2004 00:12:00 -0000	1.2
@@ -24,9 +24,6 @@
 
   switch(cmd){
   case AF_CONTROL_REINIT:
-    if(data->format != (AF_FORMAT_SI | AF_FORMAT_NE))
-       return AF_ERROR;
-
     af->data->nch    = data->nch;
     af->data->format = AF_FORMAT_SI | AF_FORMAT_NE;
     af->data->bps    = 2;

Index: af_volnorm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_volnorm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- af_volnorm.c	10 Oct 2004 14:20:42 -0000	1.2
+++ af_volnorm.c	22 Dec 2004 00:12:00 -0000	1.3
@@ -79,10 +79,6 @@
     af->data->rate   = ((af_data_t*)arg)->rate;
     af->data->nch    = ((af_data_t*)arg)->nch;
     
-    if(((af_data_t*)arg)->format != (AF_FORMAT_F | AF_FORMAT_NE) &&
-       ((af_data_t*)arg)->format != (AF_FORMAT_SI | AF_FORMAT_NE))
-       return AF_ERROR;
-    
     if(((af_data_t*)arg)->format == (AF_FORMAT_SI | AF_FORMAT_NE)){
       af->data->format = AF_FORMAT_SI | AF_FORMAT_NE;
       af->data->bps    = 2;




More information about the MPlayer-cvslog mailing list