[MPlayer-dev-eng] [PATCH] lavcresample crashes when no AF_CONTROL_COMMAND_LINE

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Dec 18 13:11:55 CET 2004


Hi,
> lavcresample currently crashes when AF_CONTROL_COMMAND_LINE is not sent.
> This is because the cutoff values isn't initialized in init.
> The attached patch fixes it and also uses a local variable to initialize
> setup to avoid doing "hundreds" of typecasts.
> I need this fixed because I want to make lavcresample default with
> -af-adv force=1.
> If nobody speaks up against this I will probably apply tomorrow.

Sorry, that patch contained unrelated changes. The attached one is the
correct one.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libaf/af_lavcresample.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_lavcresample.c,v
retrieving revision 1.3
diff -u -r1.3 af_lavcresample.c
--- libaf/af_lavcresample.c	3 Nov 2004 01:53:56 -0000	1.3
+++ libaf/af_lavcresample.c	18 Dec 2004 12:03:19 -0000
@@ -144,16 +148,18 @@
 }
 
 static int open(af_instance_t* af){
+  af_resample_t *s = calloc(1,sizeof(af_resample_t));
   af->control=control;
   af->uninit=uninit;
   af->play=play;
   af->mul.n=1;
   af->mul.d=1;
   af->data=calloc(1,sizeof(af_data_t));
-  af->setup=calloc(1,sizeof(af_resample_t));
-  ((af_resample_t*)af->setup)->filter_length= 16;
-  ((af_resample_t*)af->setup)->phase_shift= 10;
-//  ((af_resample_t*)af->setup)->setup = RSMP_INT | FREQ_SLOPPY;
+  s->filter_length= 16;
+  s->cutoff= max(1.0 - 1.0/s->filter_length, 0.80);
+  s->phase_shift= 10;
+//  s->setup = RSMP_INT | FREQ_SLOPPY;
+  af->setup=s;
   return AF_OK;
 }
 


More information about the MPlayer-dev-eng mailing list