linux-pulseaudio: Use actual sink device names
Uses the sink device names rather than the "Monitor of" names. Closes jp9000/obs-studio#990master
parent
1bae6f3c18
commit
5813a4bfbf
|
@ -343,15 +343,15 @@ skip:
|
|||
/**
|
||||
* output info callback
|
||||
*/
|
||||
static void pulse_output_info(pa_context *c, const pa_source_info *i, int eol,
|
||||
static void pulse_output_info(pa_context *c, const pa_sink_info *i, int eol,
|
||||
void *userdata)
|
||||
{
|
||||
UNUSED_PARAMETER(c);
|
||||
if (eol != 0 || i->monitor_of_sink == PA_INVALID_INDEX)
|
||||
if (eol != 0 || i->monitor_source == PA_INVALID_INDEX)
|
||||
goto skip;
|
||||
|
||||
obs_property_list_add_string((obs_property_t*) userdata,
|
||||
i->description, i->name);
|
||||
i->description, i->monitor_source_name);
|
||||
|
||||
skip:
|
||||
pulse_signal(0);
|
||||
|
@ -368,8 +368,10 @@ static obs_properties_t *pulse_properties(bool input)
|
|||
OBS_COMBO_FORMAT_STRING);
|
||||
|
||||
pulse_init();
|
||||
pa_source_info_cb_t cb = (input) ? pulse_input_info : pulse_output_info;
|
||||
pulse_get_source_info_list(cb, (void *) devices);
|
||||
if (input)
|
||||
pulse_get_source_info_list(pulse_input_info, (void *) devices);
|
||||
else
|
||||
pulse_get_sink_info_list(pulse_output_info, (void *) devices);
|
||||
pulse_unref();
|
||||
|
||||
return props;
|
||||
|
|
|
@ -185,6 +185,28 @@ int_fast32_t pulse_get_source_info_list(pa_source_info_cb_t cb, void* userdata)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int_fast32_t pulse_get_sink_info_list(pa_sink_info_cb_t cb, void *userdata)
|
||||
{
|
||||
if (pulse_context_ready() < 0)
|
||||
return -1;
|
||||
|
||||
pulse_lock();
|
||||
|
||||
pa_operation *op = pa_context_get_sink_info_list(
|
||||
pulse_context, cb, userdata);
|
||||
if (!op) {
|
||||
pulse_unlock();
|
||||
return -1;
|
||||
}
|
||||
while (pa_operation_get_state(op) == PA_OPERATION_RUNNING)
|
||||
pulse_wait();
|
||||
pa_operation_unref(op);
|
||||
|
||||
pulse_unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int_fast32_t pulse_get_source_info(pa_source_info_cb_t cb, const char *name,
|
||||
void *userdata)
|
||||
{
|
||||
|
|
|
@ -93,6 +93,20 @@ void pulse_accept();
|
|||
*/
|
||||
int_fast32_t pulse_get_source_info_list(pa_source_info_cb_t cb, void *userdata);
|
||||
|
||||
/**
|
||||
* Request sink information
|
||||
*
|
||||
* The function will block until the operation was executed and the mainloop
|
||||
* called the provided callback function.
|
||||
*
|
||||
* @return negative on error
|
||||
*
|
||||
* @note The function will block until the server context is ready.
|
||||
*
|
||||
* @warning call without active locks
|
||||
*/
|
||||
int_fast32_t pulse_get_sink_info_list(pa_sink_info_cb_t cb, void *userdata);
|
||||
|
||||
/**
|
||||
* Request source information from a specific source
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue