Results 1 to 2 of 2

Thread: Vlc-qt in qml, unble to register a type

  1. #1
    Join Date
    Dec 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Unhappy 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$_ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPla yerEE[__ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPlayerEE]+0x8): undefined reference to `VlcQmlPlayer::metaObject() const'
    debug/main.o:main.cpp.rdata$_ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPla yerEE[__ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPlayerEE]+0xc): undefined reference to `VlcQmlPlayer::qt_metacast(char const*)'
    debug/main.o:main.cpp.rdata$_ZTVN11QQmlPrivate11QQmlElementI12VlcQmlPla yerEE[__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

    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include <QtGui/QGuiApplication>
    3. #include <QtQuick/QQuickView>
    4.  
    5. #include <VLCQtCore/Common.h>
    6. #include <VLCQtQml/QmlSource.h>
    7. #include <VLCQtCore/TrackModel.h>
    8. #include <VLCQtQml/Qml.h>
    9. #include <VLCQtQml/QmlVideoObject.h>
    10. #include <VLCQtCore/MediaPlayer.h>
    11. #include <VLCQtQml/QmlPlayer.h>
    12. #include <VLCQtQml/QmlVideoOutput.h>
    13. #include <QtPlugin>
    14.  
    15. int main(int argc, char *argv[])
    16. {
    17. QCoreApplication::setApplicationName("VLC-Qt QML Player");
    18. QCoreApplication::setAttribute(Qt::AA_X11InitThreads);
    19.  
    20. QGuiApplication app(argc, argv);
    21. VlcCommon::setPluginPath(app.applicationDirPath() + "/plugins");
    22. qmlRegisterUncreatableType<Vlc>("Vlc", 1, 1, "Vlc", QStringLiteral("Vlc cannot be instantiated directly"));
    23. qmlRegisterUncreatableType<VlcQmlSource>("VlcSource", 1, 1, "VlcSource", QStringLiteral("VlcQmlSource cannot be instantiated directly"));
    24. qmlRegisterUncreatableType<VlcTrackModel>("VlcTrackModel", 1, 1, "VlcTrackModel", QStringLiteral("VlcTrackModel cannot be instantiated directly"));
    25. qmlRegisterType<VlcQmlVideoOutput>("VlcVideoOutput", 1, 1, "VlcVideoOutput");
    26. qmlRegisterType<VlcQmlPlayer>("VlcPlayer", 1, 1, "VlcPlayer");
    To copy to clipboard, switch view to plain text mode 

    Main.qml

    Qt Code:
    1. import VlcPlayer 1.1
    2. import Vlc 1.1
    3. import VlcVideoOutput 1.1
    4.  
    5. VlcVideoOutput {
    6. source:
    7. VlcPlayer {
    8. id: vlcPlayer
    9. url: "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov"
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 
    I don't want to use the VlcQmlVideoPlayer as it is deprecated and besides, I only get audio and not video when using it.
    Last edited by d_stranz; 12th August 2021 at 15:53. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,239
    Thanks
    303
    Thanked 865 Times in 852 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Vlc-qt in qml, unble to register a type

    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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Register file type for android application
    By mentalmushroom in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 21st February 2017, 06:40
  2. [solved] Register new type in qml file from C++...
    By obiwankennedy in forum Qt Quick
    Replies: 2
    Last Post: 5th February 2016, 16:34
  3. Replies: 3
    Last Post: 25th April 2013, 14:12
  4. What is register int?
    By kiboi in forum General Programming
    Replies: 2
    Last Post: 6th November 2012, 23:27

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.