Re: xmms redirection to stdout

Romain Beauxis <[email protected]> Thu, 25 Aug 2005 20:48:14 +0200
Newsgroups gmane.comp.multimedia.xmms.devel
Organization RastaGeeks
Message-ID <[email protected]>
Le Jeudi 25 Août 2005 16:57, Tim Gruene a écrit :
>
> Therefore I would like xmms to send the raw data to stdout so that I can
> catch it with a2play.
>

Well, it may help you to do the following:
Set up an alse device that outputs to stdout and then launch xmms | a2play and 
select this device from xmms.

To do so, you'll need to patch the pcm_file plugin like on the patch attached, 
for alsa-lib-1.0.9.

Then, just add the following to your .asoundrc:
pcm.stdout {
        type file
        slave.pcm default
        file -
}

And you will have a playback both in your default device and to stdout.
You can also set slave.pcm to null and only get the stdout output.

Well, I tried this and it worked, i.e. I get an output in my stdout.
Then, as I don't know how to read the stream, I let you try it!

Romain

-- 

   Everyday is just a holiday,
   I don't care what the crowd may say.
   I live the life I love with you,
   Having fun while they are feeling blue.

_______________________________________________
xmms-devel mailing list
[email protected]
http://lists.xmms.org/mailman/listinfo/xmms-devel
alsalib-stdout-file.patch (text/x-diff, 701 B)
--- alsa-lib-1.0.9/src/pcm/pcm_file.orig.c	2005-08-25 20:22:24.000000000 +0200
+++ alsa-lib-1.0.9/src/pcm/pcm_file.c	2005-08-25 20:24:04.000000000 +0200
@@ -26,6 +26,7 @@
  *
  */
   
+#include <unistd.h>
 #include <byteswap.h>
 #include <ctype.h>
 #include "pcm_local.h"
@@ -412,10 +413,14 @@
 		return -EINVAL;
 	}
 	if (fname) {
-		fd = open(fname, O_WRONLY|O_CREAT, perm);
-		if (fd < 0) {
-			SYSERR("open %s failed", fname);
-			return -errno;
+		if (strcmp(fname, "-") == 0) {
+			fd = STDOUT_FILENO;
+		} else {
+			fd = open(fname, O_WRONLY|O_CREAT, perm);
+			if (fd < 0) {
+				SYSERR("open %s failed", fname);
+				return -errno;
+			}
 		}
 	}
 	file = calloc(1, sizeof(snd_pcm_file_t));