Permalink
Browse files

Support limited multirec on digital tuners that don't use multiplexes.

This is primarily intended for cable card tuners like the Ceton and
HDHomerun Prime.  In theory, other tuners which produce digital
output, such as firewire and the analog side of the HVR-2250, could do
this too when they are converted to use the newer stream handler.

This change will not magically make these cards capable of recording
more than one channel at a time on the same tuner.  It will, hoever,
let the same content be written to different recordings when they
overlap because of pre/post-roll or start-early/end-late settings.

Note that the scheduler does not currently try to place overlapping
programs to take advantage of multirec.  A future change will try to
address that.
  • Loading branch information...
gigem committed May 8, 2014
1 parent 244ce4f commit cd86668485773e271f6950b79e2921e9130a8886
@@ -107,8 +107,8 @@ package MythTV;
# Note: as of July 21, 2010, this is actually a string, to account for proto
# versions of the form "58a". This will get used if protocol versions are
# changed on a fixes branch ongoing.
our $PROTO_VERSION = "80";
our $PROTO_TOKEN = "TaDah!";
our $PROTO_VERSION = "81";
our $PROTO_TOKEN = "MultiRecDos";

# currentDatabaseVersion is defined in libmythtv in
# mythtv/libs/libmythtv/dbcheck.cpp and should be the current MythTV core
@@ -11,8 +11,8 @@ class MythBackend {
// MYTH_PROTO_VERSION is defined in libmyth in mythtv/libs/libmyth/mythcontext.h
// and should be the current MythTV protocol version.
static $protocol_version = '80';
static $protocol_token = 'TaDah!';
static $protocol_version = '81';
static $protocol_token = 'MultiRecDos';
// The character string used by the backend to separate records
static $backend_separator = '[]:[]';
@@ -8,8 +8,8 @@
SCHEMA_VERSION = 1324
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '80'
PROTO_TOKEN = 'TaDah!'
PROTO_VERSION = '81'
PROTO_TOKEN = 'MultiRecDos'
BACKEND_SEP = '[]:[]'
INSTALL_PREFIX = '/usr/local'

@@ -39,8 +39,8 @@
* http://www.mythtv.org/wiki/Category:Myth_Protocol_Commands
* http://www.mythtv.org/wiki/Category:Myth_Protocol
*/
#define MYTH_PROTO_VERSION "80"
#define MYTH_PROTO_TOKEN "TaDah!"
#define MYTH_PROTO_VERSION "81"
#define MYTH_PROTO_TOKEN "MultiRecDos"

/** \brief Increment this whenever the MythTV core database schema changes.
*
@@ -1239,14 +1239,14 @@ QList<InputInfo> CardUtil::GetAllInputInfo()

uint CardUtil::GetCardID(uint inputid)
{
InputInfo info(QString::null, 0, inputid, 0, 0, 0);
InputInfo info(QString::null, 0, inputid, 0, 0, 0, 0);
GetInputInfo(info);
return info.cardid;
}

QString CardUtil::GetInputName(uint inputid)
{
InputInfo info(QString::null, 0, inputid, 0, 0, 0);
InputInfo info(QString::null, 0, inputid, 0, 0, 0, 0);
GetInputInfo(info);
return info.name;
}
@@ -1885,7 +1885,8 @@ bool ChannelUtil::GetATSCChannel(uint sourceid, const QString &channum,
}

bool ChannelUtil::GetChannelData(
uint sourceid, const QString &channum,
uint sourceid,
uint &chanid, const QString &channum,
QString &tvformat, QString &modulation,
QString &freqtable, QString &freqid,
int &finetune, uint64_t &frequency,
@@ -1908,7 +1909,7 @@ bool ChannelUtil::GetChannelData(
query.prepare(
"SELECT finetune, freqid, tvformat, freqtable, "
" commmethod, mplexid, "
" atsc_major_chan, atsc_minor_chan, serviceid "
" atsc_major_chan, atsc_minor_chan, serviceid, chanid "
"FROM channel, videosource "
"WHERE videosource.sourceid = channel.sourceid AND "
" channum = :CHANNUM AND "
@@ -1939,6 +1940,7 @@ bool ChannelUtil::GetChannelData(
atsc_major = query.value(6).toUInt();
atsc_minor = query.value(7).toUInt();
mpeg_prog_num = (query.value(8).isNull()) ? -1 : query.value(8).toInt();
chanid = query.value(9).toUInt();

if (!mplexid || (mplexid == 32767)) /* 32767 deals with old lineups */
return true;
@@ -2305,6 +2307,7 @@ uint ChannelUtil::GetNextChannel(
const ChannelInfoList &sorted,
uint old_chanid,
uint mplexid_restriction,
uint chanid_restriction,
ChannelChangeDirection direction,
bool skip_non_visible,
bool skip_same_channum_and_callsign)
@@ -2342,7 +2345,9 @@ uint ChannelUtil::GetNextChannel(
it->channum == start->channum &&
it->callsign == start->callsign) ||
(mplexid_restriction &&
(mplexid_restriction != it->mplexid))));
(mplexid_restriction != it->mplexid)) ||
(chanid_restriction &&
(chanid_restriction != it->chanid))));
}
else if ((CHANNEL_DIRECTION_UP == direction) ||
(CHANNEL_DIRECTION_FAVORITE == direction))
@@ -2359,7 +2364,9 @@ uint ChannelUtil::GetNextChannel(
it->channum == start->channum &&
it->callsign == start->callsign) ||
(mplexid_restriction &&
(mplexid_restriction != it->mplexid))));
(mplexid_restriction != it->mplexid)) ||
(chanid_restriction &&
(chanid_restriction != it->chanid))));
}

