Alsa 1.0.8 Digital Out

Post information here about bugs - please remember to provide an accurate and detailed description and, if possible, steps on how to replicate the issue.
Locked
faser
Newbie
Posts: 8
Joined: Sun Jan 30, 2005 8:00 am

Alsa 1.0.8 Digital Out

Post by faser »

Hi Shallax,

you have asked for feedback on Alsa 1.0.8.
I could NOT get digital out to work with 1.0.8
With the old Alsa it worked fine, after running magic unfortunally it is not working.

Did anybody else tested and had success?

How to go back to the old alsa?

Cheers

Faser
AK 47
Linux User
Posts: 16
Joined: Tue Sep 21, 2004 7:08 pm

Post by AK 47 »

I second that it doesn't work.
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

Well its about time _someone_ replied! Thanks - I'll look into it.

*Edit*
Apparently you need to pass "-ac hwac3" to mplayer to quote dmp.
The original Xbox adaptation of Gentoo
faser
Newbie
Posts: 8
Joined: Sun Jan 30, 2005 8:00 am

Post by faser »

Thanks Shallax,

will give it a try as soon as I am back home.

Just wonder as with the old driver it was not necesarry to tell mplayer anything.

Cheers

Frederik
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

The old driver was a hack... it just linked the two lines together which isnt what you're meant to do.
The original Xbox adaptation of Gentoo
faser
Newbie
Posts: 8
Joined: Sun Jan 30, 2005 8:00 am

Post by faser »

Hi Shallax,

seems mplayer is missing something.

Code: Select all

Forced audio codec: hwac3
Cannot find codec for audio format 0x55.
I googled but I could not find any hint.

Any tip from you?

Cheers

Frederik
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

I honestly have no idea. Tried updating mplayer?
The original Xbox adaptation of Gentoo
rolemaster
Newbie
Posts: 2
Joined: Wed Sep 22, 2004 9:11 pm

Post by rolemaster »

If I'm not mistaken this message looks like you are trying to decode an mp3 stream (format 0x55) as a raw ac3 stream.
The -ac hwac3 switch only work if you actually have a ac3 stream.

I was wrestling this problem myself last night and after a few hours trial and error I got it to work!

I have not installed alsa 1.0.8 with xbox-fixes through magic, since I'm still running a 2.4 kernel. Instead, I manually patched a alsa 1.0.8, compiled and installed. However, I don't see why this should not work for an alsa from magic.

First of all, be sure that mplayer is actually using alsa and not oss. This gives us:

Code: Select all

mplayer -ao alsa
Well, this doesn't give you any digital out either, because you have three devices on your nForce2 on board sound card; one analog playback, one capturing and one digital playback (numbered 0, 1 and 2).
By default the analog playback device is used. Ok, lets tell mplayer to use the digital one instead:

Code: Select all

mplayer -ao alsa:device=hw#0.2
This was the point where I was actually starting to get feed on my optical cable.

So, the next step was getting alsa to understand that the digital device should be defult. Then I stumbled over a thread handling just that on
http://www.gossamer-threads.com/lists/m ... ht=1#61265

To make it short, edit /etc/asound.conf with the following text:

Code: Select all

# Override the default output used by ALSA.
# If you do not override the default, your default
# device is identical to the (unmixed) analog device
# shown below. If you prefer mixed and/or digital
# output, uncomment the appropriate four lines below
# (only one slave.pcm line).
pcm.!default {
 type plug
## Uncomment the following to use mixed analog by default
# slave.pcm "dmix-analog"
# Uncomment the following to use unmixed digital by default
 slave.pcm "digital-hw"
## Uncomment the following to use mixed digital by default
# slave.pcm "dmix-digital"
}

# Alias for analog output on the nForce2 (hw:0,0)
# - This is identical to the device named "default"--which
# always exists and refers to hw:0,0 (unless overridden)
# - Therefore, we can specify "hw:0,0", "default", or "analog"
# to access analog output on the nForce2
pcm.analog {
type plug
slave.pcm "analog-hw"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.analog {
type hw
card 0
}

# Alias for (rate-converted) mixed analog output on the
# nForce2 (hw:0,0)
# - This will accept audio input--regardless of rate--and
# convert to the rate required for the dmix plugin
# (in this case 48000Hz)
pcm.mixed-analog {
type plug
slave.pcm "dmix-analog"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.mixed-analog {
type hw
card 0
}

# Alias for (rate-converted) digital (S/PDIF) output on the
# nForce2 (hw:0,2)
# - This will accept audio input--regardless of rate--and
# convert to the rate required for the S/PDIF hardware
# (in this case 48000Hz)
pcm.digital {
type plug
slave.pcm "digital-hw"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.digital {
type hw
card 0
}

# Alias for mixed (rate-converted) digital (S/PDIF) output on the
# nForce2 (hw:0,2)
# - This will accept audio input--regardless of rate--and
# convert to the rate required for the S/PDIF hardware
# (in this case 48000Hz)
pcm.mixed-digital {
type plug
slave.pcm "dmix-digital"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.mixed-digital {
type hw
card 0
}

# The following devices are not useful by themselves. They
# require specific rates, channels, and formats. Therefore,
# you probably do not want to use them directly. Instead use
# of of the devices defined above.

# Alias for analog output on the nForce2 (hw:0,0)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.analog-hw {
type hw
card 0
# The default value for device is 0, so no need to specify
}

# Control device (mixer, etc.) for the nForce2 card
ctl.analog-hw {
type hw
card 0
}

# Alias for digital (S/PDIF) output on the nForce2 (hw:0,2)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.digital-hw {
type hw
card 0
device 2
}

# Control device (mixer, etc.) for the nForce2 card
ctl.digital-hw {
type hw
card 0
}

# Direct software mixing plugin for analog output on
# the nForce2 (hw:0,0)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.dmix-analog {
type dmix
ipc_key 1234
slave {
pcm "analog-hw"
period_time 0
period_size 1024
buffer_size 4096
rate 48000
}
}

# Control device (mixer, etc.) for the nForce2 card
ctl.dmix-analog {
type hw
card 0
}

# Direct software mixing plugin for digital (S/PDIF) output
# on the nForce2 (hw:0,2)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.dmix-digital {
type dmix
ipc_key 1235
slave {
pcm "digital-hw"
period_time 0
period_size 1024
buffer_size 4096
rate 48000
}
}

# Control device (mixer, etc.) for the nForce2 card
ctl.dmix-digital {
type hw
card 0
} 
Now we have defined four virtual devices; analog, mixed-analog, digital and mixed-digital. By using the digital one in the default field in the configuration I managed to get digital out as default. I havent tried the mixed stuff since I'm only using gentoox for mythtv and have no need for mixing different alsa sources.

Ok, now we are back where we can actually use mplayer with:

Code: Select all

mplayer -ao alsa
Finally, if you have an ac3 stream you would probably like to use

Code: Select all

mplayer -ao alsa -ac hwac3
And if you want to play ac3 and non ac3 streams with the same command, you can tell mplayer to fall back to oss/alsa if no ac3 stream was found with:

Code: Select all

mplayer -ao alsa -ac hwac3,
Hope you find my experience useful and that it solves your problems.

Cheers,
Henrik
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

Excellent post!
The original Xbox adaptation of Gentoo
Locked