0
votes

This question is related to the unanswered “Display video in Qml via Gstreamer qmlglsink plugin” question as I have the same problem.

The issue is that Qt Creator cannot find whatever file is necessary to resolve the import “org.freedesktop.gstreamer.GLVideoItem 1.0” statement.

When I create a new QML project and add the import “org.freedesktop.gstreamer.GLVideoItem 1.0” line. I get this error. The project compiles and runs fine.

Error 1

I have another project taken from an example I downloaded. It uses GstGLVideoItem within its qml file. It also gives the same error and it also compiles and runs fine. It plays the Big Buck Bunny video from a file without issue.

I have totally rebuilt my computer trying to resolve this. Reinstalled Qt 5.15.2 using the online installer and GStreamer 1.18.0 following the instructions on the GStreamer website into an Ubuntu 20.10 PC. Both Qt and GStreamer are working as expected. I have been able to build and run any desired Qt Example without issue. I have also been able to compile and run any of the GStreamer tutorials as well as my own custom pipelines using C and gst-launch-1.0.

This issue occurs within Qt Creator when I bring the two together and try to display a GStreamer video in QML.

Error 2

I’m new to Linux, Qt, GStreamer, qmake, cmake… How can I debug this? What kind of file is the import statement looking for? Is it a .qml file or some other kind of file? How would I find the files exact name to see if it exists?

Here is the contents of the .pro file for the project that displays the video. I have tried most everything I can find online to resolve this, but no joy.

TEMPLATE = app

QT += qml quick widgets

CONFIG += qml_debug

QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig debug
PKGCONFIG += \
gstreamer-1.0 \
gstreamer-sdp-1.0 \
gstreamer-gl-prototypes-1.0 \
gstreamer-gl-1.0 \
gstreamer-gl-egl-1.0 \
gstreamer-app-1.0 \
gstreamer-net-1.0 \
gstreamer-video-1.0 \
gstreamer-controller-1.0 \
gstreamer-rtsp-1.0 \
gstreamer-plugins-base-1.0 \
gstreamer-pbutils-1.0 \
gstreamer-check-1.0 \
gstreamer-allocators-1.0 \
gstreamer-rtp-1.0 \
gstreamer-riff-1.0 \
gstreamer-tag-1.0 \
gstreamer-audio-1.0 \
gstreamer-gl-x11-1.0 \
gstreamer-fft-1.0 \
gstreamer-base-1.0

CONFIG += c++17

INCLUDEPATH += /usr/include/gstreamer-1.0/
INCLUDEPATH += /usr/include/glib-2.0/
INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include/

DEFINES += GST_USE_UNSTABLE_API

INCLUDEPATH += ../lib

SOURCES += main.cpp \
    qmlplayer.cpp \
    setplaying.cpp

RESOURCES += qmlsink.qrc

QML_IMPORT_PATH += /usr/lib/x86_64-linux-gnu/gstreamer-1.0
QML_IMPORT_PATH += /usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0
QML_IMPORT_PATH += /lib/x86_64-linux-gnu/gstreamer-1.0

HEADERS += \
    qmlplayer.h \
    setplaying.h
2
What QtCreator version is it? - folibis

2 Answers

0
votes

Matthew Waters on the GStreamer forum has answered this question.

I quote him below.

Ah, so your problem is use with the Qt designer not showing finding the relevant qml code. That use case is currently not supported by qmlglsink.

The issue is that the necessary QML item is contained within the qmlglsink element itself and is registered dynamically when the element itself is instantiated. Qt designer doesn't know anything about GStreamer so cannot perform this initialisation for you. There are no qmldir or qmltype files for qmlglsink.

The 'fix' involves are rather complicated restructure of the qmlglsink element to support placing the qml part/plugin in a separate .so that is findable with Qt tools (using qmldir or whatever).

0
votes

You might have to dynamicaly register the module before loading the qml on your main as below.

qmlRegisterType<QtGLVideoItem> ("org.freedesktop.gstreamer.GLVideoItem", 1, 0, "GstGLVideoItem");

You will have to create the QtGLVideoItem object which inherits the QtQuickItem class, please see below.

#include <QQuickItem>

class QtGLVideoItem : public QQuickItem
{
    Q_OBJECT
public:
    QtGLVideoItem();
    ~QtGLVideoItem();

protected:

private:

};