mp3stream v1.2.1
(c) Copyright 2001 Matt Messier
This library is released under the GNU PUBLIC LICENSE. Please see the accompanying file COPYING for more information. If you did not receive a copy of that file, please obtain a proper mp3stream distribution from its home at http://www.prilnari.com/mp3stream.
This is a first cut at an mp3 streaming library. It will successfully connect to Nullsoft's icy server or to icecast's server. I haven't tested it with any others if any do indeed exist.
The API is both similar to and different from libshout. It seems to me that this API is better suited to the task of streaming, but you may prefer libshout's method. If you do, use that. I wrote this library because I had problems with libshout's timing. As I went to fix that, I found a multitude of other problems with the code, so I just started from scratch instead.
This library is multi-threaded. It depends on libpthread. You should already have this installed. This library is written for Linux, but should be easily ported to other platforms. I made no conscious effort to make it portable. If you've ported to another platform and would like to contribute your changes, by all means, please do.
- Quickstart
- 1. Edit the Makefile and change anything you want to change. Of particular
interest to you may be PREFIX, where stuff gets installed to. 2. Run make
This will simply compile mp3stream.c into libmp3stream.so.1.2.1 There is only one source file and there is only one resulting executable. 3. Run make install
This will install libmp3stream.so.1.2.1 and other links to $(PREFIX)/lib and will install mp3stream.h to $(PREFIX)/include.
- Using
- Documentation for most functions can be found in mp3stream.h. For an example of how to use the library, see example.c. Note that there is no Makefile to build this example, although it should compile and run.
Stream variables that may be set: bitrate, description, genre, mount, name, public, url. If you're at all familiar with streaming (and you should be if you're attempting to use this library), these variables should all make sense to you. Note that mount only makes sense with non-icy servers. Variables must be set before a connection is established, otherwise they will return an error.
Note that streaming is done very differently from libshout. Where libshout relies on the client application to send it data and sleep, mp3stream kicks off a thread for each stream and calls back into the client application to obtain more data when it's needed. The thread is started by mp3stream_create() and it will persist until mp3stream_destroy() is called.
To do:
- Some statistics would be nice - how many frames have been transferred, how
many bytes, etc.
- Provide some method to update the server with metadata for which song is
currently streaming.
- Use ID3v2 tag information to update the server with meta information.
Bugs, Patches, etc:
Send them to me, Matt Messier, mmessier@prilnari.com. I've tested this fairly
well I think, but that doesn't mean that there aren't some problems. If you've
made changes to the code and you think that I should consider them for the
official version, please send them to me and I'll take a look at them.
You can always find the latest version of this code any other related information or code at:
http://www.prilnari.com/mp3stream
