Skip to content

Commit

Permalink
Move PID definitions to a separate class.
Browse files Browse the repository at this point in the history
Move the PID enum definitions to class PID.
To use the values it is now needed to use the class name as prefix.
  • Loading branch information
kmdewaal committed Dec 22, 2020
1 parent 98c04dc commit cd67b60
Show file tree
Hide file tree
Showing 17 changed files with 132 additions and 123 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp
Expand Up @@ -1382,7 +1382,7 @@ ChannelScanSM::GetChannelList(transport_scan_items_it_t trans_info,
for (uint i = 0; i < pat->ProgramCount(); ++i)
{
if ((pat->ProgramNumber(i) == 0) &&
(pat->ProgramPID(i) == SCTE_PSIP_PID))
(pat->ProgramPID(i) == PID::SCTE_PSIP_PID))
{
could_be_opencable = true;
}
Expand Down
12 changes: 6 additions & 6 deletions mythtv/libs/libmythtv/mpeg/atscstreamdata.cpp
Expand Up @@ -37,8 +37,8 @@ ATSCStreamData::ATSCStreamData(int desiredMajorChannel,
m_desiredMajorChannel(desiredMajorChannel),
m_desiredMinorChannel(desiredMinorChannel)
{
AddListeningPID(ATSC_PSIP_PID);
AddListeningPID(SCTE_PSIP_PID);
AddListeningPID(PID::ATSC_PSIP_PID);
AddListeningPID(PID::SCTE_PSIP_PID);
}

ATSCStreamData::~ATSCStreamData()
Expand Down Expand Up @@ -110,8 +110,8 @@ void ATSCStreamData::SetDesiredChannel(int major, int minor)
void ATSCStreamData::Reset(int desiredProgram)
{
MPEGStreamData::Reset(desiredProgram);
AddListeningPID(ATSC_PSIP_PID);
AddListeningPID(SCTE_PSIP_PID);
AddListeningPID(PID::ATSC_PSIP_PID);
AddListeningPID(PID::SCTE_PSIP_PID);
}

void ATSCStreamData::Reset(int desiredMajorChannel, int desiredMinorChannel)
Expand Down Expand Up @@ -144,8 +144,8 @@ void ATSCStreamData::Reset(int desiredMajorChannel, int desiredMinorChannel)
m_cachedCvcts.clear();
}

AddListeningPID(ATSC_PSIP_PID);
AddListeningPID(SCTE_PSIP_PID);
AddListeningPID(PID::ATSC_PSIP_PID);
AddListeningPID(PID::SCTE_PSIP_PID);
}

