Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2022-11

GStreamer API unit added

12 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

For all people interested in sound/video streaming:

After lots of work, I added the gst unit to the FPC packages. This unit contains the import declarations for the full libgstreamer-1.0 API. I didn't translate all C macros, but if you need some which I didn't translate, let me know and I will add them.

For those that are not in the know:
gstreamer is a powerful audio/video stream system, used on most modern linux distributions (it may be available on mac/windows, but I didn't test those).

I have also added a simple demo, that shows how to play a mp3 file.

I'm not an expert in sound/video streams, so if someone can contribute a more elaborate example, it would be most welcome :)

Enjoy,

Michael.

Reply by email

Aruna Hewapathirane
to Michael Van Canneyt

Hello Michael,

I would be very interested in this. Is there a link to the source and the example code please?

Thanks - Aruna

On Tue, Nov 1, 2022 at 6:45 AM Michael Van Canneyt via lazarus <

Show quoted text 33 lines
wrote: Hello, For all people interested in sound/video streaming: After lots of work, I added the gst unit to the FPC packages. This unit contains the import declarations for the full libgstreamer-1.0 API. I didn't translate all C macros, but if you need some which I didn't translate, let me know and I will add them. For those that are not in the know: gstreamer is a powerful audio/video stream system, used on most modern linux distributions (it may be available on mac/windows, but I didn't test those). I have also added a simple demo, that shows how to play a mp3 file. I'm not an expert in sound/video streams, so if someone can contribute a more elaborate example, it would be most welcome :) Enjoy, Michael. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221106/8621dde0/attachment.htm>

Reply by email

Michael Van Canneyt
to Aruna Hewapathirane

Hello,

Yes, see here:

https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/gstreamer

Michael.

Aruna Hewapathirane wrote 42 lines
Hello Michael, I would be very interested in this. Is there a link to the source and the example code please? Thanks - Aruna On Tue, Nov 1, 2022 at 6:45 AM Michael Van Canneyt via lazarus < > wrote: > > Hello, > > For all people interested in sound/video streaming: > > After lots of work, I added the gst unit to the FPC packages. > This unit contains the import declarations for the full libgstreamer-1.0 > API. > I didn't translate all C macros, but if you need some which I didn't > translate, let me know and I will add them. > > For those that are not in the know: > gstreamer is a powerful audio/video stream system, used on most modern > linux > distributions (it may be available on mac/windows, but I didn't test > those). > > I have also added a simple demo, that shows how to play a mp3 file. > > I'm not an expert in sound/video streams, so if someone can contribute a > more elaborate example, it would be most welcome :) > > Enjoy, > > Michael. > -- > _______________________________________________ > lazarus mailing list > > https://lists.lazarus-ide.org/listinfo/lazarus >

Reply by email

Aruna Hewapathirane
to Michael Van Canneyt

Hi Michael,

Many thanks for the link. I have a few more questions please? I am running FPC 3.2.0
and Lazarus 2.0.10 how do I get your gstreamer code into my installation? What is the
preferred or best way to do this? It is my first time so apologies if this is a silly question.

Many thanks once again for your help.

Aruna

On Mon, Nov 7, 2022 at 2:14 AM Michael Van Canneyt via lazarus <

Show quoted text 61 lines
wrote: Hello, Yes, see here: https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/gstreamer Michael. On Sun, 6 Nov 2022, Aruna Hewapathirane wrote: > Hello Michael, > > I would be very interested in this. Is there a link to the source and the > example code please? > > Thanks - Aruna > > On Tue, Nov 1, 2022 at 6:45 AM Michael Van Canneyt via lazarus < > > wrote: > >> >> Hello, >> >> For all people interested in sound/video streaming: >> >> After lots of work, I added the gst unit to the FPC packages. >> This unit contains the import declarations for the full libgstreamer-1.0 >> API. >> I didn't translate all C macros, but if you need some which I didn't >> translate, let me know and I will add them. >> >> For those that are not in the know: >> gstreamer is a powerful audio/video stream system, used on most modern >> linux >> distributions (it may be available on mac/windows, but I didn't test >> those). >> >> I have also added a simple demo, that shows how to play a mp3 file. >> >> I'm not an expert in sound/video streams, so if someone can contribute a >> more elaborate example, it would be most welcome :) >> >> Enjoy, >> >> Michael. >> -- >> _______________________________________________ >> lazarus mailing list >> >> https://lists.lazarus-ide.org/listinfo/lazarus >> > -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221107/b88ea405/attachment.htm>

Reply by email

Michael Van Canneyt
to Aruna Hewapathirane
Aruna Hewapathirane wrote 8 lines
Hi Michael, Many thanks for the link. I have a few more questions please? I am running FPC 3.2.0 and Lazarus 2.0.10 how do I get your gstreamer code into my installation? What is the preferred or best way to do this? It is my first time so apologies if this is a silly question.

In your case, I would recommend simply to copy the units into your project folder.

Alternatively, copy them to some folder on your harddisk, and add this folder to the unit path in the "project options" dialog in Lazarus. The compiler will then find them.

Michael.

Reply by email

Aruna Hewapathirane
to Michael Van Canneyt

On Tue, Nov 8, 2022 at 2:00 AM Michael Van Canneyt via lazarus <

Show quoted text 20 lines
wrote: On Mon, 7 Nov 2022, Aruna Hewapathirane wrote: > Hi Michael, > > Many thanks for the link. I have a few more questions please? I am running > FPC 3.2.0 > and Lazarus 2.0.10 how do I get your gstreamer code into my installation? > What is the > preferred or best way to do this? It is my first time so apologies if this > is a silly question. In your case, I would recommend simply to copy the units into your project folder.

Understood and will do so. Many thanks!

Show quoted text 5 lines
Alternatively, copy them to some folder on your harddisk, and add this folder to the unit path in the "project options" dialog in Lazarus. The compiler will then find them.

Again understood and will try both methods. Thank you :-)

