aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-02-29 23:52:10 -0800
committerChris Robinson <[email protected]>2012-02-29 23:52:10 -0800
commitb192165fb472eca57e7186afb91e1bbdfb7cb37b (patch)
tree6b5eee261a29c49da08ae58c3f4ae40840f12fc2 /Alc
parentf887f4efdddacc85b80e77fa3c40af3662e3e145 (diff)
Look for and enumerate the default PulseAudio source first
Diffstat (limited to 'Alc')
-rw-r--r--Alc/backends/pulseaudio.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index 4e5a33c6..5659e44e 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -108,6 +108,7 @@ MAKE_FUNC(pa_channel_map_equal);
MAKE_FUNC(pa_context_get_server_info);
MAKE_FUNC(pa_context_get_sink_info_by_name);
MAKE_FUNC(pa_context_get_sink_info_list);
+MAKE_FUNC(pa_context_get_source_info_by_name);
MAKE_FUNC(pa_context_get_source_info_list);
MAKE_FUNC(pa_operation_get_state);
MAKE_FUNC(pa_operation_unref);
@@ -175,6 +176,7 @@ MAKE_FUNC(pa_stream_begin_write);
#define pa_context_get_server_info ppa_context_get_server_info
#define pa_context_get_sink_info_by_name ppa_context_get_sink_info_by_name
#define pa_context_get_sink_info_list ppa_context_get_sink_info_list
+#define pa_context_get_source_info_by_name ppa_context_get_source_info_by_name
#define pa_context_get_source_info_list ppa_context_get_source_info_list
#define pa_operation_get_state ppa_operation_get_state
#define pa_operation_unref ppa_operation_unref
@@ -363,6 +365,7 @@ static ALCboolean pulse_load(void) //{{{
LOAD_FUNC(pa_context_get_server_info);
LOAD_FUNC(pa_context_get_sink_info_by_name);
LOAD_FUNC(pa_context_get_sink_info_list);
+ LOAD_FUNC(pa_context_get_source_info_by_name);
LOAD_FUNC(pa_context_get_source_info_list);
LOAD_FUNC(pa_operation_get_state);
LOAD_FUNC(pa_operation_unref);
@@ -772,7 +775,30 @@ static void probe_devices(ALboolean capture)
o = pa_context_get_sink_info_list(context, sink_device_callback, loop);
}
else
+ {
+ pa_sample_spec spec;
+ pa_stream *stream;
+
+ spec.format = PA_SAMPLE_S16NE;
+ spec.rate = 44100;
+ spec.channels = 1;
+
+ stream = connect_record_stream(NULL, loop, context, 0, NULL,
+ &spec, NULL);
+ if(stream)
+ {
+ o = pa_context_get_source_info_by_name(context, pa_stream_get_device_name(stream), source_device_callback, loop);
+ while(pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+ pa_threaded_mainloop_wait(loop);
+ pa_operation_unref(o);
+
+ pa_stream_disconnect(stream);
+ pa_stream_unref(stream);
+ stream = NULL;
+ }
+
o = pa_context_get_source_info_list(context, source_device_callback, loop);
+ }
while(pa_operation_get_state(o) == PA_OPERATION_RUNNING)
pa_threaded_mainloop_wait(loop);
pa_operation_unref(o);