Shout Class Reference

The main event. Wraps the shout_t object in a C++ object. More...

#include <shoutcc.h>

List of all members.

Public Member Functions

shout_t * get_self ()
 Shout ()
 Constructor.
 ~Shout ()
 Destructor.
void check (int code)
 Internal wrapper for libshout2 return codes. If it was an error, throw the appropriate ShoutErr object.
const char * get_error ()
 Return a statically allocated string describing the last shout error that occured in this connection. Only valid until the next call affecting this connection.
int get_errno ()
 Return the shout error code of the last error that occured in this connection.
bool get_connected ()
 Are we connected to a server?
void set_host (const char *host)
 Set IP address or hostname of our server.
const char * get_host ()
 Return IP address/hostname of our server.
void set_port (unsigned short port)
 Set server port.
unsigned short get_port ()
 Return server port.
void set_password (const char *password)
 Set password to authenticate to the server with.
const char * get_password ()
 Return the password.
void set_mount (const char *mount)
 Set the mount point for this stream.
const char * get_mount ()
 Return this stream's mount point.
void set_name (const char *name)
 Set the name of this stream.
const char * get_name ()
 Return the name of this stream.
void set_url (const char *url)
 Set the URL of a site about this stream.
const char * get_url ()
 Return URL of the site about this stream.
void set_genre (const char *genre)
 Set the genre of this stream.
const char * get_genre ()
 Return the genre of this stream.
void set_user (const char *username)
 Set username for authenticating with the server.
const char * get_user ()
 Return the user name.
void set_agent (const char *username)
 Set the user agent header.
const char * get_agent ()
 Return the user agent header.
void set_description (const char *description)
 Set the description of this stream.
const char * get_description ()
 Return the description of this stream.
void set_dumpfile (const char *dumpfile)
 Set server-side archive filename.
const char * get_dumpfile ()
 Return server-side archive filename.
void set_audio_info (const char *name, const char *value)
 Set a stream audio parameter.
const char * get_audio_info (const char *name)
 Return a stream audio parameter.
void set_public (unsigned int make_public)
 Instruct the server to advertise (or not) this stream.
unsigned int get_public ()
 Return whether this stream will be public.
void set_format (unsigned int format)
 Set the audio format of this stream.
unsigned int get_format ()
 Return the audio format of the stream.
void set_protocol (unsigned int protocol)
 Set the protocol with which to connect to the server.
unsigned int get_protocol ()
 Return the protocol this stream will use.
void open ()
 Open a connection to a server. All connection parameters must have been set prior to this call.
void close ()
 Close this connection to the server.
void send (const unsigned char *data, size_t len)
 Send audio data to the server.
ssize_t send_raw (const unsigned char *data, size_t len)
 Send data to the server, in an unfriendly, unsafe manner.
void sync ()
 Sleep until the server will be ready for more data.
int delay ()
 Return delay, in milliseconds, after which server will be ready for more data.
void set_metadata (ShoutMetadata *metadata)
 Valid only for Mp3, define the metadata (title, artist, etc.) for the current stream.
void set_nonblocking (bool unblocking)
bool get_nonblocking ()
 true if libshout will use nonblocking I/O.
ssize_t queuelen ()
 Number of bytes on the write queue (only makes sense in nonblocking mode).


Detailed Description

The main event. Wraps the shout_t object in a C++ object.


Member Function Documentation

void Shout::send ( const unsigned char *  data,
size_t  len 
)

Send audio data to the server.

Send len bytes of audio data from the buffer pointed to by data to the server. The connection must already have been established by a successful call to Shout::shout_open.

ssize_t Shout::send_raw ( const unsigned char *  data,
size_t  len 
)

Send data to the server, in an unfriendly, unsafe manner.

Send len bytes of audio data from the buffer pointed to by data to the server. The data is not parsed for timing or validity, but sent raw over the connection. The connection must already have been established by a successful call to Shout::shout_open.

Warning:
This function should not be used unless you know exactly what you are doing. Its use is deprecated and it may be removed in a future version of the library.

void Shout::set_agent ( const char *  username  ) 

Set the user agent header.

This is libshout/VERSION by default. If you don't know what this function is for, don't use it.

void Shout::set_audio_info ( const char *  name,
const char *  value 
)

Set a stream audio parameter.

The currently defined parameters are listed in shout.h ("bitrate", "samplerate", "channels", "quality") but you are free to add additional fields if your directory server understands them.

void Shout::set_dumpfile ( const char *  dumpfile  ) 

Set server-side archive filename.

If the server supports it, you can request that your stream be archived on the server under the name dumpfile. This can quickly eat a lot of disk space, so think twice before setting it.

void Shout::set_format ( unsigned int  format  ) 

Set the audio format of this stream.

The default is SHOUT_FORMAT_VORBIS

void Shout::set_genre ( const char *  genre  ) 

Set the genre of this stream.

This is usually a keyword list, eg "techno electronica world hippity-hop".

void Shout::set_host ( const char *  host  ) 

Set IP address or hostname of our server.

The default is localhost.

Parameters:
host IP address in dotted decimal format, or hostname, of server.

void Shout::set_metadata ( ShoutMetadata metadata  ) 

Valid only for Mp3, define the metadata (title, artist, etc.) for the current stream.

Currently the only metadata supported is song title and only for MP3 streams.

Ogg/Vorbis metadata should be embedded in the Ogg stream.

void Shout::set_mount ( const char *  mount  ) 

Set the mount point for this stream.

A mountpoint is a resource on the icecast server that represents a single broadcast stream. Mountpoints are named similar to files (/mystream.ogg, /mymp3stream). When listeners connect to icecast2, they must specify the mountpoint in the request (i.e. http://192.168.1.10:8000/mystream.ogg). Additionally, source clients must specify a mountpoint when they connect as well. Statistics are kept track of by mountpoint. Mountpoints are a fundamental aspect of icecast2 and how it is organized.

Only for protocols that support this option. ( SHOUT_PROTOCOL_ICY doesn't).

void Shout::set_name ( const char *  name  ) 

Set the name of this stream.

This must be for the benefit of listing the stream, e.g. "The Emo Hamster Rock Channel"

void Shout::set_nonblocking ( bool  unblocking  ) 

Must be called before shout_open (no switching back and forth midstream).

void Shout::set_password ( const char *  password  ) 

Set password to authenticate to the server with.

This parameter must be set. There is no default.

void Shout::set_port ( unsigned short  port  ) 

Set server port.

The default is 8000.

void Shout::set_protocol ( unsigned int  protocol  ) 

Set the protocol with which to connect to the server.

The default is SHOUT_PROTOCOL_HTTP (compatible with Icecast 2).

void Shout::set_public ( unsigned int  make_public  ) 

Instruct the server to advertise (or not) this stream.

Setting this to 1 asks the server to list the stream in any directories it knows about. To suppress listing, set this to 0. The default is 0.

void Shout::sync (  ) 

Sleep until the server will be ready for more data.

Causes the caller to sleep for the amount of time necessary to play back audio sent since the last call to Shout::shout_sync. Should be called before every call to Shout::shout_send to ensure that audio data is sent to the server at the correct speed. Alternatively, the caller may use Shout::shout_delay to determine the number of milliseconds to wait and delay itself.


The documentation for this class was generated from the following files:
Generated on Sun Nov 26 17:18:18 2006 for shoutpy by  doxygen 1.4.7