Show quoted text 8 lines
Michael. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221108/8fd87953/attachment.htm>

Reply by email

Aruna Hewapathirane
to Michael Van Canneyt: In your case, I would recommend simply to copy the units into your project folder.…

On Tue, Nov 8, 2022 at 2:00 AM Michael Van Canneyt via lazarus <

Show quoted text 26 lines
wrote: On Mon, 7 Nov 2022, Aruna Hewapathirane wrote: > Hi Michael, > > Many thanks for the link. I have a few more questions please? I am running > FPC 3.2.0 > and Lazarus 2.0.10 how do I get your gstreamer code into my installation? > What is the > preferred or best way to do this? It is my first time so apologies if this > is a silly question. In your case, I would recommend simply to copy the units into your project folder. Alternatively, copy them to some folder on your harddisk, and add this folder to the unit path in the "project options" dialog in Lazarus. The compiler will then find them. Michael.

Hello Michael,

I tried to get things working but had problems with the IDE I have attached as screenshot.
https://pasteboard.co/xc64IUDOYVBb.png

Then I tried to see if I can get it going on the command line but trouble again, screenshot attached.
https://pasteboard.co/dHxckB8iMPxh.png

See below for details please:
--------------------------------------
aruna at debian:/media/aruna/linux-next/home/lazarus/gstreamer/example$ fpc playmp3
Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64
Compiling playmp3.pp
playmp3.pp(48,95) Warning: range check error while evaluating constants (-1 must be between 0 and 18446744073709551615)
Linking playmp3
/usr/bin/ld.bfd: cannot find -lgstreamer-1.0
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode

----------------------------------------------------------------------------- So I changed the -1 to a 0 in line 48,95 and tried again.... -----------------------------------------------------------------------------

aruna at debian:/media/aruna/linux-next/home/lazarus/gstreamer/example$ fpc playmp3
Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64
Compiling playmp3.pp
Linking playmp3
/usr/bin/ld.bfd: cannot find -lgstreamer-1.0
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
aruna at debian:/media/aruna/linux-next/home/lazarus/gstreamer/example$

This time it tries to link but dies saying can't find : /usr/bin/ld.bfd: cannot find -lgstreamer-1.0

Now what? I will keep trying different things...

Thanks, Aruna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221108/8efab067/attachment.htm>

Reply by email

Luca Olivetti
to Aruna Hewapathirane

El 9/11/22 a les 3:06, Aruna Hewapathirane via lazarus ha escrit:

This time it tries to link but dies saying can't find : /usr/bin/ld.bfd: cannot find -lgstreamer-1.0

In debian/ubuntu based distributions you'll have to install the libgstreamer1.0-dev package:

$ apt-file search libgstreamer-1.0
libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1404.0 libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1602.0 libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1603.0 libgstreamer1.0-dev: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so libgstreamer1.0-dev:
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1602.0-gdb.py libgstreamer1.0-dev:
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1603.0-gdb.py

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Michael Van Canneyt
Aruna Hewapathirane wrote 5 lines
> Hello Michael, I tried to get things working but had problems with the IDE I have attached screenshots.

It seems you opened the .lpi file as a pascal file using the file - open menu ?

A .lpi file must be opened with project - open menu.

Show quoted text 18 lines
Then I tried to see if I can get it going on the commandline but trouble again, see below please. aruna at debian:/media/aruna/linux-next/home/lazarus/gstreamer/example$ fpc playmp3 Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling playmp3.pp playmp3.pp(48,95) Warning: range check error while evaluating constants (-1 must be between 0 and 18446744073709551615) Linking playmp3 /usr/bin/ld.bfd: cannot find -lgstreamer-1.0 Error: Error while linking Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: /usr/bin/ppcx64 returned an error exitcode

