STREAMER.readme Streamer 1.0 Brian Donahue Introduction ------------ Streamer is a program for playing Internet radio stations. It only supports ShoutCast servers at this time. Since RealAudio and Windows Media are closed to developers, it is unlikely that Amiga will ever see a proper version of these players. ShoutCast is based on open standards, and is therefore easy to develop on the Amiga. A ShoutCast server streams mp3 audio files over the Internet, and its' companion client program for the PC is called WinAmp. WinAMP and Shoutcast are trademarks of NullSoft Inc. ShoutCast sends a list of servers and other info in a 'Playlist File'. The server may be a cluster: the same stream is duplicated on many servers. If there is an error connecting to a server, streamer sties the next one, until all servers in the playlist have been tried. Streamer can also play mp3 files over Internet Web servers. Why Streamer? ------------- I needed a simple but useful project to learn the C language and develop for Amigas. You know the drill: You compile 'HELLO WORLD', then you want to write a 3D game. It doesn't work that way. There are two other ShoutCast clients: StreAmi and streammp3.rx. StreAmi is a stand-alone MUI app that works very well, but can't work from a browser. It doesn't recognize or understand PLS files, either. Streammp3 has served me very well, but it has a few problems: 1) No URL support 2) Only supports one server per cluster. The first server is often busy and sends you a busy message which streammp3 doesn't understand. 3) It's not very dynamic, ie: if you stop a stream, streammp3 quits and forces you to restart it. 4) It sometimes can't exit. Since it calls itself, it launches multiple processes, which complicates things. 5) Slow execution because it's actually a script. 6) It doesn't report how long you're connected. Important here in Europe. :-) 7) It doesn't report what it's doing. (IE: opening connections, error messages, etc) 8) Streammp3's window takes up much valuable screen 'real estate' Requirements: ------------- 1. A suitable version of AmigaOS. V37 and up. 2. MPEGA, or other suitable MP3 file player 3. 68020 processor and up. MPEGA supports PPC processors. 4. TCP stack, MIAMI or AMITCP 5. OpenURL.library (optional) Installation: ------------- Put your copy of MPEGA in your command path (C: recommended). If you want to set MPEG playback options, put mpega.cfg in the same directory as mpega. Copy streamer wherever you want. You can also specify another player to use by setting STREAMER_MPLAYER. Any one should work: we recommend AmigaAMP. If you're behind a firewall, you can disrespect your boss by running through a proxy server. Most ISPs also have one. Proxies get information on your behalf and return it to you. A proxy may benefit you because it's inside your local network, hence more bandwidth. :-) However, if your proxy server is busy, it means less bandwidth. :-( Set STREAMER_HTTP_PROXY do this. Configure your browser. Open your browser's MIME prefs, or go to viewers. For most browsers: Type: audio/x-scpls Extensions: mpu, m3u, pls Command: streamer Arguments: "%f" "%p" (Where %f is the filename and %p is the pubscreen name) Environmet variables: --------------------- setenv STREAMER_MPLAYER "mpeg player command string" - mp3 player to use instead of MPEGA setenv STREAMER_HTTP_PROXY "http://proxy.com" or "http://proxy.com:8000" or "proxy.com" or "proxy.com:8080" Port number defaults to 8000... Usage: ----- Find a shoutcast server. Most of them are listed at http://www.shoutcast.com. Click on the 'Listen' link. You may also choose to save playlist files to your hard disk, right-click on the link and choose 'save file as', then pick a directory and save the file with an extension of '.pls'. You can keep a list of your favorite stations this way without hitting shoutcast.com every time. Server addresses are subject to change, though... To run streamer from a CLI, type streamer . Pubscreen is optional. It will run by default on your default pubscreen (workbench). You can also feed streamer a URL as the first argument. They can be in many formats such as: http://www.servername.com http://www.servername.com/path/mp3.mp3 /* Defaults to port 80 */ http://www.servername.com:port/path/mp3.mp3 *** You MUST include http:// in lower case!!! *** Servername can also be an IP address. Playing starts automatically. Press the 'WWW' button to see the stream's webpage. Usually you will see what's playing, information about the station, DJ's, etc. Press the Stop button to stop the stream. This is useful for temporarily freeing up bandwidth to load the stream WWW page, or to free your audio channels for something else. A word of warning, though, the server may disconnect you. Although Streamer attempts to re-connect, the server may become full while you're stopped. Playing after a stop will not attempt to connect to other servers in a cluster. The stop and play buttons may appear simultaneously. This means that streamer is still waiting for data to come in. This could last for up to 60 seconds if the server has dropped out. Press the 'Record' button to save the audio to a file. In this version, Play will halt the audio until you've specified a file. Problems: --------- Hitting STOP seems to send Streamer into Parkinson's mode. Error Messages: --------------- Couldn't load .library - Library is missing from your system, or is too old. Replace the files in LIBS: or Upgrade :-) Sart your TCP stack (Miami/AMITCP) File is not a playlist file - The first line of a playlist file should be '[playlist]' The server may be broken and it returned a debugging message to you. Couldn't Re-Connect - The server timed out and streamer failed to re-connect to it. Invalid filename - The playlist file couldn't be opened Couldn't start MPEG player - MPEGA isn't in your command path. Put it somewhere like C: or edit your startup-sequence to include the drawer where MPEGA lives. Couldn't lock Pubscreen - Streamer can't examine the public screen you specified Ensure you typed the name of the pubscreen correctly... ie Voyager, AWEB, etc. Another program may have a lock on the pubscreen. This is unlikely. Couldn't open PIPE: - There was an error opening the PIPE: file. The Amiga's pipe isn't all that peachy. That's why Streamer works great for some people and not at all for others. If you are one of the unfortunates, try upgrading your pipe or queue-handler with a replacement from AmiNet. Try as I may, I can't get it to work for everybody. Sorry. Couldn't write to PIPE: - Streamer can't copy data from the Internet to your player's pipe. See above. Your player may not be emptying the PIPE: buffers quickly enough, but that shouldn't ever happen, realistically. Couldn't open diamond.font: - Streamer requires this font. It should have come with your OS. Summary of changes: ------------------- v1.0 19-Nov-00 Fixed problem with radiospy.com playlists and their layme sequence. v1.01 21-Nov-00 Added timer. v1.02 22-Nov-00 Squashed bugs and changed lame compiler settings to make streamer more friendly. v1.03 25-Nov-00 Changed receive buffer to 512 bytes for better response. Let Streamer connect to ports > 10000. They shouldn't be using ports this high, though, as far as I know. Also, I support some ShoutCast variations like "NeoCast". There will be no URL or bitrate support... Fixed stupid file requester problem. Path and file are now done correctly. v1.04 3-Dec-00 Made buttons bigger and easier to see. Added support for more MPEG players. To do this, set the STREAMER_MPLAYER environment variable. Changed default screen font in display to diamond 12. It fixes garbled displays and looks really kewl. Set buffer back to 1024 bytes. Non-shoutcast servers display the IP address and ?? as a bitrate. Fixed beginning of play bug where the stream either starts out sounding like the Chipmunks or Barry White. v1.05 6-Dec-00 Now supports "http://" in command line. I think that I fixed the screen closing bug now. Really. Removed useless reference to SysBase that I think was poking 0x0000. It had no effect whatsoever. Record button starts play now, also. Each time Streamer starts it opens a unique pipe: name. This is good if a copy of streamer gets suspended. v1.06 10-Dec-00 A minor update, I cleaned up my code and removed the enforcer hits. That's all... v1.07 10-Dec-00 Added proxy support. Due to an oversight, streamer's buttons only appeared with graphics cards or Fblit. Now the button glyphs are loaded into chipmem like they should be. Geek Stuff: ----------- MPEGA's default command string is 'run >NIL: MPEGA -r -n -b0 PIPE:(time)' If MPEGA doesn't quit after streamer is stopped or quit, it's because streamer never wrote an eof to PIPE:tmpmp3. This should never happen. Knock on wood. Buttons are created using classes:gadgets/button.gadget. Streamer will not run without this file. The button glyphs are embedded in the program and can't be changed. The stream name, www address, and bitrate are gathered from the first 512 bytes of the stream. Streamer gets 512 bytes first, then buffers 4K to PIPE: for play. While streamer is running, it gets 1K of data from the socket and copies it to PIPE: and your save file, if you're saving. It then checks for signals from the window. This process loops until there is no more data from the socket or the connection drops. I've run up an incredible phone bill testing this darn thing. Finally, it occurred to me to run my own web server and set up an MP3 file as the default document. Now I can do much more testing, and, who knows, the Amiga may have a ShoutCast server program someday. :-) Streamer is written and compiled with StormC 3.0 and the Amiga Developer CD 2.1, available from all finer Amiga dealers. Yep. Both of 'em. My contact info: email brian@tigger1.demon.co.uk web: http://www.tigger1.demon.co.uk/amiga