XBMC PulseAudio passthrough support (including Nvidia) is available

  Thread Rating:
  • 3 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
cbxbiker61 Offline
Senior Member
Posts: 180
Joined: Nov 2010
Reputation: 2
Post: #1
Hey,

After I got a wonderful Onkyo/Polk Audio surround system I just had to have DTS/AC3 passthrough working. So I spent two weeks writing code getting it to happen. It's working great. I fixed a bug or two in XBMC's pulseaudio implementation on the way.

In the process I ported Ac3Filter to Linux (and renamed it AudioFilter, so as not to confuse the two (I changed too many interfaces and improved it's performance). Anyway AudioFilter has become my primary audio library with regard to passthrough support.

Download/build/install in order.

Build PulseAudio 1.1 with patch located at http://forum.xbmc.org/showthread.php?p=9...post938511.

wget http://freedesktop.org/software/pulseaud...1.1.tar.gz
apply patch mentioned above
follow directions in readme

git clone git://github.com/cbxbiker61/audiofilter.git
follow directions in readme
git clone git://github.com/cbxbiker61/xbmc.git
follow directions in readme
Configure xbmc with "Digital Surround 7.1 (HDMI)" selected in System Settings/Audio as passthrough device.
(This post was last modified: 2011-11-26 10:39 by cbxbiker61.)
find quote
shadow Offline
Senior Member
Posts: 178
Joined: Jan 2011
Reputation: 3
Post: #2
Any chance this supports DTS-HD MA and TrueHD? (I have a-lot of Blu-Ray backups)

So far I can only passthrough them in a rudimentary way (put them through ffmpeg then play with aplay) but that is more just to see my receiver say it is getting the formats since it loses video.

But seeing my receiver saw 7.1ch DTS-HD MA was nice.
find quote
cbxbiker61 Offline
Senior Member
Posts: 180
Joined: Nov 2010
Reputation: 2
Post: #3
shadow Wrote:Any chance this supports DTS-HD MA and TrueHD? (I have a-lot of Blu-Ray backups)

But seeing my receiver saw 7.1ch DTS-HD MA was nice.

I'm currently working on dts-hd format support. My first step is going to be to passthrough the dts-5.1 core. Then if I can get proper doc for the dts-hd format I'll try to pass that through as well. FFmpeg doesn't seem to grok dts-hd very well either, it's too slow and causes stutters.

It'll probably be a week or so before I can handle dts-hd streams in AudioFilter.
find quote
cbxbiker61 Offline
Senior Member
Posts: 180
Joined: Nov 2010
Reputation: 2
Post: #4
shadow Wrote:Any chance this supports DTS-HD MA and TrueHD? (I have a-lot of Blu-Ray backups)

So far I can only passthrough them in a rudimentary way (put them through ffmpeg then play with aplay) but that is more just to see my receiver say it is getting the formats since it loses video.

But seeing my receiver saw 7.1ch DTS-HD MA was nice.

What is the ffmpeg command you are using to mux the dts-hd file? I would like to analyze what it's doing with the the hd portion of the stream.

I'm playing dts-hd mkv's now (I'm stripping off the hd portion currently). I updated AudioFilter and the Xbmc AudioFilter patch. For some reason Xbmc doesn't like the dts timestamps in the dts-hd stream made with MakeMkv. I added a patch for Xbmc which fixes (works around) this.
find quote
shadow Offline
Senior Member
Posts: 178
Joined: Jan 2011
Reputation: 3
Post: #5
Here is a copy and paste from my email with the dev behind HD Audio passthrough in ffmpeg
Apparently it requires setting the rate to 4x the actual.

----

All other than DTS-HD :
ffmpeg -i inputfile -f spdif -acodec copy output.spdif

For DTS-HD (e.g.), to get more than the core you need:
ffmpeg -i inputfile -f spdif -dtshd_rate 768000 -acodec copy output.spdif
(768000 makes output suitable to be played back as 8 channel 192kHz)
(This post was last modified: 2011-03-15 00:52 by shadow.)
find quote
cbxbiker61 Offline
Senior Member
Posts: 180
Joined: Nov 2010
Reputation: 2
Post: #6
shadow Wrote:Here is a copy and paste from my email with the dev behind HD Audio passthrough in ffmpeg
Apparently it requires setting the rate to 4x the actual.

----

All other than DTS-HD :
ffmpeg -i inputfile -f spdif -acodec copy output.spdif

For DTS-HD (e.g.), to get more than the core you need:
ffmpeg -i inputfile -f spdif -dtshd_rate 768000 -acodec copy output.spdif
(768000 makes output suitable to be played back as 8 channel 192kHz)

I'm using ffmpeg svn from 20110311 it doesn't like the dtshd_rate option. They must've changed something.
find quote
shadow Offline
Senior Member
Posts: 178
Joined: Jan 2011
Reputation: 3
Post: #7
Here is what I am using if you wanted to try rolling back for a test.


FFmpeg version git-391a132, Copyright © 2000-2011 the FFmpeg developers
built on Mar 5 2011 23:47:38 with gcc 4.5.2
configuration:
libavutil 50. 39. 0 / 50. 39. 0
libavcodec 52.113. 2 / 52.113. 2
libavformat 52.102. 0 / 52.102. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1. 76. 0 / 1. 76. 0
libswscale 0. 12. 0 / 0. 12. 0


Also not when I played the files with aplay using the following command, even if I was only doing a DTS-HD MA 5,1 I still had to use -c8 (receiver reported only 5.1) when I tried -c6 I only got static (and the receiver reported 5.1 Linear PCM)

aplay -D hdmi:CARD=NVidia,DEV=3,AES0=6 -c8 -fs16_le -r192000 output.spdif
find quote
cbxbiker61 Offline
Senior Member
Posts: 180
Joined: Nov 2010
Reputation: 2
Post: #8
shadow Wrote:Here is what I am using if you wanted to try rolling back for a test.


FFmpeg version git-391a132, Copyright © 2000-2011 the FFmpeg developers
built on Mar 5 2011 23:47:38 with gcc 4.5.2
configuration:
libavutil 50. 39. 0 / 50. 39. 0
libavcodec 52.113. 2 / 52.113. 2
libavformat 52.102. 0 / 52.102. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1. 76. 0 / 1. 76. 0
libswscale 0. 12. 0 / 0. 12. 0


Also not when I played the files with aplay using the following command, even if I was only doing a DTS-HD MA 5,1 I still had to use -c8 (receiver reported only 5.1) when I tried -c6 I only got static (and the receiver reported 5.1 Linear PCM)

aplay -D hdmi:CARD=NVidia,DEV=3,AES0=6 -c8 -fs16_le -r192000 output.spdif

I think the problem is that I was using svn. Usually when the change source controls they delete the old repository and put a README in there to let you know about the new repository. Should be good to go now that I've rebuild the git version.
find quote
shadow Offline
Senior Member
Posts: 178
Joined: Jan 2011
Reputation: 3
Post: #9
If you didn't know about moving to git, I doubt you are going to know this since it just happened but it looks like due to fighting the ffmpeg is getting branched with most devs going to the new one. So you may have to start watching http://www.libav.org for updates that affect you.

I hope it doesn't turn into a problem where some features are one version and some in the other.


Source: ffmpeg-devel mailing list which I just skimmed so may not have the clearest understanding of what is happening.
find quote
topfs2 Offline
Team-Kodi Developer
Posts: 4,050
Joined: Dec 2007
Reputation: 10
Post: #10
I haven't reviewed the patches but so they don't fall into the void and under our radar (which is easy on the forum!) could you please fork our repo, patch it and send a pull request. Alternatively, but we prefer the first way, you can simply start a trac ticket with the patches.

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
cbxbiker61 Offline
Senior Member
Posts: 180
Joined: Nov 2010
Reputation: 2
Post: #11
topfs2 Wrote:I haven't reviewed the patches but so they don't fall into the void and under our radar (which is easy on the forum!) could you please fork our repo, patch it and send a pull request. Alternatively, but we prefer the first way, you can simply start a trac ticket with the patches.

Yeah, that sounds like a plan. PulseAudio has just recently created a branch to work out their long term pass-through support. I'll be testing against that branch as soon as I can. Not sure when Pulse will be ready to roll in their "new" pass-through code. Probably be a while, and then I'll be ready to submit "official" patches.

In the meantime, I'll be analyzing the dts-hd support. It is nice though that blu-ray rips with dts-hd will play today with the code as it stands.
find quote
cbxbiker61 Offline
Senior Member
Posts: 180
Joined: Nov 2010
Reputation: 2
Post: #12
OK, I've tested dts-hd passthrough with pulse and I've got the test working. Now it's just a matter of coding up a proper solution. Probably 4 to 5 days. Then I'll test with the pulseaudio passthrough branch and see if they've added a couple of features I want/need.
find quote
topfs2 Offline
Team-Kodi Developer
Posts: 4,050
Joined: Dec 2007
Reputation: 10
Post: #13
Yeah, if it can't be used in pulse which is found in our target distros I'd say its probably better to wait, we don't generally want to keep that type of development code in our mainline but a fork on github is the way to go about it I would say, that way other pulseaudio bleeding edge users can use your fork if they wish. When they merge in their branch and distros start having (or they will have it until our next release is going in) you can submit a pull request and we will pull it in if we want.

Awesome to see that the pulseaudio fellows finally are working on this, it has been such a pain that they haven't had support for this already.

Also, you might want to check out gnif's AE branch, this will be merged into mainline hopefully before eden so it might make sense if you target that with your patches. It is still in somewhat of a flux but most of the interfaces ought to be stable now.

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
shadow Offline
Senior Member
Posts: 178
Joined: Jan 2011
Reputation: 3
Post: #14
cbxbiker61 make sure you put a link to your repo when you make it. I will be trying it.
find quote
Philmatic Offline
Fan
Posts: 451
Joined: Nov 2009
Reputation: 0
Location: Santa Barbara, CA
Post: #15
Isn't this duplicating the work being done in the AudioEngine branch? Or do I not understand what you're talking about (Always possible Smile)?

Living Room: AppleTV 1st Gen / Broadcom CrystalHD / XBMC 12.3 Frodo on Crystalbuntu 2.0
Bedroom: AppleTV 1st Gen / Broadcom CrystalHD / XBMC 12.3 Frodo on Crystalbuntu 2.0
Home Office: AppleTV 1st Gen / Broadcom CrystalHD / XBMC 12.3 Frodo on Crystalbuntu 2.0
Windows Home Server: Intel Core i3-2100T / 8GB Ram / 32TB / MySQL / StableBit DrivePool on WHS 2011
find quote
Post Reply