未加星标

Kodi and ALSA on Fedora 25

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二04 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

My hardware configuration is Kodi HTPC connected to TV HDMI and HiFi stereo with analog input. Kodi is running as a standalone app so ALSA is preferred over PulseAudio (plus some other advantages). And last, Kodi configuration should have simple audio device selection.

In my previous installation of Kodi 15 / Fedora 22, I have used PulseAudio configured to send simultaneous audio to HDMI and analog output. Both audio outputs were never used at once and sound delay on HDMI was not a problem for my case. During Kodi 17 / Fedora 25 configuration, I figured that PulseAudio is actually not needed (someone wrote for PulseAudio as “a man in the middle” scenario) and therefore I tried to set Kodi directly with ALSA.

Here is my approach for Kodi ALSA configuration:

1) Disable pulseaudio service

Open /etc/pulse/client.conf and write two lines to the file end:

autospawn = no
daemon-binary = /bin/true

This will generally disable PulseAudio. On the other hand it’s possible to disable PulseAudio only for user. Copy client.conf file from /etc directory and add “autospawn = no” at the file end.

> cp /etc/pulse/client.conf /home/[user]/.config/pulse

More can be read at PulseAudio/HOW-TO: Disable PulseAudio and use ALSA (without removing PulseAudio) for Ubuntu

2) Set envirenoment variable AE_SINK in /home/kodi/.bashrc # User specific aliases and functions
AE_SINK=ALSA

With defined AE_SINK environment variable, Kodi will permanently use ALSA instead of PulseAudio (using PulseAudio in Kodi linux installation is default option). Just keep in mind that PulseAudio should be disabled otherwise Kodi will use PulseAudio no matter of AE_SINK variable.

3) Install “Audio Profiles” Kodi add-on (and set two audio profiles)

Audio Profiles is program add-on from offical Kodi repository. After installation, in “Audio Profiles” add-on settings, enable two profiles (HDMI and Analog) and save each profile with different audio output. Configuration is easy, first step is to open “Audio output device” in Kodi settings and set analog output:

System Settings -> Audio -> Audio output device
Kodi and ALSA on Fedora 25

Next step is to navigate to program add-on “Audio Profiles”, click on it and choose audio profile to save configuration. Repeat this action with HDMI output in audio settings.

4) Create keyboard shortcuts (for easy audio output switching)

Kodi uses XML keymap files in .kodi/userdata/keymaps/ directory. To create XML file, you should know XML format and key id. I used “Keymap Editor” add-on (from official repository) to create XML file with defined keys. In my case I want to toggle audio output with “z” and start radio with “r”. Here is complete keymap file for such scenario:

<?xml version="1.0"?>
PlayMedia(plugin://plugin.audio.radio_de/station/Antena+Zagreb) RunScript(script.audio.profiles,0) RunScript(script.audio.profiles,0) Full file location is /home/[user]/.kodi/userdata/keymaps/ .xml or in my case /home/kodi/.kodi/userdata/keymaps/kodi_shorcut.xml (only file extension is important and should be “xml”).

So, to prepare XML keymap file, install “Keymap Editor” add-on and create some randomly picked actions for “r” and “z” keys. After saving settings, gen.xml file will be created in .kodi/userdata/keymaps/ directory as one long line (no newlines and indentation). With xmllint command line utility, here is how to reformat and re-indent gen.xml file:

cat gen.xml | xmllint --format - > kodi_shorcut.xml

New file is now ready for customisation. Don’t forget to uninstall “Keymap Editor” because it could change prepared keymap file.

And last trick in 3 step how to find radio ID or plugin URL for PlayMedia:

install program add-on “Log Viewer”

start picked radio station

open Log Viewer add-on and find lines related to radio_de add-on

Wish you happy Kodi time :)

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: XMLLinuxUbuntu
分页:12
转载请注明
本文标题:Kodi and ALSA on Fedora 25
本站链接:http://www.codesec.net/view/520609.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(37)