From a512b9a9fa24250ac16316916c5b015a15666b33 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 20 May 2006 10:17:44 +0200 Subject: [PATCH] Fixed handling Transfer Mode when replaying Dolby Digital audio and the option '-a' was given --- CONTRIBUTORS | 2 ++ HISTORY | 6 +++++- audio.c | 19 +++++++++++++++++-- dvbdevice.c | 28 +++++++++++++++++++++++----- dvbdevice.h | 14 ++++++++++++-- 5 files changed, 59 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f03f6c38..98725204 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -309,6 +309,8 @@ Werner Fink and firmware can handle live DD without the need of a Transfer Mode for fixing cDvbDevice::SetAudioBypass() in case setTransferModeForDolbyDigital is false + for a patch that was used as a base to fix handling Transfer Mode when replaying + Dolby Digital audio and the option '-a' was given Rolf Hakenes for providing 'libdtv' and adapting the EIT mechanisms to it diff --git a/HISTORY b/HISTORY index 07fe1566..47257901 100644 --- a/HISTORY +++ b/HISTORY @@ -4716,8 +4716,12 @@ Video Disk Recorder Revision History - Fixed automatically updating the CAM menu in case the whole operation (for instance a firmware update) takes longer than the menu timeout. -2006-05-19: Version 1.4.0-2 +2006-05-20: Version 1.4.0-2 - Removed leftover LSMOD=... line from 'runvdr'. - Modified the Makefile to copy additional libraries a plugin might provide (suggested by Wayne Keer). See PLUGINS.html for details. +- Fixed handling Transfer Mode when replaying Dolby Digital audio and the option + '-a' was given (based on a patch from Werner Fink). To avoid having to increment + the API version, several #if checks have been introduced around this. These will + be removed once the API version actually needs to be incremented. diff --git a/audio.c b/audio.c index 742c50b4..ad5725c6 100644 --- a/audio.c +++ b/audio.c @@ -4,11 +4,18 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: audio.c 1.3 2005/02/12 12:40:51 kls Exp $ + * $Id: audio.c 1.4 2006/05/20 10:02:08 kls Exp $ */ #include "audio.h" -#include "stdlib.h" +#include +// TODO remove the following if APIVERSNUM > 10400 +#include "config.h" +#if APIVERSNUM != 10400 +#warning ******* API version changed - remove old stuff +#endif +// TODO +#include "dvbdevice.h" // --- cAudio ---------------------------------------------------------------- @@ -61,6 +68,14 @@ void cExternalAudio::Play(const uchar *Data, int Length, uchar Id) if (command && !mute) { if (pipe || pipe.Open(command, "w")) { if (0x80 <= Id && Id <= 0x87 || Id == 0xBD) { // AC3 +#if APIVERSNUM == 10400 + extern int cDvbDevice__setTransferModeForDolbyDigital; + cDvbDevice__setTransferModeForDolbyDigital = 2; + cDvbDevice::SetTransferModeForDolbyDigital(false); +#else +#warning ******* API version changed - remove old stuff + cDvbDevice::SetTransferModeForDolbyDigital(2); +#endif int written = Data[8] + 9; // skips the PES header if (Id != 0xBD) written += 4; // skips AC3 bytes diff --git a/dvbdevice.c b/dvbdevice.c index db6a4476..6570695e 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.156 2006/04/01 14:19:43 kls Exp $ + * $Id: dvbdevice.c 1.157 2006/05/20 09:52:23 kls Exp $ */ #include "dvbdevice.h" @@ -356,7 +356,12 @@ void cDvbTuner::Action(void) // --- cDvbDevice ------------------------------------------------------------ int cDvbDevice::devVideoOffset = -1; -bool cDvbDevice::setTransferModeForDolbyDigital = true; +int cDvbDevice::setTransferModeForDolbyDigital = 1; +#if APIVERSNUM == 10400 +int cDvbDevice__setTransferModeForDolbyDigital = -1; +#else +#warning ******* API version changed - remove old stuff +#endif cDvbDevice::cDvbDevice(int n) { @@ -653,7 +658,7 @@ eVideoSystem cDvbDevice::GetVideoSystem(void) bool cDvbDevice::SetAudioBypass(bool On) { - if (!setTransferModeForDolbyDigital) + if (setTransferModeForDolbyDigital != 1) return false; return ioctl(fd_audio, AUDIO_SET_BYPASS_MODE, On) == 0; } @@ -914,10 +919,23 @@ void cDvbDevice::SetDigitalAudioDevice(bool On) } } +#if APIVERSNUM == 10400 void cDvbDevice::SetTransferModeForDolbyDigital(bool On) { - setTransferModeForDolbyDigital = On; + if (cDvbDevice__setTransferModeForDolbyDigital >= 0) { + setTransferModeForDolbyDigital = cDvbDevice__setTransferModeForDolbyDigital; + cDvbDevice__setTransferModeForDolbyDigital = -1; + } + else + setTransferModeForDolbyDigital = On; } +#else +#warning ******* API version changed - remove old stuff +void cDvbDevice::SetTransferModeForDolbyDigital(int Mode) +{ + setTransferModeForDolbyDigital = Mode; +} +#endif void cDvbDevice::SetAudioTrackDevice(eTrackType Type) { @@ -932,7 +950,7 @@ void cDvbDevice::SetAudioTrackDevice(eTrackType Type) } } else if (IS_DOLBY_TRACK(Type)) { - if (!setTransferModeForDolbyDigital) + if (setTransferModeForDolbyDigital == 0) return; // Currently this works only in Transfer Mode ForceTransferMode(); diff --git a/dvbdevice.h b/dvbdevice.h index 6f2078ab..1031c83d 100644 --- a/dvbdevice.h +++ b/dvbdevice.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.h 1.39 2006/04/01 14:18:59 kls Exp $ + * $Id: dvbdevice.h 1.40 2006/05/20 09:32:06 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -104,14 +104,24 @@ protected: private: bool digitalAudio; - static bool setTransferModeForDolbyDigital; + static int setTransferModeForDolbyDigital; protected: virtual int GetAudioChannelDevice(void); virtual void SetAudioChannelDevice(int AudioChannel); virtual void SetVolumeDevice(int Volume); virtual void SetDigitalAudioDevice(bool On); public: +#if APIVERSNUM == 10400 static void SetTransferModeForDolbyDigital(bool On); +#else +#warning ******* API version changed - remove old stuff + static void SetTransferModeForDolbyDigital(int Mode); + ///< Controls how the DVB device handles Transfer Mode when replaying + ///< Dolby Digital audio. + ///< 0 = don't set "audio bypass" in driver/firmware, don't force Transfer Mode + ///< 1 = set "audio bypass" in driver/firmware, force Transfer Mode (default) + ///< 2 = don't set "audio bypass" in driver/firmware, force Transfer Mode +#endif // Player facilities