hi again,
 
I did a port of your shoutcast~ to linux,
but I didn't use any "black magic"
( like adding a counter ),
I rather did the following modifications to
your first posted version :
 
a/ make the port to linux, including the makefile.
You might to fix the path to your libmp3lame.so in the makefile.
 
b/ change the code for allocation which might have been
responsible for the crashes.
In lame documentation, it is said that when you encode N samples,
your mp3 buffer must be 1,25*N+7200 bytes !!!
I guess it's not science here, but rather taken from experiment.
I declared the requested buffers accordingly.
 
c/ change
    (short) *in1++*32768
to
    (short) (*in1++*32768)
yes, that's why you had zeros ,
because the cast was made BEFORE multiplication !!!!
 
d/ make a -DSHOUTCAST or -DICECAST toggle for compilation,
it seems that they are not using the same port number.
 
e/ change some more code to follow the rules
of external writing HOWTO
( to read first for anyone who wants to make externals )
 
The remaining problems are :
 
a/ I haven't tried to compile it for windows,
I don't have such a compilation environment.
So, you could get some errors.
 
b/ there are some clicks in the sound received,
I don't know the reason, it seems to happen
for each buffer boundary ( 65536 samples ).
I'll check this later.
 
cheers,
 
Yves/
 
PS : from this external, an mp3 file encoder must be rather straightforward,
I'll try to do it.