16 pw_thread_loop_signal(s->pipewire_loop.get(),
false);
25 PW_VERSION_CORE_EVENTS,
33 .remove_mem =
nullptr,
34#if PW_MAJOR > 0 || PW_MINOR > 3 || (PW_MINOR == 3 && PW_MICRO > 67)
35 .bound_props =
nullptr,
41 s.
pipewire_loop.reset(pw_thread_loop_new(
"Playback",
nullptr));
57 uint32_t ,
const char *
type, uint32_t ,
58 const struct spa_dict *props)
60 auto result =
static_cast<std::vector<Pipewire_device> *
>(data);
61 std::string_view type_sv(
type);
62 if(type_sv !=
"PipeWire:Interface:Node")
66 for(
unsigned i = 0; i < props->n_items; i++){
67 std::string_view
key(props->items[i].key);
68 std::string_view
val(props->items[i].value);
70 if(
key ==
"node.description")
72 else if(
key ==
"node.nick")
74 else if(
key ==
"media.class")
76 else if(
key ==
"node.name")
78 else if(
key ==
"object.serial")
82 result->push_back(std::move(dev));
89 std::vector<Pipewire_device> result;
95 const static pw_registry_events registry_events = {
96 PW_VERSION_REGISTRY_EVENTS,
98 .global_remove =
nullptr
102 pw_registry_add_listener(registry.get(), ®istry_listener.
get(), ®istry_events, &result);
123 for(
const auto& dev : devices){
124 if(dev.media_class == media_class){
125 color_printf(
"\t%s: %s (%s)\n", dev.serial.c_str(), dev.description.c_str(), dev.name.c_str());
int color_printf(const char *format,...)
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_ERROR
general errors
void print_devices(std::string_view media_class)
bool initialize_pw_common(pipewire_state_common &s, int fd)
static void on_core_error(void *, uint32_t id, int seq, int res, const char *message)
std::vector< Pipewire_device > get_pw_device_list()
static void on_registry_event_global(void *data, uint32_t, uint32_t, const char *type, uint32_t, const struct spa_dict *props)
static void on_core_done(void *data, uint32_t, int seq)
static const struct pw_core_events core_events
raii_uniq_proxy_handle< pw_registry > pw_registry_uniq
pw_context_uniq pipewire_context
pw_thread_loop_uniq pipewire_loop
pw_core_uniq pipewire_core
pipewire_init_guard init_guard
spa_hook_uniq core_listener