File indexing completed on 2024-11-03 05:04:12

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef PORT_H
0008 #define PORT_H
0009 
0010 #include "profile.h"
0011 
0012 #include <pulse/def.h>
0013 
0014 namespace QPulseAudio
0015 {
0016 class Port : public Profile
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit Port(QObject *parent);
0022     ~Port() override;
0023 
0024     template<typename PAInfo>
0025     bool setInfo(const PAInfo *info)
0026     {
0027         Availability newAvailability;
0028         switch (info->available) {
0029         case PA_PORT_AVAILABLE_NO:
0030             newAvailability = Unavailable;
0031             break;
0032         case PA_PORT_AVAILABLE_YES:
0033             newAvailability = Available;
0034             break;
0035         default:
0036             newAvailability = Unknown;
0037         }
0038         return setCommonInfo(info, newAvailability);
0039     }
0040 };
0041 
0042 } // QPulseAudio
0043 
0044 #endif // PORT_H