Skip to content

Commit

Permalink
Backport [27216:27217]. Change the behaviour of overriding the digita…
Browse files Browse the repository at this point in the history
…l passthrough device. If set, we assume AC3 and DTS passthrough option are always available no matter what the main audio device reports. This allow to set-up a different audio device between plain stereo/lpcm and digital passthrough. This change is required for a series of fixes attempting to overcome the issue with hdmi alsa drivers.

git-svn-id: http://svn.mythtv.org/svn/branches/release-0-24-fixes@27305 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information
jyavenard committed Nov 20, 2010
1 parent e8c6c19 commit 0604ffb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 17 deletions.
7 changes: 5 additions & 2 deletions mythtv/libs/libmyth/audiooutputsettings.cpp
Expand Up @@ -299,9 +299,12 @@ AudioOutputSettings* AudioOutputSettings::GetUsers(bool newcopy)

int cur_channels = gCoreContext->GetNumSetting("MaxChannels", 2);
int max_channels = aosettings->BestSupportedChannels();
bool bAC3 = aosettings->m_AC3 &&
bool bForceDigital = gCoreContext->GetNumSetting("AdvancedAudioSettings", false) &&
gCoreContext->GetNumSetting("PassThruDeviceOverride", false);

bool bAC3 = (aosettings->m_AC3 || bForceDigital) &&
gCoreContext->GetNumSetting("AC3PassThru", false);
bool bDTS = aosettings->m_DTS &&
bool bDTS = (aosettings->m_DTS || bForceDigital) &&
gCoreContext->GetNumSetting("DTSPassThru", false);
bool bLPCM = aosettings->m_LPCM &&
(aosettings->m_passthrough == -1 ||
Expand Down
49 changes: 34 additions & 15 deletions mythtv/programs/mythfrontend/globalsettings.cpp
Expand Up @@ -118,7 +118,8 @@ AudioConfigSettings::AudioConfigSettings() :
VerticalConfigurationGroup(false, true, false, false),
m_OutputDevice(NULL), m_MaxAudioChannels(NULL),
m_AudioUpmix(NULL), m_AudioUpmixType(NULL),
m_AC3PassThrough(NULL), m_DTSPassThrough(NULL), m_MPCM(NULL)
m_AC3PassThrough(NULL), m_DTSPassThrough(NULL), m_MPCM(NULL),
m_AdvancedAudioSettings(NULL), m_PassThroughOverride(NULL)
{
setLabel(QObject::tr("Audio System"));
setUseLabel(false);
Expand Down Expand Up @@ -173,22 +174,22 @@ AudioConfigSettings::AudioConfigSettings() :
maingroup->addChild((m_AudioUpmix = AudioUpmix()));
maingroup->addChild((m_AudioUpmixType = AudioUpmixType()));

Setting *advancedsettings = AdvancedAudioSettings();
addChild(advancedsettings);
m_AdvancedAudioSettings = AdvancedAudioSettings();
addChild(m_AdvancedAudioSettings);

ConfigurationGroup *group2 =
new VerticalConfigurationGroup(false);

TriggeredItem *sub2 = new TriggeredItem(advancedsettings, group2);
TriggeredItem *sub2 = new TriggeredItem(m_AdvancedAudioSettings, group2);
addChild(sub2);

ConfigurationGroup *settings3 =
new HorizontalConfigurationGroup(false, false);

Setting *passthroughoverride = PassThroughOverride();
m_PassThroughOverride = PassThroughOverride();
TriggeredItem *sub3 =
new TriggeredItem(passthroughoverride, PassThroughOutputDevice());
settings3->addChild(passthroughoverride);
new TriggeredItem(m_PassThroughOverride, PassThroughOutputDevice());
settings3->addChild(m_PassThroughOverride);
settings3->addChild(sub3);

ConfigurationGroup *settings4 =
Expand Down Expand Up @@ -218,6 +219,10 @@ AudioConfigSettings::AudioConfigSettings() :
this, SLOT(UpdateCapabilities(const QString&)));
connect(m_MPCM, SIGNAL(valueChanged(const QString&)),
this, SLOT(UpdateCapabilities(const QString&)));
connect(m_PassThroughOverride, SIGNAL(valueChanged(const QString&)),
this, SLOT(UpdateCapabilities(const QString&)));
connect(m_AdvancedAudioSettings, SIGNAL(valueChanged(const QString&)),
this, SLOT(UpdateCapabilities(const QString&)));
}

