1
0
Fork 0
VideoPlayer/src/MpvPlayerBackend.h

66 lines
1.5 KiB
C
Raw Normal View History

#ifndef MpvPlayerBackend_H
#define MpvPlayerBackend_H
2018-10-13 15:38:31 +01:00
#include <mpv/client.h>
#include <mpv/qthelper.hpp>
#include <mpv/render_gl.h>
2018-10-13 15:38:31 +01:00
#include <QObject>
#include <QOpenGLContext>
#include <QQuickFramebufferObject>
class MpvRenderer;
class MpvPlayerBackend : public QQuickFramebufferObject
2018-10-13 15:38:31 +01:00
{
Q_OBJECT
mpv_handle* mpv;
mpv_render_context* mpv_gl;
bool onTop = false;
2018-10-13 15:38:31 +01:00
friend class MpvRenderer;
2018-10-13 15:38:31 +01:00
public:
static void on_update(void* ctx);
2018-10-13 15:38:31 +01:00
MpvPlayerBackend(QQuickItem* parent = 0);
virtual ~MpvPlayerBackend();
virtual Renderer* createRenderer() const;
2018-10-13 15:38:31 +01:00
public slots:
void launchAboutQt();
void togglePlayPause();
void toggleMute();
void nextAudioTrack();
void nextVideoTrack();
void nextSubtitleTrack();
void prevPlaylistItem();
void nextPlaylistItem();
void toggleOnTop();
QVariant getTracks() const;
void setVolume(const QVariant& volume);
void addVolume(const QVariant& volume);
void loadFile(const QVariant& filename);
void seek(const QVariant& seekTime);
void command(const QVariant& params);
void setProperty(const QString& name, const QVariant& value);
void setOption(const QString& name, const QVariant& value);
QVariant getProperty(const QString& name) const;
QVariant createTimestamp(const QVariant& seconds) const;
2018-10-13 15:38:31 +01:00
signals:
void onUpdate();
void positionChanged(int value);
void mpv_events();
2018-10-13 15:38:31 +01:00
private slots:
void doUpdate();
void on_mpv_events();
2018-10-13 15:38:31 +01:00
private:
void handle_mpv_event(mpv_event* event);
2018-10-13 15:38:31 +01:00
};
2018-10-21 13:00:25 +01:00
#endif