Skip to content

Commit

Permalink
Re-implement cardid logging in streamdata in a much cleaner and more …
Browse files Browse the repository at this point in the history
…useful way.

Note: this commit may be reverted if it is decided that corrupting the
mpegstream data with (useless) cardid info, is not sufficiently offset by the
extra logging information.
  • Loading branch information
jpoet committed Jan 21, 2013
1 parent 080bf37 commit 5070987
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 84 deletions.
53 changes: 33 additions & 20 deletions mythtv/libs/libmythtv/mpeg/atscstreamdata.cpp
Expand Up @@ -12,7 +12,7 @@ using namespace std;
#include "ringbuffer.h"
#include "eithelper.h"

#define LOC QString("ATSCStream: ")
#define LOC QString("ATSCStream[%1]: ").arg(_cardid)

/** \class ATSCStreamData
* \brief Encapsulates data about ATSC stream and emits events for most tables.
Expand All @@ -31,8 +31,8 @@ using namespace std;
*/
ATSCStreamData::ATSCStreamData(int desiredMajorChannel,
int desiredMinorChannel,
bool cacheTables)
: MPEGStreamData(-1, cacheTables),
int cardnum, bool cacheTables)
: MPEGStreamData(-1, cardnum, cacheTables),
_GPS_UTC_offset(GPS_LEAP_SECONDS),
_atsc_eit_reset(false),
_mgt_version(-1),
Expand Down Expand Up @@ -475,7 +475,7 @@ bool ATSCStreamData::HandleTables(uint pid, const PSIPTable &psip)

