[MPlayer-cvslog] CVS: main/libaf af.c,1.47,1.48 af.h,1.26,1.27

Reimar Döffinger CVS syncmail at mplayerhq.hu
Fri Jun 24 12:50:55 CEST 2005


CVS change done by Reimar Döffinger CVS

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

Modified Files:
	af.c af.h 
Log Message:
make -srate work again, unify audio filter init and preinit.


Index: af.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- af.c	21 Jun 2005 01:00:35 -0000	1.47
+++ af.c	24 Jun 2005 10:50:53 -0000	1.48
@@ -329,12 +329,11 @@
    and output should contain the format of the current movie and the
    formate of the preferred output respectively. The function is
    reentrant i.e. if called with an already initialized stream the
-   stream will be reinitialized. If the binary parameter
-   "force_output" is set, the output format will be converted to the
-   format given in "s", otherwise the output fromat in the last filter
-   will be copied "s". The return value is 0 if success and -1 if
-   failure */
-int af_init(af_stream_t* s, int force_output)
+   stream will be reinitialized.
+   If one of the prefered output parameters is 0 the one that needs
+   no conversion is used (i.e. the output format in the last filter).
+   The return value is 0 if success and -1 if failure */
+int af_init(af_stream_t* s)
 {
   int i=0;
 
@@ -373,17 +372,11 @@
     if (!af_append(s,s->first,"dummy") || AF_OK != af_reinit(s,s->first))
       return -1;
 
-  // If force_output isn't set do not compensate for output format
-  if(!force_output){
-    memcpy(&s->output, s->last->data, sizeof(af_data_t));
-    return 0;
-  }
-
   // Check output format
   if((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE){
     af_instance_t* af = NULL; // New filter
     // Check output frequency if not OK fix with resample
-    if(s->last->data->rate!=s->output.rate){
+    if(s->output.rate && s->last->data->rate!=s->output.rate){
       // try to find a filter that can change samplrate
       af = af_control_any_rev(s, AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET,
                &(s->output.rate));
@@ -428,7 +421,7 @@
       
     // Check number of output channels fix if not OK
     // If needed always inserted last -> easy to screw up other filters
-    if(s->last->data->nch!=s->output.nch){
+    if(s->output.nch && s->last->data->nch!=s->output.nch){
       if(!strcmp(s->last->info->name,"format"))
 	af = af_prepend(s,s->last,"channels");
       else
@@ -441,7 +434,7 @@
     }
     
     // Check output format fix if not OK
-    if(s->last->data->format != s->output.format){
+    if(s->output.format && s->last->data->format != s->output.format){
       if(strcmp(s->last->info->name,"format"))
 	af = af_append(s,s->last,"format");
       else
@@ -458,6 +451,9 @@
     if(AF_OK != af_reinit(s,s->first))
       return -1;
 
+    if (!s->output.format) s->output.format = s->last->data->format;
+    if (!s->output.nch) s->output.nch = s->last->data->nch;
+    if (!s->output.rate) s->output.rate = s->last->data->rate;
     if((s->last->data->format != s->output.format) || 
        (s->last->data->nch    != s->output.nch)    || 
        (s->last->data->rate   != s->output.rate))  {

Index: af.h
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- af.h	1 Mar 2005 22:52:02 -0000	1.26
+++ af.h	24 Jun 2005 10:50:53 -0000	1.27
@@ -134,7 +134,7 @@
    format given in "s", otherwise the output fromat in the last filter
    will be copied "s". The return value is 0 if success and -1 if
    failure */
-int af_init(af_stream_t* s, int force_output);
+int af_init(af_stream_t* s);
 
 // Uninit and remove all filters
 void af_uninit(af_stream_t* s);




More information about the MPlayer-cvslog mailing list