This is a typical error when you do not have the gstreamer1-0-dev package installed.

normally,

sudo apt-get install libgstreamer1.0-dev

will fix this.

Alternatively, you can try to change the code

gstreamerlib = 'libgstreamer-1.0'; {Setup as you need}

to

gstreamerlib = 'libgstreamer-1.0.so.0'; {Setup as you need}

Michael.

Reply by email

Aruna Hewapathirane
to Luca Olivetti: El 9/11/22 a les 3:06, Aruna Hewapathirane via lazarus ha escrit: In debian/ubuntu based…

On Wed, Nov 9, 2022 at 2:34 AM Luca Olivetti via lazarus <

Show quoted text 30 lines
wrote: El 9/11/22 a les 3:06, Aruna Hewapathirane via lazarus ha escrit: > This time it tries to link but dies saying can't find : /usr/bin/ld.bfd: > cannot find -lgstreamer-1.0 In debian/ubuntu based distributions you'll have to install the libgstreamer1.0-dev package: $ apt-file search libgstreamer-1.0 libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1404.0 libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1602.0 libgstreamer1.0-0: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1603.0 libgstreamer1.0-dev: /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so libgstreamer1.0-dev: /usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/ libgstreamer-1.0.so.0.1602.0-gdb.py libgstreamer1.0-dev: /usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/ libgstreamer-1.0.so.0.1603.0-gdb.py Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Ahhh.. ofcourse.. thank you Luca.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221109/3b19c3bf/attachment.htm>

Reply by email

Aruna Hewapathirane
to Michael Van Canneyt: It seems you opened the .lpi file as a pascal file using the file - open menu ? A .lpi…

On Wed, Nov 9, 2022 at 3:37 AM Michael Van Canneyt via lazarus <

Show quoted text 18 lines
wrote: On Tue, 8 Nov 2022, Aruna Hewapathirane wrote: >> > Hello Michael, > > I tried to get things working but had problems with the IDE I have attached > screenshots. It seems you opened the .lpi file as a pascal file using the file - open menu ? A .lpi file must be opened with project - open menu.

Oh.. I did not know this thank you. Yes it opens fine now. Screenshot attached.
https://pasteboard.co/6vWHLlaCiYc3.png

Show quoted text 30 lines
> Then I tried to see if I can get it going on the commandline but trouble > again, see below please. > > aruna at debian:/media/aruna/linux-next/home/lazarus/gstreamer/example$ fpc > playmp3 > Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64 > Copyright (c) 1993-2020 by Florian Klaempfl and others > Target OS: Linux for x86-64 > Compiling playmp3.pp > playmp3.pp(48,95) Warning: range check error while evaluating constants (-1 > must be between 0 and 18446744073709551615) > Linking playmp3 > /usr/bin/ld.bfd: cannot find -lgstreamer-1.0 > Error: Error while linking > Fatal: There were 1 errors compiling module, stopping > Fatal: Compilation aborted > Error: /usr/bin/ppcx64 returned an error exitcode > This is a typical error when you do not have the gstreamer1-0-dev package installed. normally, sudo apt-get install libgstreamer1.0-dev will fix this.

I installed gstreamer1.0-dev package and now it compiles. Compiles and builds playmp3 - screenshot attached. https://pasteboard.co/Uq4bM35Ykllu.png

But new problem now. I have attached screenshots.

Errors when trying to play a *.mp3 file:
https://pasteboard.co/xK7PNcnRMZa8.png

Show quoted text 16 lines
Alternatively, you can try to change the code gstreamerlib = 'libgstreamer-1.0'; {Setup as you need} to gstreamerlib = 'libgstreamer-1.0.so.0'; {Setup as you need} Michael. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

Thank you for your patience and all the guidance, Aruna -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221109/9a346d2c/attachment.htm>

Reply by email

Michael Van Canneyt
to Aruna Hewapathirane
Aruna Hewapathirane wrote 16 lines
> normally, > > sudo apt-get install libgstreamer1.0-dev > > will fix this. > I installed gstreamer1.0-dev package and now it compiles. Compiles and builds playmp3 - screenshot attached. https://pasteboard.co/Uq4bM35Ykllu.png But new problem now. I have attached screenshots. Errors when trying to play a *.mp3 file: https://pasteboard.co/xK7PNcnRMZa8.png

That's an error of gstreamer itself.

At first sight I would say that you are not using pulseaudio on your system, since it seems gstreamer cannot connect to the pulseaudio streamer.

Try changing "pulsesink" with "osssink" or "alsasink" in the gst_parse_launch call.

If none of those help, I'm also at a loss: I am not a gstreamer expert...

Michael.

Reply by email