|
@@ -77,10 +77,13 @@ bool devices_match(const char *id1, const char *id2)
|
|
|
}
|
|
|
if (strcmp(id2, "default") == 0) {
|
|
|
get_default_id(&name2);
|
|
|
- id2 = name2;
|
|
|
+ } else {
|
|
|
+ name2 = bzalloc(strlen(id2) + 9);
|
|
|
+ strcat(name2, id2);
|
|
|
+ strcat(name2, ".monitor");
|
|
|
}
|
|
|
|
|
|
- match = strcmp(id1, id2) == 0;
|
|
|
+ match = strcmp(id1, name2) == 0;
|
|
|
bfree(name1);
|
|
|
bfree(name2);
|
|
|
return match;
|
|
@@ -267,6 +270,51 @@ int_fast32_t pulseaudio_get_source_info(pa_source_info_cb_t cb,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int_fast32_t pulseaudio_get_sink_info_list(pa_sink_info_cb_t cb, void *userdata)
|
|
|
+{
|
|
|
+ if (pulseaudio_context_ready() < 0)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ pulseaudio_lock();
|
|
|
+
|
|
|
+ pa_operation *op =
|
|
|
+ pa_context_get_sink_info_list(pulseaudio_context, cb, userdata);
|
|
|
+ if (!op) {
|
|
|
+ pulseaudio_unlock();
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ while (pa_operation_get_state(op) == PA_OPERATION_RUNNING)
|
|
|
+ pulseaudio_wait();
|
|
|
+ pa_operation_unref(op);
|
|
|
+
|
|
|
+ pulseaudio_unlock();
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int_fast32_t pulseaudio_get_sink_info(pa_sink_info_cb_t cb, const char *name,
|
|
|
+ void *userdata)
|
|
|
+{
|
|
|
+ if (pulseaudio_context_ready() < 0)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ pulseaudio_lock();
|
|
|
+
|
|
|
+ pa_operation *op = pa_context_get_sink_info_by_name(pulseaudio_context,
|
|
|
+ name, cb, userdata);
|
|
|
+ if (!op) {
|
|
|
+ pulseaudio_unlock();
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ while (pa_operation_get_state(op) == PA_OPERATION_RUNNING)
|
|
|
+ pulseaudio_wait();
|
|
|
+ pa_operation_unref(op);
|
|
|
+
|
|
|
+ pulseaudio_unlock();
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int_fast32_t pulseaudio_get_server_info(pa_server_info_cb_t cb, void *userdata)
|
|
|
{
|
|
|
if (pulseaudio_context_ready() < 0)
|
|
@@ -312,7 +360,7 @@ int_fast32_t pulseaudio_connect_playback(pa_stream *s, const char *name,
|
|
|
if (pulseaudio_context_ready() < 0)
|
|
|
return -1;
|
|
|
|
|
|
- size_t dev_len = strlen(name) - 8;
|
|
|
+ size_t dev_len = strlen(name);
|
|
|
char *device = bzalloc(dev_len + 1);
|
|
|
memcpy(device, name, dev_len);
|
|
|
|