SHA256
1
0
forked from pool/pulseaudio
pulseaudio/pulseaudio-bnc480113-default-sink.patch

42 lines
1.4 KiB
Diff
Raw Normal View History

Index: pulseaudio-0.9.15/src/pulsecore/namereg.c
===================================================================
--- pulseaudio-0.9.15.orig/src/pulsecore/namereg.c
+++ pulseaudio-0.9.15/src/pulsecore/namereg.c
@@ -244,14 +244,35 @@ pa_source* pa_namereg_set_default_source
pa_sink *pa_namereg_get_default_sink(pa_core *c) {
pa_sink *s;
+ pa_sink *best_sink;
+ uint32_t idx;
pa_assert(c);
+ pa_log_info ("Enter - pa_namereg_get_default_sink");
if (c->default_sink)
return c->default_sink;
- if ((s = pa_idxset_first(c->sinks, NULL)))
+ pa_log_info ("trying to chose best default sink");
+ s = NULL;
+ for (best_sink = pa_idxset_first(c->sinks, &idx); best_sink; best_sink = pa_idxset_next(c->sinks, &idx)) {
+ char * proplist = pa_proplist_to_string(best_sink->proplist);
+ pa_log_info ("%s", proplist);
+ if (!strstr(proplist, "HDMI") && !strstr(proplist, "SPDIF") && !strstr(proplist, "Digital")) {
+ pa_log_info ("found non HDMI and non SPDIF and non Digital");
+ s = best_sink;
+ pa_xfree(proplist);
+ break;
+ }
+ pa_xfree(proplist);
+ }
+ if (s)
return pa_namereg_set_default_sink(c, s);
+ else
+ {
+ if ((s = pa_idxset_first(c->sinks, NULL)))
+ return pa_namereg_set_default_sink(c, s);
+ }
return NULL;
}