Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] Howto: how to play back vdr recodings with AC3 sound.
Step 1: Get a sound card that has an SPDIF output.
I bought a Leadtek Winfast 4Xsound (http://www.leadtek.com/4xsound.htm)
from german dealer Atelco (http://www.atelco.de).
It has both electrical and optical (via a second slot cover)
SPDIF outputs and optical SPDIF inputs.
The package also contains a 2m TOSLink optical cable and an
adapter from TOSLink to Miniplug.
With all this stuff, I consider the price (DM 65) to be
quite a bargain. Unfortunaltely, Atelco did not have
the card in stock in Hamburg nor in their shipping center,
so I had to go all the way to Bremen to buy one.
The card is based on the CMI 8738 chip, see www.cmedia.com.tw
for details.
Step 2: Install the latest beta ALSA drivers, library and utilities.
At the time I wrote this, these were
* ALSA driver 0.9.0beta6 from ftp://ftp.alsa-project.org/pub/driver/alsa-driver-0.9.0beta6.tar.bz2
* ALSA library 0.9.0beta6 from ftp://ftp.alsa-project.org/pub/lib/alsa-lib-0.9.0beta6.tar.bz2
* ALSA utils 0.9.0beta6 from ftp://ftp.alsa-project.org/pub/utils/alsa-utils-0.9.0beta6.tar.bz2
You may want to check http://www.alsa-project.org for even newer versions.
If you are feeling adventuresome, you may also try to check out their
latest CVS versions from http://sourceforge.net/projects/alsa
At least on my SuSE 7.2 system, this turned out to be complicated,
as autoconf appears not to be set up correctly for this purpose in
SuSE 7.2.
See http://linuxtv.org/mailinglists/linux-dvb/msg12066.html for
a solution that worked for me. Your mileage may vary, please do not
ask me if you have trouble with autoconf on your system, I am not
an autoconf expert.
Step 3: Activate the driver module.
Do not try to activate the driver module via Yast2.
At least the Yast2 in my SuSE 7.2 system could not handle the
new 0.9beta driver.
Simply put the following into your modules.conf manually:
# ALSA native device support
alias char-major-116 snd
options snd snd_major=116 snd_cards_limit=1
alias snd-card-0 snd-card-cmipci
# OSS/Free setup
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
Now you should be able to play sound.
Do not proceed to the next step before you have verified that you can
play PCM sound through your new sound card.
Step 4: Connect the SPDIF output of the DVB card to
the SPDIF input of the sound card.
Obviously, it would be a hazzle to switch your receiver from an analog
to a digital input all the time. So it would be best to play back not
only sound from AC3 recordings via the digital connection, but
live sound and sound from non-AC3 recordings as well.
At least the old DVB cards have an electrical SPDIF output that
can be directly connected to the 4xSound card's electrical SPDIF input.
That input is located on the optical module (additional slot cover) that
comes with the card. It is labelled "J1-SPDIF IN". See Page 5 of the
sound card manual. Connect the signal pin of J1 with the SPDIF out
pin of the DVB card (see http://linuxtv.org/mailinglists/linux-dvb/msg01086.html).
If your version of the DVB card does not have an SPDIF output, you
can of course also connect the DVB card's line output to the sound
card's line input. The following text assumes that you have made the
internal connection.
Step 5: Set up the ALSA mixing parameters.
You can use the interactive (ncurses) tool alsamixer or the command line
tool amixer to set up the ALSA mixing parameters.
See the "alsamixer" and "amixer" man pages.
I have muted '3D Control - Switch', 'Synth', 'Line', 'Line-In As Rear',
'CD', 'Mic', 'Mic Boost', 'IEC958 Copyright', 'IEC958 In Valid',
'IEC958 Loop', 'IEC958 Out To DAC', 'Aux', 'Analog Four Channel',
'Exchange DAC' and I have unmuted everything else.
Step 6: Install the specially patched ac3dec tool.
As you may have heard, the Dolby Laboratories are threatening to sue
everyone who offers an AC3 decoder without paying licenses to them.
In spite of it's name, we are not using the ac3dec tool as an AC3
decoder. We use this tool to transmit the AC3 stream to the IEC958
output of the sound card. The actual decoding takes place in your
receiver, which of course must have an SPDIF input and must be able
to decode AC3.
You can find ac3dec in the ac3-tools directory in the ALSA CVS
repository on sourceforge.
There is one problem in the interaction between vdr, ac3dec and the
ALSA system: vdr starts up the "external AC3 sound tool" supplied
via the -a vdr command line parameter, even if the recording to be
played back does not contain any AC3 sound. ac3dec, as it currently
exists in the sourceforge CVS repository, mutes everything else (in
particular, our normal DVB sound), as soon as it starts up.
Consequently, when you run vdr with the -a "ac3dec -C" parameter,
you will not hear any sound when playing back non-AC3 recordings.
There are three solution alternatives:
1) Change vdr to only bring up ac3dec when there is data for it.
This may not be trivial, as parts of one recording may contain
AC3 sound, while other parts of the same recording may not.
But I am sure that this problem can be solved and that this
solution may turn out to be the best one in the long run.
2) Wrap a shell script around the ac3dec call that reads one byte
from stdin (dd of=/dev/null bs=1 count=1) before actually starting
ac3dec. I have tried that. It works.
3) patch ac3dec so it does not mute anything before it has actually
received the first data block.
Robert Schneider has developed such a patch.
Here is the essential part of it:
--- ac3dec.c-original Wed Aug 8 20:49:04 2001
+++ ac3dec.c Wed Aug 8 20:52:05 2001
@@ -209,18 +209,24 @@
output_play(ac3_frame->audio_data, 256 * 6);
} while((ac3_frame = ac3_decode_frame()));
} else {
+ int do_open = 1;
uint_8 *start, *end;
init_spdif();
- if (output_open(&out_config) < 0) {
- fprintf(stderr, "Output open failed\n");
- exit(EXIT_FAILURE);
- }
signal(SIGINT, ac3dec_signal_handler);
signal(SIGTERM, ac3dec_signal_handler);
signal(SIGABRT, ac3dec_signal_handler);
while (fill_buffer(&start, &end) > 0)
+ {
+ if (do_open) {
+ if (output_open(&out_config) < 0) {
+ fprintf(stderr, "Output open failed\n");
+ exit(EXIT_FAILURE);
+ }
+ do_open = 0;
+ }
if (output_spdif(start, end, quiet) < 0)
break;
+ }
}
output_close();
fclose(in_file);
This is the solution that I am using at the moment.
Step 7: Run vdr with the "-a 'ac3dec -C'" parameter.
As an example, you can use
./runvdr -c . -v /video -a "'ac3dec -C'"
to run vdr.
Disclaimer: The above steps worked for me. Your mileage may vary.
In particular, I would assume that the above works with few
or maybe even no other sound cards than the one I tried.
Do it all at your own risk.
I wrote this howto in the hope that it will be useful,
but no guarantees of any kind are implied.
Please do not swamp me with e-mail. I know little more
about the matter than I wrote above. Other knowledgable
people on the linux-dvb mailing list may be able to help
you better than I could, so please ask the list for help
if you get stuck.
Carsten.
--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.
Home |
Main Index |
Thread Index