return it->chanid;
@@ -171,7 +171,8 @@ class MTV_PUBLIC ChannelUtil
static int GetChanID(uint sourceid, const QString &channum)
{ return GetChannelValueInt("chanid", sourceid, channum); }
static bool GetChannelData(
uint sourceid, const QString &channum,
uint sourceid,
uint &chanid, const QString &channum,
QString &tvformat, QString &modulation,
QString &freqtable, QString &freqid,
int &finetune, uint64_t &frequency,
@@ -208,6 +209,7 @@ class MTV_PUBLIC ChannelUtil
static uint GetNextChannel(const ChannelInfoList &sorted,
uint old_chanid,
uint mplexid_restriction,
uint chanid_restriction,
ChannelChangeDirection direction,
bool skip_non_visible = true,
bool skip_same_channum_and_callsign = false);
@@ -5,13 +5,14 @@

InputInfo::InputInfo(
const QString &_name,
uint _sourceid, uint _inputid, uint _cardid, uint _mplexid,
uint _sourceid, uint _inputid, uint _cardid, uint _mplexid, uint _chanid,
uint _livetvorder) :
name(_name),
sourceid(_sourceid),
inputid(_inputid),
cardid(_cardid),
mplexid(_mplexid),
chanid(_chanid),
livetvorder(_livetvorder)
{
name.detach();
@@ -48,7 +49,8 @@ bool InputInfo::FromStringList(QStringList::const_iterator &it,

recPriority = (*it).toInt(); NEXT();
scheduleOrder = (*it).toUInt(); NEXT();
quickTune = (*it).toUInt(); ++it;
quickTune = (*it).toUInt(); NEXT();
chanid = (*it).toUInt(); ++it;

return true;
}
@@ -66,19 +68,20 @@ void InputInfo::ToStringList(QStringList &list) const
list.push_back(QString::number(recPriority));
list.push_back(QString::number(scheduleOrder));
list.push_back(QString::number(quickTune));
list.push_back(QString::number(chanid));
}

TunedInputInfo::TunedInputInfo(
const QString &_name,
uint _sourceid, uint _inputid, uint _cardid, uint _mplexid,
uint _livetvorder, uint _chanid) :
InputInfo(_name, _sourceid, _inputid, _cardid, _mplexid, _livetvorder),
chanid(_chanid)
InputInfo(_name, _sourceid, _inputid, _cardid, _mplexid, _chanid,
_livetvorder)
{
}

TunedInputInfo::TunedInputInfo(const TunedInputInfo &other) :
InputInfo(other), chanid(other.chanid)
InputInfo(other)
{
}

@@ -98,18 +101,15 @@ void TunedInputInfo::Clear(void)
bool TunedInputInfo::FromStringList(QStringList::const_iterator &it,
QStringList::const_iterator end)
{
if (!InputInfo::FromStringList(it, end) || (it == end))
if (!InputInfo::FromStringList(it, end))
return false;

chanid = (*it).toUInt();
++it;
return true;
}

void TunedInputInfo::ToStringList(QStringList &list) const
{
InputInfo::ToStringList(list);
list.push_back(QString::number(chanid));
}

ChannelInputInfo::ChannelInputInfo(const ChannelInputInfo &other) :
@@ -14,18 +14,19 @@ class MTV_PUBLIC InputInfo
public:
InputInfo() : name(QString::null),
sourceid(0), inputid(0), cardid(0), mplexid(0),
recPriority(0), scheduleOrder(0),
chanid(0), recPriority(0), scheduleOrder(0),
livetvorder(0), quickTune(false) {}
InputInfo(const QString &name,
uint sourceid, uint inputid, uint cardid, uint mplexid,
uint livetvorder);
uint chanid, uint livetvorder);

