Leo Laporte
The Tech Guy
2–5p ET Sat & Sun

Sponsors

Leo Links

RSS
Colophon



Main > Playing Radio Streams in Linux

Edit | Read | Hist | Prt


Warning: this is a work in progress, there may be formatting and other errors

[1]?

Introduction

Ok, you’ve tried Linux, and you like it. But it doesn’t come with that WMA player… you don’t
want to miss out on all that nifty programming on Internet Radio, do you? Perhaps you’d like
to get rid of that dual boot and move over to Linux entirely, but this is a major hurdle.

The purpose of this article is to help teach you how you can go about setting up access to your
favorite internet radio streams from within that Linux environment.

I do not believe this is a trivial thing to accomplish: I have only attempted this in Mandrake 10
so far, and succeeded. However, if you have input to add, how this process may be made easier,
for example, then by all means add that input.

Ok, the first thing, check out the details this site informed me as to the software and approach I needed to take; from there, there were a few problems which I easily solved. In theory the instructions should be all you need. Unfortunately, it’s not quite that simple, at least it wasn’t for me on Mandrake 10
(Update: binaries of avifile are available at this time from the FTP mirrors!). If you’re just getting started with Linux, this can be quite a challenge.

There’s really no way to “point and click” and get your radio streams out of the box, unfortunately.

Check your Operating System vendor first, however, to see if they offer an avifile or aviplayer package, then check rpmfind.net. If you can find a pre-made binary package for avifile, it should be much easier to install those than to compile software yourself.

Follow this link to search for that.

The Steps

The steps in general:

  • Download, compile and install the Avifile package.
    If you want to follow along below, get the version numbered: avifile-0.7–0.7.38.tar.gz from

the sourceforge download page If a newer version is available, it may need less patching to install: I haven’t tried the CVS version yet, it may work perfectly out of the box (haven’t tested it yet). If you want to include the optional DivX capabilities, be sure to read this page first: in that case,
I think you should retrieve avifile from CVS instead of following these exact instructions.

  • Download the codec binaries, i.e. binaries-011002.tgz also from the Avifile project’s download

page.

  • Open a terminal window, cd to the directory you saved the files in
  • Install the codec binaries they provide by moving them into /usr/lib/win32:
    tar -zxvf binaries-01102.tgz -C /tmp && su -c ‘mv /tmp/win32/ /usr/lib’
  • Optionally go to XviD.org to download and install XviD and over

here to get the divx libraries. These are not needed to
listen to audio streams, but you might find it useful to include video playback capabilities.

  • tar zxvf xvidcore-1.0.2.tar.gz ; cd xvidcore-1.0.2/build/generic
  • ./configure ; make
  • su -c ‘make install’
  • tar zxvf divx4linux-std-20030428.tar.gz ; cd divx4linux-20030428
  • su -c ‘./install.sh’

More detailed instructions for compiling and installing version 0.7–0.738
on a mandrake 10 system

Pre-requisites

  Packages you need to install before compiling the software:
  # gcc
  # gcc-c++
  # libqt3-devel
  # freetype2-devel

How to install the pre-requisites

Have all 6 Mandrake CDs ready (or setup urpmi download the packages for you)… open up a terminal (alt+F2 , type konsole, press enter)

Building avifile

Now, in order to install avifile:

 * tar -zxvf avifile-0.7–0.7.38.tar.gz
 * cd avifile-0.7–0.7.38
 * We need to patch the configure script first to fix a small problem, using this command at the terminal: 
sed 's/void exit \?(int);/void exit (int) throw () __attribute__ ((__noreturn__));/' configure >configure.tmp * mv -f configure.tmp configure && chmod u+x configure * Now run configure, type: ./configure --prefix=/usr/local --with-qt-prefix=/usr/lib/qt3/ * Now we need to fix a few other problems, edit: lib/video/sub_ft.cpp

Remove the line that reads: #include <freetype/freetype.h>
And add in its place:
→#include <ft2build.h>
→#include FT_FREETYPE_H

Edit plugins/libwin32/loader/ldt_keeper.c, comment out the following code:

  #pragma pack(4)
    struct modify_ldt_ldt_s {
          unsigned int  entry_number;
          unsigned long base_addr;
          unsigned int  limit;
          unsigned int  seg_32bit:1;
          unsigned int  contents:2;
          unsigned int  read_exec_only:1;
          unsigned int  limit_in_pages:1;
          unsigned int  seg_not_present:1;
          unsigned int  useable:1;
    };

By changing it to:

   /* #pragma pack(4)
   struct modify_ldt_ldt_s {
           unsigned int  entry_number;
           unsigned long base_addr;
           unsigned int  limit;
           unsigned int  seg_32bit:1;
           unsigned int  contents:2;
           unsigned int  read_exec_only:1;
           unsigned int  limit_in_pages:1;
           unsigned int  seg_not_present:1;
           unsigned int  useable:1;
   }; */

Now edit plugins/libwin32/loader/ldt_keeper.h and paste a copy of the code after
the first #endif near the beginning of the file:

#pragma pack(4)
struct modify_ldt_ldt_s {

        unsigned int  entry_number;
        unsigned long base_addr;
        unsigned int  limit;
        unsigned int  seg_32bit:1;
        unsigned int  contents:2;
        unsigned int  read_exec_only:1;
        unsigned int  limit_in_pages:1;
        unsigned int  seg_not_present:1;
        unsigned int  useable:1;
  };
  • Compile it: su -c ‘make; make install’
  • Once everything has successfully installed, go back to your home directory: make sure you leave

the root shell, type exit if you see a hash symbol in your prompt, or if in doubt close the
terminal and open a new session. Type cd and press enter to return to your home directory.

  • Make a .asx file using the mms:// links of the Internet Radio stations you want. These should

be visible from your web browser when listening to the stream.
For example, I entered this command in the terminal:
echo '<ASX version="3"><ENTRY><ref href="mms://ccdig.liquidviewer.com/kfi"/></ENTRY></ASX>' > kfi.asx

  • aviplay kfi.asx

-Mysidia

Or with Fedora/Redhat

An easier way in Fedora/red hat is mplayer. Get the rpm from here. Install the rpm through the package monitor or through comandline rpm -i rpmnamehere.rpm
Check if it’s installed (from the comandline mplayer-h).
Then in the terminal su root
cd /etc/mplaer
vi mplayer.conf
Find the line of:

 # Use 8MB input cache by default.
 cache           = 812(number will be diffrent

change the value of cache to something low like 812. The higher you set this longer you have to wait for the stream to start and delay in stream but its the amount of data that is cached so when the steam chokes it doe not interupt your audio. For example Leo’s show, is 21kbps so for each 21 you have 1 second of delay and cached audio! Mine is set 812.

Once you have decided, shift+: then wq!
in the terminal for Leo’s show:

 mplayer http://ccdig.liquidviewer.com/kfi

You’ll see your cache fill and after it fills you’ll hear it through your speakers.
Enjoy,
RHNet


Creative Commons License

This work is released under a Creative Commons License.
Built with pmwiki-2.2.0-beta19