diff options
Diffstat (limited to 'src/helper.h')
-rw-r--r-- | src/helper.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/helper.h b/src/helper.h new file mode 100644 index 0000000..823f3e1 --- /dev/null +++ b/src/helper.h @@ -0,0 +1,61 @@ +#ifndef _HELPER_H_ +#define _HELPER_H_ + +#include "pavucontrol.h" +#include <pulse/ext-stream-restore.h> +#if HAVE_EXT_DEVICE_RESTORE_API +# include <pulse/ext-device-restore.h> +#endif + +#include <set> +#include <map> +#include <QByteArray> +#include <QMap> +#include <vector> + +struct ProfileEntry { + QByteArray id; + QStringList tokens; + QString getName() const; +}; + +struct ProfileGroup { + ProfileGroup() : available(false) {} + bool available; + QString name; + QList<ProfileEntry> entries; + QString getProfileName(); + void addEntry(const char* id, const char* name); + bool containsProfile(const QByteArray &pro) const; +}; + +struct PortInfo { + QByteArray name; + QByteArray description; + uint32_t priority; + int available; + int direction; + int64_t latency_offset; + std::vector<QByteArray> profiles; +}; + + +/* Used for profile sorting */ +struct profile_prio_compare { + bool operator() (pa_card_profile_info2 const * const lhs, pa_card_profile_info2 const * const rhs) const { + + if (lhs->priority == rhs->priority) + return strcmp(lhs->name, rhs->name) > 0; + + return lhs->priority > rhs->priority; + } +}; + +void populatePorts(const pa_card_info &info, std::map<QByteArray, PortInfo> &ports); + + +void groupProfiles(const std::set<pa_card_profile_info2 *, profile_prio_compare> &profile_priorities, + const std::map<QByteArray, PortInfo> &ports, + QMap<QString, ProfileGroup> &profiles); + +#endif |