Skip to content

Commit

Permalink
DVB: Improve encryption detection by only checking the CA encryption …
Browse files Browse the repository at this point in the history
…bits for Audio and Video.

This prevents cases where some channels are mistakenly discarded as encrypted in DVB systems.  This should help to improve the accuracy of scans.

Patch from eallaud, minor cleanup and verification against the specs by me, secondary code review by Stuart A.  Thanks!

Fixes #8645.
  • Loading branch information
Robert McNamara committed Jun 9, 2011
1 parent c0a27a6 commit 19a2cc7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp
Expand Up @@ -370,7 +370,7 @@ void ChannelScanSM::HandlePMT(uint, const ProgramMapTable *pmt)
QString("Got a Program Map Table for %1")
.arg((*current).FriendlyName) + "\n" + pmt->toString());

if (!currentTestingDecryption && pmt->IsEncrypted())
if (!currentTestingDecryption && pmt->IsEncrypted(GetDTVChannel()->GetSIStandard()))
currentEncryptionStatus[pmt->ProgramNumber()] = kEncUnknown;
}

Expand Down Expand Up @@ -1184,7 +1184,7 @@ ChannelScanSM::GetChannelList(transport_scan_items_it_t trans_info,
info.is_opencable = true;
}

info.is_encrypted |= pmt->IsEncrypted();
info.is_encrypted |= pmt->IsEncrypted(GetDTVChannel()->GetSIStandard());
info.in_pmt = true;
}

Expand Down
6 changes: 4 additions & 2 deletions mythtv/libs/libmythtv/dtvsignalmonitor.cpp
Expand Up @@ -329,8 +329,10 @@ void DTVSignalMonitor::HandlePMT(uint, const ProgramMapTable *pmt)
return; // Not the PMT we are looking for...
}

if (pmt->IsEncrypted())
if (pmt->IsEncrypted(GetDTVChannel()->GetSIStandard())) {
VERBOSE(VB_IMPORTANT,QString("PMT says program %1 is encrypted").arg(programNumber));
GetStreamData()->TestDecryption(pmt);
}

// if PMT contains audio and/or video stream set as matching.
uint hasAudio = 0;
Expand All @@ -345,7 +347,7 @@ void DTVSignalMonitor::HandlePMT(uint, const ProgramMapTable *pmt)
if ((hasVideo >= GetStreamData()->GetVideoStreamsRequired()) &&
(hasAudio >= GetStreamData()->GetAudioStreamsRequired()))
{
if (pmt->IsEncrypted() && !ignore_encrypted)
if (pmt->IsEncrypted(GetDTVChannel()->GetSIStandard()) && !ignore_encrypted)
AddFlags(kDTVSigMon_WaitForCrypt);

AddFlags(kDTVSigMon_PMTMatch);
Expand Down
13 changes: 8 additions & 5 deletions mythtv/libs/libmythtv/mpeg/mpegtables.cpp
Expand Up @@ -467,15 +467,18 @@ bool ProgramMapTable::IsAudio(uint i, QString sistandard) const
return StreamID::IsAudio(stream_id);
}

/** \fn ProgramMapTable::IsEncrypted(void) const
* \brief Returns true iff PMT contains CA descriptor.
/** \fn ProgramMapTable::IsEncrypted(QString sistandard) const
* \brief Returns true iff PMT contains CA descriptor for a vid/aud stream.
*/
bool ProgramMapTable::IsEncrypted(void) const
bool ProgramMapTable::IsEncrypted(QString sistandard) const
{
bool encrypted = IsProgramEncrypted();

for (uint i = 0; !encrypted && i < StreamCount(); i++)
encrypted |= IsStreamEncrypted(i);
for (uint i = 0; !encrypted && i < StreamCount(); i++) {
/* Only check audio/video streams */
if (IsAudio(i,sistandard) || IsVideo(i,sistandard))
encrypted |= IsStreamEncrypted(i);
}

return encrypted;
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/mpegtables.h
Expand Up @@ -605,7 +605,7 @@ class ProgramMapTable : public PSIPTable
// helper methods
bool IsVideo(uint i, QString sistandard) const;
bool IsAudio(uint i, QString sistandard) const;
bool IsEncrypted(void) const;
bool IsEncrypted(QString sistandard) const;
bool IsProgramEncrypted(void) const;
bool IsStreamEncrypted(uint pid) const;
/// Returns true iff PMT contains a still-picture video stream
Expand Down

0 comments on commit 19a2cc7

Please sign in to comment.