GSTreamer Qt WINDOWS

There is a lot of information on setting up a .pro file for Qt on Linux to run GStreamer. But in WINDOWS it is so hard to do. I downloaded Gst from my official site and ran the installer. Now this is in D: \ gstreamer \ 1.0 \ x86 ... I found the only description from who was trying to modify the qt.pro file. I did the same:

INCLUDEPATH += c:/gstreamer/1.0/x86/include \ c:/gstreamer/1.0/x86/include/gstreamer-1.0/gst \ c:/gstreamer/1.0/x86/include/glib-2.0\ c:/gstreamer/1.0/x86/include/glib-2.0/glib \ c:/gstreamer/1.0/x86/lib/glib-2.0/include LIBS += -Lc:/gstreamer/1.0/x86/lib CONFIG += c:/gstreamer/1.0/x86/lib/pkgconfig 

And finding the project helps with typing "gst_init (" and other things for gstreamer, but it gives an error

undefined link to gst_init

That is the question. How to connect GStreamer in windows?

 #include <QCoreApplication> #include <gst/gst.h> int main(int argc, char *argv[]) { gst_init(NULL,NULL); //g_print("abc"); return 0; } 

C: /Qt/Qt5.1.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug mingw32-make [1]: enter the directory 'D: / Projects / Alltests / Qt / built-in console Desktop_Qt_5_1_1_MinGW_32bit-Debug' g ++ -Wl, -subsystem, console -mthreads -o debug \ Console.exe debug / main.o -Lc: /gstreamer/1.0/x86/lib -LC: \ Qt \ Qt5.1.1 \ 5.1.1 \ mingw48_32 \ lib - lQt5Cored debug / main.o: In main': D:\Projects\AllTests\Qt\build-Console-Desktop_Qt_5_1_1_MinGW_32bit-Debug/../Console/main.cpp:8: undefined reference to gst_init' collect2.exe: error : ld returned 1 exit status Makefile.Debug: 77: recipe for target 'debug \ Console.exe' failed mingw32-make [1]: * [debug \ Console.exe] Error 1 mingw32-make [1]: leave directory ' D: / Projects / Alltests / Qt / built-in console Desktop_Qt_5_1_1_MinGW_32bit-Debug 'makefile: 34: the recipe for "debugging" the target is not fulfilled mingw32-make: * [debug] Error 2 00:20:18: The process "C: \ Qt \ Qt5.1.1 \ Tools \ mingw48_32 \ bin \ mingw32-make.exe" ends with code 2.

+6
source share
4 answers

You must specify the gstreamer libraries with which your binaries should be associated.

According to this documentation for qmake , by releasing LIBS += -Lc:/gstreamer/1.0/x86/lib , you instruct qmake to look for libraries in the specified path, but none of them actually reference your binary files. I am not familiar with gstreamer, so I'm not sure which libraries should be linked in the particular case that you presented, but I think you will find them all in gstreamer/1.0/x86/lib . If you are not sure, you can add them all to the list by casting the lowercase "l" to their names. For example, if the library was called math, add it by adding -lmath to the list. Just be careful not to add multiple versions of the same library, say, the debug version and release version at the same time, or you will probably get several link errors.

Instead of manually specifying the libraries that should be associated with your binaries as suggested above, you can also use pkg-config to do the hard work for you. This documentation for gstreamer states that the following must be added to the .pro file:

 CONFIG += link_pkgconfig PKGCONFIG += QtGStreamer-0.10 

The disadvantage of this approach is, of course, that you must first run pkg-config on your system.

+2
source

I found that on windows you can really avoid the pkg-config bit than you need to include everything that is needed for gstreamer like libs and .h . But you also need to enable GTK . A good answer from Kei Naga gives the idea of qt in VS 2010 http://gstreamer-devel.966125.n4.nabble.com/Configure-Visual-Studio-2010-for-GStreamer-td3804989.html , but if you pass everything that he wrote for the .pro file it will also work (at least for me).

Here is the pro file code:

 INCLUDEPATH += C:/ ... /GStreamer/v0.10.6/sdk/include/gstreamer-0.10 \ C:/ ... /GTK/include/libxml2 \ C:/ ... /GTK/include/libglade-2.0 \ C:/ ... /GTK/lib/gtkglext-1.0/include \ C:/ ... /GTK/lib/glib-2.0/include \ C:/ ... /GTK/lib/gtk-2.0/include \ C:/ ... /GTK/include/gtkglext-1.0 \ C:/ ... /GTK/include/atk-1.0 \ C:/ ... /GTK/include/cairo \ C:/ ... /GTK/include/pango-1.0 \ C:/ ... /GTK/include/glib-2.0 \ C:/ ... /GTK/include/gtk-2.0 \ C:/ ... /GTK/include LIBS += -LC:/ ... /GTK/lib -LC:/ ... /GStreamer/v0.10.6/sdk/lib -lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgtk-win32-2.0 -lgstinterfaces-0.10 
0
source

I believe this works for me. It uses the environment variable set by the GStreamer installation, so it should work on other PCs. There is another environment variable for 64-bit, but the same principle.

 QT += core gui TARGET = GStreamerTest4 TEMPLATE = app SOURCES += \ qt-videooverlay.cpp HEADERS += FORMS += GstreamerDir=$$(GSTREAMER_1_0_ROOT_X86) INCLUDEPATH = $${GstreamerDir}/include/gstreamer-1.0 INCLUDEPATH += $${GstreamerDir}/include/glib-2.0 INCLUDEPATH += $${GstreamerDir}/lib/glib-2.0/include INCLUDEPATH += $${GstreamerDir}/lib/gstreamer-1.0/include LIBS = $${GstreamerDir}/lib/gstreamer-1.0.lib LIBS += $${GstreamerDir}/lib/*.lib 

In addition, you need to make sure that C: \ gstreamer \ 1.0 \ x86 \ bin is on the way (control panel or you can install it in QtCreator).

0
source

If you are running gstreamer with Windows Visual Studio. Can you help me with the synchronization, this is a really important question for me, and I can not handle it?

0
source

Source: https://habr.com/ru/post/959270/


All Articles