Ticket #4472: 4472-v1.patch
File 4472-v1.patch, 7.0 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/channel.h
31 31 Channel(TVRec *parent, const QString &videodevice); 32 32 virtual ~Channel(void); 33 33 34 bool Init(QString &inputname, QString &startchannel );34 bool Init(QString &inputname, QString &startchannel, bool setchan); 35 35 36 36 bool Open(void); 37 37 void Close(void); -
libs/libmythtv/channelbase.h
28 28 ChannelBase(TVRec *parent); 29 29 virtual ~ChannelBase(); 30 30 31 virtual bool Init(QString &inputname, QString &startchannel); 31 virtual bool Init(QString &inputname, QString &startchannel, bool setchan); 32 virtual bool IsTunable(const QString &input, const QString &channum) const; 32 33 33 34 // Methods that must be implemented. 34 35 /// \brief Opens the channel changing hardware for use. -
libs/libmythtv/channelbase.cpp
45 45 { 46 46 } 47 47 48 bool ChannelBase::Init(QString &inputname, QString &startchannel )48 bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan) 49 49 { 50 50 bool ok; 51 51 52 if (inputname.isEmpty()) 52 if (!setchan) 53 ok = IsTunable(inputname, startchannel); 54 else if (inputname.isEmpty()) 53 55 ok = SetChannelByString(startchannel); 54 56 else 55 57 ok = SwitchToInput(inputname, startchannel); … … 86 88 87 89 if (chanid && cit != channels.end()) 88 90 { 89 ok = SwitchToInput(*it, (*cit).channum); 91 if (!setchan) 92 ok = IsTunable(inputname, startchannel); 93 else 94 ok = SwitchToInput(*it, (*cit).channum); 95 90 96 if (ok) 91 97 { 92 98 inputname = *it; 93 99 startchannel = QDeepCopy<QString>((*cit).channum); 94 msg2 = QString(" tuned to '%1' on input '%2' instead.")100 msg2 = QString("selected to '%1' on input '%2' instead.") 95 101 .arg(startchannel).arg(inputname); 96 102 msg_error = false; 97 103 } … … 111 117 return ok; 112 118 } 113 119 120 bool ChannelBase::IsTunable(const QString &input, const QString &channum) const 121 { 122 QString loc = LOC + QString("IsTunable(%1,%2)").arg(input).arg(channum); 123 124 int inputid = currentInputID; 125 if (!input.isEmpty()) 126 inputid = GetInputByName(input); 127 128 InputMap::const_iterator it = inputs.find(inputid); 129 if (it == inputs.end()) 130 { 131 VERBOSE(VB_IMPORTANT, loc + " " + QString( 132 "Requested non-existant input '%1':'%2' ") 133 .arg(input).arg(inputid)); 134 135 return false; 136 } 137 138 uint mplexid_restriction; 139 if (!IsInputAvailable(inputid, mplexid_restriction)) 140 { 141 VERBOSE(VB_IMPORTANT, loc + " " + QString( 142 "Requested channel is on input '%1' " 143 "which is in a busy input group") 144 .arg(inputid)); 145 146 return false; 147 } 148 149 // Fetch tuning data from the database. 150 QString tvformat, modulation, freqtable, freqid, dtv_si_std; 151 int finetune; 152 uint64_t frequency; 153 int mpeg_prog_num; 154 uint atsc_major, atsc_minor, mplexid, tsid, netid; 155 bool commfree; 156 157 if (!ChannelUtil::GetChannelData( 158 (*it)->sourceid, channum, 159 tvformat, modulation, freqtable, freqid, 160 finetune, frequency, 161 dtv_si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid, 162 mplexid, commfree)) 163 { 164 VERBOSE(VB_IMPORTANT, loc + " " + QString( 165 "Failed to find channel in DB on input '%1' ") 166 .arg(inputid)); 167 168 return false; 169 } 170 171 if (mplexid_restriction && (mplexid != mplexid_restriction)) 172 { 173 VERBOSE(VB_IMPORTANT, loc + " " + QString( 174 "Channel is valid, but tuner is busy " 175 "on different multiplex (%1 != %2)") 176 .arg(mplexid).arg(mplexid_restriction)); 177 178 return false; 179 } 180 181 return true; 182 } 183 114 184 uint ChannelBase::GetNextChannel(uint chanid, int direction) const 115 185 { 116 186 if (!chanid) -
libs/libmythtv/dvbchannel.h
34 34 bool Open(void) { return Open(this); } 35 35 void Close(void) { Close(this); } 36 36 37 bool Init(QString &inputname, QString &startchannel );37 bool Init(QString &inputname, QString &startchannel, bool setchan); 38 38 39 39 // Sets 40 40 void SetPMT(const ProgramMapTable*); -
libs/libmythtv/dvbchannel.cpp
297 297 return it != is_open.end(); 298 298 } 299 299 300 bool DVBChannel::Init(QString &inputname, QString &startchannel )300 bool DVBChannel::Init(QString &inputname, QString &startchannel, bool setchan) 301 301 { 302 if ( !IsOpen())302 if (setchan && !IsOpen()) 303 303 Open(this); 304 return ChannelBase::Init(inputname, startchannel); 304 305 return ChannelBase::Init(inputname, startchannel, setchan); 305 306 } 306 307 307 308 // documented in dtvchannel.h -
libs/libmythtv/tv_rec.cpp
1175 1175 QString input = inputname; 1176 1176 QString channum = startchannel; 1177 1177 1178 channel->Init(input, channum );1178 channel->Init(input, channum, true); 1179 1179 } 1180 1180 1181 1181 void TVRec::CloseChannel(void) … … 3310 3310 } 3311 3311 } 3312 3312 if (request.flags & kFlagLiveTV) 3313 channel->Init(input, channum );3313 channel->Init(input, channum, false); 3314 3314 3315 3315 if (channel && !channum.isEmpty() && (channum.find("NextChannel") >= 0)) 3316 3316 { -
libs/libmythtv/channel.cpp
58 58 Close(); 59 59 } 60 60 61 bool Channel::Init(QString &inputname, QString &startchannel )61 bool Channel::Init(QString &inputname, QString &startchannel, bool setchan) 62 62 { 63 SetFormat(gContext->GetSetting("TVFormat")); 64 SetDefaultFreqTable(gContext->GetSetting("FreqTable")); 65 return ChannelBase::Init(inputname, startchannel); 63 if (setchan) 64 { 65 SetFormat(gContext->GetSetting("TVFormat")); 66 SetDefaultFreqTable(gContext->GetSetting("FreqTable")); 67 } 68 return ChannelBase::Init(inputname, startchannel, setchan); 66 69 } 67 70 68 71 bool Channel::Open(void)