Author Topic: BASSHLS beta (HTTP Live Streaming add-on)  (Read 15188 times)

Ian @ un4seen

  • Administrator
  • Posts: 19987
BASSHLS beta (HTTP Live Streaming add-on)
« on: 11 Nov '15 - 17:49 »
Here is a new add-on that adds support for HLS (HTTP Live Streaming) streams:

   www.un4seen.com/stuff/basshls.zip (updated: 6 Feb '17)

Win32/OSX/Linux/Android/iOS/WinStore versions are included. Dedicated BASS_HLS_StreamCreateURL and BASS_HLS_StreamCreateFile functions are provided, and it can also be used via the plugin system. Although local HLS playlist files are supported, the media segments in the playlist currently must be URLs.

HLS streams consist of a media playlist (and optionally a master playlist) and segments. The media segments usually have AAC data, but MP3 or AC3 are also possible. BASSHLS should support any audio format that's supported by BASS or a plugin. The data is usually in an MPEG-TS container, but it can also be plain audio data, possibly with ID3v2 tags. As well as possibly ID3v2 tags, the current segment's EXTINF tag (which may include a title) in the media playlist is available via the new BASS_TAG_HLS_EXTINF tag type. If present, the ID3v2 tags can/will change with each segment. A BASS_SYNC_HLS_SEGMENT sync type has been added to be informed of when a new segment starts downloading, which could be used to refresh the tags. A BASS_FILEPOS_HLS_SEGMENT BASS_StreamGetFilePosition option has also been added to get the current segment's sequence number.

When a master playlist is passed to BASSHLS, it will play the first entry from it. If you would like to play a different entry (eg. perhaps for a different bitrate), you can download the master playlist separately and then extract and pass the wanted entry's URL to BASSHLS.

A subset of the HLS spec is currently supported. The supported tags are: EXTINF, EXT-X-BYTERANGE, EXT-X-ENDLIST, EXT-X-KEY, EXT-X-MEDIA-SEQUENCE, EXT-X-TARGETDURATION. That seems to be sufficient, but please report if you find any HLS streams that aren't working properly. If you are looking for test streams, a bunch of streams can be found here:

   www.radiofeeds.co.uk/other.asp
   www.addictradio.net/en/labs/

It seems to be working nicely so far, but it's still early days for BASSHLS. Please report any problems/suggestions/etc that you may have.
« Last Edit: 6 Feb '17 - 17:39 by Ian @ un4seen »

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #1 on: 13 Nov '15 - 15:25 »
Android and iOS versions have been added to the package in the 1st post.

Oleg N

  • Posts: 77
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #2 on: 16 Nov '15 - 16:34 »
That's great news, thank You!

drama22

  • Posts: 17
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #3 on: 17 Nov '15 - 11:46 »
how it works ? can i stream from microphone from pc to android and from android To pc ?

Oleg N

  • Posts: 77
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #4 on: 17 Nov '15 - 12:53 »
drama22, for this You don't need BASSHLS, just BASSENC to create streaming server and BASS_StreamCreateURL() to receive/play it.

HLS is the protocol to play some new radio station streams available on internet.

radio42

  • Posts: 4532
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #5 on: 18 Nov '15 - 08:38 »
I guess 'drama22's question is, if the add-on would also allow him/her to create a HLS stream.
As far as I know this is not possible with BASSENC nor with the new BASSHLS.
Meaning the BASSHLS add-on purely adds playback support.

Oleg N

  • Posts: 77
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #6 on: 18 Nov '15 - 11:37 »
Yes, radio42, You answered this more clearly.

ramses

  • Posts: 103
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #7 on: 22 Nov '15 - 04:36 »
Hi Ian,

Is there a x64 version available ?

Thanks,

Philippe

Bert B.

  • Posts: 118
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #8 on: 23 Nov '15 - 07:59 »
Is there a x64 version available ?

Did you look inside the zip package?

ramses

  • Posts: 103
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #9 on: 23 Nov '15 - 08:25 »
Hi,

Not in the latest package. I see that the x64 version is now inside.

 :o

Philippe

ramses

  • Posts: 103
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #10 on: 24 Nov '15 - 11:30 »
Hi Ian,

It works very fine  :D

Did you have any sample to extract metadata (like in bass_radio standard package) ?

Regards,

Philippe

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #11 on: 24 Nov '15 - 13:58 »
I don't think most HLS streams include metadata. In some cases, a title will be included in the EXTINF tag, which you can get via the new BASS_TAG_HLS_EXTINF option. For example, you could try something like this:

Code: [Select]
BASS_ChannelSetSync(stream, BASS_SYNC_HLS_SEGMENT, 0, HLSSegmentSyncProc, 0); // set sync on new HLS segment

...

void CALLBACK HLSSegmentSyncProc(HSYNC handle, DWORD channel, DWORD data, void *user)
{
const char *extinf=BASS_ChannelGetTags(channel, BASS_TAG_HLS_EXTINF); // get new segment's EXTINF tag
const char *title=strchr(extinf, ','); // look for duration/title separator
if (title && title[1]) SetTitle(title+1); // use title
}

Some streams may also have ID3v2 tags, which you can get via the BASS_TAG_ID3V2 tag option.

leonardo

  • Posts: 5
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #12 on: 16 Dec '15 - 07:55 »
how to import addon android project? im usign android acc bass

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #13 on: 16 Dec '15 - 17:03 »
To add HLS support to your app, you should just need to add the BASSHLS libraries to your project's "libs" folder (alongside the BASS libraries) and add a BASS_PluginLoad call to your initialization code:

Code: [Select]
BASS.BASS_PluginLoad(getApplicationInfo().nativeLibraryDir+"/libbasshls.so", 0); // load BASSHLS

Do the same for the BASS_AAC add-on if you want to support AAC data (which is what most HLS streams contain).

leonardo

  • Posts: 5
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #14 on: 17 Dec '15 - 07:40 »
both type aac hls

leonardo

  • Posts: 5
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #15 on: 17 Dec '15 - 08:38 »
if(info.ctype ==BASS.BASS_CTYPE_STREAM_AAC){
                  fileformat=".aac";
               }else{
                  Logger.error("  Type"+info.ctype);
               }
               
   

this work. working but very slowly
« Last Edit: 27 Dec '15 - 14:42 by leonardo »

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #16 on: 17 Dec '15 - 13:31 »
Oh, do you want to detect an HLS stream? If so, you can do that by checking whether the BASS_FILEPOS_HLS_SEGMENT value is available, like this:

Code: [Select]
boolean isHLS=(BASS.BASS_StreamGetFilePosition(stream, BASSHLS.BASS_FILEPOS_HLS_SEGMENT)!=-1);

Brazil2

  • Posts: 3
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #17 on: 19 Jan '16 - 19:38 »
Bug: it doesn't update the metadata (NowPlaying) on track change.

For instance, with both of these streams:
AAC: http://hls1.addictradio.net/addictrock_aac_hls/playlist.m3u8
MP3: http://hls1.addictradio.net/addictrock_hls/playlist.m3u8

We got the correct artist and title when connecting but it's not updated on the next track, we have to stop and restart the stream to get the proper information.

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #18 on: 20 Jan '16 - 13:56 »
Testing those streams here, the BASS_TAG_HLS_EXTINF and BASS_TAG_ID3V2 tag types both seem to be getting updated OK. I do see an issue though, which could result in BASS_ChannelGetTags failing (returning NULL) sometimes, and even crashing sometimes in the case of BASS_TAG_ID3V2. Here's an update for you to try, which should fix that:

   www.un4seen.com/stuff/basshls-test.zip

If you still have the problem with that, please show how/when you are getting the tags.

Brazil2

  • Posts: 3
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #19 on: 20 Jan '16 - 15:56 »
www.un4seen.com/stuff/basshls-test.zip
If you still have the problem with that, please show how/when you are getting the tags.

It's the same with this version.

I have just dropped it into the plugins folder of AIMP3.
The playback works a treat but the tags are not updated on track change while it's working fine with all other 'normal' radios, doesn't matter which codec is used.

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #20 on: 20 Jan '16 - 17:08 »
OK. It isn't actually possible to simply drop BASSHLS.DLL into an existing app and have it automatically handle tag updates; some code additions will be needed: a BASS_SYNC_HLS_SEGMENT sync should be set, which can check the BASS_TAG_HLS_EXTINF/BASS_TAG_ID3V2 tags in its SYNCPROC callback function. From what you say, it sounds like AIMP3 doesn't currently do that.

Brazil2

  • Posts: 3
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #21 on: 21 Jan '16 - 10:11 »
some code additions will be needed: a BASS_SYNC_HLS_SEGMENT sync should be set, which can check the BASS_TAG_HLS_EXTINF/BASS_TAG_ID3V2 tags in its SYNCPROC callback function.

Got it, so I have to show your post to the AIMP dev.
Thanks for the answer :)

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #22 on: 22 Jan '16 - 14:26 »
The BASSHLS update I posted a couple of days ago is now available for all platforms in the 1st post.

drama22

  • Posts: 17
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #23 on: 25 Jan '16 - 12:09 »
drama22, for this You don't need BASSHLS, just BASSENC to create streaming server and BASS_StreamCreateURL() to receive/play it.

HLS is the protocol to play some new radio station streams available on internet.

is there any sample for that guide iam really new to bass thanks in advance

Ian @ un4seen

  • Administrator
  • Posts: 19987
Re: BASSHLS beta (HTTP Live Streaming add-on)
« Reply #24 on: 25 Jan '16 - 16:42 »
A demonstration of what Oleg mentioned can be found in the SERVER example that's included in the BASSenc package. The main function of interest is BASS_Encode_ServerInit, so you should also look that up in the BASSenc documentation.