Author: qboosh                       Date: Thu Jan 24 22:15:01 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- allow multiple outputs (to fallback if init fails)

---- Files affected:
SOURCES:
   mpg123-multi-ao.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/mpg123-multi-ao.patch
diff -u /dev/null SOURCES/mpg123-multi-ao.patch:1.1
--- /dev/null   Thu Jan 24 23:15:01 2008
+++ SOURCES/mpg123-multi-ao.patch       Thu Jan 24 23:14:56 2008
@@ -0,0 +1,72 @@
+--- mpg123-1.1.0/src/audio.c.orig      2008-01-15 03:27:32.000000000 +0100
++++ mpg123-1.1.0/src/audio.c   2008-01-24 22:47:39.898426268 +0100
+@@ -13,6 +13,7 @@
+ #ifdef HAVE_SYS_WAIT_H
+ #include <sys/wait.h>
+ #endif
++#include <errno.h>
+ 
+ static int file_write(struct audio_output_struct* ao, unsigned char *bytes, 
int count)
+ {
+@@ -97,27 +98,40 @@
+       mpg123_module_t *module = NULL;
+       audio_output_t *ao = NULL;
+       int result = 0;
++      char *curmodname, *modnames;
+ 
+       if(param.usebuffer) return NULL;
+ 
+       /* Use internal code. */
+       if(param.outmode != DECODE_AUDIO) return open_fake_module();
+ 
++      modnames = strdup(name);
++      if (modnames == NULL) {
++              error1("Error allocating memory for module name(s): %s", 
strerror(errno));
++              return NULL;
++      }
++      curmodname = strtok(modnames, ",");
++
++    while (curmodname != NULL) {
++      name = curmodname;
++      curmodname = strtok(NULL, ",");
+       /* Open the module */
+       module = open_module( "output", name );
+-      if (module == NULL) return NULL;
++      if (module == NULL) continue;
+ 
+       /* Check module supports output */
+       if (module->init_output == NULL) {
+               error1("Module '%s' does not support audio output.", name);
+               close_module( module );
+-              return NULL;
++              continue;
+       }
+       
+       /* Allocation memory for audio output type */
+       ao = alloc_audio_output();
+       if (ao==NULL) {
+               error( "Failed to allocate audio output structure." );
++              close_module( module );
++              free( modnames );
+               return NULL;
+       }
+       
+@@ -129,13 +143,16 @@
+       if (result) {
+               error1( "Module's init function failed: %d", result );
+               close_module( module );
+-              return NULL;
++              free( ao );
++              continue;
+       }
+       
+       /* Store the pointer to the module (so we can close it later) */
+       ao->module = module;
+-
++      free( modnames );
+       return ao;
++    }
++      return NULL;
+ }
+ 
+ 
================================================================
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to