[mythtv-users] 2 mux on same time

Adam Juraszek juriad at gmail.com
Wed Feb 9 13:44:15 UTC 2011


I might have found another solution, but it requires patching the source code.

every channel change triggers
void TV::ChangeChannel(PlayerContext *ctx, uint chanid, const QString
&chan) in tv_play.cpp:
but in some situations (direct number input in livetv), chanid is not
set, so I must do I manually:

// added because I need to force calling ShouldSwitchToAnotherCard;
WORKS ONLY IN MY CASE: I have all channels available on all cards, so
there is a bijection between channum and chanid
else if (!channum.isEmpty() && !chanid) {

		MSqlQuery query(MSqlQuery::InitCon());
		query.prepare("SELECT chanid "
			"FROM channel "
			"WHERE channum = :CHANNUM");
		query.bindValue(":CHANNUM", channum);
		if (!query.exec()) {
			MythDB::DBError("select chanid by channum failed ", query);
		}
		if (query.next()) {
			chanid = query.value(0).toUInt();
		}
	}

the ShouldSwitchToAnotherCard request goes through network and is implemented by
bool TVRec::ShouldSwitchToAnotherCard(QString chanid) in tv_rec.cpp
it will try to find channel on current card first, but it doesn't
check if the channel is tunable on that card

// this will try to check tunability on current card as well
else if (query.size() > 0) {
		msg
				= "Found channel (%1) on current card(%2). and checking if it is tunable";
		VERBOSE(VB_RECORD, LOC + msg.arg(channelname).arg(cardid));

		if (channel->IsTunable(channel->GetCurrentInput(), channelname)) {
			VERBOSE(VB_RECORD, "is tunable!, return false");
			return false;
		}
		VERBOSE(VB_RECORD, "is *not* tunable!, will check other cards");
	}

I think some of these changes could be ported in git, especially the second one.

hope this will help somebody with the same problem.

Adam Juraszek


More information about the mythtv-users mailing list