mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Add new signal to CVlcPlayer
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
#include "vlcmedia.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QUrl>
|
||||
|
||||
CVlcMedia::CVlcMedia(libvlc_instance_t* pVlcInstance, const QString& sFile, bool bEventForwarding)
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#include "vlcplayer.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
CVlcPlayer::CVlcPlayer(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
// initialize vlc media player
|
||||
@ -19,6 +17,8 @@ CVlcPlayer::CVlcPlayer(QWidget* parent) : QWidget(parent)
|
||||
}
|
||||
libvlc_event_attach(m_pEventManager, libvlc_MediaPlayerTimeChanged , onTimeChanged, this);
|
||||
libvlc_event_attach(m_pEventManager, libvlc_MediaPlayerPositionChanged , onPositionChanged, this);
|
||||
|
||||
libvlc_event_attach(m_pEventManager, libvlc_MediaPlayerVout , onVideoOutputChanged, this);
|
||||
}
|
||||
|
||||
CVlcPlayer::~CVlcPlayer()
|
||||
@ -45,6 +45,12 @@ void CVlcPlayer::onPositionChanged(const libvlc_event_t* pEvent, void* pData)
|
||||
emit pVlcPlayer->positionChanged(pEvent->u.media_player_position_changed.new_position);
|
||||
}
|
||||
|
||||
void CVlcPlayer::onVideoOutputChanged(const libvlc_event_t* pEvent, void* pData)
|
||||
{
|
||||
CVlcPlayer* pVlcPlayer = reinterpret_cast<CVlcPlayer*>(pData);
|
||||
emit pVlcPlayer->videoOutputChanged(pEvent->u.media_player_vout.new_count);
|
||||
}
|
||||
|
||||
void CVlcPlayer::integrateIntoWidget(QWidget* pWidget)
|
||||
{
|
||||
#if defined(_MAC)
|
||||
|
||||
@ -20,6 +20,7 @@ public:
|
||||
static void onStateChanged(const libvlc_event_t* pEvent, void *pData);
|
||||
static void onTimeChanged(const libvlc_event_t* pEvent, void *pData);
|
||||
static void onPositionChanged(const libvlc_event_t* pEvent, void *pData);
|
||||
static void onVideoOutputChanged(const libvlc_event_t* pEvent, void *pData);
|
||||
|
||||
public:
|
||||
void integrateIntoWidget(QWidget* pWidget);
|
||||
@ -37,6 +38,7 @@ public:
|
||||
void setPosition(float fPos);
|
||||
float position();
|
||||
|
||||
// NOTE: isAudio() will always return true until event libvlc_MediaPlayerVout is occurred (see onVideoOutputChanged())
|
||||
bool isAudio();
|
||||
bool isPlaying();
|
||||
libvlc_state_t getState();
|
||||
@ -45,6 +47,7 @@ signals:
|
||||
void stateChanged(int newState);
|
||||
void timeChanged(qint64 nNewTime);
|
||||
void positionChanged(float fNewPos);
|
||||
void videoOutputChanged(int nVoutCount);
|
||||
|
||||
public:
|
||||
libvlc_media_player_t* m_pVlcPlayer;
|
||||
|
||||
Reference in New Issue
Block a user