[pulseaudio-discuss] Nvidia hdmi passthrough
Kelly Anderson
kelly at silka.with-linux.com
Fri Mar 4 19:47:56 PST 2011
diff --git a/src/Makefile.am b/src/Makefile.am
index 24e2f82..bb501fb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1131,7 +1131,9 @@ dist_alsapaths_DATA = \
modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf \
modules/alsa/mixer/paths/analog-output-mono.conf \
modules/alsa/mixer/paths/iec958-stereo-output.conf \
- modules/alsa/mixer/paths/iec958-passthrough-output.conf
+ modules/alsa/mixer/paths/iec958-passthrough-output.conf \
+ modules/alsa/mixer/paths/hdmi-stereo-output.conf \
+ modules/alsa/mixer/paths/hdmi-passthrough-output.conf
endif
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index fa07674..ad28c41 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1952,7 +1952,9 @@ static int path_verify(pa_alsa_path *p) {
{ "analog-output-mono", N_("Analog Mono Output") },
{ "analog-output-speaker", N_("Analog Speakers") },
{ "iec958-stereo-output", N_("Digital Output (IEC958)") },
- { "iec958-passthrough-output", N_("Digital Passthrough (IEC958)") }
+ { "iec958-passthrough-output", N_("Digital Passthrough (IEC958)") },
+ { "hdmi-stereo-output", N_("Digital Output (HDMI)") },
+ { "hdmi-passthrough-output", N_("Digital Passthrough (HDMI)") }
};
pa_alsa_element *e;
@@ -2995,7 +2997,10 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
{ "iec958-passthrough", N_("Digital Passthrough (IEC958)") },
{ "iec958-ac3-surround-40", N_("Digital Surround 4.0 (IEC958/AC3)") },
{ "iec958-ac3-surround-51", N_("Digital Surround 5.1 (IEC958/AC3)") },
- { "hdmi-stereo", N_("Digital Stereo (HDMI)") }
+ { "hdmi-stereo", N_("Digital Stereo (HDMI)") },
+ { "hdmi-passthrough", N_("Digital Passthrough (HDMI)") },
+ { "hdmi-ac3-surround-40", N_("Digital Surround 4.0 (HDMI/AC3)") },
+ { "hdmi-ac3-surround-51", N_("Digital Surround 5.1 (HDMI/AC3)") }
};
pa_assert(m);
@@ -3119,6 +3124,7 @@ static int profile_verify(pa_alsa_profile *p) {
{ "output:analog-mono+input:analog-mono", N_("Analog Mono Duplex") },
{ "output:analog-stereo+input:analog-stereo", N_("Analog Stereo Duplex") },
{ "output:iec958-stereo+input:iec958-stereo", N_("Digital Stereo Duplex (IEC958)") },
+ { "output:hdmi-stereo+input:hdmi-stereo", N_("Digital Stereo Duplex (HDMI)") },
{ "off", N_("Off") }
};
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 9ed4d4d..e10b99d 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1708,7 +1708,8 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v
}
/* FIXME: need automatic detection rather than hard-coded path */
- if (!strcmp(u->mixer_path->name, "iec958-passthrough-output")) {
+ if (!strcmp(u->mixer_path->name, "iec958-passthrough-output")
+ || !strcmp(u->mixer_path->name, "hdmi-passthrough-output")) {
u->sink->flags |= PA_SINK_PASSTHROUGH;
} else {
u->sink->flags &= ~PA_SINK_PASSTHROUGH;
diff --git a/src/modules/alsa/mixer/paths/hdmi-passthrough-output.conf b/src/modules/alsa/mixer/paths/hdmi-passthrough-output.conf
new file mode 100644
index 0000000..fe58f68
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/hdmi-passthrough-output.conf
@@ -0,0 +1,19 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+
+[Element HDMI]
+switch = mute
diff --git a/src/modules/alsa/mixer/paths/hdmi-stereo-output.conf b/src/modules/alsa/mixer/paths/hdmi-stereo-output.conf
new file mode 100644
index 0000000..fe58f68
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/hdmi-stereo-output.conf
@@ -0,0 +1,19 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+
+[Element HDMI]
+switch = mute
diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf
index cf207bd..ac95a15 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -141,6 +141,25 @@ channel-map = left,right
priority = 4
direction = output
+[Mapping hdmi-passthrough]
+device-strings = hdmi:%f
+channel-map = left,right
+direction = output
+paths-output = hdmi-passthrough-output
+priority = 5
+
+[Mapping hdmi-ac3-surround-40]
+device-strings = a52:%f
+channel-map = front-left,front-right,rear-left,rear-right
+priority = 2
+direction = output
+
+[Mapping hdmi-ac3-surround-51]
+device-strings = a52:%f
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
+priority = 3
+direction = output
+
; An example for defining multiple-sink profiles
#[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo]
#description = Foobar
More information about the pulseaudio-discuss
mailing list