Permalink
Browse files

Add mplexid to RecordingInfo for use within the scheduler.

This avoids having to repeatedly query the database when checking for
conflicts between virtual tuners.
  • Loading branch information...
gigem committed Jun 16, 2013
1 parent 7e250bc commit 23914b079856ebb5a9eea20aa90c77eded5469a4
@@ -104,7 +104,8 @@ RecordingInfo::RecordingInfo(
uint _videoproperties,
uint _audioproperties,
bool _future,
int _schedorder) :
int _schedorder,
uint _mplexid) :
ProgramInfo(
_title, _subtitle, _description, _season, _episode,
_category, _chanid, _chanstr, _chansign, _channame,
@@ -115,6 +116,7 @@ RecordingInfo::RecordingInfo(
savedrecstatus(rsUnknown),
future(_future),
schedorder(_schedorder),
mplexid(_mplexid),
desiredrecstartts(_startts),
desiredrecendts(_endts),
record(NULL)
@@ -214,6 +216,7 @@ RecordingInfo::RecordingInfo(
savedrecstatus(rsUnknown),
future(false),
schedorder(0),
mplexid(0),
desiredrecstartts(_startts),
desiredrecendts(_endts),
record(NULL)
@@ -248,6 +251,7 @@ RecordingInfo::RecordingInfo(
savedrecstatus(rsUnknown),
future(false),
schedorder(0),
mplexid(0),
desiredrecstartts(),
desiredrecendts(),
record(NULL)
@@ -399,6 +403,7 @@ void RecordingInfo::clone(const RecordingInfo &other,
savedrecstatus = other.savedrecstatus;
future = other.future;
schedorder = other.schedorder;
mplexid = other.mplexid;
desiredrecstartts = other.desiredrecstartts;
desiredrecendts = other.desiredrecendts;
}
@@ -426,6 +431,7 @@ void RecordingInfo::clone(const ProgramInfo &other,
savedrecstatus = rsUnknown;
future = false;
schedorder = 0;
mplexid = 0;
desiredrecstartts = QDateTime();
desiredrecendts = QDateTime();
}
@@ -441,6 +447,7 @@ void RecordingInfo::clear(void)
savedrecstatus = rsUnknown;
future = false;
schedorder = 0;
mplexid = 0;
desiredrecstartts = QDateTime();
desiredrecendts = QDateTime();
}
@@ -37,6 +37,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
savedrecstatus(rsUnknown),
future(false),
schedorder(0),
mplexid(0),
desiredrecstartts(),
desiredrecendts(),
record(NULL) {}
@@ -46,6 +47,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
savedrecstatus(other.savedrecstatus),
future(other.future),
schedorder(other.schedorder),
mplexid(other.mplexid),
desiredrecstartts(other.desiredrecstartts),
desiredrecendts(other.desiredrecendts),
record(NULL) {}
@@ -55,6 +57,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
savedrecstatus(rsUnknown),
future(false),
schedorder(0),
mplexid(0),
desiredrecstartts(startts),
desiredrecendts(endts),
record(NULL) {}
@@ -64,6 +67,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
savedrecstatus(rsUnknown),
future(false),
schedorder(0),
mplexid(0),
desiredrecstartts(startts),
desiredrecendts(endts),
record(NULL) {}
@@ -74,6 +78,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
savedrecstatus(rsUnknown),
future(false),
schedorder(0),
mplexid(0),
desiredrecstartts(startts),
desiredrecendts(endts),
record(NULL) {}
@@ -140,7 +145,8 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
uint videoproperties,
uint audioproperties,
bool future,
int schedorder);
int schedorder,
uint mplexid);
/// Create RecordingInfo from 'record'+'channel' tables,
/// user in scheduler.cpp @ ~ 3566 & ~ 3643
@@ -260,6 +266,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
RecStatusType savedrecstatus;
bool future;
int schedorder;
uint mplexid; // Only valid within the scheduler
QDateTime desiredrecstartts;
QDateTime desiredrecendts;
@@ -848,6 +848,7 @@ void Scheduler::SlaveConnected(RecordingList &slavelist)
if (sp->GetInputID() && !found)
{
sp->mplexid = sp->QueryMplexID();
reclist.push_back(new RecordingInfo(*sp));
reclist_changed = true;
sp->AddHistory(false);
@@ -1084,15 +1085,14 @@ bool Scheduler::FindNextConflict(
.arg(p->GetCardID()).arg(q->GetCardID())
.arg(igrp.GetSharedInputGroup(
p->GetInputID(), q->GetInputID()))
.arg(p->QueryMplexID()).arg(q->QueryMplexID()));
.arg(p->mplexid).arg(q->mplexid));
}
// if two inputs are in the same input group we have a conflict
// unless the programs are on the same multiplex.
if (p->GetCardID() != q->GetCardID())
{
uint p_mplexid = p->QueryMplexID();
if (p_mplexid && (p_mplexid == q->QueryMplexID()))
if (p->mplexid && (p->mplexid == q->mplexid))
continue;
}
@@ -1700,6 +1700,7 @@ void Scheduler::AddRecording(const RecordingInfo &pi)
QString("Adding '%1' to reclist.").arg(pi.GetTitle()));
RecordingInfo * new_pi = new RecordingInfo(pi);
new_pi->mplexid = new_pi->QueryMplexID();
reclist.push_back(new_pi);
reclist_changed = true;
@@ -3997,7 +3998,8 @@ void Scheduler::AddNewRecords(void)
" p.subtitletypes+0, p.audioprop+0, RECTABLE.storagegroup, "//40-42
" capturecard.hostname, recordmatch.oldrecstatus, NULL, "//43-45
" oldrecstatus.future, cardinput.schedorder, " //46-47
" p.syndicatedepisodenumber, p.partnumber, p.parttotal, ") + //48-50
" p.syndicatedepisodenumber, p.partnumber, p.parttotal, " //48-50
" c.mplexid, ") + //51
pwrpri + QString(
"FROM recordmatch "
"INNER JOIN RECTABLE ON (recordmatch.recordid = RECTABLE.recordid) "
@@ -4056,6 +4058,10 @@ void Scheduler::AddNewRecords(void)
&& callsign == lastp->GetChannelSchedulingID())
continue;
uint mplexid = result.value(51).toUInt();
if (mplexid == 32767)
mplexid = 0;
RecordingInfo *p = new RecordingInfo(
title,
result.value(5).toString(),//subtitle
@@ -4119,7 +4125,8 @@ void Scheduler::AddNewRecords(void)
result.value(39).toUInt(),//videoproperties
result.value(41).toUInt(),//audioproperties
result.value(46).toInt(),//future
result.value(47).toInt());//schedorder
result.value(47).toInt(),//schedorder
mplexid); //mplexid
if (!p->future && !p->IsReactivated() &&
p->oldrecstatus != rsAborted &&
@@ -4128,7 +4135,7 @@ void Scheduler::AddNewRecords(void)
p->SetRecordingStatus(p->oldrecstatus);
}
p->SetRecordingPriority2(result.value(51).toInt());
p->SetRecordingPriority2(result.value(52).toInt());
// Check to see if the program is currently recording and if
// the end time was changed. Ideally, checking for a new end

0 comments on commit 23914b0

Please sign in to comment.