what did you have to slightly modify and why?
mpg123:
- added support for linking against linux libmp3 library
libao:
- removed dependency on unit AcSysUtils to use fpc's dynlibs unit instead
- modified library functions loading to make use of dynlib functions
- updated to match latest libao headers
- reorganized some of the layout of the unit
- commented the intialization and finalization routines
If you literally wish to see what was changed then you could try and use a diff viewer.
I personally use Double Commander's
compare files by contents (scroll down to see an example) but any diff viewer that you are comfortable with will do.
It also says
If you want to play it safe then by all means please do what you are most comfortable with.
I made the comment because whenever you install a dev package it will also install the actual library. That means that it could cause you to inadvertently install the wrong library (for your distro).
The warning is perhaps a bit overkill because in the worse case scenario it is possible to break your (lib)curl installation. In that case a simple re-install will probably solve that but then you would have to know what and how exactly it was installed (hence the warning).
I do not know if other programs in your distro depend on a specific installation of (lib)curl and might break in the process when messing things up.
Just make sure to know what version of the libcurl library is installed by default (and what crypto libs are used) and install the corresponding dev-package and you should be good to go. If no (lib)curl is installed by default then just install any libcurl of your choice.
They may all be cross-platform but my common sense (whatever remains of it ) tells me this is gonna be dependency hell, so don't do it.
For windows you do not have to worry at all as you can download and place the libraries next to your executable for testing purposes. You can then later decide to install them system-wide on a windows system.
I do not know how that works on/for macos but on linux the dependencies should be automatically resolved by your package manager. The only warning is for libcurl because of how some distro's support multiple versions of the library.
Like you suggested yourself: if it all looks a bit too hazardous then use a VM for testing. I do that myself as well for things that I am not familiar with and/or could have a big impact on the current installation.
Thank you I will go through the libao examples and see if my currently fried brain is able to comprehend what they have done.
Just to make sure, I am/was referring to
this example for c.
My initial goal was to get some internet radio streams to play and some of them have *.m3u8 files some have urls that end in port number and path (:2020/stream/hirufmgarden) which I really have no idea what format they use?
m3u8 and pls files originates from being playlists normally used by mp3 players.
When the internets became popular someone figured out that you can also use such a playlist to store several links to (online) streams. Some lists contain different radio stations while others contain a list of the same station but using different (MP3) bitrates or different kind of stream types (MP3, ogg, asf, wav, flac etc).
Some URL's clearly identifies what kind of stream is behind the URL while others give no clue whatsoever.
If you want to know more then either share the m3u8/pls or use something like VLC to play the stream and use VLC's codec information menu to figure out what kind of stream is actually behind such URL (many other tools can show this information as well, VLC is merely an example).
Who is DJ?
A fellow member of this forum who gracefully shared his mpg123 header with us (full alias name, DJMaster).
Why left intentionally blank?
Because there is no good solution to implement here. Best would probably be to display an error message.
The reason for that is how the whole thing is setup.
- libcurl downloads the packets to a buffer which then get passed to the callback
- the callback decodes the mp3 frames that are inside the buffer
- then the decoded frames are send to the audio buffer
In case the MPG123_NEED_MORE status is returned then we need to feed more MP3 data that can be decoded but we are already in the libcurl callback routine which means there is no more data until libcurl calls the callback routine again.
There are (many) more returning message (see
here) such as for example MPG123_DONE but why bother handling that for a live-stream (though technically it is possible that a live-stream stops streaming for whatever reason)
The reason to explicitly mention MPG123_NEED_MORE is so that it is possible to determine f.e. a buffer underrun situation (which indirectly implies to increase the libcurl buffer size).
@TRon Very impressive stuff btw ( am just saying ) wish I could do something like playurl ( someday.. )
That is really giving me too much credit :-)
I probably came across this solution on my quest for seeking audio examples. I just found it in one of my catalogs (meaning it was probably copied from somewhere else or in case written in another language converted by me).
I like the example because it is small, clean and to the point.
But it is also not that hard to figure out on yourself. There are plenty of instructions and examples for libmpg123, and the FPC libcurl package has a nice streaming example. I have used mpg123 and libao for ages though I am not that familiar with using libcurl.
In that regards I myself am intrigued by Fred vS' example as that uses fphttpclient, which removes the requirement to use libcurl (just as using a native mp3 decoder would remove the need to depend on libmpg123).
The story of all times: Too much to do, and so little time
Thank you for your interest.