File indexing completed on 2024-07-14 04:37:33

0001 /*
0002     SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 #ifndef STREAM_P_H
0007 #define STREAM_P_H
0008 
0009 #include "stream.h"
0010 #include "volumeobject_p.h"
0011 
0012 namespace PulseAudioQt
0013 {
0014 class StreamPrivate
0015 {
0016 public:
0017     explicit StreamPrivate(Stream *q);
0018     virtual ~StreamPrivate();
0019 
0020     Stream *q;
0021 
0022     quint32 m_deviceIndex = PA_INVALID_INDEX;
0023     quint32 m_clientIndex = PA_INVALID_INDEX;
0024     bool m_virtualStream = false;
0025     bool m_corked = false;
0026     bool m_hasVolume = false;
0027 
0028     template<typename PAInfo>
0029     void updateStream(const PAInfo *info)
0030     {
0031         q->VolumeObject::d->updateVolumeObject(info);
0032 
0033         if (m_hasVolume != info->has_volume) {
0034             m_hasVolume = info->has_volume;
0035             Q_EMIT q->hasVolumeChanged();
0036         }
0037         if (q->VolumeObject::d->m_volumeWritable != info->volume_writable) {
0038             q->VolumeObject::d->m_volumeWritable = info->volume_writable;
0039             Q_EMIT q->isVolumeWritableChanged();
0040         }
0041         if (m_clientIndex != info->client) {
0042             m_clientIndex = info->client;
0043             Q_EMIT q->clientChanged();
0044         }
0045         if (m_virtualStream != (info->client == PA_INVALID_INDEX)) {
0046             m_virtualStream = info->client == PA_INVALID_INDEX;
0047             Q_EMIT q->virtualStreamChanged();
0048         }
0049         if (m_corked != info->corked) {
0050             m_corked = info->corked;
0051             Q_EMIT q->corkedChanged();
0052         }
0053     }
0054 };
0055 }
0056 #endif