void AudioConfigSettings::AudioRescan()
Expand Down Expand Up @@ -271,19 +276,23 @@ void AudioConfigSettings::UpdateVisibility(const QString &device)

void AudioConfigSettings::UpdateCapabilities(const QString &device)
{
int max_speakers = 8;
int max_speakers = 8;
bool invalid = false;
int passthrough = 0;
AudioOutputSettings settings;

// Test if everything is set yet
if (!m_OutputDevice || !m_MaxAudioChannels ||
!m_AC3PassThrough || !m_DTSPassThrough || !m_MPCM)
!m_AC3PassThrough || !m_DTSPassThrough || !m_MPCM ||
!m_AdvancedAudioSettings || !m_PassThroughOverride)
return;

if (!slotlock.tryLock()) // Doing a rescan of channels
return;

bool bForceDigital = (m_AdvancedAudioSettings->boolValue() &&
m_PassThroughOverride->boolValue());

QString out = m_OutputDevice->getValue();
if (!audiodevs.contains(out))
{
Expand All @@ -296,8 +305,10 @@ void AudioConfigSettings::UpdateCapabilities(const QString &device)

max_speakers = settings.BestSupportedChannels();

bool bAC3 = settings.canAC3() && m_AC3PassThrough->boolValue();
bool bDTS = settings.canDTS() && m_DTSPassThrough->boolValue();
bool bAC3 = (settings.canAC3() || bForceDigital) &&
m_AC3PassThrough->boolValue();
bool bDTS = (settings.canDTS() || bForceDigital) &&
m_DTSPassThrough->boolValue();
bool bLPCM = settings.canPassthrough() == -1 ||
(settings.canLPCM() && m_MPCM->boolValue());

Expand All @@ -308,15 +319,22 @@ void AudioConfigSettings::UpdateCapabilities(const QString &device)
passthrough = settings.canPassthrough();
}

m_triggerAC3->setValue(invalid || settings.canAC3());
m_triggerDTS->setValue(invalid || settings.canDTS());
m_triggerAC3->setValue(invalid || settings.canAC3() || bForceDigital);
m_triggerDTS->setValue(invalid || settings.canDTS() || bForceDigital);

m_MPCM->setEnabled(invalid || (settings.canLPCM() &&
settings.canPassthrough() >= 0));
switch (passthrough)
{
case -1:
m_MPCM->setLabel(QObject::tr("No digital passthrough"));
if (bForceDigital)
{
m_MPCM->setLabel(QString());
}
else
{
m_MPCM->setLabel(QObject::tr("No digital passthrough"));
}
break;
case 1:
m_MPCM->setLabel(QObject::tr("LPCM"));
Expand Down Expand Up @@ -348,7 +366,8 @@ void AudioConfigSettings::UpdateCapabilities(const QString &device)
m_MaxAudioChannels->resetMaxCount(3);
for (int i = 1; i <= max_speakers; i++)
{
if (invalid || settings.IsSupportedChannels(i))
if (invalid || settings.IsSupportedChannels(i) ||
(bForceDigital && i == 6))
{
QString txt;

Expand Down
2 changes: 2 additions & 0 deletions mythtv/programs/mythfrontend/globalsettings.h
Expand Up @@ -57,6 +57,8 @@ class AudioConfigSettings : public VerticalConfigurationGroup
HostCheckBox *m_AC3PassThrough;
HostCheckBox *m_DTSPassThrough;
HostCheckBox *m_MPCM;
HostCheckBox *m_AdvancedAudioSettings;
HostCheckBox *m_PassThroughOverride;
ADCMap audiodevs;
AudioOutput::ADCVect devices;
QMutex slotlock;
Expand Down

0 comments on commit 0604ffb

Please sign in to comment.