summaryrefslogtreecommitdiffstats
path: root/mediaplayer/mediaplayer.h
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-02-14 18:00:05 -0500
committerScott Murray <scott.murray@konsulko.com>2022-02-15 17:15:07 -0500
commit3f384d30d099f6eea5eb946c3cb0380f0453e2bc (patch)
tree5630474f9932b31327133351c41035b63d7dec76 /mediaplayer/mediaplayer.h
parent5ef90db242ad29c9772f2237b477c58ef65545c7 (diff)
Rework mediaplayer support to use mpd
Rework the mediaplayer support to replace the stubbed out app framework agl-service-mediaplayer binding use with driving mpd (Media Player Daemon) via the libmpdclient library. Local file playback behavior should be equivalent to before in an image with mpd present and suitably configured. Bluetooth AVRCP support is still stubbed out, and will be re-implemented with followup changes. Bug-AGL: SPEC-4182 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ifdf092b472c271460d0f5e9a8c7d2353904411b2
Diffstat (limited to 'mediaplayer/mediaplayer.h')
-rw-r--r--mediaplayer/mediaplayer.h62
1 files changed, 26 insertions, 36 deletions
diff --git a/mediaplayer/mediaplayer.h b/mediaplayer/mediaplayer.h
index 3d53a24..9afe6c6 100644
--- a/mediaplayer/mediaplayer.h
+++ b/mediaplayer/mediaplayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2020 Konsulko Group
+ * Copyright (C) 2018-2020,2022 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,29 +17,25 @@
#ifndef MEDIAPLAYER_H
#define MEDIAPLAYER_H
-#include <memory>
#include <QObject>
#include <QtQml/QQmlContext>
#include <QtQml/QQmlListProperty>
-class MessageEngine;
-class Message;
-
class Playlist : public QObject
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(int index READ index NOTIFY indexChanged)
- Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
- Q_PROPERTY(QString path READ path NOTIFY pathChanged)
+ Q_PROPERTY(int index READ index NOTIFY indexChanged)
+ Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
+ Q_PROPERTY(QString path READ path NOTIFY pathChanged)
- // METADATA FIELDS
- Q_PROPERTY(QString title READ title NOTIFY titleChanged)
- Q_PROPERTY(QString album READ album NOTIFY albumChanged)
- Q_PROPERTY(QString artist READ artist NOTIFY artistChanged)
- Q_PROPERTY(QString genre READ genre NOTIFY genreChanged)
+ // METADATA FIELDS
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QString album READ album NOTIFY albumChanged)
+ Q_PROPERTY(QString artist READ artist NOTIFY artistChanged)
+ Q_PROPERTY(QString genre READ genre NOTIFY genreChanged)
- public:
+public:
explicit Playlist(QVariantMap& item);
virtual ~Playlist();
@@ -54,7 +50,7 @@ class Playlist : public QObject
QString artist() { return m_artist; };
QString genre() { return m_genre; };
- signals:
+signals:
void indexChanged();
void durationChanged();
void pathChanged();
@@ -63,22 +59,26 @@ class Playlist : public QObject
void artistChanged();
void genreChanged();
- private:
+private:
int m_index, m_duration;
QString m_path, m_title, m_album, m_artist, m_genre;
};
+class MediaplayerMpdBackend;
+
class Mediaplayer : public QObject
{
- Q_OBJECT
+ Q_OBJECT
- public:
- explicit Mediaplayer(QUrl &url, QQmlContext *context, QObject * parent = Q_NULLPTR);
+public:
+ explicit Mediaplayer(QQmlContext *context, QObject * parent = Q_NULLPTR);
virtual ~Mediaplayer();
// controls
- Q_INVOKABLE void disconnect();
Q_INVOKABLE void connect();
+ Q_INVOKABLE void disconnect();
+ Q_INVOKABLE void connectBluetooth();
+ Q_INVOKABLE void disconnectBluetooth();
Q_INVOKABLE void play();
Q_INVOKABLE void pause();
Q_INVOKABLE void previous();
@@ -90,27 +90,17 @@ class Mediaplayer : public QObject
Q_INVOKABLE void volume(int);
Q_INVOKABLE void loop(QString);
+public slots:
void updatePlaylist(QVariantMap playlist);
+ void updateMetadata(QVariantMap metadata);
- signals:
+signals:
void metadataChanged(QVariantMap metadata);
- private:
- std::shared_ptr<MessageEngine> m_mloop;
+private:
QQmlContext *m_context;
QList<QObject *> m_playlist;
-
- void control(QString, QJsonObject);
- void control(QString);
-
- void onConnected();
- void onDisconnected();
- void onMessageReceived(std::shared_ptr<Message>);
-
- const QStringList events {
- "playlist",
- "metadata",
- };
+ MediaplayerMpdBackend *m_backend;
};
#endif // MEDIAPLAYER_H