diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-02-28 13:04:45 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-02-28 13:04:45 -0500 |
commit | 1332cc7d0a618ee88b4d19813340665332d406ca (patch) | |
tree | fe500276505160f5fd8ba8acb46334633ed0788a /mediaplayer/MpdEventHandler.cpp | |
parent | 0de8ac83e6a190d5fc124587d1f9f0a7f0198ce3 (diff) |
Add Bluetooth media control supportmarlin_12.93.0marlin/12.93.012.93.0
Rework to expose Bluetooth AVRCP media control in the Bluetooth
class, and use that support to implement a Bluetooth backend in the
Mediaplayer class. This replaces the scheme that existed with the
agl-service-mediaplayer binding where it abstracted away the
Bluetooth support itself. However, care has been take to make sure
that the exposed API to users of libqtappfw-mediaplayer has not
changed.
Bug-AGL: SPEC-4231
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I76b4f75621ce0121364eea3259b074bf3067ee88
Diffstat (limited to 'mediaplayer/MpdEventHandler.cpp')
-rw-r--r-- | mediaplayer/MpdEventHandler.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mediaplayer/MpdEventHandler.cpp b/mediaplayer/MpdEventHandler.cpp index 40d2999..56a4612 100644 --- a/mediaplayer/MpdEventHandler.cpp +++ b/mediaplayer/MpdEventHandler.cpp @@ -15,6 +15,7 @@ */ #include <QDebug> +#include <QFileInfo> #include "MpdEventHandler.h" MpdEventHandler::MpdEventHandler(QObject *parent) : @@ -101,6 +102,13 @@ void MpdEventHandler::handleQueueEvent(void) QString genre(mpd_song_get_tag(song, MPD_TAG_GENRE, 0)); QString uri(mpd_song_get_uri(song)); int pos = mpd_song_get_pos(song); + + if (title.isEmpty()) { + // If there's no tag, use the filename + QFileInfo fi(uri); + title = fi.fileName(); + } + //qDebug() << "Queue[" << pos << "]: " << artist << " - " << title << " / " << album << ", genre " << genre; QVariantMap track; @@ -138,6 +146,13 @@ void MpdEventHandler::handlePlayerEvent(void) QString genre(mpd_song_get_tag(song, MPD_TAG_GENRE, 0)); pos = mpd_song_get_pos(song); uri = mpd_song_get_uri(song); + + if (title.isEmpty()) { + // If there's no tag, use the filename + QFileInfo fi(uri); + title = fi.fileName(); + } + //qDebug() << "Current song[" << pos << "]: " << artist << " - " << title << " / " << album << ", genre " << genre; track["title"] = title; @@ -147,6 +162,7 @@ void MpdEventHandler::handlePlayerEvent(void) track["index"] = pos; track["duration"] = mpd_song_get_duration_ms(song); track["path"] = uri; + mpd_song_free(song); metadata["track"] = track; |