/** \fn ATSCStreamData::IsRedundant(uint pid, const PSIPTable&) const
Expand Down
112 changes: 55 additions & 57 deletions mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp
Expand Up @@ -5,14 +5,12 @@
#include <QSharedPointer>
#include "dvbstreamdata.h"
#include "dvbtables.h"
#include "mpegdescriptors.h"
#include "mpegtables.h"
#include "premieretables.h"
#include "eithelper.h"

#define PREMIERE_ONID 133
#define FREESAT_EIT_PID 3842
#define MCA_ONID 6144
#define MCA_EIT_TSID 136
#define MCA_EIT_PID 1018

#define LOC QString("DVBStream[%1]: ").arg(m_cardId)

Expand All @@ -24,9 +22,9 @@ DVBStreamData::DVBStreamData(uint desired_netid, uint desired_tsid,
{
m_nitStatus.SetVersion(-1,0);
m_nitoStatus.SetVersion(-1,0);
AddListeningPID(DVB_NIT_PID);
AddListeningPID(DVB_SDT_PID);
AddListeningPID(DVB_TDT_PID);
AddListeningPID(PID::DVB_NIT_PID);
AddListeningPID(PID::DVB_SDT_PID);
AddListeningPID(PID::DVB_TDT_PID);
}

DVBStreamData::~DVBStreamData()
Expand Down Expand Up @@ -102,7 +100,7 @@ bool DVBStreamData::IsRedundant(uint pid, const PSIPTable &psip) const
}

bool is_eit = false;
if (DVB_EIT_PID == pid || FREESAT_EIT_PID == pid)
if (PID::DVB_EIT_PID == pid || PID::FREESAT_EIT_PID == pid)
{
// Standard Now/Next Event Information Tables for this transport
is_eit |= TableID::PF_EIT == table_id;
Expand Down Expand Up @@ -130,15 +128,15 @@ bool DVBStreamData::IsRedundant(uint pid, const PSIPTable &psip) const
return m_sdtoStatus.IsSectionSeen(psip.TableIDExtension(), version, psip.Section());
}

if (DVB_EIT_PID == pid || FREESAT_EIT_PID == pid || MCA_EIT_PID == pid)
if (PID::DVB_EIT_PID == pid || PID::FREESAT_EIT_PID == pid || PID::MCA_EIT_PID == pid)
{
// Standard Now/Next Event Information Tables for other transport
is_eit |= TableID::PF_EITo == table_id;
// Standard Future Event Information Tables for other transports
is_eit |= (TableID::SC_EITbego <= table_id &&
TableID::SC_EITendo >= table_id);
}
if (DVB_DNLONG_EIT_PID == pid || DVB_BVLONG_EIT_PID == pid)
if (PID::DVB_DNLONG_EIT_PID == pid || PID::DVB_BVLONG_EIT_PID == pid)
{
// Dish Network and Bev Long Term Future Event Information
// for all transports
Expand All @@ -152,7 +150,7 @@ bool DVBStreamData::IsRedundant(uint pid, const PSIPTable &psip) const
return m_eitStatus.IsSectionSeen(key, version, psip.Section());
}

if (((PREMIERE_EIT_DIREKT_PID == pid) || (PREMIERE_EIT_SPORT_PID == pid)) &&
if (((PID::PREMIERE_EIT_DIREKT_PID == pid) || (PID::PREMIERE_EIT_SPORT_PID == pid)) &&
TableID::PREMIERE_CIT == table_id)
{
uint content_id = PremiereContentInformationTable(psip).ContentID();
Expand Down Expand Up @@ -196,9 +194,9 @@ void DVBStreamData::Reset(uint desired_netid, uint desired_tsid,

m_cacheLock.unlock();
}
AddListeningPID(DVB_NIT_PID);
AddListeningPID(DVB_SDT_PID);
AddListeningPID(DVB_TDT_PID);
AddListeningPID(PID::DVB_NIT_PID);
AddListeningPID(PID::DVB_SDT_PID);
AddListeningPID(PID::DVB_TDT_PID);
}

/** \fn DVBStreamData::HandleTables(uint pid, const PSIPTable&)
Expand Down Expand Up @@ -363,9 +361,9 @@ bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip)
}
}

if ((DVB_EIT_PID == pid || DVB_DNLONG_EIT_PID == pid || FREESAT_EIT_PID == pid ||
((MCA_ONID == m_desiredNetId) && (MCA_EIT_TSID == m_desiredTsId) &&
(MCA_EIT_PID == pid)) || DVB_BVLONG_EIT_PID == pid) &&
if ((PID::DVB_EIT_PID == pid || PID::DVB_DNLONG_EIT_PID == pid || PID::FREESAT_EIT_PID == pid ||
((OriginalNetworkID::MCA == m_desiredNetId) && (MCA_EIT_TSID == m_desiredTsId) &&
(PID::MCA_EIT_PID == pid)) || PID::DVB_BVLONG_EIT_PID == pid) &&

DVBEventInformationTable::IsEIT(psip.TableID()))
{
Expand All @@ -388,8 +386,8 @@ bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip)
return true;
}

if (m_desiredNetId == PREMIERE_ONID &&
(PREMIERE_EIT_DIREKT_PID == pid || PREMIERE_EIT_SPORT_PID == pid) &&
if (m_desiredNetId == OriginalNetworkID::PREMIERE &&
(PID::PREMIERE_EIT_DIREKT_PID == pid || PID::PREMIERE_EIT_SPORT_PID == pid) &&
PremiereContentInformationTable::IsEIT(psip.TableID()))
{
QMutexLocker locker(&m_listenerLock);
Expand Down Expand Up @@ -450,36 +448,36 @@ bool DVBStreamData::GetEITPIDChanges(const uint_vec_t &cur_pids,
if ((m_eitRate >= 0.5F) && HasAnyEIT())
{
if (find(cur_pids.begin(), cur_pids.end(),
(uint) DVB_EIT_PID) == cur_pids.end())
(uint) PID::DVB_EIT_PID) == cur_pids.end())
{
add_pids.push_back(DVB_EIT_PID);
add_pids.push_back(PID::DVB_EIT_PID);
}

if (m_dvbEitDishnetLong &&
find(cur_pids.begin(), cur_pids.end(),
(uint) DVB_DNLONG_EIT_PID) == cur_pids.end())
(uint) PID::DVB_DNLONG_EIT_PID) == cur_pids.end())
{
add_pids.push_back(DVB_DNLONG_EIT_PID);
add_pids.push_back(PID::DVB_DNLONG_EIT_PID);
}

if (m_dvbEitDishnetLong &&
find(cur_pids.begin(), cur_pids.end(),
(uint) DVB_BVLONG_EIT_PID) == cur_pids.end())
(uint) PID::DVB_BVLONG_EIT_PID) == cur_pids.end())
{
add_pids.push_back(DVB_BVLONG_EIT_PID);
add_pids.push_back(PID::DVB_BVLONG_EIT_PID);
}

#if 0
// OpenTV EIT pids
if (m_dvbEitDishnetLong)
{
for (uint pid = OTV_EIT_TIT_PID_START; pid <= OTV_EIT_TIT_PID_END; pid++)
for (uint pid = PID::OTV_EIT_TIT_PID_START; pid <= PID::OTV_EIT_TIT_PID_END; pid++)
{
if (find(cur_pids.begin(), cur_pids.end(),
pid) == cur_pids.end())
add_pids.push_back(pid);
}
for (uint pid = OTV_EIT_SUP_PID_START; pid <= OTV_EIT_SUP_PID_END; pid++)
for (uint pid = PID::OTV_EIT_SUP_PID_START; pid <= PID::OTV_EIT_SUP_PID_END; pid++)
{
if (find(cur_pids.begin(), cur_pids.end(),
pid) == cur_pids.end())
Expand All @@ -488,67 +486,67 @@ bool DVBStreamData::GetEITPIDChanges(const uint_vec_t &cur_pids,
}
#endif

if (m_desiredNetId == PREMIERE_ONID &&
if (m_desiredNetId == OriginalNetworkID::PREMIERE &&
find(cur_pids.begin(), cur_pids.end(),
(uint) PREMIERE_EIT_DIREKT_PID) == cur_pids.end())
(uint) PID::PREMIERE_EIT_DIREKT_PID) == cur_pids.end())
{
add_pids.push_back(PREMIERE_EIT_DIREKT_PID);
add_pids.push_back(PID::PREMIERE_EIT_DIREKT_PID);
}

if (m_desiredNetId == PREMIERE_ONID &&
if (m_desiredNetId == OriginalNetworkID::PREMIERE &&
find(cur_pids.begin(), cur_pids.end(),
(uint) PREMIERE_EIT_SPORT_PID) == cur_pids.end())
(uint) PID::PREMIERE_EIT_SPORT_PID) == cur_pids.end())
{
add_pids.push_back(PREMIERE_EIT_SPORT_PID);
add_pids.push_back(PID::PREMIERE_EIT_SPORT_PID);
}

if (find(cur_pids.begin(), cur_pids.end(),
(uint) FREESAT_EIT_PID) == cur_pids.end())
(uint) PID::FREESAT_EIT_PID) == cur_pids.end())
{
add_pids.push_back(FREESAT_EIT_PID);
add_pids.push_back(PID::FREESAT_EIT_PID);
}

if (MCA_ONID == m_desiredNetId && MCA_EIT_TSID == m_desiredTsId &&
if (OriginalNetworkID::MCA == m_desiredNetId && MCA_EIT_TSID == m_desiredTsId &&
find(cur_pids.begin(), cur_pids.end(),
(uint) MCA_EIT_PID) == cur_pids.end())
(uint) PID::MCA_EIT_PID) == cur_pids.end())
{
add_pids.push_back(MCA_EIT_PID);
add_pids.push_back(PID::MCA_EIT_PID);
}

}
else
{
if (find(cur_pids.begin(), cur_pids.end(),
(uint) DVB_EIT_PID) != cur_pids.end())
(uint) PID::DVB_EIT_PID) != cur_pids.end())
{
del_pids.push_back(DVB_EIT_PID);
del_pids.push_back(PID::DVB_EIT_PID);
}

if (m_dvbEitDishnetLong &&
find(cur_pids.begin(), cur_pids.end(),
(uint) DVB_DNLONG_EIT_PID) != cur_pids.end())
(uint) PID::DVB_DNLONG_EIT_PID) != cur_pids.end())
{
del_pids.push_back(DVB_DNLONG_EIT_PID);
del_pids.push_back(PID::DVB_DNLONG_EIT_PID);
}

if (m_dvbEitDishnetLong &&
find(cur_pids.begin(), cur_pids.end(),
(uint) DVB_BVLONG_EIT_PID) != cur_pids.end())
(uint) PID::DVB_BVLONG_EIT_PID) != cur_pids.end())
{
del_pids.push_back(DVB_BVLONG_EIT_PID);
del_pids.push_back(PID::DVB_BVLONG_EIT_PID);
}

#if 0
// OpenTV EIT pids
if (m_dvbEitDishnetLong)
{
for (uint pid = OTV_EIT_TIT_PID_START; pid <= OTV_EIT_TIT_PID_END; pid++)
for (uint pid = PID::OTV_EIT_TIT_PID_START; pid <= PID::OTV_EIT_TIT_PID_END; pid++)
{
if (find(cur_pids.begin(), cur_pids.end(),
pid) != cur_pids.end())
del_pids.push_back(pid);
}
for(uint pid=OTV_EIT_SUP_PID_START; pid <= OTV_EIT_SUP_PID_END; pid++)
for(uint pid=PID::OTV_EIT_SUP_PID_START; pid <= PID::OTV_EIT_SUP_PID_END; pid++)
{
if (find(cur_pids.begin(), cur_pids.end(),
pid) != cur_pids.end())
Expand All @@ -557,31 +555,31 @@ bool DVBStreamData::GetEITPIDChanges(const uint_vec_t &cur_pids,
}
#endif

if (m_desiredNetId == PREMIERE_ONID &&
if (m_desiredNetId == OriginalNetworkID::PREMIERE &&
find(cur_pids.begin(), cur_pids.end(),
(uint) PREMIERE_EIT_DIREKT_PID) != cur_pids.end())
(uint) PID::PREMIERE_EIT_DIREKT_PID) != cur_pids.end())
{
del_pids.push_back(PREMIERE_EIT_DIREKT_PID);
del_pids.push_back(PID::PREMIERE_EIT_DIREKT_PID);
}

if (m_desiredNetId == PREMIERE_ONID &&
if (m_desiredNetId == OriginalNetworkID::PREMIERE &&
find(cur_pids.begin(), cur_pids.end(),
(uint) PREMIERE_EIT_SPORT_PID) != cur_pids.end())
(uint) PID::PREMIERE_EIT_SPORT_PID) != cur_pids.end())
{
del_pids.push_back(PREMIERE_EIT_SPORT_PID);
del_pids.push_back(PID::PREMIERE_EIT_SPORT_PID);
}

if (find(cur_pids.begin(), cur_pids.end(),
(uint) FREESAT_EIT_PID) != cur_pids.end())
(uint) PID::FREESAT_EIT_PID) != cur_pids.end())
{
del_pids.push_back(FREESAT_EIT_PID);
del_pids.push_back(PID::FREESAT_EIT_PID);
}

if (MCA_ONID == m_desiredNetId && MCA_EIT_TSID == m_desiredTsId &&
if (OriginalNetworkID::MCA == m_desiredNetId && MCA_EIT_TSID == m_desiredTsId &&
find(cur_pids.begin(), cur_pids.end(),
(uint) MCA_EIT_PID) != cur_pids.end())
(uint) PID::MCA_EIT_PID) != cur_pids.end())
{
del_pids.push_back(MCA_EIT_PID);
del_pids.push_back(PID::MCA_EIT_PID);
}
}

Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
Expand Up @@ -43,8 +43,8 @@ MPEGStreamData::MPEGStreamData(int desiredProgram, int cardnum,
// Single program stuff
m_desiredProgram(desiredProgram)
{
MPEGStreamData::AddListeningPID(MPEG_PAT_PID);
MPEGStreamData::AddListeningPID(MPEG_CAT_PID);
MPEGStreamData::AddListeningPID(PID::MPEG_PAT_PID);
MPEGStreamData::AddListeningPID(PID::MPEG_CAT_PID);
}

MPEGStreamData::~MPEGStreamData()
Expand Down Expand Up @@ -165,8 +165,8 @@ void MPEGStreamData::Reset(int desiredProgram)

ResetDecryptionMonitoringState();

AddListeningPID(MPEG_PAT_PID);
AddListeningPID(MPEG_CAT_PID);
AddListeningPID(PID::MPEG_PAT_PID);
AddListeningPID(PID::MPEG_CAT_PID);
}

void MPEGStreamData::DeletePartialPSIP(uint pid)
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/mpeg/mpegtables.cpp
Expand Up @@ -736,20 +736,20 @@ uint ProgramMapTable::FindPIDs(uint type,
uint ProgramMapTable::FindUnusedPID(uint desired_pid) const
{
uint pid = desired_pid;
if (pid >= MPEG_NULL_PID)
if (pid >= PID::MPEG_NULL_PID)
pid = 0x20;

while (FindPID(pid) != -1)
pid += 0x10;

if (pid < MPEG_NULL_PID)
if (pid < PID::MPEG_NULL_PID)
return pid;

pid = desired_pid;
while (FindPID(pid) != -1)
pid += 1;

if (pid < MPEG_NULL_PID)
if (pid < PID::MPEG_NULL_PID)
return pid;

pid = 0x20;
Expand Down

0 comments on commit cd67b60

Please sign in to comment.