Author Topic: Identifying stream formats  (Read 102 times)


  • Posts: 2
Identifying stream formats
« on: 28 Nov '17 - 17:50 »
I've got a nice little streaming internet radio working.  Occasionally though it says 'unsupported format' for a stream.  Here's an example:

How do I identify what format the stream is, and then whether BASS really doesn't support it or whether I've made a cock up somewhere :)

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: Identifying stream formats
« Reply #1 on: 30 Nov '17 - 14:20 »
It may be possible to identify the stream's format from the HTTP headers, eg. the "Content-Type". You can use the BASS_STREAM_STATUS flag in your BASS_StreamCreateURL call, and provide a DOWNLOADPROC callback function, to receive the HTTP headers. It could look something like this:

Code: [Select]
stream = BASS_StreamCreateURL(url, 0, BASS_STREAM_STATUS, StatusProc, NULL);


void CALLBACK StatusProc(const void *buffer, DWORD length, void *user)
if (buffer && !length) {
// got HTTP/ICY tags in "buffer"
const char *header = (const char*)buffer;
while (*header) {
if (!strnicmp(header, "Content-Type:", 13)) {
// found a Content-Type header, check it here...
header += strlen(header) + 1; // move on to next header

In your example URL's case, it is "audio/aacp" (HE-AAC). If your OS doesn't include support for that, you can use the BASS_AAC add-on to provide it (load it via BASS_PluginLoad).