Shout - Perl glue for libshout MP3 streaming source library use Shout qw{}; my $conn = new Shout ip => 'localhost', port => 8000, mount => 'testing', password => 'pa$$word!', icy_compat => 0, aim => 'myAIMid', # ICY only icq => '000001', # ICY only irc => '#icecast', # ICY only dumpfile => undef, name => 'Wir sind nur Affen', url => 'http://apan.org/' genre => 'Monkey Music', description => 'A whole lotta monkey music.', bitrate => 64, ispublic => 0; # - or - my $conn = new Shout; $conn->ip('localhost'); $conn->port(8000); $conn->mount('testing'); $conn->password('pa$$word!'); $conn->icy_compat(0); $conn->aim('myAIMid'); # ICY only $conn->icq('00001'); # ICY only $conn->irc('#icecast'); # ICY only $conn->dumpfile(undef); $conn->name('Test libshout-perl stream'); $conn->url('http://www.icecast.org/'); $conn->genre('perl'); $conn->description('Stream with icecast at http://www.icecast.org'); $conn->bitrate(64); $conn->ispublic(0); ### Connect to the server $conn->connect or die "Failed to connect: ", $conn->error; ### Stream some data my ( $buffer, $bytes ) = ( '', 0 ); while( ($bytes = sysread( STDIN, $buffer, 4096 )) > 0 ) { $conn->sendData( $buffer ) && next; print STDERR "Error while sending: ", $conn->error, "\n"; last; } continue { $conn->sleep; } ### Now close the connection $conn->disconnect; Nothing by default.

:constants
The following error constants are exported into your package if the '":constants"' tag is given as an argument to the "use" statement. SHOUTERR_INSANE SHOUTERR_NOCONNECT SHOUTERR_NOLOGIN SHOUTERR_SOCKET SHOUTERR_MALLOC SHOUTERR_METADATA

:functions
The following functions are exported into your package if the '":functions"' tag is given as an argument to the "use" statement. shout_init_connection shout_connect shout_disconnect shout_update_metadata shout_send_data shout_sleep shout_set_ip shout_set_port shout_set_mount shout_set_password shout_set_icy_compat shout_set_aim shout_set_icq shout_set_irc shout_set_dumpfile shout_set_name shout_set_url shout_set_genre shout_set_description shout_set_bitrate shout_set_ispublic shout_get_ip shout_get_port shout_get_mount shout_get_password shout_get_icy_compat shout_get_aim shout_get_icq shout_get_irc shout_get_dumpfile shout_get_name shout_get_url shout_get_genre shout_get_description shout_get_bitrate shout_get_ispublic shout_error They work almost identically to their libshout C counterparts. See the libshout documentation for more information about how to use the function interface.

:all
All of the above symbols can be imported into your namespace by giving the '":all"' tag as an argument to the "use" statement. This module is an object-oriented interface to libshout, an MP3 streaming library that allows applications to easily communicate and broadcast to an Icecast streaming media server. It handles the socket connections, metadata communication, and data streaming for the calling application, and lets developers focus on feature sets instead of implementation details. Jack Moffitt <jack@icecast.org> Get/set the stream's bitrate. Connect to the target server. Returns undef and sets the object error message if the connect fails; returns a true value if the connect succeeds. Get/set the description of the stream. Disconnect from the target server. Returns undef and sets the object error message if the disconnect fails; returns a true value if the disconnect succeeds. Get/set the name of the icecast dumpfile for the stream. The dumpfile is a special feature of recent icecast servers. When dumpfile is not undefined, and the x-audiocast protocol is being used, the icecast server will save the stream locally to a dumpfile (a dumpfile is just a raw mp3 stream dump). Using this feature will cause data to be written to the drive on the icecast server, so use with caution, or you will fill up your disk! Returns a human-readable error message if one has occurred in the object. Returns the undefined value if no error has occurred. Get/set the stream's genre. Get/set the stream's "icy_compat" flag. "icy_compat" is useful if you will be connecting to an older icecast server (before the 1.3.0 release) or to another streaming media server like the ones at live365.com that don't fully support the x-audiocast protocols. Setting this flag disables both the "dumpfile", "mount", and "description" attributes, as they are not supported by servers that require "icy_compat". Get/set the stream's "aim" id. Get/set the stream's "icq" number. Get/set the stream's "irc" channel. Initialization method. This is just a convenience wrapper for the "shout_init_connection" method, and is already called for you if you use the "new()" constructor. Get/set the target host for the connection. Argument can be either an address or a hostname. It is a fatal error is the argument is a hostname, and the numeric address cannot be resolved from it. Get/set the mountpoint to use when connecting to the server. Get/set the name of the stream. Get/set the password to use when connecting to the Icecast server. Get/set the port to connect to on the target Icecast server. Get/set the connection's ispublic flag. This flag, when set to true, indicates that the stream may be listed in the public directory servers. Send the specified data with the optional length to the Icecast server. Returns a true value on success, and returns the undefined value after setting the per-object error message on failure. Sleep until the connection is ready for more data. This function should be used only in conjuction with "sendData()", in order to send data at the correct speed to the icecast server. Update the metadata for the connection. Returns a true value if the update succeeds, and the undefined value if it fails. Get/set the url of the stream's homepage.

Constructor Methods
Create and initialize a new icecast server connection. The configuration hash is in the following form: ( ip => <destination ip address>, port => <destination port>, mount => <stream mountpoint>, password => <password to use when connecting>, icy_compat => <maintain old icecast compatibility>, aim => <aim id, icy only>, icq => <icq number, icy only>, irc => <irc channel, icy only>, dumpfile => <dumpfile for the stream>, name => <name of the stream>, url => <url of stream's homepage>, genre => <genre of the stream>, description => <stream description>, bitrate => <bitrate of the stream>, ispublic => <public flag - list the stream in directory servers>, ) None of the keys are mandatory, and may be set after the connection object is created. This method returns the initialized icecast server connection object. Returns the undefined value on failure.

Proxy Methods
Provides a proxy for functions and methods which aren't explicitly defined.