Recent

Author Topic: IceCast over TFPHTTPClient  (Read 811 times)

RedCat

  • New Member
  • *
  • Posts: 28
IceCast over TFPHTTPClient
« on: April 08, 2023, 03:21:49 pm »
Good day to all!
Such a question, how can I receive and process data from the http stream in parallel, I want to try to make an Internet radio, and process the icecast protocol as a decoder, I use libmpeg123 at this time I receive data via Synapse TTCPBlockSocket, but I don't like how this bundle works, after a while I get buffer emptying, maybe I'm wrong I process the headers, or rather I don't process them myself at all, I give the received packet to the decoder, he takes what he needs from there, now I want to try to use httpclient to receive the stream, but when sending a request
FSocket HTTP.Get('http://myradio',Tmp Radio Stream);
the stream is hanging, I assume that the client starts downloading the stream at the moment and it will exit this procedure only after the download is finished, i.e. never. Who knows, maybe there are some ways around this problem?

Fred vS

  • Hero Member
  • *****
  • Posts: 3952
    • StrumPract is the musicians best friend
Re: IceCast over TFPHTTPClient
« Reply #1 on: April 08, 2023, 03:35:07 pm »
Hello.

You may try uos: https://github.com/fredvs/uos
In uos_define.inc, uncomment the line {.$DEFINE shout} // uncomment to enable IceCast-Shout audio web server.

There is a demo: /uos/examples/simplewebserver_fpGUI.pas.

Here "how-to" from fpgui mailinglist:
Sadly the files of the demo were deleted but, afaik, you may try with the uos simplewebserver_fpGUI demo.
-------------------------------------------
Icecast is a audio stream server.
http://icecast.org

It can deal Opus files encapsulated in Ogg format.
https://opus-codec.org

Opus files can be encoded for voip (voice over ip) or for web-radios (sound
over ip).

To communicate with IceCast, libshout and his fpc header will be used.
https://github.com/xiph/Icecast-libshout

Today we will install and test the server on Unix 64 bit systems.

1) Installing IceCast + libshout.so.

- Linux :
  # sudo apt-get install icecast2
  # sudo apt-get install libshout3

- FreeBSD :
  # sudo pkg install icecast2
  # sudo pkg install shout

2) Downloading libshout fpc header + demo from here:

   https://sites.google.com/site/fredvsbinaries/shout_demo.tar.xz
   
   Uncompress it somewhere.

3) Testing the audio server on localhost.
 
  # cd /directory/of/shout_demo
  # sudo uos_icecast2 start

If connection is ok, you may check it that way:

In your favorite web-browser, enter as url: http://localhost:8000

Enter login: admin
         password: hackme

This should load the IceCast Status page.

Now run the fpc demo opus_shout_demo.pas to assign a mount-point on the
server:
 
   # cd /directory/of/shout_demo
   # fpc opus_shout_demo.pas
   # ./opus_shout_demo

If all ok, in the IceCast Status web-page, after refresh, a new mount-point
will be added.

Congratulations, your IceCast server is working and you have assigned your
first mount-point.

--------------------------
Maybe it could help you.

Fre;D

[EDIT] If you want to access files from your web server you may try the uos examples: simplewebplayer or conswebstream.
« Last Edit: April 08, 2023, 04:35:43 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018