changeset 8969:a892e5f051e1

Adding support for more logical libaf configuration
author anders
date Fri, 17 Jan 2003 01:00:07 +0000
parents 973bd8b405f8
children bfc26f478845
files libaf/af.c libaf/af.h libmpcodecs/dec_audio.c
diffstat 3 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af.c	Thu Jan 16 23:40:42 2003 +0000
+++ b/libaf/af.c	Fri Jan 17 01:00:07 2003 +0000
@@ -310,9 +310,12 @@
    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. The return value is 0 if success and
-   -1 if failure */
-int af_init(af_stream_t* s)
+   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)
 {
   int i=0;
 
@@ -346,6 +349,12 @@
   if(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
--- a/libaf/af.h	Thu Jan 16 23:40:42 2003 +0000
+++ b/libaf/af.h	Fri Jan 17 01:00:07 2003 +0000
@@ -124,10 +124,13 @@
    if necessary according to the values set in input and output. Input
    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 wit an already initialized stream the
-   stream will be reinitialized. The return value is 0 if success and
-   -1 if failure */
-int af_init(af_stream_t* s);
+   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);
 
 // Uninit and remove all filters
 void af_uninit(af_stream_t* s);
--- a/libmpcodecs/dec_audio.c	Thu Jan 16 23:40:42 2003 +0000
+++ b/libmpcodecs/dec_audio.c	Fri Jan 17 01:00:07 2003 +0000
@@ -304,7 +304,7 @@
       afs->output.rate,afs->output.nch,afs->output.bps*8);
   
   // let's autoprobe it!
-  if(0 != af_init(afs)){
+  if(0 != af_init(afs,1)){
     free(afs);
     return 0; // failed :(
   }