rendered paste bodydiff --git a/mythtv/bindings/perl/MythTV.pm b/mythtv/bindings/perl/MythTV.pm
index ebaecaf..9129cb3 100644
--- a/mythtv/bindings/perl/MythTV.pm
+++ b/mythtv/bindings/perl/MythTV.pm
@@ -114,7 +114,7 @@ package MythTV;
# schema version supported in the main code. We need to check that the schema
# version in the database is as expected by the bindings, which are expected
# to be kept in sync with the main code.
- our $SCHEMA_VERSION = "1274";
+ our $SCHEMA_VERSION = "1275";
# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
diff --git a/mythtv/bindings/python/MythTV/static.py b/mythtv/bindings/python/MythTV/static.py
index a090431..2f731ad 100644
--- a/mythtv/bindings/python/MythTV/static.py
+++ b/mythtv/bindings/python/MythTV/static.py
@@ -5,7 +5,7 @@ Contains any static and global variables for MythTV Python Bindings
"""
OWN_VERSION = (0,25,-1,2)
-SCHEMA_VERSION = 1274
+SCHEMA_VERSION = 1275
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '65'
diff --git a/mythtv/libs/libmythtv/dbcheck.cpp b/mythtv/libs/libmythtv/dbcheck.cpp
index d960ad5..79207d6 100644
--- a/mythtv/libs/libmythtv/dbcheck.cpp
+++ b/mythtv/libs/libmythtv/dbcheck.cpp
@@ -21,7 +21,7 @@ using namespace std;
mythtv/bindings/perl/MythTV.pm
*/
/// This is the DB schema version expected by the running MythTV instance.
-const QString currentDatabaseVersion = "1274";
+const QString currentDatabaseVersion = "1275";
static bool UpdateDBVersionNumber(const QString &newnumber, QString &dbver);
static bool performActualUpdate(
@@ -5655,7 +5655,41 @@ NULL
" DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';",
NULL
};
- if (!performActualUpdate(updates, "1274", dbver))
+
+ if (!performActualUpdate(updates, "1273", dbver))
+ return false;
+ }
+
+ if (dbver == "1274")
+ {
+ const char *updates[] = {
+"UPDATE cardinput SET tunechan=NULL"
+" WHERE inputname='DVBInput' OR inputname='MPEG2TS';"
+"UPDATE dtv_multiplex SET symbolrate = NULL"
+" WHERE modulation LIKE 't%' OR modulation LIKE '%t';",
+"UPDATE dtv_multiplex"
+" SET bandwidth=SUBSTR(modulation,2,1)"
+" WHERE SUBSTR(modulation,3,3)='qam' OR"
+" SUBSTR(modulation,3,4)='qpsk';",
+"UPDATE dtv_multiplex"
+" SET bandwidth=SUBSTR(modulation,5,1)"
+" WHERE SUBSTR(modulation,1,4)='auto' AND"
+" LENGTH(modulation)=6;",
+"UPDATE dtv_multiplex SET modulation='auto'"
+" WHERE modulation LIKE 'auto%';",
+"UPDATE dtv_multiplex SET modulation='qam_16'"
+" WHERE modulation LIKE '%qam16%';",
+"UPDATE dtv_multiplex SET modulation='qam_32'"
+" WHERE modulation LIKE '%qam32%';",
+"UPDATE dtv_multiplex SET modulation='qam_64'"
+" WHERE modulation LIKE '%qam64%';",
+"UPDATE dtv_multiplex SET modulation='qam_128'"
+" WHERE modulation LIKE '%qam128%';",
+"UPDATE dtv_multiplex SET modulation='qam_256'"
+" WHERE modulation LIKE '%qam256%';",
+NULL
+};
+ if (!performActualUpdate(updates, "1275", dbver))
return false;
}
diff --git a/mythtv/libs/libmythtv/dtvconfparserhelpers.cpp b/mythtv/libs/libmythtv/dtvconfparserhelpers.cpp
index d6fcaca..e9d2f7d 100644
--- a/mythtv/libs/libmythtv/dtvconfparserhelpers.cpp
+++ b/mythtv/libs/libmythtv/dtvconfparserhelpers.cpp
@@ -44,6 +44,7 @@ const int DTVTunerType::kTunerTypeDVBC = 0x0001;
const int DTVTunerType::kTunerTypeDVBT = 0x0002;
const int DTVTunerType::kTunerTypeATSC = 0x0003;
const int DTVTunerType::kTunerTypeASI = 0x1000;
+const int DTVTunerType::kTunerTypeOCUR = 0x2000;
const int DTVTunerType::kTunerTypeUnknown = 0x80000000;
static QMutex dtv_tt_canonical_str_lock;
@@ -57,6 +58,7 @@ void DTVTunerType::initStr(void)
dtv_tt_canonical_str[kTunerTypeDVBS1] = "QPSK";
dtv_tt_canonical_str[kTunerTypeDVBS2] = "DVB_S2";
dtv_tt_canonical_str[kTunerTypeASI] = "ASI";
+ dtv_tt_canonical_str[kTunerTypeOCUR] = "OCUR";
dtv_tt_canonical_str[kTunerTypeUnknown] = "UNKNOWN";
}
@@ -77,6 +79,7 @@ const DTVParamHelperStruct DTVTunerType::parseTable[] =
{ "ATSC", kTunerTypeATSC },
{ "DVB_S2", kTunerTypeDVBS2 },
{ "ASI", kTunerTypeASI },
+ { "OCUR", kTunerTypeOCUR },
{ "UNKNOWN", kTunerTypeUnknown },
{ NULL, kTunerTypeUnknown },
};
diff --git a/mythtv/libs/libmythtv/dtvconfparserhelpers.h b/mythtv/libs/libmythtv/dtvconfparserhelpers.h
index e6aa1d2..d89a93a 100644
--- a/mythtv/libs/libmythtv/dtvconfparserhelpers.h
+++ b/mythtv/libs/libmythtv/dtvconfparserhelpers.h
@@ -92,6 +92,7 @@ class DTVTunerType : public DTVParamHelper
static const int kTunerTypeATSC; // 8-VSB, 16-VSB,
// QAM-16, QAM-64, QAM-256, QPSK
static const int kTunerTypeASI; // baseband
+ static const int kTunerTypeOCUR; // Virtual Channel tuning of QAM-64/256
static const int kTunerTypeUnknown;
// Note: Just because some cards sold in different regions support the same
diff --git a/mythtv/libs/libmythtv/hdhrchannel.cpp b/mythtv/libs/libmythtv/hdhrchannel.cpp
index d18be4f..74fd7a5 100644
--- a/mythtv/libs/libmythtv/hdhrchannel.cpp
+++ b/mythtv/libs/libmythtv/hdhrchannel.cpp
@@ -92,15 +92,96 @@ bool HDHRChannel::IsOpen(void) const
return _stream_handler;
}
+/// This is used when the tuner type is kTunerTypeOCUR
bool HDHRChannel::Tune(const QString &freqid, int /*finetune*/)
{
return _stream_handler->TuneVChannel(freqid);
}
+static QString format_modulation(
+ const DTVMultiplex &tuning, bool &has_dvbt, bool &has_dvbc)
+{
+ QString mod;
+
+ if (DTVModulation::kModulationQAM256 == tuning.modulation)
+ (mod = "qam256"),(has_dvbt=false);
+ else if (DTVModulation::kModulationQAM128 == tuning.modulation)
+ (mod = "qam128"),(has_dvbt=false);
+ else if (DTVModulation::kModulationQAM64 == tuning.modulation)
+ mod = "qam64";
+ else if (DTVModulation::kModulationQAM16 == tuning.modulation)
+ (mod = "qam16"),(has_dvbc=false);
+ else if (DTVModulation::kModulationDQPSK == tuning.modulation)
+ (mod = "qpsk"),(has_dvbc=false);
+ else if (DTVModulation::kModulation8VSB == tuning.modulation)
+ mod = "8vsb";
+ else
+ mod = "auto";
+
+ return mod;
+}
+
+static QString format_dvbt(const DTVMultiplex &tuning, const QString &mod)
+{
+ const QChar b = tuning.bandwidth.toChar();
+
+ if ((QChar('a') == b) || (mod == "auto"))
+ return "auto"; // uses bandwidth from channel map
+ else if (QChar('a') != b)
+ return QString("t%1%2").arg(b).arg(mod);
+
+ return QString("auto%1t").arg(b);
+}
+
+static QString format_dvbc(const DTVMultiplex &tuning, const QString &mod)
+{
+ const QChar b = tuning.bandwidth.toChar();
+ if ((QChar('a') == b) || (mod == "auto"))
+ return "auto"; // uses bandwidth from channel map
+ else if ((QChar('a') != b) && (tuning.symbolrate > 0))
+ return QString("a%1%2-%3")
+ .arg(b).arg(mod).arg(tuning.symbolrate/1000);
+
+ return QString("auto%1c").arg(b);
+}
+
+static QString get_tune_spec(const vector<DTVTunerType> &tuner_types,
+ const DTVMultiplex &tuning)
+{
+ bool has_dvbc = false, has_dvbt = false, has_atsc = false;
+ vector<DTVTunerType>::const_iterator it = tuner_types.begin();
+ for (; it != tuner_types.end(); ++it)
+ {
+ has_dvbt |= (DTVTunerType::kTunerTypeDVBT == *it);
+ has_dvbc |= (DTVTunerType::kTunerTypeDVBC == *it);
+ has_atsc |= (DTVTunerType::kTunerTypeATSC == *it);
+ }
+
+ QString mod = format_modulation(tuning, has_dvbt, has_dvbc);
+
+ // HACK HACK HACK -- BEGIN
+ // Prefer DVB-T if the symbolrate is not set, we will fallback
+ // to DVB-C and then auto if tuning fails. Ideally we'd have
+ // DTVTunerType in the tuning info.
+ if (tuning.symbolrate == 0)
+ has_dvbc = false;
+ // HACK HACK HACK -- END
+
+ QString spec = "auto";
+ if (has_atsc) // old atsc firmware does no recognize "auto"
+ spec = (mod == "auto") ? "qam" : mod;
+ else if (has_dvbc && !has_dvbt)
+ spec = format_dvbc(tuning, mod);
+ else if (has_dvbt && !has_dvbc)
+ spec = format_dvbt(tuning, mod);
+
+ return spec;
+}
+
bool HDHRChannel::Tune(const DTVMultiplex &tuning, QString /*inputname*/)
{
- QString chan = tuning.modulation.toString() + ':' +
- QString::number(tuning.frequency);
+ QString spec = get_tune_spec(_tuner_types, tuning);
+ QString chan = QString("%1:%2").arg(spec).arg(tuning.frequency);
VERBOSE(VB_CHANNEL, LOC + "Tuning to " + chan);
@@ -110,5 +191,38 @@ bool HDHRChannel::Tune(const DTVMultiplex &tuning, QString /*inputname*/)
return true;
}
+ // HACK HACK HACK -- BEGIN
+ // if the DTVTunerType were specified in tuning we wouldn't
+ // need to try these alternative tuning methods.
+ if (spec != "auto")
+ {
+ bool has_dvbc = (find(_tuner_types.begin(), _tuner_types.end(),
+ DTVTunerType::kTunerTypeDVBC)
+ != _tuner_types.end());
+ if (has_dvbc && ((spec.left(1) == "t") || (spec.right(1) == "t")))
+ {
+ bool dummy0, dummy1;
+ QString mod = format_modulation(tuning, dummy0, dummy1);
+ spec = format_dvbc(tuning, mod);
+ QString chan = QString("%1:%2").arg(spec).arg(tuning.frequency);
+ if (_stream_handler->TuneChannel(chan))
+ {
+ SetSIStandard(tuning.sistandard);
+ return true;
+ }
+ }
+
+ if (spec != "auto")
+ {
+ QString chan = QString("%1:%2").arg("auto").arg(tuning.frequency);
+ if (_stream_handler->TuneChannel(chan))
+ {
+ SetSIStandard(tuning.sistandard);
+ return true;
+ }
+ }
+ }
+ // HACK HACK HACK -- END
+
return false;
}
diff --git a/mythtv/libs/libmythtv/hdhrstreamhandler.cpp b/mythtv/libs/libmythtv/hdhrstreamhandler.cpp
index 95462a8..9a95957 100644
--- a/mythtv/libs/libmythtv/hdhrstreamhandler.cpp
+++ b/mythtv/libs/libmythtv/hdhrstreamhandler.cpp
@@ -260,7 +260,11 @@ bool HDHRStreamHandler::Open(void)
{
const char *model = hdhomerun_device_get_model_str(_hdhomerun_device);
_tuner_types.clear();
- if (QString(model).toLower().contains("dvb"))
+ if (QString(model).toLower().contains("cablecard"))
+ {
+ _tuner_types.push_back(DTVTunerType::kTunerTypeOCUR);
+ }
+ else if (QString(model).toLower().contains("dvb"))
{
_tuner_types.push_back(DTVTunerType::kTunerTypeDVBT);
_tuner_types.push_back(DTVTunerType::kTunerTypeDVBC);
@@ -386,18 +390,6 @@ QString HDHRStreamHandler::TunerSet(
return QString::null;
}
- // Database modulation strings and HDHR use different syntax.
- // HACK!! Caller should be doing this. (e.g. auto in HDHRChannel::Tune())
- //
- if (error && name == QString("channel") && val.contains("qam_"))
- {
- QString newval = val;
- newval.replace("qam_256", "qam");
- newval.replace("qam_64", "qam");
- VERBOSE(VB_CHANNEL, "HDHRSH::TunerSet() Failed. Trying " + newval);
- return TunerSet(name, newval, report_error_return, print_error);
- }
-
if (report_error_return && error)
{
if (print_error)