fredvs / uos

United Open-libraries of Sound. United procedures for open-source audio libraries. For FPC/Lazarus/fpGUI/MSEgui.
Other
136 stars 28 forks source link

Web stream play aac ? #42

Closed GuvaCode closed 2 months ago

GuvaCode commented 2 months ago

Do I allow aac (mp4a) playback ?

for example https://radiorecord.hostingradio.ru/ps96.aacp

or json api https://www.radiorecord.ru/api/stations/

fredvs commented 2 months ago

Hello Guva.

Yes, of course uos can play mpa4. When loading the libraries, assign the aac library (nil = not load).

// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;

You may test it with the /uos/examples/SimplePlayer

fredvs commented 2 months ago

Ooops, you are talking about webstream. No, at the moment only webstream from mp3 or opus. I will see what can be done, if you have some infos about web streaming of aac, it will be welcome.

GuvaCode commented 2 months ago

I just have a small program for listening to the radio that uses the radio record api. and they broadcast in aac format. I had to use the bass dll, which is not good. https://github.com/GuvaCode/UnRecord

fredvs commented 2 months ago

I used bass.dll a lot but it is not opensource nor free for commercial. I prefer now to use opensource and free libraries.

For stream of acc, I did try this week but I am blocked... https://github.com/knik0/faac/issues/50

I hope to get help from there.

fredvs commented 2 months ago

Some news from the front.

I lay down my gloves in front of libfaad. No help, I tried everything, I give up.

So I went to see the other projects. And there is this one: https://github.com/mstorsjo/fdk-aac

The translation of the library header is ok and, the good news, I managed to do webstreaming with uos: https://github.com/fredvs/test/releases/download/fpc323/uos_aac_webstream.mp4

There are still some bugs to fix but I think everything will work asap.

fredvs commented 2 months ago

Hello.

OK, the hard fight is over. Thanks to this great (and working) fdk_aac library, uos can now do audio webstream of aac files. You may test the SimpleWebPlayer demo, it can read your aac radio site (I hope). All the updates are in the last commit https://github.com/fredvs/uos/commit/1b243147145ac78dea5f8e97b8ace559fccb2c8e

At the moment, only binary of libfdk_aac for Linux 64 and Windows 64 are provided. I will compile for Rpi and *BSD asap.

Have fun.

Fre;D

GuvaCode commented 2 months ago

Oh, thank you for your hard work. But I won't be able to test it until tomorrow.

fredvs commented 2 months ago

Hello. In the release of project Simple Web Player, is added a version with aac decoder for Windows 64 and Linux 64 : https://github.com/fredvs/swp/releases/

Tested on Linux Xubuntu 22.04 and Windows 11 and all seems to work ok. The aac decoder needs more data in the buffer vs mp3 decoder and so the latency is higher. So, when designing the wave form and the update of the view meters are slower than with the mp3 decoder. Otherwise, all seems ok, even with DSP's.

For Windows 32 bit, I did not find yet a working binary of the library and sadly I dont have a Windows machine with Visual Studio installed.

fredvs commented 2 months ago

OK, last battle ended. Now there is a check if url is accessible and so avoid crash if the url is bad. Was done in last commit: https://github.com/fredvs/uos/commit/854c7ef8c84d5d8ccfdf583a2c1a3a4cdd404fb0

Voila, I think I may go to sleep now.

GuvaCode commented 2 months ago

Great job. I just had to install libssl-dev

fredvs commented 2 months ago

Great job. I just had to install libssl-dev

Sorry, I dont understand, is libssl-dev needed for uos? If so, when did you need to install libssl-dev, did you get a error message?

GuvaCode commented 2 months ago

000

fredvs commented 2 months ago

Aaaargh.

Do you get this message only with last commit or because you did not try webstreaming with uos before?

GuvaCode commented 2 months ago

last commit uos1

fredvs commented 2 months ago

Hum, ok, it seems that you did not try uos before because this was always there. Like I explained to you before, I absolutely want that uos is "out-of-the-box". And the kind of message you have should not be.

So, to resume, library OpenSLL, needed to access https site, should be part also in uos libraries, with dynamic loading.

By the way, are you able to access https sites without installing OpenSSL, or is it because of the (horrible) limitation of fpc that does not allow to link library with so number, like libsomething.so.2 (but only libsomething.so) and so oblige people to install the dev package ?

GuvaCode commented 2 months ago

The developer package is only needed when compiling. Afterwards, the normal libssl is used. But that's on the developer's shoulders.

fredvs commented 2 months ago

Ha, ok, thanks. But I will update fpc-ootb for libssl, so the dev package will not be needed for compilation. https://github.com/fredvs/freepascal-ootb So, for people using fpc-ootb, all should be totally out-of-the-box. Many thanks for your attention. Have lot of fun. Fre;D

GuvaCode commented 2 months ago

Good. Thanks again for the work done. I think the topic can be closed.

fredvs commented 2 months ago

If all is working for you, with pleasure. But about libssl, I think that I will do a uos_libssl.pas, with dynamic loading. Of course, by default, it will use the "system" library installed but will give also the possibility to load a custom libssl.so.number or from a other directory.

By the way, I love the graphic of your https://github.com/GuvaCode/UnRecord project.

GuvaCode commented 2 months ago

well, there was a very good job on the static link of libraries. several people took part. tiny big games brought it all to an end. up to working condition. Rgfw+miniaudio+stb+cute_headers+pl_mpeg+minizip now connect .It is possible to make all your libraries too. The problem was only under windows

GuvaCode commented 2 months ago

Sorry for my English

fredvs commented 2 months ago

My English is poor so for me your English is perfect.

fredvs commented 2 months ago

In case you use MSEgui widgetset, in uos_define.inc, un-comment {$DEFINE mse} to use MSE threads that are much better for synchronization than the fpc threads, mainly with Windows but also with linux.

I will close the issue, many thanks for your attention.

GuvaCode commented 2 months ago

my plans are to watch MSE. There's been a lot going on lately. A lot of clean air , my head is full

GuvaCode commented 2 months ago

A lot of C code, lately, in the last few years.

fredvs commented 2 months ago

I do (did) also lot of C code. But if I still use fpc it is mainly because of MSEgui widget set. I did not find the equivalent in C that dont need any dependencies, has total customization feature and works perfectly for Windows and Unix OS.

fredvs commented 1 month ago

Hello. I noted that in demo SimpleWebPlayer sometimes the url fails to access. It was fixed adding sleep(1000); before uos_Play(PlayerIndex1); The demo was updated in last commit.