Fixed handling Transfer Mode when replaying Dolby Digital audio and the option '-a' was given

This commit is contained in:
Klaus Schmidinger 2006-05-20 10:17:44 +02:00
parent c8c22ad49b
commit a512b9a9fa
5 changed files with 59 additions and 10 deletions

View File

@ -309,6 +309,8 @@ Werner Fink <werner@suse.de>
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 <hakenes@hippomi.de>
for providing 'libdtv' and adapting the EIT mechanisms to it

View File

@ -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.

19
audio.c
View File

@ -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 <stdlib.h>
// 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

View File

@ -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();

View File

@ -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