[SOLVED]Vlc-Qt problem!



  • Hello,
    I'm new in this forum nice to meet u.
    I would like to use libVLC in Qt, i downloaded https://github.com/vlc-qt/vlc-qt, i added the content of folder src in Qt(folder include), and lvlc in .pro .
    When i compile i have this error ; Config.h don't find, the probleme appear when i include <MediaPlayer.h>
    Thank!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You need to build VLC-Qt before using it, you can't just copy the sources in your project.



  • Ah ok,
    I tried to build a simple class juste for a test, but no result, i do not know where and how to start .


  • Lifetime Qt Champion

    Did you build VLC-Qt itself ?



  • It's my fault, i downloaded the VLC-QT of other personne. else now i download the official version in http://vlc-qt.tano.si/
    If I have a problem I will tell you .



  • I wanted to try a reading, but this code doesn't work ;

    #ifndef VIDEO_H
    #define VIDEO_H
    #include <QMainWindow>
    #include <vlc/VLCQtCore/Instance.h>
    #include <vlc/VLCQtCore/MediaPlayer.h>
    #include <vlc/VLCQtCore/Media.h>
    #include <vlc/VLCQtCore/Common.h>
    #include <vlc/VLCQtWidgets/WidgetVideo.h>
    class Video : public QMainWindow
    {
    Q_OBJECT
    public:
    explicit Video(QWidget *parent = 0);

    public slots:
    void player();
    private :
    VlcMedia * _media;
    VlcInstance* _instance;
    VlcMediaPlayer* _player;
    VlcWidgetVideo * widget;
    };
    #endif // VIDEO_H

    .cpp

    #include "video.h"

    Video::Video(QWidget *parent) : QMainWindow(parent)
    {
    QPushButton *buttonPlayer=new QPushButton("play",this);
    QVBoxLayout *layout=new QVBoxLayout(this);
    _instance = new VlcInstance(VlcCommon::args(), this);
    _player = new VlcMediaPlayer(_instance);
    widget=new VlcWidgetVideo(_player);
    _player->setVideoWidget(widget);
    layout->addWidget(buttonPlayer);
    layout->addWidget(widget);
    setLayout(layout);

    connect(buttonPlayer, SIGNAL(clicked()), this, SLOT(player()));
    

    }
    void Video::player()
    {
    QString file =
    QFileDialog::getOpenFileName(this, tr("Open file"),
    QDir::homePath(),
    tr("Multimedia files(*)"));

    if (file.isEmpty())
        return;
    _media = new VlcMedia(file, true, _instance);
    _player->open(_media);
    

    }
    I have this message
    QLayout: Attempting to add QLayout "" to Video "", which already has a layout
    [02cb4df4] core libvlc error: No plugins found! Check your VLC installation.
    core libvlc error: No plugins found! Check your VLC installation.
    VLC-Qt Error: libvlc failed to load!

    http://i45.tinypic.com/dzb138.png
    I downloaded version for MinGW


  • Lifetime Qt Champion

    QMainWindow has already a layout, don't set a new one. Use a placeholder widget that you'll set as central widget of your QMainWindow.



  • Video::Video(QWidget parent) : QMainWindow(parent), _media(0)
    {
    QWidget
    zoneCentrale = new QWidget;
    QVBoxLayout *layout=new QVBoxLayout(this);

    QPushButton *buttonPlayer=new QPushButton("play",this);
    

    _instance = new VlcInstance(VlcCommon::args(), this);
    _player = new VlcMediaPlayer(_instance);
    widget=new VlcWidgetVideo(_player,this);

    _player->setVideoWidget(widget);
    widget->setMediaPlayer(_player);

    layout->addWidget(widget);
    layout->addWidget(buttonPlayer);
    zoneCentrale->setLayout(layout);
    

    setCentralWidget(zoneCentrale);

    connect(buttonPlayer, SIGNAL(clicked()), this, SLOT(player()));
    

    }

    Doesn't work,still same error

    ps ; even if I use QWidget in place of QMainWindows , I still get the same error


  • Lifetime Qt Champion

    QVBoxLayout *layout=new QVBoxLayout(this); will set the layout on this which is not what you want in this case.

    QVBoxLayout *layout=new QVBoxLayout(zoneCentrale); will set the layout on the zoneCentrale



  • Still same error :'(, i don't know anymore


  • Lifetime Qt Champion

    The layout problem ?



  • When i launch the program , i have this message http://fr.tinypic.com/view.php?pic=dzb138&s=6#.Vhg6sHrtlBc

    and error ;
    core libvlc error: No plugins found! Check your VLC installation.
    [03126584] core libvlc error: No plugins found! Check your VLC installation.
    VLC-Qt Error: libvlc failed to load!

    I test this condition

    QLibrary lib( "libvlc" );
    if ( lib.load() )
    {
    qDebug() << "libvlc loaded";
    }
    else
    {
    qDebug() << "libvlc not loaded";
    }
    she return always true


  • Lifetime Qt Champion

    Try setting VLC_PLUGIN_PATH in your application environment variables (Run part of the project panel in Qt Creator)



  • it works, I added the folder plu gin in release !!! i"m very happy :')


  • Lifetime Qt Champion

    Good :)

    Then since you have it working now please update the thread title prepending [solved] so other forum users may know a solution has been found :)



  • Hi everybody, when I launch my program from Qt Creator all is OK.
    But when I run exec file directly from windows explorer no HMI appears. I use dependency walker to see what is wring and I have got the same message :
    GetProcAddress(0x76190000 [GDI32.DLL], "GetCharWidthI") called from "QWINDOWS.DLL" at address 0x520D4FAA and returned 0x761C8EB6.
    GetProcAddress(0x76060000 [MSVCRT.DLL], "_get_output_format") called from "LIBVLCCORE.DLL" at address 0x5042A5E4 and returned 0x760D5CE8.
    core libvlc error: No plugins found! Check your VLC installation.
    VLC-Qt Error: libvlc failed to load!
    Second chance exception 0xC0000005 (Access Violation) occurred in "LIBVLC.DLL" at address 0x5238D481.
    Exited "TESTVIDEO.EXE" (process 0xE44) with code -1073741819 (0xC0000005).

    Have you got an idea? I saw in last topic that I need to add environnement variable VLC_PLUGIN_PATH. Where is the plugin path? Does I need to install VLC. I only install QtVlc with the 3 folders, bin, include et lib.

    Regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.