Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

HDHR Prime: Allow Prime tuners with CableCard to fetch channels.

With this commit, HDHomeRun Prime tuners are fully configurable
with no extra hoops to jump through.  If a a channel fetch is
requested, and if a HDHomeRun tuner is a member of the source,
the device will be checked for the presence of an OOB tuner. If
one is present, OOB tuner lock is checked.  If both are true,
channels are fetched from the listings source.  This has the
advantage of also ensuring that if a Prime tuner is used *without*
a functioning cablecard, it will behave as a traditional HDHR.

This addition is a minor hack, as it involves contacting the HDHR
rather than just checking the card type, but it will definitely
serve until the OCUR tuner type is ready, and then we can encourage
users to move to that tuner type to use the DRI interface.

This concludes the patches necessary to get the HDHR Prime
configuration experience where it should be for a release.  One
can now create all three tuners without issue, and fetch channels
without the use of a dummy tuner or other tricks.
  • Loading branch information...
commit d7a00c50d646c0c84b5645342363f8105adbcefe 1 parent 4614384
Robert McNamara authored
31 mythtv/libs/libmythtv/cardutil.cpp
View
@@ -86,6 +86,37 @@ QString CardUtil::GetScanableCardTypes(void)
return QString("(%1)").arg(cardTypes);
}
+bool CardUtil::IsCableCardPresent(uint cardid,
+ const QString &cardType)
+{
+ if (cardType == "HDHOMERUN")
+ {
+#ifdef USING_HDHOMERUN
+ hdhomerun_device_t *hdhr;
+ hdhomerun_tuner_status_t status;
+ QString device = GetVideoDevice(cardid);
+ hdhr = hdhomerun_device_create_from_str(device.toAscii(), NULL);
+ if (!hdhr)
+ return false;
+
+ int oob = -1;
+ oob = hdhomerun_device_get_oob_status(hdhr, NULL, &status);
+
+ // if no OOB tuner, oob will be < 1. If no CC present, OOB
+ // status will be "none."
+ if (oob > 0 && (strncmp(status.channel, "none", 4) != 0))
+ {
+ LOG(VB_GENERAL, LOG_INFO, "Cardutil: HDHomeRun Cablecard Present.");
+ return true;
+ }
+ else
+#endif
+ return false;
+ }
+ else
+ return false;
+}
+
bool CardUtil::IsTunerShared(uint cardidA, uint cardidB)
{
LOG(VB_GENERAL, LOG_DEBUG, QString("IsTunerShared(%1,%2)")
3  mythtv/libs/libmythtv/cardutil.h
View
@@ -136,6 +136,9 @@ class MTV_PUBLIC CardUtil
}
static QString GetScanableCardTypes(void);
+ static bool IsCableCardPresent(uint cardid,
+ const QString &cardType);
+
static bool IsEITCapable(const QString &rawtype)
{
return
6 mythtv/libs/libmythtv/datadirect.cpp
View
@@ -711,7 +711,8 @@ int DataDirectProcessor::UpdateChannelsSafe(
return -1;
}
- bool is_encoder = (SourceUtil::IsEncoder(sourceid, true) ||
+ bool is_encoder = (SourceUtil::IsCableCardPresent(sourceid) ||
+ SourceUtil::IsEncoder(sourceid, true) ||
SourceUtil::IsUnscanable(sourceid));
while (query.next())
@@ -786,7 +787,8 @@ bool DataDirectProcessor::UpdateChannelsUnsafe(
" atsc_minor_chan = :MINORCHAN "
"WHERE xmltvid = :STATIONID AND sourceid = :SOURCEID");
- bool is_encoder = (SourceUtil::IsEncoder(sourceid, true) ||
+ bool is_encoder = (SourceUtil::IsCableCardPresent(sourceid) ||
+ SourceUtil::IsEncoder(sourceid, true) ||
SourceUtil::IsUnscanable(sourceid));
while (dd_station_info.next())
14 mythtv/libs/libmythtv/sourceutil.cpp
View
@@ -326,6 +326,20 @@ bool SourceUtil::IsUnscanable(uint sourceid)
return types.empty() || unscanable;
}
+bool SourceUtil::IsCableCardPresent(uint sourceid)
+{
+ bool ccpresent = false;
+ vector<uint> cards = CardUtil::GetCardIDs(sourceid);
+ vector<uint>::iterator it = cards.begin();
+ for (; it != cards.end(); ++it)
+ {
+ if (CardUtil::IsCableCardPresent(*it, CardUtil::GetRawCardType(*it)))
+ ccpresent = true;
+ }
+
+ return ccpresent;
+}
+
bool SourceUtil::IsAnySourceScanable(void)
{
MSqlQuery query(MSqlQuery::InitCon());
1  mythtv/libs/libmythtv/sourceutil.h
View
@@ -28,6 +28,7 @@ class MTV_PUBLIC SourceUtil
static bool IsProperlyConnected(uint sourceid, bool strict = false);
static bool IsEncoder(uint sourceid, bool strict = false);
static bool IsUnscanable(uint sourceid);
+ static bool IsCableCardPresent(uint sourceid);
static bool IsAnySourceScanable(void);
static bool UpdateChannelsFromListings(
uint sourceid, QString cardtype = QString::null, bool wait = false);
3  mythtv/libs/libmythtv/videosource.cpp
View
@@ -2980,7 +2980,8 @@ void CardInput::sourceFetch(void)
QString cardtype = CardUtil::GetRawCardType(crdid);
- if (!CardUtil::IsUnscanable(cardtype) &&
+ if (!CardUtil::IsCableCardPresent(crdid, cardtype) &&
+ !CardUtil::IsUnscanable(cardtype) &&
!CardUtil::IsEncoder(cardtype) &&
!num_channels_before)
{
4 mythtv/programs/mythfilldatabase/channeldata.cpp
View
@@ -62,6 +62,7 @@ bool ChannelData::insert_chan(uint sourceid)
if (!insert_channels)
{
bool isEncoder, isUnscanable;
+ bool isCableCard = SourceUtil::IsCableCardPresent(sourceid);
if (cardtype.isEmpty())
{
isEncoder = SourceUtil::IsEncoder(sourceid);
@@ -72,7 +73,8 @@ bool ChannelData::insert_chan(uint sourceid)
isEncoder = CardUtil::IsEncoder(cardtype);
isUnscanable = CardUtil::IsUnscanable(cardtype);
}
- insert_channels = (isEncoder || isUnscanable) && !remove_new_channels;
+ insert_channels = (isCableCard || isEncoder || isUnscanable) &&
+ !remove_new_channels;
}
return insert_channels;
Please sign in to comment.
Something went wrong with that request. Please try again.