Ticket #3031: 3031-dbg-5.patch
File 3031-dbg-5.patch, 15.6 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/hdhrchannel.cpp
87 87 88 88 bool HDHRChannel::EnterPowerSavingMode(void) 89 89 { 90 #if 0 90 91 return QString::null != TunerSet("channel", "none", false); 92 #endif 91 93 } 92 94 93 95 bool HDHRChannel::FindDevice(void) … … 275 277 if (!inputName.isEmpty()) 276 278 return SwitchToInput(inputName, channum); 277 279 278 ClearDTVInfo(); 279 _ignore_filters = false; 280 SetCachedATSCInfo(""); 280 281 281 282 InputMap::const_iterator it = inputs.find(currentInputID); 282 283 if (it == inputs.end()) … … 331 332 curchannelname = QDeepCopy<QString>(channum); 332 333 333 334 // Set the major and minor channel for any additional multiplex tuning 334 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num); 335 if (atsc_major || atsc_minor) 336 SetCachedATSCInfo(QString("%1_%2").arg(atsc_major).arg(atsc_minor)); 337 else if (mpeg_prog_num >= 0) 338 SetCachedATSCInfo(QString("0-%1").arg(mpeg_prog_num)); 339 else 340 SetCachedATSCInfo(QString("%1_0").arg(channum)); 335 341 336 342 // Set this as the future start channel for this source 337 inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname);343 inputs[currentInputID]->startChanNum = curchannelname; 338 344 339 // Turn on the HDHomeRun program filtering if it is supported340 // and we are tuning to an MPEG program number.341 if (mpeg_prog_num && (GetTuningMode() == "mpeg"))342 {343 QString pnum = QString::number(mpeg_prog_num);344 _ignore_filters = QString::null != TunerSet("program", pnum, false);345 }346 347 345 return true; 348 346 } 349 347 … … 529 527 vector<uint> range_min; 530 528 vector<uint> range_max; 531 529 532 if (_ignore_filters)533 return true;534 535 530 for (uint i = 0; i < _pids.size(); i++) 536 531 { 537 532 uint pid_min = _pids[i]; -
libs/libmythtv/dvbchannel.h
72 72 73 73 private: 74 74 int GetChanID(void) const; 75 bool InitChannelParams(DTVMultiplex &t, 76 uint sourceid, const QString &channum); 75 77 76 78 void CheckOptions(DTVMultiplex &t) const; 77 79 bool CheckModulation(DTVModulation modulation) const; -
libs/libmythtv/dtvchannel.h
100 100 uint dvb_orig_netid, 101 101 uint mpeg_tsid, int mpeg_pnum); 102 102 void ClearDTVInfo(void) { SetDTVInfo(0, 0, 0, 0, -1); } 103 void SetCachedATSCInfo(const QString &chan); 103 104 104 105 static void GetCachedPids(int chanid, pid_cache_t&); 105 106 static void SaveCachedPids(int chanid, const pid_cache_t&); -
libs/libmythtv/dvbchannel.cpp
238 238 QString loc_err = LOC_ERR + tmp; 239 239 240 240 VERBOSE(VB_CHANNEL, loc); 241 242 241 if (fd_frontend < 0) 243 242 { 244 243 VERBOSE(VB_IMPORTANT, loc_err + "Channel object " 245 244 "will not open, can not change channels."); 246 245 247 ClearDTVInfo();248 246 return false; 249 247 } 250 248 … … 254 252 return true; 255 253 } 256 254 257 ClearDTVInfo();258 259 255 QString inputName; 260 256 if (!CheckChannel(channum, inputName)) 261 257 { … … 276 272 if (it == inputs.end()) 277 273 return false; 278 274 279 // Get the input data for the channel 280 QString tvformat, modulation, freqtable, freqid, si_std; 281 int finetune; 282 uint64_t frequency; 283 int mpeg_prog_num; 284 uint atsc_major, atsc_minor, mplexid, tsid, netid; 285 286 if (!ChannelUtil::GetChannelData( 287 (*it)->sourceid, channum, 288 tvformat, modulation, freqtable, freqid, 289 finetune, frequency, 290 si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid, 291 mplexid, commfree)) 292 { 293 VERBOSE(VB_IMPORTANT, loc_err + 294 "Unable to find channel in database."); 295 296 return false; 297 } 298 299 // Initialize basic the tuning parameters 275 // Initialize all the tuning parameters 300 276 DTVMultiplex tuning; 301 if (! mplexid || !tuning.FillFromDB(card_type, mplexid))277 if (!InitChannelParams(tuning, (*it)->sourceid, channum)) 302 278 { 303 279 VERBOSE(VB_IMPORTANT, loc_err + 304 "Failed to initialize multiplexoptions");280 "Failed to initialize channel options"); 305 281 306 282 return false; 307 283 } 308 284 309 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);310 311 // Try to fix any problems with the multiplex312 285 CheckOptions(tuning); 313 286 314 287 if (!Tune(tuning, "")) 315 288 { 316 289 VERBOSE(VB_IMPORTANT, loc_err + "Tuning to frequency."); 317 290 318 ClearDTVInfo();319 291 return false; 320 292 } 321 293 … … 360 332 return SetChannelByString((*it)->startChanNum); 361 333 } 362 334 335 /** \fn DVBChannel::InitChannelParams(DTVMultiplex&,uint,const QString&) 336 * \brief Initializes all variables pertaining to a channel. 337 * 338 * \return true on success and false on failure 339 */ 340 bool DVBChannel::InitChannelParams(DTVMultiplex &tuning, 341 uint sourceid, 342 const QString &channum) 343 { 344 QString tvformat, modulation, freqtable, freqid, si_std; 345 int finetune; 346 uint64_t frequency; 347 uint mplexid; 348 349 if (!ChannelUtil::GetChannelData( 350 sourceid, channum, 351 tvformat, modulation, freqtable, freqid, 352 finetune, frequency, 353 si_std, currentProgramNum, 354 currentATSCMajorChannel, currentATSCMinorChannel, 355 currentTransportID, currentOriginalNetworkID, 356 mplexid, commfree)) 357 { 358 return false; 359 } 360 361 if (currentATSCMinorChannel) 362 currentProgramNum = -1; 363 364 if (mplexid) 365 return tuning.FillFromDB(card_type, mplexid); 366 367 VERBOSE(VB_IMPORTANT, LOC_ERR + "Unable to find channel in database."); 368 return false; 369 } 370 363 371 /** \fn DVBChannel::CheckOptions(DTVMultiplex&) const 364 372 * \brief Checks tuning for problems, and tries to fix them. 365 373 */ -
libs/libmythtv/tv_rec.cpp
765 765 changeState = false; 766 766 767 767 eitScanStartTime = QDateTime::currentDateTime(); 768 if ((internalState == kState_None) && 769 CardUtil::IsEITCapable(genOpt.cardtype)) 768 if ((internalState == kState_None) && (genOpt.cardtype == "DVB")) 770 769 { 771 770 // Add some randomness to avoid all cards starting 772 771 // EIT scanning at nearly the same time. … … 981 980 MythEvent me("RECORDING_LIST_CHANGE"); 982 981 gContext->dispatch(me); 983 982 pauseNotify = true; 983 } 984 984 985 if (GetDTVChannel())986 GetDTVChannel()->EnterPowerSavingMode();987 }988 989 985 DVBRecorder *TVRec::GetDVBRecorder(void) 990 986 { 991 987 #ifdef USING_DVB … … 1057 1053 } 1058 1054 VERBOSE(VB_IMPORTANT, LOC_ERR + msg1 + "\n\t\t\t" + msg2); 1059 1055 } 1060 1061 if (GetDTVChannel())1062 GetDTVChannel()->EnterPowerSavingMode();1063 1056 } 1064 1057 1065 1058 void TVRec::CloseChannel(void) … … 1656 1649 sd->SetCaching(true); 1657 1650 } 1658 1651 1659 uint neededVideo = 0; 1660 uint neededAudio = 0; 1652 QString sistandard = dtvchan->GetSIStandard(); 1661 1653 1662 ProgramInfo *rec = lastTuningRequest.program;1663 RecordingProfile profile;1664 load_profile(genOpt.cardtype, tvchain, rec, profile);1665 const Setting *setting = profile.byName("recordingtype");1666 if (setting)1667 {1668 neededVideo = (setting->getValue() == "tv") ? 1 : 0;1669 neededAudio = (setting->getValue() == "audio") ? 1 : 0;1670 }1671 1672 const QString tuningmode = dtvchan->GetTuningMode();1673 1674 1654 // Check if this is an ATSC Channel 1675 1655 int major = dtvchan->GetMajorChannel(); 1676 1656 int minor = dtvchan->GetMinorChannel(); 1677 if ((minor > 0) && ( tuningmode== "atsc"))1657 if ((minor > 0) && (sistandard == "atsc")) 1678 1658 { 1679 1659 QString msg = QString("ATSC channel: %1_%2").arg(major).arg(minor); 1680 1660 VERBOSE(VB_RECORD, LOC + msg); … … 1691 1671 asd->Reset(major, minor); 1692 1672 sm->SetStreamData(sd); 1693 1673 sm->SetChannel(major, minor); 1694 sd->SetVideoStreamsRequired(neededVideo); 1695 sd->SetAudioStreamsRequired(neededAudio); 1674 sd->SetVideoStreamsRequired(1); 1696 1675 1697 1676 // Try to get pid of VCT from cache and 1698 1677 // require MGT if we don't have VCT pid. … … 1706 1685 // Check if this is an DVB channel 1707 1686 int progNum = dtvchan->GetProgramNumber(); 1708 1687 #ifdef USING_DVB 1709 if ((progNum >= 0) && ( tuningmode== "dvb"))1688 if ((progNum >= 0) && (sistandard == "dvb")) 1710 1689 { 1711 1690 int netid = dtvchan->GetOriginalNetworkID(); 1712 1691 int tsid = dtvchan->GetTransportID(); 1713 1692 1693 uint neededVideo = 0; 1694 uint neededAudio = 0; 1695 1714 1696 DVBStreamData *dsd = dynamic_cast<DVBStreamData*>(sd); 1715 1697 if (!dsd) 1716 1698 { … … 1720 1702 GetDTVRecorder()->SetStreamData(dsd); 1721 1703 } 1722 1704 1705 ProgramInfo *rec = lastTuningRequest.program; 1706 RecordingProfile profile; 1707 load_profile(genOpt.cardtype, tvchain, rec, profile); 1708 const Setting *setting = profile.byName("recordingtype"); 1709 if (setting) 1710 { 1711 neededVideo = (setting->getValue() == "tv") ? 1 : 0; 1712 neededAudio = (setting->getValue() == "audio") ? 1 : 0; 1713 } 1714 1723 1715 VERBOSE(VB_RECORD, LOC + 1724 1716 QString("DVB service_id %1 on net_id %2 tsid %3") 1725 1717 .arg(progNum).arg(netid).arg(tsid)); … … 1771 1763 sd->Reset(progNum); 1772 1764 sm->SetStreamData(sd); 1773 1765 sm->SetProgramNumber(progNum); 1774 sd->SetVideoStreamsRequired(neededVideo); 1775 sd->SetAudioStreamsRequired(neededAudio); 1776 1766 sd->SetVideoStreamsRequired(1); 1777 1767 sm->AddFlags(SignalMonitor::kDTVSigMon_WaitForPAT | 1778 1768 SignalMonitor::kDTVSigMon_WaitForPMT | 1779 1769 SignalMonitor::kDVBSigMon_WaitForPos); … … 1784 1774 } 1785 1775 1786 1776 QString msg = "No valid DTV info, ATSC maj(%1) min(%2), MPEG pn(%3)"; 1787 VERBOSE(VB_ IMPORTANT, LOC_ERR + msg.arg(major).arg(minor).arg(progNum));1777 VERBOSE(VB_RECORD, LOC_ERR + msg.arg(major).arg(minor).arg(progNum)); 1788 1778 return false; 1789 1779 } 1790 1780 … … 2312 2302 long long bitrate; 2313 2303 if (genOpt.cardtype == "MPEG") 2314 2304 bitrate = 10080000LL; // use DVD max bit rate 2315 else if (genOpt.cardtype == "DBOX2") 2316 bitrate = 10080000LL; // use DVD max bit rate 2317 else if (!CardUtil::IsEncoder(genOpt.cardtype)) 2305 else if (genOpt.cardtype == "HDTV") 2318 2306 bitrate = 19400000LL; // 1080i 2307 else if (genOpt.cardtype == "FIREWIRE") 2308 bitrate = 19400000LL; // 1080i 2309 else if (genOpt.cardtype == "DVB") 2310 bitrate = 19400000LL; // 1080i 2319 2311 else // frame grabber 2320 2312 bitrate = 10080000LL; // use DVD max bit rate, probably too big 2321 2313 … … 3390 3382 */ 3391 3383 void TVRec::TuningFrequency(const TuningRequest &request) 3392 3384 { 3393 DTVChannel *dtvchan = GetDTVChannel(); 3394 if (dtvchan) 3385 if (request.minorChan) 3395 3386 { 3396 MPEGStreamData *mpeg = NULL; 3397 3398 if (GetDTVRecorder()) 3399 mpeg = GetDTVRecorder()->GetStreamData(); 3400 3401 const QString tuningmode = (HasFlags(kFlagEITScannerRunning)) ? 3402 dtvchan->GetSIStandard() : 3403 dtvchan->GetSuggestedTuningMode( 3404 kState_WatchingLiveTV == internalState); 3405 3406 dtvchan->SetTuningMode(tuningmode); 3407 3408 if (request.minorChan && (tuningmode == "atsc")) 3409 { 3410 channel->SetChannelByString(request.channel); 3411 3412 ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg); 3413 if (atsc) 3414 atsc->SetDesiredChannel(request.majorChan, request.minorChan); 3415 } 3416 else if (request.progNum >= 0) 3417 { 3418 channel->SetChannelByString(request.channel); 3419 3420 if (mpeg) 3421 mpeg->SetDesiredProgram(request.progNum); 3422 } 3387 MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData(); 3388 ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg); 3389 channel->SetChannelByString(request.channel); 3390 atsc->SetDesiredChannel(request.majorChan, request.minorChan); 3423 3391 } 3424 3392 else if (request.progNum >= 0) 3393 { 3394 MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData(); 3395 channel->SetChannelByString(request.channel); 3396 mpeg->SetDesiredProgram(request.progNum); 3397 } 3425 3398 if (request.IsOnSameMultiplex()) 3426 3399 { 3427 3400 QStringList slist; -
libs/libmythtv/channel.cpp
441 441 if (!inputName.isEmpty()) 442 442 return ChannelBase::SwitchToInput(inputName, channum); 443 443 444 ClearDTVInfo();444 SetCachedATSCInfo(""); 445 445 446 446 InputMap::const_iterator it = inputs.find(currentInputID); 447 447 if (it == inputs.end()) … … 516 516 InitPictureAttributes(); 517 517 518 518 // Set the major and minor channel for any additional multiplex tuning 519 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num); 519 if (atsc_major || atsc_minor) 520 SetCachedATSCInfo(QString("%1_%2").arg(atsc_major).arg(atsc_minor)); 521 else 522 SetCachedATSCInfo(QString("%1_0").arg(channum)); 520 523 521 524 // Set this as the future start channel for this source 522 inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname);525 inputs[currentInputID]->startChanNum = curchannelname; 523 526 524 527 return true; 525 528 } -
libs/libmythtv/dtvchannel.cpp
142 142 QMutexLocker locker(&dtvinfo_lock); 143 143 tuningMode = QDeepCopy<QString>(tuning_mode.lower()); 144 144 } 145 146 void DTVChannel::SetCachedATSCInfo(const QString &chan) 147 { 148 int progsep = chan.find("-"); 149 int chansep = chan.find("_"); 150 151 currentProgramNum = -1; 152 currentOriginalNetworkID = 0; 153 currentTransportID = 0; 154 currentATSCMajorChannel = 0; 155 currentATSCMinorChannel = 0; 156 157 if (progsep >= 0) 158 { 159 currentProgramNum = chan.right(chan.length() - progsep - 1).toInt(); 160 currentATSCMajorChannel = chan.left(progsep).toInt(); 161 } 162 else if (chansep >= 0) 163 { 164 currentATSCMinorChannel = 165 chan.right(chan.length() - chansep - 1).toInt(); 166 currentATSCMajorChannel = chan.left(chansep).toInt(); 167 } 168 else 169 { 170 bool ok; 171 int chanNum = chan.toInt(&ok); 172 if (ok && chanNum >= 10) 173 { 174 currentATSCMinorChannel = chanNum % 10; 175 currentATSCMajorChannel = chanNum / 10; 176 } 177 } 178 179 if (currentATSCMinorChannel > 0) 180 { 181 VERBOSE(VB_CHANNEL, LOC + 182 QString("SetCachedATSCInfo(%2): %3_%4").arg(chan) 183 .arg(currentATSCMajorChannel).arg(currentATSCMinorChannel)); 184 } 185 else if ((0 == currentATSCMajorChannel) && (0 == currentProgramNum)) 186 { 187 VERBOSE(VB_CHANNEL, LOC + 188 QString("SetCachedATSCInfo(%2): RESET").arg(chan)); 189 } 190 else 191 { 192 VERBOSE(VB_CHANNEL, LOC + 193 QString("SetCachedATSCInfo(%2): %3-%4").arg(chan) 194 .arg(currentATSCMajorChannel).arg(currentProgramNum)); 195 } 196 }