InputInfo(const InputInfo &other) :
name(other.name),
sourceid(other.sourceid),
inputid(other.inputid),
cardid(other.cardid),
mplexid(other.mplexid),
chanid(other.chanid),
displayName(other.displayName),
recPriority(other.recPriority),
scheduleOrder(other.scheduleOrder),
@@ -43,6 +44,7 @@ class MTV_PUBLIC InputInfo
inputid = other.inputid;
cardid = other.cardid;
mplexid = other.mplexid;
chanid = other.chanid;
displayName = other.displayName;
recPriority = other.recPriority;
scheduleOrder = other.scheduleOrder;
@@ -72,6 +74,7 @@ class MTV_PUBLIC InputInfo
uint inputid; ///< unique key in DB for this input
uint cardid; ///< card id associated with input
uint mplexid; ///< mplexid restriction if applicable
uint chanid; ///< chanid restriction if applicable
QString displayName;
int recPriority;
uint scheduleOrder;
@@ -82,7 +85,7 @@ class MTV_PUBLIC InputInfo
class MTV_PUBLIC TunedInputInfo : public InputInfo
{
public:
TunedInputInfo() : chanid(0) { }
TunedInputInfo() { }
TunedInputInfo(const QString &name,
uint _sourceid, uint _inputid,
uint _cardid, uint _mplexid, uint _livetvorder,
@@ -96,9 +99,6 @@ class MTV_PUBLIC TunedInputInfo : public InputInfo
virtual void ToStringList(QStringList &list) const;

virtual void Clear(void);

public:
uint chanid;
};

class MTV_PUBLIC ChannelInputInfo : public InputInfo
@@ -114,7 +114,8 @@ class MTV_PUBLIC ChannelInputInfo : public InputInfo
uint _inputid, uint _mplexid,
uint _livetvorder,
const ChannelInfoList &_channels) :
InputInfo(_name, _sourceid, _inputid, _cardid, _mplexid, _livetvorder),
InputInfo(_name, _sourceid, _inputid, _cardid, _mplexid, 0,
_livetvorder),
startChanNum(_startChanNum),
tuneToChannel(_tuneToChannel), externalChanger(_externalChanger),
channels(_channels),
Oops, something went wrong.

0 comments on commit cd86668

Please sign in to comment.