diff options
author | Simon Rettberg | 2021-11-22 15:56:24 +0100 |
---|---|---|
committer | Simon Rettberg | 2021-11-22 15:56:24 +0100 |
commit | bd13c3716248570f14982b8e03a4adf4926e0c24 (patch) | |
tree | 0ef0dc9bad8de36f53c6d1cc9d5657c6576f1576 /src/helper.h | |
parent | Try to group the output configurations in the last tab (diff) | |
download | pavucontrol-slx-bd13c3716248570f14982b8e03a4adf4926e0c24.tar.gz pavucontrol-slx-bd13c3716248570f14982b8e03a4adf4926e0c24.tar.xz pavucontrol-slx-bd13c3716248570f14982b8e03a4adf4926e0c24.zip |
Add -o option to select output profilev29r1
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 |