Vlc-qt in qml, unble to register a type
I know this is an old post, but I am trying to do what you did here but I am getting the below error. May you please help, I am new to VLC-Qt thing.
Thank you.
C:/Qt/5.15.0/mingw81_32/include/QtCore/qmetatype.h:1590: undefined reference to `VlcQmlPlayer::staticMetaObject'
debug/main.o: In function `ZN18QMetaTypeIdQObjectIP12VlcQmlPlayerLi8EE14qt_m etatype_idEv':
C:/Qt/5.15.0/mingw81_32/include/QtCore/qmetatype.h:1951: undefined reference to `VlcQmlPlayer::staticMetaObject'
debug/main.o:main.cpp:(.rdata$_ZTVN11QQmlPrivate11QQmlEl ementI12VlcQmlPlayerEE[__ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPlayerEE]+0x8): undefined reference to `VlcQmlPlayer::metaObject() const'
debug/main.o:main.cpp:(.rdata$_ZTVN11QQmlPrivate11QQmlEl ementI12VlcQmlPlayerEE[__ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPlayerEE]+0xc): undefined reference to `VlcQmlPlayer::qt_metacast(char const*)'
debug/main.o:main.cpp:(.rdata$_ZTVN11QQmlPrivate11QQmlEl ementI12VlcQmlPlayerEE[__ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPlayerEE]+0x10): undefined reference to `VlcQmlPlayer::qt_metacall(QMetaObject::Call, int, void**)'
debug/main.o: In function `ZN11QQmlPrivate11QQmlElementI12VlcQmlPlayerED1Ev' :
C:/Qt/5.15.0/mingw81_32/include/QtQml/qqmlprivate.h:144: undefined reference to `VlcQmlPlayer::~VlcQmlPlayer()'
My code is as shown below
Main.cpp
Code:
#include <QtCore/QCoreApplication>
#include <QtGui/QGuiApplication>
#include <QtQuick/QQuickView>
#include <VLCQtCore/Common.h>
#include <VLCQtQml/QmlSource.h>
#include <VLCQtCore/TrackModel.h>
#include <VLCQtQml/Qml.h>
#include <VLCQtQml/QmlVideoObject.h>
#include <VLCQtCore/MediaPlayer.h>
#include <VLCQtQml/QmlPlayer.h>
#include <VLCQtQml/QmlVideoOutput.h>
#include <QtPlugin>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
VlcCommon::setPluginPath(app.applicationDirPath() + "/plugins");
qmlRegisterUncreatableType<Vlc>("Vlc", 1, 1, "Vlc", QStringLiteral("Vlc cannot be instantiated directly"));
qmlRegisterUncreatableType<VlcQmlSource>("VlcSource", 1, 1, "VlcSource", QStringLiteral("VlcQmlSource cannot be instantiated directly"));
qmlRegisterUncreatableType<VlcTrackModel>("VlcTrackModel", 1, 1, "VlcTrackModel", QStringLiteral("VlcTrackModel cannot be instantiated directly"));
qmlRegisterType<VlcQmlVideoOutput>("VlcVideoOutput", 1, 1, "VlcVideoOutput");
qmlRegisterType<VlcQmlPlayer>("VlcPlayer", 1, 1, "VlcPlayer");
Main.qml
Code:
import VlcPlayer 1.1
import Vlc 1.1
import VlcVideoOutput 1.1
VlcVideoOutput {
source:
VlcPlayer {
id: vlcPlayer
url: "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov"
}
}
I don't want to use the VlcQmlVideoPlayer as it is deprecated and besides, I only get audio and not video when using it.
Re: Vlc-qt in qml, unble to register a type
Quote:
I know this is an old post
What is "an old post"? This is a brand new thread.
Your error messages indicate that you aren't linking whatever library or other binary that contains the VlcQmlPlayer class implementation into your program. It could also be the case that MOC has not been run on the VlcQmlPlayer class to generate the metaobject code.
Check you qmake project file to make sure you are linking to the library that contains the Vlc code.