vdr-bitstreamout(5)

NAME
bitstreamout - audio streams out to S/P-DIF of sound cards

SYNOPSIS
Start of plugin bitstreamout:
vdr [...] -P 'bitstreamout [-o] [-mscript]'

Configuration of plugin bitstreamout by Setup menu:
Setup
+-> Plugins
+-> bitstreamout

    Option | Default value | Possible values
    On/Off | On | On/Off
    Mp2Enable | On | On/Off
    Mp2Out | Dither | Round/Dither/Nonlinear
    Card | 0 | [0 ... 7]
    Device | 2 | [0 ... 31]
    Delay | 0 | [0 ... 32]
    LiveDelay | 0 | [0 ... 32]
    PCMinitial | 0 | [4 ... 12]
    Mp2offset | 0 | [0 ... 12]
    IEC958 | Con | Con/Pro
    VariableIO | yes | Yes/No
    MemoryMap | no | Yes/No

This is a VDR plugin to redirect AC-3, DTS and MP2 Audio (Mpeg Audio Layer II) endcode audio data frames or linear PCM decoded audio frames towards to an external decoder/amplifier through the S/P-DIF interface of a sound card. Encoded audio frames will not be decoded due Copyright/License restrictions of the required algorithms but embedded into PCM frames accordingly to IEC 61937 for loop through the result over a sound card to the appropriate hard ware.

The loop through of linear PCM get from VDR works only for real Audio PCM. For nonlinear PCM, e.g. as a result of an external encoded audio frame wrapper, may work only if the correct frame start is found. This may not work for all PCM streams and can destroy the high frequency drivers of your loudspeakers (see WARNING).

Bitstreamout is written for the Advanced Linux Sound Architecture (ALSA). It was tested on a Trident 4DWave NX and CMIPCI based card. A DTT2500 and VSA-E07 was hooked up to the S/P-DIF interface. It should work with most any external AC-3 decoder. Other sound cards may work, please check the ALSA site http://www.alsa-project.org for S/P-DIF out capable cards that are supported.

WARNING
This program is distributed in the hope that it will be useful, but Without Any Warranty; without even the implied warranty of Merchantability or Fitness For A Particular Purpose. See the GNU General Public License for more details.

OPTIONS

  The plugin
The plugin its self can take two options:

-m, --mute=script
    use this script script for switching the S/P-DIF on or off. The script should be able to read on option key word which is on either off for enabling respectively disabling the S/P-DIF interface of the sound card. This is useful if the S/P-DIF out of the DVB card is routed through the S/P-DIF interface of the sound card. Such a script can be written `in' bash(1) using amixer(1).

-o, --onoff
    to enable an control entry in the main menu of VDR to change the values of the plugin. This menu includes the possibility to switch between audio tracks (AC-3 and MP2 Audio). An further menu is available under the main configuration at point plugins. On or Off.

  The configuration setup
The configuration setup (see SYNOPSIS) has the following options:

On/Off
    Enable or disable the bitstreamout plugin.

IEC958 (Con,Pro)
    If Con is chosen the IEC(60)958 (S/P-DIF) consumer mode (this is the default) is used. For Pro the IEC(60)958 (AES-3) professional mode is used. The correct and supported value may depend on the used sound card.

Card [0...7]
    The given number is one of the card numbers provided by ALSA at /proc/asound/card<#>

Device [0...31]
    Select the hardware device of the chosen card above by the numbers provided by ALSA at /proc/asound/card<#>/pcm<#>p/.

MemoryMap (Yes,No)
    The setting yes Force bitstreamout to use memory mapping for PCM data transfer. Whereas no switch to ioctl based PCM data transfer which is the default. The correct supported value may depend on the used sound card. Be carefully, some ALSA driver may not be able to use memory mapping for AC-3 data.

Delay/LiveDelay [0...32]
    With this you can set the initial delay time of the sound to get video and audio synchrony in replay and live mode at your view position. Choose a number of silent stereo PCM frames with 10ms delay aka 33cm for each frame. These frames will used before the first audio frame from VDR is forwarded to the sound card. Possible values are 0 upto 32, default are 0 pieces aka 0cm which is prefect for C-Media PCI CMI873 sound card and Pioneer VSA-E07.

PCMinitial [4...12]
    The numbers of initial PCM wait frames to reset the parser and decoder of your A/V receiver at LiveTV. As larger the number as more your A/V receiver can synchronize but only up to the maximal filling grade of its input buffer. If the value is to large you will hear a large silent pause. You should then decrease the value. A good value for, e.g. Pioneer VSA-E07 is 6. Small values may cause an underrun of the hardware buffer of your soundcard, which can be heard as a short staccato or reset (see VariableIO) initial after a channel switch.

VariableIO (Yes,No)
    Handle buffer underruns of the sound cards buffer in the case that the reference clock of the card is faster than the rate of the DVB live stream. Overruns can not be handled due to the problem that every audio frame represents exactly, e.g. in the case of AC-3 1536 16 bit audio sample and no frame nor sample can be dropped without noisy stream leaks (on the other sides it seems possible in the case of an underrun to send send some frames twice for filling the sound cards buffer).

Mp2Enable (On,Off)
    Enable or disable the MP2 part of the bitstreamout plugin. Not that if you use hardware loop through from the DVB S/P-DIF out to the sound cards S/P-DIF in connector you should disable this feature. This because the hardware of the DVB card can do a much better synchronization of Audio and Video.

Mp2Out (Round,Dither,Nonlinear)
    Switch for the configuration how to use the MP2 Audio input stream from VDR at replaying a recording or during live viewing from DVB card. The two cases Round and Dither are switches for the resulting linear PCM which its self will be obtained by decoding the MP2 Audio input stream with the help of the LibMad. Dithering leads to a much better sound quality then Rounding it does. The Nonlinear option provides an alternative way how to put MP2 Audio data forward to the A/V receiver. With this the MP2 Audio will not be decoded but send with a simliar method as done for AC-3 or DTS input streams. If and only if your A/V receiver supports the decoding of MP2 Audio stream you may choose this option. But note that for daily use your A/V receiver should support automatic detection of MP2 Audio. Or you have to configure your A/V receiver by hand for every change between AC-3, DTS and MP2 Audio input sources.

MP2offset [1...12]
    An additional offset only for for MP2 Audio. On very fast systems the decoded linear PCM may reach the AV receiver to early. You can reach the AV synchronization with steps of 10ms silent linear PCM.

EXAMPLE

/usr/bin/vdr -P 'bitstreamout -m /usr/lib/vdr/mute.sh'

AUTHOR
AC-3 scanning part -- Aaron Holtzman
MP2 implementation -- Sven Goethel <sven@jausoft.com>
MP2 frame based libmad handling -- Werner Fink <feedback@suse.de>
Plugin part -- Werner Fink <feedback@suse.de>

FILES
@@VIDEODIR@@/setup.conf
/proc/asound/card<#>/pcm<#>p/
/proc/asound/card<#>/pcm<#>p/info
/etc/asound.state

SEE ALSO
ac3play(1), vdr(1), vdr(5), aplay(1), alsactl(1), amixer(1), alsamixer(1).