Skip to content

Commit

Permalink
V2 Services: GetInputList exclude virtual tuners
Browse files Browse the repository at this point in the history
Exclude virtual tuners from GetInputList API.  If  you want virtual
tuners, GetEncoderList can be used.

Fixes #812
  • Loading branch information
bennettpeter committed Nov 12, 2023
1 parent f2825c0 commit 12bcfd0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
11 changes: 8 additions & 3 deletions mythtv/libs/libmythtv/cardutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,15 +1729,20 @@ bool CardUtil::GetInputInfo(InputInfo &input, std::vector<uint> *groupids)
return true;
}

QList<InputInfo> CardUtil::GetAllInputInfo()
// virtTuners to include virtual tuners in the list
QList<InputInfo> CardUtil::GetAllInputInfo(bool virtTuners)
{
QList<InputInfo> infoInputList;

MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT cardid, "
QString queryStr = "SELECT cardid, "
"inputname, sourceid, livetvorder, "
"schedorder, displayname, recpriority, quicktune "
"FROM capturecard");
"FROM capturecard";

if (!virtTuners)
queryStr.append(" WHERE parentid = 0");
query.prepare(queryStr);

if (!query.exec())
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/cardutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class MTV_PUBLIC CardUtil : public QObject
static std::vector<uint> GetInputIDs(uint sourceid);
static bool GetInputInfo(InputInfo &input,
std::vector<uint> *groupids = nullptr);
static QList<InputInfo> GetAllInputInfo();
static QList<InputInfo> GetAllInputInfo(bool virtTuners);
static QString GetInputName(uint inputid);
static QString GetStartChannel(uint inputid);
static QString GetDisplayName(uint inputid);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythbackend/services/dvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ DTC::EncoderList* Dvr::GetEncoderList()
auto* pList = new DTC::EncoderList();

QReadLocker tvlocker(&TVRec::s_inputsLock);
QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(true);
for (auto * elink : qAsConst(gTVList))
{
if (elink != nullptr)
Expand Down Expand Up @@ -1066,7 +1066,7 @@ DTC::InputList* Dvr::GetInputList()
{
auto *pList = new DTC::InputList();

QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(false);
for (const auto & inputInfo : qAsConst(inputInfoList))
{
DTC::Input *input = pList->AddNewInput();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythbackend/servicesv2/v2dvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ V2InputList* V2Dvr::GetInputList()
{
auto *pList = new V2InputList();

QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(false);
for (const auto & inputInfo : qAsConst(inputInfoList))
{
V2Input *input = pList->AddNewInput();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythbackend/servicesv2/v2serviceUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ void V2FillSeek(V2CutList* pCutList, RecordingInfo* rInfo, MarkTypes marktype)
void FillEncoderList(QVariantList &list, QObject* parent)
{
QReadLocker tvlocker(&TVRec::s_inputsLock);
QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(true);
for (auto * elink : qAsConst(gTVList))
{
if (elink != nullptr)
Expand Down

0 comments on commit 12bcfd0

Please sign in to comment.