Skip to content

Commit

Permalink
Use channel frequency table defaults for ATSC channel scanning
Browse files Browse the repository at this point in the history
Use the Channel frequency table value defined in the Video source or,
when that is "default", the frequency table value defined in the
General / Locale settings as default for the ATSC scan type "Full Scan"
frequency table parameter in the Channel Scan page.

Refs #13472
  • Loading branch information
kmdewaal committed Feb 9, 2020
1 parent d61dc26 commit 6d2e7b2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
3 changes: 3 additions & 0 deletions mythtv/libs/libmythtv/channelscan/paneatsc.h
Expand Up @@ -60,6 +60,9 @@ class PaneATSC : public GroupSetting
}
}

void SetFrequencyTable(const QString &atsc_table)
{ m_atsc_table->setValue(atsc_table); }

QString GetFrequencyTable(void) const
{ return m_atsc_table->getValue(); }
QString GetModulation(void) const
Expand Down
43 changes: 39 additions & 4 deletions mythtv/libs/libmythtv/channelscan/scanwizardconfig.cpp
Expand Up @@ -114,26 +114,49 @@ void ScanWizard::SetPaneDefaults(const QString &cardid_inputname)
{
const int sourceid = m_videoSource->getValue().toInt();
uint scanfrequency = 0;
QString freqtable;

MSqlQuery query(MSqlQuery::InitCon());
query.prepare(
"SELECT scanfrequency "
"SELECT scanfrequency, freqtable "
"FROM videosource "
"WHERE videosource.sourceid = :SOURCEID ;");
query.bindValue(":SOURCEID", sourceid);
if (!query.exec() || !query.isActive())
{
MythDB::DBError("ScanOptionalConfig::SetPaneDefaults", query);
return;
}
else if (query.next())
{
scanfrequency = query.value(0).toUInt();
freqtable = query.value(1).toString();
LOG(VB_CHANSCAN, LOG_DEBUG,
QString("SetPaneDefaults cardid_inputname:%1 sourceid:%2 frequency:%3")
.arg(cardid_inputname).arg(sourceid).arg(scanfrequency));
QString("SetPaneDefaults cardid_inputname:%1 sourceid:%2 scanfrequency:%3 freqtable:%4")
.arg(cardid_inputname).arg(sourceid).arg(scanfrequency).arg(freqtable));
}

// Channel Frequency Table for ATSC
// Use general setting if not defined in the videosource
{
if (freqtable == "default")
{
freqtable = gCoreContext->GetSetting("FreqTable");
}
QString table;
table = (freqtable == "us-bcast" ) ? "us" : table;
table = (freqtable == "us-cable" ) ? "uscable" : table;
table = (freqtable == "us-cable-hrc") ? "ushrc" : table;
table = (freqtable == "us-cable-irc") ? "usirc" : table;
if (!table.isEmpty())
{
LOG(VB_CHANSCAN, LOG_DEBUG,
QString("SetPaneDefaults ATSC frequency table:'%1'").arg(table));
m_scanConfig->SetTuningPaneValuesATSC(table);
}
}

// Set defaults only when a frequency has been entered.
// Set "Full Scan (Tuned)" defaults only when a frequency has been entered.
if (scanfrequency == 0)
return;

Expand Down Expand Up @@ -636,3 +659,15 @@ void ScanOptionalConfig::SetTuningPaneValues(uint frequency, const DTVMultiplex
}
}
}

void ScanOptionalConfig::SetTuningPaneValuesATSC(const QString &freqtable)
{
const int st = m_scanType->getValue().toInt();

if (st == ScanTypeSetting::FullScan_ATSC)
{
PaneATSC *pane = m_paneATSC;

pane->SetFrequencyTable(freqtable);
}
}
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/channelscan/scanwizardconfig.h
Expand Up @@ -130,6 +130,7 @@ class ScanOptionalConfig : public GroupSetting
QMap<QString,QString> GetStartChan(void) const;
uint GetScanID(void) const;
void SetTuningPaneValues(uint frequency, const DTVMultiplex &mpx);
void SetTuningPaneValuesATSC(const QString &freqtable);

public slots:
void SetSourceID(const QString &sourceid);
Expand Down

0 comments on commit 6d2e7b2

Please sign in to comment.