kodi: remove amcodec sysfs passthrough workaround

This commit is contained in:
Jonas Karlman 2016-10-07 18:21:59 +02:00
parent e1f33a285b
commit e1488fb4b9
5 changed files with 96 additions and 202 deletions

View File

@ -0,0 +1,24 @@
From 370709ff0bd108a8bf66656e1424c38341e0b0ac Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Fri, 7 Oct 2016 13:42:10 +0200
Subject: [PATCH] AESinkALSA: force default device for non-passthrough
---
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
index 6a9066b..4d7f85d 100644
--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
@@ -535,9 +535,8 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device)
m_passthrough = false;
}
#if defined(HAS_LIBAMCODEC)
- if (aml_present())
+ if (!m_passthrough && aml_present())
{
- aml_set_audio_passthrough(m_passthrough);
device = "default";
}
#endif

View File

@ -1,103 +0,0 @@
From a49dd2258d46279466d5aaba44d1f0ee06253ff2 Mon Sep 17 00:00:00 2001
From: kszaq <kszaquitto@gmail.com>
Date: Sun, 4 Sep 2016 00:51:03 +0200
Subject: [PATCH] [aml] Multichannel-PCM and HD Audio passthrough
1. If we want passthrough, is should be redirected to device 1. To make sure device 1 output is enabled, set device 0 to stereo.
2. Set digital_codec parameter to notify sound driver about audio format.
3. Amlogic wants 48kHz for EAC3 passthrough.
4. Identify Amlogic audio output as HDMI.
---
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 59 +++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 4 deletions(-)
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
index 6a9066b..9741e3e 100644
--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
@@ -38,6 +38,7 @@
#include "settings/AdvancedSettings.h"
#if defined(HAS_LIBAMCODEC)
#include "utils/AMLUtils.h"
+#include "utils/SysfsUtils.h"
#endif
#ifdef TARGET_POSIX
@@ -534,13 +535,57 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device)
{
m_passthrough = false;
}
-#if defined(HAS_LIBAMCODEC)
- if (aml_present())
+
+ if (device.find("M8AUDIO") != std::string::npos)
{
+ int aml_digital_codec = 0;
+
+ if (m_passthrough)
+ {
+ /* Open 2 channels at device 0 to enable device 1 output to HDMI */
+ ALSAConfig m_inconfig, m_outconfig;
+ snd_config_t *config;
+ m_inconfig = inconfig;
+ m_inconfig.channels = 2;
+ snd_config_copy(&config, snd_config);
+ OpenPCMDevice("hw:AMLM8AUDIO,0", "", m_inconfig.channels, &m_pcm, config);
+ snd_config_delete(config);
+ InitializeHW(m_inconfig, m_outconfig);
+
+ /* Passthrough is supported only by device 1 */
+ device = "hw:AMLM8AUDIO,1";
+
+ switch(format.m_streamInfo.m_type)
+ {
+ case CAEStreamInfo::STREAM_TYPE_AC3:
+ aml_digital_codec = 2;
+ break;
+
+ case CAEStreamInfo::STREAM_TYPE_DTS_512:
+ case CAEStreamInfo::STREAM_TYPE_DTS_1024:
+ case CAEStreamInfo::STREAM_TYPE_DTS_2048:
+ case CAEStreamInfo::STREAM_TYPE_DTSHD_CORE:
+ aml_digital_codec = 3;
+ break;
+
+ case CAEStreamInfo::STREAM_TYPE_EAC3:
+ aml_digital_codec = 4;
+ inconfig.sampleRate = 48000;
+ break;
+
+ case CAEStreamInfo::STREAM_TYPE_DTSHD:
+ aml_digital_codec = 8;
+ break;
+
+ case CAEStreamInfo::STREAM_TYPE_TRUEHD:
+ aml_digital_codec = 7;
+ break;
+ }
+ }
+
aml_set_audio_passthrough(m_passthrough);
- device = "default";
+ SysfsUtils::SetInt("/sys/class/audiodsp/digital_codec", aml_digital_codec);
}
-#endif
if (inconfig.channels == 0)
{
@@ -1550,6 +1595,12 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev
info.m_dataFormats.push_back(i);
}
+ if (info.m_displayName.find("M8AUDIO") != std::string::npos)
+ {
+ info.m_displayNameExtra = "HDMI";
+ info.m_deviceType = AE_DEVTYPE_HDMI;
+ }
+
if (info.m_deviceType == AE_DEVTYPE_HDMI)
{
// we don't trust ELD information and push back our supported formats explicitely
--
1.8.3.1

View File

@ -3,18 +3,6 @@
#
AML-M8AUDIO.pcm.default {
@args [ CARD ]
@args.CARD { type string }
type plug
slave.pcm {
@func concat
strings [ "dmix:" $CARD ]
}
}
<confdir:pcm/front.conf>
AML-M8AUDIO.pcm.front.0 {
@args [ CARD ]
@args.CARD { type string }
type hw
@ -23,30 +11,33 @@ AML-M8AUDIO.pcm.front.0 {
format S32_LE
}
<confdir:pcm/surround71.conf>
<confdir:pcm/hdmi.conf>
AML-M8AUDIO.pcm.surround71.0 {
@args [ CARD ]
AML-M8AUDIO.pcm.hdmi.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD { type string }
type route
ttable.0.0 1
ttable.1.1 1
ttable.2.6 1
ttable.3.7 1
ttable.4.3 1
ttable.5.2 1
ttable.6.4 1
ttable.7.5 1
@args.AES0 { type integer }
@args.AES1 { type integer }
@args.AES2 { type integer }
@args.AES3 { type integer }
type hooks
slave.pcm {
type plug
slave {
pcm {
type hw
card $CARD
device 0
type hw
card $CARD
device 1
format S16_LE
}
hooks.0 {
type ctl_elems
hook_args [
{
interface MIXER
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
channels 8
format S32_LE
}
]
}
}

View File

@ -3,18 +3,6 @@
#
AML-M8AUDIO.pcm.default {
@args [ CARD ]
@args.CARD { type string }
type plug
slave.pcm {
@func concat
strings [ "dmix:" $CARD ]
}
}
<confdir:pcm/front.conf>
AML-M8AUDIO.pcm.front.0 {
@args [ CARD ]
@args.CARD { type string }
type hw
@ -23,30 +11,33 @@ AML-M8AUDIO.pcm.front.0 {
format S32_LE
}
<confdir:pcm/surround71.conf>
<confdir:pcm/hdmi.conf>
AML-M8AUDIO.pcm.surround71.0 {
@args [ CARD ]
AML-M8AUDIO.pcm.hdmi.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD { type string }
type route
ttable.0.0 1
ttable.1.1 1
ttable.2.6 1
ttable.3.7 1
ttable.4.3 1
ttable.5.2 1
ttable.6.4 1
ttable.7.5 1
@args.AES0 { type integer }
@args.AES1 { type integer }
@args.AES2 { type integer }
@args.AES3 { type integer }
type hooks
slave.pcm {
type plug
slave {
pcm {
type hw
card $CARD
device 0
type hw
card $CARD
device 1
format S16_LE
}
hooks.0 {
type ctl_elems
hook_args [
{
interface MIXER
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
channels 8
format S32_LE
}
]
}
}

View File

@ -3,18 +3,6 @@
#
AML-M8AUDIO.pcm.default {
@args [ CARD ]
@args.CARD { type string }
type plug
slave.pcm {
@func concat
strings [ "dmix:" $CARD ]
}
}
<confdir:pcm/front.conf>
AML-M8AUDIO.pcm.front.0 {
@args [ CARD ]
@args.CARD { type string }
type hw
@ -23,30 +11,33 @@ AML-M8AUDIO.pcm.front.0 {
format S32_LE
}
<confdir:pcm/surround71.conf>
<confdir:pcm/hdmi.conf>
AML-M8AUDIO.pcm.surround71.0 {
@args [ CARD ]
AML-M8AUDIO.pcm.hdmi.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD { type string }
type route
ttable.0.0 1
ttable.1.1 1
ttable.2.6 1
ttable.3.7 1
ttable.4.3 1
ttable.5.2 1
ttable.6.4 1
ttable.7.5 1
@args.AES0 { type integer }
@args.AES1 { type integer }
@args.AES2 { type integer }
@args.AES3 { type integer }
type hooks
slave.pcm {
type plug
slave {
pcm {
type hw
card $CARD
device 0
type hw
card $CARD
device 1
format S16_LE
}
hooks.0 {
type ctl_elems
hook_args [
{
interface MIXER
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
channels 8
format S32_LE
}
]
}
}