#pragma once #if USE_VLC #include #include #include class VlcMediaListPlayer : public QObject { Q_OBJECT public: enum PlayMode{ Default, Loop, Repeat }; public: VlcMediaListPlayer(); ~VlcMediaListPlayer(); void SetResolution(int width, int height); void SetMediaList(const QStringList& paths); bool Play(); void Stop(); bool IsPlaying() const; void SetPlayMode(PlayMode model); signals: void VideoDataOutput(QImage); void Stopped(); void TimeChanged(qint64); protected: void OnPostionChangedCallback(float pos); void OnTimeChangedCallback(qint64 pos); private: struct libvlc_media_player_t* vlcPlayer_{ nullptr }; struct libvlc_media_list_player_t* vlcListPlayer_{ nullptr }; struct libvlc_media_list_t* vlcMediaList_{ nullptr }; friend void* MediaListMediaCallbakLocak(void* opaque, void** planes); friend void MediaListMediaCallbakUnLocak(void* opaque, void* picture, void* const* planes); friend void OnMediaListVLCEvent(const struct libvlc_event_t* event, void* data); //friend unsigned MediaSetup(void** opaque, char* chroma, unsigned* width, unsigned* height, unsigned* pitches, unsigned* lines); std::mutex mutx_; std::vector pixels_; int videoWidth_{ 0 }; int videoHeight_{ 0 }; }; #endif