2019-08-21 03:38:35 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
|
|
|
* SPDX-FileCopyrightText: 2019 Piyush Aggarwal <piyushaggarwal002@gmail.com>
|
2019-08-21 03:38:35 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2019-08-21 03:38:35 +01:00
|
|
|
*/
|
|
|
|
|
2023-07-21 19:22:59 +01:00
|
|
|
#pragma once
|
2019-08-21 03:38:35 +01:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <QHash>
|
2019-08-21 03:38:35 +01:00
|
|
|
#include <QObject>
|
|
|
|
#include <QSet>
|
|
|
|
#include <QString>
|
2021-06-22 08:27:13 +01:00
|
|
|
|
|
|
|
#include <winrt/Windows.ApplicationModel.h>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <winrt/Windows.Foundation.Collections.h>
|
|
|
|
#include <winrt/Windows.Media.Control.h>
|
2019-08-21 03:38:35 +01:00
|
|
|
|
|
|
|
#include <core/kdeconnectplugin.h>
|
|
|
|
|
|
|
|
#include <endpointvolume.h>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <mmdeviceapi.h>
|
2019-08-21 03:38:35 +01:00
|
|
|
|
2021-06-22 08:27:13 +01:00
|
|
|
using namespace winrt;
|
|
|
|
using namespace Windows::Media::Control;
|
|
|
|
using namespace Windows::ApplicationModel;
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
class PauseMusicPlugin : public KdeConnectPlugin
|
2019-08-21 03:38:35 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-09-10 22:23:52 +01:00
|
|
|
explicit PauseMusicPlugin(QObject *parent, const QVariantList &args);
|
2019-08-21 03:38:35 +01:00
|
|
|
~PauseMusicPlugin();
|
|
|
|
|
2023-07-31 08:25:45 +01:00
|
|
|
void receivePacket(const NetworkPacket &np) override;
|
2019-08-21 03:38:35 +01:00
|
|
|
|
|
|
|
private:
|
2021-06-22 08:27:13 +01:00
|
|
|
void updatePlayersList();
|
|
|
|
bool updateSinksList();
|
|
|
|
|
|
|
|
bool valid;
|
2019-08-21 03:38:35 +01:00
|
|
|
IMMDeviceEnumerator *deviceEnumerator;
|
2021-06-22 08:27:13 +01:00
|
|
|
QHash<QString, IAudioEndpointVolume *> sinksList;
|
|
|
|
|
2023-07-25 16:22:20 +01:00
|
|
|
GlobalSystemMediaTransportControlsSessionManager sessionManager;
|
2021-06-22 08:27:13 +01:00
|
|
|
QHash<QString, GlobalSystemMediaTransportControlsSession> playersList;
|
2019-08-21 03:38:35 +01:00
|
|
|
|
2021-06-22 08:27:13 +01:00
|
|
|
QSet<QString> pausedSources;
|
|
|
|
QSet<QString> mutedSinks;
|
2019-08-21 03:38:35 +01:00
|
|
|
};
|