53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
//
|
|
// Created by Administrator on 2023-09-17.
|
|
//
|
|
|
|
#ifndef VLCPLAYER_CVLCKIT_H
|
|
#define VLCPLAYER_CVLCKIT_H
|
|
|
|
#ifdef _WIN32
|
|
#include <basetsd.h>
|
|
typedef SSIZE_T ssize_t;
|
|
#endif
|
|
#include <QObject>
|
|
#include <vlc/vlc.h>
|
|
#include <string>
|
|
|
|
class CVlcKit : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CVlcKit();
|
|
~CVlcKit() override;
|
|
public:
|
|
bool InitVLC();
|
|
[[nodiscard]] std::string getLastError() const;
|
|
[[nodiscard]] libvlc_media_player_t* getPlayerPoint() const;
|
|
public:
|
|
void pauseVideo();
|
|
void playVideo();
|
|
void stopVideo();
|
|
bool openVideo(const char* path, void* pWindow);
|
|
void setPlayPostion(float pos);
|
|
void setVolume(int vol);
|
|
signals:
|
|
void sigSetTimeSlider(int value);
|
|
void sigSetVolumeSlider(int value);
|
|
void sigSetStringTime(long long value);
|
|
void sigSetTotalSecond(long long value);
|
|
|
|
private:
|
|
static void vlc_call( const struct libvlc_event_t *p_event, void *p_data );
|
|
private:
|
|
libvlc_instance_t* m_pInstance{};
|
|
libvlc_media_player_t* m_pMediaPlayer{};
|
|
libvlc_media_t* m_pMedia{};
|
|
libvlc_event_manager_t* m_event{};
|
|
|
|
libvlc_time_t m_totalSec = -1;
|
|
std::string m_szError;
|
|
};
|
|
|
|
|
|
#endif //VLCPLAYER_CVLCKIT_H
|