Digital audio via S/PDIF
#1
Well, I received and installed my Chaintech AV710 and after spending some time with the ALSA configuration, I was able to get most of the stuff I tried sending audio over SPDIF, including AC3 audio via mplayer. That's the standalone version of mplayer, not XBMC.

I started XBMC and decided to see what happened. To my surprise, 2 channel audio worked fine. MP3s through the audio player and a few videos with two channel AAC audio. I did not try any videos with 2 channel AC3 audio. Videos with 5.1 AC3 audio played without audio.

In case anyone else wants to try, here's a summary of what I did:

First, I disabled the onboard audio from the BIOS.

Here's some info about my card from ALSA:
Code:
herg@leela:~/projects$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AV710 [Chaintech AV-710], device 0: ICE1724 [ICE1724]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: AV710 [Chaintech AV-710], device 1: IEC1724 IEC958 [IEC1724 IEC958]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

My asound.conf file:
Code:
herg@leela:~/projects$ cat /etc/asound.conf
pcm.envy_spdifdmix {
        type dmix
        ipc_key 1337
        slave {
                pcm "hw:0,1"
                format S32_LE
                rate 44100
        }
}

pcm.envy_spdif {
        type plug
        slave {
                pcm envy_spdifdmix
        }
}

pcm.!default {
        type plug
        slave {
                pcm envy_spdifdmix
        }
}

# For ogle
#
pcm.!spdif {
        type plug
        slave {
                pcm "hw:0,1"
                format S32_LE
        }
}

# For mplayer ao (mplayer -ac hwac3 -ao alsa1x:mplayer)
# For vlc, use mplayer as alsa device
#
pcm.!iec958 {
        type plug
        slave {
                pcm "hw:0,1"
                format S32_LE
        }
}

pcm.mplayer {
        type plug
        slave {
                pcm "hw:0,1"
                format S32_LE
        }
}

Output from mplayer. It says 2ch, but it plays 6ch. I'm guessing mplayer doesn't do any decoding, so it doesn't know the number of channels.
Code:
herg@leela:/share/disk3/MoviesArchive/Cars$ mplayer -aspect 4:3 -ac hwac3 Cars.iso
MPlayer 2:1.0~rc1-0ubuntu9.1 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Celeron(R) CPU 2.66GHz (Family: 15, Model: 4, Stepping: 1)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not open config files /home/herg/.lircrc and /etc/lirc//lircrc
mplayer: No such file or directory
Failed to read LIRC config file ~/.lircrc.

Playing Cars.iso.
MPEG-PS file format detected.
VIDEO:  MPEG2  720x480  (aspect 3)  29.970 fps  9800.0 kbps (1225.0 kbyte/s)
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] Can't open /dev/fb0: No such file or directory.
[VO_3DFX] Unable to open /dev/3dfx.
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred colorspace: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
==========================================================================
Forced audio codec: hwac3
Opening audio decoder: [hwac3] AC3/DTS pass-through S/PDIF
No accelerated IMDCT transform found
hwac3: switched to AC3, 448000 bps, 48000 Hz
AUDIO: 48000 Hz, 2 ch, ac3, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [hwac3] afm: hwac3 (AC3 through S/PDIF)
==========================================================================
AO: [alsa] 48000Hz 2ch ac3 (1 bytes per sample)
Starting playback...
VDec: vo config request - 720 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 720x480 => 720x540 Planar YV12
Reply
#2
I spent a little time this weekend and got AC3 passthrough working with DVDPlayer in XBMC. I haven't checked to make sure I didn't break anything (Analog) and the AC3/DTS radios on the audio select GUI screen are just hardcoded. It does, however, let me watch DVD iso files with DD5.1 audio.

If it is of interest, I can submit a patch, but be forewarned, it is not a robust solution.
Reply
#3
the patch will be interesting, even if just as a guide. please submit
Reply
#4
Done:
http://sourceforge.net/tracker/index.php...tid=581840
Reply
#5
already looked at it. it looks fine to me, we just need to add some /proc/asound processing to make sure the device is there (plus its not called spdif on all cards iirc)
Reply
#6
Herg,
I have been waiting for this. Thanks a LOT! Do I need some special settings in my .asoundrc? I get the following error in xbmc.log.

16:01:03 T:2930609040 M: 80109568 NOTICE: Creating audio device with codec id: 86020, channels: 2, sample rate: 48000, pass-through
16:01:03 T:2930609040 M: 80109568 ERROR: CALSADirectSound - pcm_open, alsa error: Device or resource busy

Thanks
Reply
#7
Err.. Had forgotten to do XBMC_AUDIODEV=spdif.
I don't see the errors in xbmc.log now but no audio either.

And I changed the audio settings to use digital out.
Reply
#8
You shouldn't have to do XBMC_AUDIODEV=spdif, but I do have to do SDL_AUDIODRIVER=ALSA. I think what's happening is that SDL is used for navigation sounds and interferes with writing directly to the spdif. I also have nothing special in .asoundrc.

Can you get passthrough to work with mplayer outside XBMC?
Reply
#9
Thanks for getting back so quickly. I have spdif working wth mplayer and xine.
I did both XBMC_AUDIODEV=spdif and SDL_AUDIODRIVER=ALSA.
Reply
#10
On further investigation I figured mplayer and xine were not working either. Finally figured it was a receiver setting.. Duh!!
Anyway now XBMC is working just fine with spdif out!!!
THANK YOU VERY MUCH!!!
Reply
#11
so far i've heard turtle beach riviera (CMI8738 alsa) and Chaintech av710 which is envy HT-S? the cmi8738 is hella cheap (and the drivers are hella lame) but what the heck.

I'm going to run both VISTA and Linux so i picked up a CMI8770 (which oddly is seen as cmi8738 in linux grrr) since it has the unique ability to pipe everything out in DD or DTS. I am not sure if this is software driver in windows or what.

It would be cool if we would "WINE-WRAP" the audio and video to rob VISTA's excellent ability to do multimedia using technology that will never be open-sourced (DD/DTS encoding).

Post up other cheap card solutions please. Sadly my mobo is sooo cheap they put intel hd audio onboard but only a stereo analog 2 ch output (Grr). So i'll throw all the soundcards into the mix and let ALSA sort it out Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Digital audio via S/PDIF0