From 0ade21ad07f88f77fbf296af0fc71bec179ee7ab Mon Sep 17 00:00:00 2001 From: Steve Lhomme <robux4@ycbcr.xyz> Date: Thu, 7 May 2020 08:28:34 +0200 Subject: [PATCH] QtPlayer example: fix compilation with newer Qt/libvlc --- doc/libvlc/QtPlayer/player.cpp | 10 ++++++++-- doc/libvlc/QtPlayer/player.h | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/libvlc/QtPlayer/player.cpp b/doc/libvlc/QtPlayer/player.cpp index b1316026ba97..3e68f064aeed 100644 --- a/doc/libvlc/QtPlayer/player.cpp +++ b/doc/libvlc/QtPlayer/player.cpp @@ -11,6 +11,12 @@ #define qtu( i ) ((i).toUtf8().constData()) #include <QtGui> +#include <QMessageBox> +#include <QMenuBar> +#include <QAction> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QFileDialog> Mwindow::Mwindow() { vlcPlayer = NULL; @@ -142,7 +148,7 @@ void Mwindow::openFile() { #elif defined(Q_OS_UNIX) libvlc_media_player_set_xwindow(vlcPlayer, videoWidget->winId()); #elif defined(Q_OS_WIN) - libvlc_media_player_set_hwnd(vlcPlayer, videoWidget->winId()); + libvlc_media_player_set_hwnd(vlcPlayer, (HWND)videoWidget->winId()); #endif /* And start playback */ @@ -181,7 +187,7 @@ int Mwindow::changeVolume(int vol) { /* Called on volume slider change */ void Mwindow::changePosition(int pos) { /* Called on position slider change */ if (vlcPlayer) - libvlc_media_player_set_position(vlcPlayer, (float)pos/1000.0); + libvlc_media_player_set_position(vlcPlayer, (float)pos/1000.0, true); } void Mwindow::updateInterface() { //Update interface and check if song is finished diff --git a/doc/libvlc/QtPlayer/player.h b/doc/libvlc/QtPlayer/player.h index 495ea9531183..8a5d192a6fc0 100644 --- a/doc/libvlc/QtPlayer/player.h +++ b/doc/libvlc/QtPlayer/player.h @@ -9,6 +9,10 @@ #define PLAYER #include <QtGui> +#include <QMainWindow> +#include <QPushButton> +#include <QSlider> +#include <QWidget> #include <vlc/vlc.h> class Mwindow : public QMainWindow { -- GitLab