diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index 91ef914..dd2f1f8 100644
|
a
|
b
|
void TV::ChangeChannel(PlayerContext *ctx, int direction)
|
| 6996 | 6996 | UpdateOSDInput(ctx); |
| 6997 | 6997 | } |
| 6998 | 6998 | |
| | 6999 | static uint get_chanid(const PlayerContext *ctx, |
| | 7000 | uint cardid, const QString &channum) |
| | 7001 | { |
| | 7002 | uint chanid = 0, cur_sourceid = 0; |
| | 7003 | // try to find channel on current input |
| | 7004 | if (ctx && ctx->playingInfo && ctx->playingInfo->GetSourceID()) |
| | 7005 | { |
| | 7006 | cur_sourceid = ctx->playingInfo->GetSourceID(); |
| | 7007 | chanid = max(ChannelUtil::GetChanID(cur_sourceid, channum), 0); |
| | 7008 | if (chanid) |
| | 7009 | return chanid; |
| | 7010 | } |
| | 7011 | // try to find channel on all inputs |
| | 7012 | vector<uint> inputs = CardUtil::GetInputIDs(cardid); |
| | 7013 | for (vector<uint>::const_iterator it = inputs.begin(); |
| | 7014 | it != inputs.end(); ++it) |
| | 7015 | { |
| | 7016 | uint sourceid = CardUtil::GetSourceID(*it); |
| | 7017 | if (cur_sourceid == sourceid) |
| | 7018 | continue; // already tested above |
| | 7019 | if (sourceid) |
| | 7020 | { |
| | 7021 | chanid = max(ChannelUtil::GetChanID(sourceid, channum), 0); |
| | 7022 | if (chanid) |
| | 7023 | return chanid; |
| | 7024 | } |
| | 7025 | } |
| | 7026 | return chanid; |
| | 7027 | } |
| | 7028 | |
| 6999 | 7029 | void TV::ChangeChannel(PlayerContext *ctx, uint chanid, const QString &chan) |
| 7000 | 7030 | { |
| 7001 | 7031 | LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("ChangeChannel(%1, '%2') ") |
| … |
… |
void TV::ChangeChannel(PlayerContext *ctx, uint chanid, const QString &chan)
|
| 7006 | 7036 | |
| 7007 | 7037 | QString channum = chan; |
| 7008 | 7038 | QStringList reclist; |
| | 7039 | QSet<uint> tunable_on; |
| 7009 | 7040 | |
| 7010 | 7041 | QString oldinputname = ctx->recorder->GetInput(); |
| 7011 | 7042 | |
| … |
… |
void TV::ChangeChannel(PlayerContext *ctx, uint chanid, const QString &chan)
|
| 7036 | 7067 | ctx->recorder->CheckChannelPrefix(chan, pref_cardid, |
| 7037 | 7068 | dummy, needed_spacer); |
| 7038 | 7069 | |
| | 7070 | LOG(VB_CHANNEL, LOG_INFO, LOC + |
| | 7071 | QString("CheckChannelPrefix(%1, pref_cardid %2, %3, %4) " |
| | 7072 | "cardid %5") |
| | 7073 | .arg(chan).arg(pref_cardid).arg(dummy).arg(needed_spacer) |
| | 7074 | .arg(cardid)); |
| | 7075 | |
| 7039 | 7076 | channum = add_spacer(chan, needed_spacer); |
| 7040 | | getit = (pref_cardid != cardid); |
| | 7077 | if (pref_cardid != cardid) |
| | 7078 | { |
| | 7079 | getit = true; |
| | 7080 | } |
| | 7081 | else |
| | 7082 | { |
| | 7083 | if (!chanid) |
| | 7084 | chanid = get_chanid(ctx, cardid, chan); |
| | 7085 | tunable_on = IsTunableOn(ctx, chanid, true); |
| | 7086 | getit = !tunable_on.contains(cardid); |
| | 7087 | } |
| 7041 | 7088 | } |
| 7042 | 7089 | |
| 7043 | 7090 | if (getit) |
| 7044 | | reclist = ChannelUtil::GetValidRecorderList(chanid, channum); |
| | 7091 | { |
| | 7092 | QStringList tmp = |
| | 7093 | ChannelUtil::GetValidRecorderList(chanid, channum); |
| | 7094 | if (tunable_on.empty()) |
| | 7095 | { |
| | 7096 | if (!chanid) |
| | 7097 | chanid = get_chanid(ctx, ctx->GetCardID(), chan); |
| | 7098 | tunable_on = IsTunableOn(ctx, chanid, true); |
| | 7099 | } |
| | 7100 | QStringList::const_iterator it = tmp.begin(); |
| | 7101 | for (; it != tmp.end(); ++it) |
| | 7102 | { |
| | 7103 | if (!chanid || tunable_on.contains((*it).toUInt())) |
| | 7104 | reclist.push_back(*it); |
| | 7105 | } |
| | 7106 | } |
| 7045 | 7107 | } |
| 7046 | 7108 | |
| 7047 | 7109 | if (reclist.size()) |
| … |
… |
void TV::ShowLCDDVDInfo(const PlayerContext *ctx)
|
| 7718 | 7780 | |
| 7719 | 7781 | bool TV::IsTunable(const PlayerContext *ctx, uint chanid, bool use_cache) |
| 7720 | 7782 | { |
| 7721 | | LOG(VB_PLAYBACK, LOG_INFO, QString("IsTunable(%1)").arg(chanid)); |
| | 7783 | return !IsTunableOn(ctx,chanid,use_cache).empty(); |
| | 7784 | } |
| | 7785 | |
| | 7786 | QSet<uint> TV::IsTunableOn( |
| | 7787 | const PlayerContext *ctx, uint chanid, bool use_cache) |
| | 7788 | { |
| | 7789 | LOG(VB_CHANNEL, LOG_INFO, QString("IsTunableOn(%1)").arg(chanid)); |
| | 7790 | QSet<uint> tunable_cards; |
| 7722 | 7791 | |
| 7723 | 7792 | if (!chanid) |
| 7724 | | return false; |
| | 7793 | return tunable_cards; |
| 7725 | 7794 | |
| 7726 | 7795 | uint mplexid = ChannelUtil::GetMplexID(chanid); |
| 7727 | 7796 | mplexid = (32767 == mplexid) ? 0 : mplexid; |
| … |
… |
bool TV::IsTunable(const PlayerContext *ctx, uint chanid, bool use_cache)
|
| 7797 | 7866 | inputs[j].mplexid != mplexid) |
| 7798 | 7867 | continue; |
| 7799 | 7868 | |
| 7800 | | LOG(VB_PLAYBACK, LOG_INFO, QString("IsTunable(%1) -> true\n") |
| 7801 | | .arg(chanid)); |
| | 7869 | LOG(VB_CHANNEL, LOG_INFO, QString("IsTunableOn(%1) added %2\n") |
| | 7870 | .arg(chanid).arg(cardids[i])); |
| 7802 | 7871 | |
| 7803 | | return true; |
| | 7872 | tunable_cards.insert(cardids[i]); |
| | 7873 | |
| | 7874 | break; |
| 7804 | 7875 | } |
| 7805 | 7876 | } |
| 7806 | 7877 | |
| 7807 | | LOG(VB_PLAYBACK, LOG_INFO, QString("IsTunable(%1) -> false\n").arg(chanid)); |
| 7808 | | |
| 7809 | | return false; |
| | 7878 | return tunable_cards; |
| 7810 | 7879 | } |
| 7811 | 7880 | |
| 7812 | 7881 | void TV::ClearTunableCache(void) |
diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
index adce496..33ecd1e 100644
|
a
|
b
|
using namespace std;
|
| 24 | 24 | #include <QHash> |
| 25 | 25 | #include <QTime> |
| 26 | 26 | #include <QMap> |
| | 27 | #include <QSet> |
| 27 | 28 | |
| 28 | 29 | // MythTV |
| 29 | 30 | #include "mythdeque.h" |
| … |
… |
class MTV_PUBLIC TV : public QObject
|
| 261 | 262 | bool StartEmbedding(const QRect&); |
| 262 | 263 | void StopEmbedding(void); |
| 263 | 264 | bool IsTunable(const PlayerContext*, uint chanid, bool use_cache = false); |
| | 265 | QSet<uint> IsTunableOn(const PlayerContext*, uint chanid, bool use_cache); |
| 264 | 266 | void ClearTunableCache(void); |
| 265 | 267 | void ChangeChannel(const PlayerContext*, const DBChanList &options); |
| 266 | 268 | void DrawUnusedRects(void); |