BASS.NET API for the Un4seen BASS Audio Library

BassEncBASS_Encode_CastGetStats Method

BASS.NET API for the Un4seen BASS Audio Library
Retrieves stats from the Shoutcast or Icecast server.

Namespace:  Un4seen.Bass.AddOn.Enc
Assembly:  Bass.Net (in Bass.Net.dll) Version:

public static string BASS_Encode_CastGetStats(
	int handle,
	BASSEncodeStats type,
	string pass


Type: SystemInt32
The encoder handle.
Type: Un4seen.Bass.AddOn.EncBASSEncodeStats
The type of stats to retrieve. One of the following (see BASSEncodeStats):
BASS_ENCODE_STATS_SHOUTShoutcast stats, including listener information and additional server information.
BASS_ENCODE_STATS_ICEIcecast mount-point listener information.
BASS_ENCODE_STATS_ICESERVIcecast server stats, including information on all mount points on the server.
Type: SystemString
Password when retrieving Icecast server stats... = use the password provided in the BASS_Encode_CastInit(Int32, String, String, String, String, String, String, String, String, Int32, BASSEncodeCast) call.

Return Value

Type: String
If successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.

The stats are returned in XML format.

Each encoder has a single stats buffer, which is reused by each call of this function for the encoder. So if the data needs to be retained across multiple calls, it should be copied to another buffer.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_ILLTYPEtype is invalid.
BASS_ERROR_NOTAVAILThere isn't a cast of the requested type set on the encoder.
BASS_ERROR_TIMEOUTThe server did not respond to the request within the timeout period, as set with the BASS_CONFIG_NET_TIMEOUT config option.
BASS_ERROR_MEMThere is insufficient memory.
BASS_ERROR_UNKNOWNSome other mystery problem!


Get the number of listeners for SHOUTcast:
string stats = BassEnc.BASS_Encode_CastGetStats(encoder, 
                       BASSEncodeStats.BASS_ENCODE_STATS_SHOUT, password);
if (stats != null)
  int start = stats.IndexOf( "<CURRENTLISTENERS>" );
  int end = stats.IndexOf( "</CURRENTLISTENERS>" );
  if (start > 0 && end > 0)
    start += 18;
    count = int.Parse( stats.Substring(start, end-start) );
See Also