PDA

View Full Version : AlienStream modifications



Niek Jongerius
2004-08-16, 11:47
Hi list,

I've been tinkering with AlienStream. In a previous post I detailed some
issues regarding WMA streams and hangs of the slimserver daemon. I changed
the process a bit and got rid of the two pipes in /tmp. It now uses a
daemon process that listens for alien stream requests.

The original AlienStream plugin works something like this:

- The AlienStream helper app is started, and it connects to the alien
stream via a URL. The output is WAV, which is put in a named pipe
under /tmp.
- A lame process is started, that reads from that named pipe (and thus
reads the WAV data), and puts an encoded stream (MP3) in a second
pipe.
- The slimserver then reads the second pipe (the MP3 data).

This process is somewhat cumbersome. If anything goes awry (for instance,
if the AlienStream helper or lame dies prematurely), the server gets
stuck reading a "dead" pipe. Furthermore, this scheme can get difficult
to implement on other non-*ix platforms.

My version works like this:

- I don't use a plugin at all. Instead, I use some special formatting
for a playlist file. An example (which will connect to a WMA stream
of a Dutch radio station):
http://localhost:668/mms://livemedia2.omroep.nl/radio3-smal
- When played by the server, this will connect to localhost on port 668
and start a program which takes care of connecting to the "real" URL
(obviously the part starting with "mms://"). The program will extract
the URL, connect to the stream, decode/encode to MP3, and return the
MP3 data to slimserver. At the moment this program is just a shell
script containing a modified alienstream helper and lame.

Upside is that if anything goes wrong, the daemon process quits, and the
slimserver won't hang up. Since there are no named pipes, portability
_could_ be better (I'm no Windows jockey...). And you could even run the
alienstream/lame stuff on another machine if your server is cpu bound, or
use the very same daemon to play WMA streams using a pure MP3 player like
mpg123.

For this to work (and to get rid of these pipes) I had to tickle the
Xine libs just a little to let it output WAV to stdout instead of to a
file. 3 extra lines of code in a Xine source file, and set the
XINE_WAVE_OUTPUT environment variable to "1".

If anyone is interested, let me know. It's not polished code yet, but
it works (for me).

Regards, Niek.

Jules Taplin
2004-08-17, 01:16
Hi Nick.

Ok. Great minds think alike - the new version of AlienBBC works in almost
exactly this fashion (actually... we didn't bother removing the pipes
altogether, but we did move the transcoder process into a separate proxy,
which has helped enormously).

We should get a new release out this week, which has some relatively major
changes. It'll also browse AlienStream playlists for you, so it could be
used as a straight drop-in replacement.

-- Jules

----- Original Message -----
From: "Niek Jongerius" <niek (AT) qwertyboy (DOT) org>
To: <discuss (AT) lists (DOT) slimdevices.com>
Sent: Monday, August 16, 2004 7:47 PM
Subject: [slim] AlienStream modifications


> Hi list,
>
> I've been tinkering with AlienStream. In a previous post I detailed some
> issues regarding WMA streams and hangs of the slimserver daemon. I changed
> the process a bit and got rid of the two pipes in /tmp. It now uses a
> daemon process that listens for alien stream requests.
>
> The original AlienStream plugin works something like this:
>
> - The AlienStream helper app is started, and it connects to the alien
> stream via a URL. The output is WAV, which is put in a named pipe
> under /tmp.
> - A lame process is started, that reads from that named pipe (and thus
> reads the WAV data), and puts an encoded stream (MP3) in a second
> pipe.
> - The slimserver then reads the second pipe (the MP3 data).
>
> This process is somewhat cumbersome. If anything goes awry (for instance,
> if the AlienStream helper or lame dies prematurely), the server gets
> stuck reading a "dead" pipe. Furthermore, this scheme can get difficult
> to implement on other non-*ix platforms.
>
> My version works like this:
>
> - I don't use a plugin at all. Instead, I use some special formatting
> for a playlist file. An example (which will connect to a WMA stream
> of a Dutch radio station):
> http://localhost:668/mms://livemedia2.omroep.nl/radio3-smal
> - When played by the server, this will connect to localhost on port 668
> and start a program which takes care of connecting to the "real" URL
> (obviously the part starting with "mms://"). The program will extract
> the URL, connect to the stream, decode/encode to MP3, and return the
> MP3 data to slimserver. At the moment this program is just a shell
> script containing a modified alienstream helper and lame.
>
> Upside is that if anything goes wrong, the daemon process quits, and the
> slimserver won't hang up. Since there are no named pipes, portability
> _could_ be better (I'm no Windows jockey...). And you could even run the
> alienstream/lame stuff on another machine if your server is cpu bound, or
> use the very same daemon to play WMA streams using a pure MP3 player like
> mpg123.
>
> For this to work (and to get rid of these pipes) I had to tickle the
> Xine libs just a little to let it output WAV to stdout instead of to a
> file. 3 extra lines of code in a Xine source file, and set the
> XINE_WAVE_OUTPUT environment variable to "1".
>
> If anyone is interested, let me know. It's not polished code yet, but
> it works (for me).
>
> Regards, Niek.
>