default:
{
LOG(VB_RECORD, LOG_ERR,
LOG(VB_RECORD, LOG_ERR, LOC +
QString("ATSCStreamData::HandleTables(): Unknown table 0x%1")
.arg(psip.TableID(),0,16));
break;
Expand Down Expand Up @@ -528,7 +528,7 @@ bool ATSCStreamData::GetEITPIDChanges(const uint_vec_t &cur_pids,
uint i;

#if 0
LOG(VB_GENERAL, LOG_DEBUG, QString("eit size: %1, rate: %2, cnt: %3")
LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("eit size: %1, rate: %2, cnt: %3")
.arg(_atsc_eit_pids.size()).arg(_eit_rate).arg(eit_count));
#endif

Expand Down Expand Up @@ -598,7 +598,8 @@ void ATSCStreamData::ProcessVCT(uint tsid, const VirtualChannelTable *vct)
{
if (vct->IsHidden(i) && vct->IsHiddenInGuide(i))
{
LOG(VB_EIT, LOG_INFO, QString("%1 chan %2-%3 is hidden in guide")
LOG(VB_EIT, LOG_INFO, LOC +
QString("%1 chan %2-%3 is hidden in guide")
.arg(vct->ModulationMode(i) == 1 ? "NTSC" : "ATSC")
.arg(vct->MajorChannel(i))
.arg(vct->MinorChannel(i)));
Expand All @@ -607,13 +608,13 @@ void ATSCStreamData::ProcessVCT(uint tsid, const VirtualChannelTable *vct)

if (1 == vct->ModulationMode(i))
{
LOG(VB_EIT, LOG_INFO, QString("Ignoring NTSC chan %1-%2")
LOG(VB_EIT, LOG_INFO, LOC + QString("Ignoring NTSC chan %1-%2")
.arg(vct->MajorChannel(i))
.arg(vct->MinorChannel(i)));
continue;
}

LOG(VB_EIT, LOG_INFO, QString("Adding Source #%1 ATSC chan %2-%3")
LOG(VB_EIT, LOG_INFO, LOC + QString("Adding Source #%1 ATSC chan %2-%3")
.arg(vct->SourceID(i))
.arg(vct->MajorChannel(i))
.arg(vct->MinorChannel(i)));
Expand Down Expand Up @@ -644,7 +645,8 @@ void ATSCStreamData::ProcessCVCT(uint tsid,
bool ATSCStreamData::HasCachedMGT(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

return (bool)(_cached_mgt);
}
Expand Down Expand Up @@ -680,7 +682,8 @@ bool ATSCStreamData::HasChannel(uint major, uint minor) const
bool ATSCStreamData::HasCachedTVCT(uint pid, bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

_cache_lock.lock();
tvct_cache_t::const_iterator it = _cached_tvcts.find(pid);
Expand All @@ -693,7 +696,8 @@ bool ATSCStreamData::HasCachedTVCT(uint pid, bool current) const
bool ATSCStreamData::HasCachedCVCT(uint pid, bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

_cache_lock.lock();
cvct_cache_t::const_iterator it = _cached_cvcts.find(pid);
Expand All @@ -706,7 +710,8 @@ bool ATSCStreamData::HasCachedCVCT(uint pid, bool current) const
bool ATSCStreamData::HasCachedAllTVCTs(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

if (!_cached_mgt)
return false;
Expand All @@ -726,7 +731,8 @@ bool ATSCStreamData::HasCachedAllTVCTs(bool current) const
bool ATSCStreamData::HasCachedAllCVCTs(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

if (!_cached_mgt)
return false;
Expand All @@ -746,7 +752,8 @@ bool ATSCStreamData::HasCachedAllCVCTs(bool current) const
bool ATSCStreamData::HasCachedAnyTVCTs(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

QMutexLocker locker(&_cache_lock);
return !_cached_tvcts.empty();
Expand All @@ -755,7 +762,8 @@ bool ATSCStreamData::HasCachedAnyTVCTs(bool current) const
bool ATSCStreamData::HasCachedAnyCVCTs(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

QMutexLocker locker(&_cache_lock);
return !_cached_cvcts.empty();
Expand All @@ -764,7 +772,8 @@ bool ATSCStreamData::HasCachedAnyCVCTs(bool current) const
const MasterGuideTable *ATSCStreamData::GetCachedMGT(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

_cache_lock.lock();
const MasterGuideTable *mgt = _cached_mgt;
Expand All @@ -777,7 +786,8 @@ const MasterGuideTable *ATSCStreamData::GetCachedMGT(bool current) const
tvct_const_ptr_t ATSCStreamData::GetCachedTVCT(uint pid, bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

tvct_ptr_t tvct = NULL;

Expand All @@ -793,7 +803,8 @@ tvct_const_ptr_t ATSCStreamData::GetCachedTVCT(uint pid, bool current) const
cvct_const_ptr_t ATSCStreamData::GetCachedCVCT(uint pid, bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

cvct_ptr_t cvct = NULL;

Expand All @@ -809,7 +820,8 @@ cvct_const_ptr_t ATSCStreamData::GetCachedCVCT(uint pid, bool current) const
tvct_vec_t ATSCStreamData::GetCachedTVCTs(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

vector<const TerrestrialVirtualChannelTable*> tvcts;

Expand All @@ -829,7 +841,8 @@ tvct_vec_t ATSCStreamData::GetCachedTVCTs(bool current) const
cvct_vec_t ATSCStreamData::GetCachedCVCTs(bool current) const
{
if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

vector<const CableVirtualChannelTable*> cvcts;

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/atscstreamdata.h
Expand Up @@ -29,7 +29,7 @@ class MTV_PUBLIC ATSCStreamData : virtual public MPEGStreamData
public:
ATSCStreamData(int desiredMajorChannel,
int desiredMinorChannel,
bool cacheTables = false);
int cardnum, bool cacheTables = false);
virtual ~ATSCStreamData();

virtual void Reset(void) { ResetATSC(-1, -1); }
Expand Down
27 changes: 18 additions & 9 deletions mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp
Expand Up @@ -14,10 +14,12 @@ using namespace std;
#define MCA_EIT_TSID 136
#define MCA_EIT_PID 1018

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

// service_id is synonymous with the MPEG program number in the PMT.
DVBStreamData::DVBStreamData(uint desired_netid, uint desired_tsid,
int desired_program, bool cacheTables)
: MPEGStreamData(desired_program, cacheTables),
int desired_program, int cardnum, bool cacheTables)
: MPEGStreamData(desired_program, cardnum, cacheTables),
_desired_netid(desired_netid), _desired_tsid(desired_tsid),
_dvb_eit_dishnet_long(false),
_nit_version(-2), _nito_version(-2)
Expand Down Expand Up @@ -711,7 +713,8 @@ bool DVBStreamData::HasCachedAnyNIT(bool current) const
QMutexLocker locker(&_cache_lock);

if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

return (bool)(_cached_nit.size());
}
Expand All @@ -721,7 +724,8 @@ bool DVBStreamData::HasCachedAllNIT(bool current) const
QMutexLocker locker(&_cache_lock);

if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

if (_cached_nit.empty())
return false;
Expand All @@ -742,7 +746,8 @@ bool DVBStreamData::HasCachedAllSDT(uint tsid, bool current) const
QMutexLocker locker(&_cache_lock);

if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

sdt_cache_t::const_iterator it = _cached_sdts.find(tsid << 8);
if (it == _cached_sdts.end())
Expand All @@ -764,7 +769,8 @@ bool DVBStreamData::HasCachedAnySDT(uint tsid, bool current) const
QMutexLocker locker(&_cache_lock);

if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

for (uint i = 0; i <= 255; i++)
if (_cached_sdts.find((tsid << 8) | i) != _cached_sdts.end())
Expand Down Expand Up @@ -826,7 +832,8 @@ nit_const_ptr_t DVBStreamData::GetCachedNIT(
QMutexLocker locker(&_cache_lock);

if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

nit_ptr_t nit = NULL;

Expand Down Expand Up @@ -859,7 +866,8 @@ sdt_const_ptr_t DVBStreamData::GetCachedSDT(
QMutexLocker locker(&_cache_lock);

if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

sdt_ptr_t sdt = NULL;

Expand All @@ -876,7 +884,8 @@ sdt_vec_t DVBStreamData::GetCachedSDTs(bool current) const
QMutexLocker locker(&_cache_lock);

if (!current)
LOG(VB_GENERAL, LOG_WARNING, "Currently we ignore \'current\' param");
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Currently we ignore \'current\' param");

sdt_vec_t sdts;

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/dvbstreamdata.h
Expand Up @@ -27,7 +27,7 @@ class MTV_PUBLIC DVBStreamData : virtual public MPEGStreamData
{
public:
DVBStreamData(uint desired_netid, uint desired_tsid,
int desired_program, bool cacheTables = false);
int desired_program, int cardnum, bool cacheTables = false);
virtual ~DVBStreamData();

virtual void Reset(void) { ResetDVB(0, 0, -1); }
Expand Down

0 comments on commit 5070987

Please sign in to comment.