Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GStreamer Qt WINDOWS

There is lot's of information about configuring .pro file for Qt in linux to run GStreamer. But it looks so difficult to do the same in WINDOWS. I downloaded Gst from their official site and ran an installer. Now it's in D:\gstreamer\1.0\x86 ... I found the only description from someone who tried to change 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 the project find , gives assistance when typing "gst_init(" and other stuff for gstreamer but it gives an error

undefined reference to gst_init

Here 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]: Entering directory 'D:/Projects/AllTests/Qt/build-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 function main': D:\Projects\AllTests\Qt\build-Console-Desktop_Qt_5_1_1_MinGW_32bit-Debug/../Console/main.cpp:8: undefined reference togst_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]: Leaving directory 'D:/Projects/AllTests/Qt/build-Console-Desktop_Qt_5_1_1_MinGW_32bit-Debug' makefile:34: recipe for target 'debug' failed mingw32-make: * [debug] Error 2 00:20:18: Process «C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\mingw32-make.exe» finishes with code 2.

like image 291
Vadim Avatar asked Dec 03 '13 20:12

Vadim


1 Answers

You have to specify the gstreamer libraries against which your binaries must be linked.

According to this documentation for qmake, by issuing LIBS += -Lc:/gstreamer/1.0/x86/lib you are instructing qmake to look for libraries within the given path, but not which of them to actually link to your binaries. I am not familiar with gstreamer, so I'm not sure what libraries must be linked in the specific case you presented, but I guess you'll find them all in gstreamer/1.0/x86/lib. If unsure you could add them all to the list prepending the lower case "l" to their names. For instance, if the library were called math, you'd add it by appending -lmath to the list. Just be cautious not to add multiple versions of the same library, say a debug version and a release version, at the same time, or you most certainly will get multiple reference linking errors.

Instead of manually specifying the libraries which should be linked to your binaries as suggested above, you also have the option to use pkg-config to do the hard work for you. This documentation for gstreamer states it suficies to add the following to the .pro file:

CONFIG += link_pkgconfig
PKGCONFIG += QtGStreamer-0.10

The drawback to this approach is naturally that you have to get pkg-config to work on your system first.

like image 129
brunocodutra Avatar answered Oct 04 '22 10:10

brunocodutra