Ticket #3031: 3031-dbg-2.patch
| File 3031-dbg-2.patch, 30.5 KB (added by , 19 years ago) |
|---|
-
libs/libmythtv/firewirechannel.cpp
65 65 66 66 bool ok = false; 67 67 if (!(*it)->externalChanger.isEmpty()) 68 {69 68 ok = ChangeExternalChannel(freqid); 70 SetSIStandard("mpeg");71 SetDTVInfo(0,0,0,0,1);72 }73 69 else 74 70 { 75 71 uint ichan = freqid.toUInt(&ok); … … 206 202 "STB is turned off, must be on to set channel."); 207 203 208 204 SetSIStandard("mpeg"); 209 Set DTVInfo(0,0,0,0,1);205 SetCachedATSCInfo(QString("%1-1").arg(channel)); 210 206 211 207 return true; // signal monitor will call retune later... 212 208 } … … 215 211 return false; 216 212 217 213 SetSIStandard("mpeg"); 218 Set DTVInfo(0,0,0,0,1);214 SetCachedATSCInfo(QString("%1-1").arg(channel)); 219 215 220 216 return true; 221 217 } -
libs/libmythtv/cardutil.h
160 160 static bool IgnoreEncrypted(uint cardid, const QString &inputname); 161 161 static bool TVOnly(uint cardid, const QString &inputname); 162 162 static bool IsInNeedOfExternalInputConf(uint cardid); 163 static uint GetQuickTuning(uint cardid, const QString &inputname);164 163 165 164 // DVB info 166 165 static bool IsDVB(uint cardid, const QString &_inputname); -
libs/libmythtv/hdhrsignalmonitor.cpp
98 98 if (!GetStreamData()) 99 99 return false; 100 100 101 UpdateListeningForEIT();102 103 101 const QMap<uint, bool> &listening = GetStreamData()->ListeningPIDs(); 104 102 105 103 // PIDs that need to be added.. -
libs/libmythtv/hdhrchannel.cpp
26 26 #include "channelutil.h" 27 27 #include "frequencytables.h" 28 28 29 #define DEBUG_PID_FILTERS30 31 29 #define LOC QString("HDHRChan(%1): ").arg(GetDevice()) 32 30 #define LOC_ERR QString("HDHRChan(%1), Error: ").arg(GetDevice()) 33 31 … … 85 83 } 86 84 } 87 85 88 bool HDHRChannel::EnterPowerSavingMode(void)89 {90 return QString::null != TunerSet("channel", "none", false);91 }92 93 86 bool HDHRChannel::FindDevice(void) 94 87 { 95 88 if (!_device_id) … … 141 134 return true; 142 135 } 143 136 144 QString HDHRChannel::DeviceGet(const QString &name , bool report_error_return)137 QString HDHRChannel::DeviceGet(const QString &name) 145 138 { 146 139 QMutexLocker locker(&_lock); 147 140 … … 159 152 return QString::null; 160 153 } 161 154 162 if (report_error_return && error) 163 { 164 VERBOSE(VB_IMPORTANT, LOC_ERR + 165 QString("DeviceGet(%1): %2").arg(name).arg(error)); 166 155 if (error) { 156 VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceGet(%1): %2").arg(name).arg(error)); 167 157 return QString::null; 168 158 } 169 159 170 160 return QString(value); 171 161 } 172 162 173 QString HDHRChannel::DeviceSet(const QString &name, const QString &val, 174 bool report_error_return) 163 QString HDHRChannel::DeviceSet(const QString &name, const QString &val) 175 164 { 176 165 QMutexLocker locker(&_lock); 177 166 … … 186 175 if (hdhomerun_control_set(_control_socket, name, val, &value, &error) < 0) 187 176 { 188 177 VERBOSE(VB_IMPORTANT, LOC_ERR + "Set request failed" + ENO); 189 190 178 return QString::null; 191 179 } 192 180 193 if (report_error_return && error) 194 { 195 VERBOSE(VB_IMPORTANT, LOC_ERR + 196 QString("DeviceSet(%1 %2): %3").arg(name).arg(val).arg(error)); 197 181 if (error) { 182 VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceSet(%1 %2): %3").arg(name).arg(val).arg(error)); 198 183 return QString::null; 199 184 } 200 185 201 186 return QString(value); 202 187 } 203 188 204 QString HDHRChannel::TunerGet(const QString &name , bool report_error_return)189 QString HDHRChannel::TunerGet(const QString &name) 205 190 { 206 return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name), 207 report_error_return); 191 return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name)); 208 192 } 209 193 210 QString HDHRChannel::TunerSet(const QString &name, const QString &value, 211 bool report_error_return) 194 QString HDHRChannel::TunerSet(const QString &name, const QString &value) 212 195 { 213 return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value, 214 report_error_return); 196 return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value); 215 197 } 216 198 217 199 bool HDHRChannel::DeviceSetTarget(unsigned short localPort) … … 275 257 if (!inputName.isEmpty()) 276 258 return SwitchToInput(inputName, channum); 277 259 278 ClearDTVInfo(); 279 _ignore_filters = false; 260 SetCachedATSCInfo(""); 280 261 281 262 InputMap::const_iterator it = inputs.find(currentInputID); 282 263 if (it == inputs.end()) … … 331 312 curchannelname = QDeepCopy<QString>(channum); 332 313 333 314 // Set the major and minor channel for any additional multiplex tuning 334 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num); 315 if (atsc_major || atsc_minor) 316 SetCachedATSCInfo(QString("%1_%2").arg(atsc_major).arg(atsc_minor)); 317 else if (mpeg_prog_num >= 0) 318 SetCachedATSCInfo(QString("0-%1").arg(mpeg_prog_num)); 319 else 320 SetCachedATSCInfo(QString("%1_0").arg(channum)); 335 321 336 322 // Set this as the future start channel for this source 337 inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname);323 inputs[currentInputID]->startChanNum = curchannelname; 338 324 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 325 return true; 348 326 } 349 327 … … 445 423 it = lower_bound(_pids.begin(), _pids.end(), pid); 446 424 if (it != _pids.end() && *it == pid) 447 425 { 448 #ifdef DEBUG_PID_FILTERS449 426 VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<") NOOP"); 450 #endif // DEBUG_PID_FILTERS451 427 return true; 452 428 } 453 429 454 430 _pids.insert(it, pid); 455 431 456 #ifdef DEBUG_PID_FILTERS457 432 VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<")"); 458 #endif // DEBUG_PID_FILTERS459 433 460 434 if (do_update) 461 435 return UpdateFilters(); … … 470 444 it = lower_bound(_pids.begin(), _pids.end(), pid); 471 445 if (it == _pids.end()) 472 446 { 473 #ifdef DEBUG_PID_FILTERS474 447 VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") NOOP"); 475 #endif // DEBUG_PID_FILTERS 476 477 return true; 448 return true; 478 449 } 479 450 480 451 if (*it == pid) 481 452 { 482 #ifdef DEBUG_PID_FILTERS483 453 VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- found"); 484 #endif // DEBUG_PID_FILTERS485 454 _pids.erase(it); 486 455 } 487 456 else 488 457 { 489 #ifdef DEBUG_PID_FILTERS490 458 VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- failed"); 491 #endif // DEBUG_PID_FILTERS492 459 } 493 460 494 461 if (do_update) … … 500 467 { 501 468 QMutexLocker locker(&_lock); 502 469 503 #ifdef DEBUG_PID_FILTERS504 470 VERBOSE(VB_CHANNEL, "DelAllPID()"); 505 #endif // DEBUG_PID_FILTERS506 507 471 _pids.clear(); 508 472 509 473 return UpdateFilters(); … … 529 493 vector<uint> range_min; 530 494 vector<uint> range_max; 531 495 532 if (_ignore_filters)533 return true;534 535 496 for (uint i = 0; i < _pids.size(); i++) 536 497 { 537 498 uint pid_min = _pids[i]; … … 567 528 568 529 QString new_filter = TunerSet("filter", filter); 569 530 570 #ifdef DEBUG_PID_FILTERS571 531 QString msg = QString("Filter: '%1'").arg(filter); 572 532 if (filter != new_filter) 573 533 msg += QString("\n\t\t\t\t'%2'").arg(new_filter); 574 534 575 535 VERBOSE(VB_CHANNEL, msg); 576 #endif // DEBUG_PID_FILTERS577 536 578 537 return filter == new_filter; 579 538 } -
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
41 41 virtual bool TuneMultiplex(uint mplexid, QString inputname) = 0; 42 42 /// \brief To be used by the channel scanner and possibly the EIT scanner. 43 43 virtual bool Tune(const DTVMultiplex &tuning, QString inputname) = 0; 44 /// \brief Enters power saving mode if the card supports it45 virtual bool EnterPowerSavingMode(void) { return true; }46 44 47 45 // Gets 48 46 … … 69 67 /// \brief Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable 70 68 QString GetSIStandard(void) const; 71 69 72 /// \brief Returns suggested tuning mode: "mpeg", "dvb", or "atsc"73 QString GetSuggestedTuningMode(bool is_live_tv) const;74 75 /// \brief Returns tuning mode last set by SetTuningMode().76 QString GetTuningMode(void) const;77 78 70 /** \brief Returns cached MPEG PIDs for last tuned channel. 79 71 * \param pid_cache List of PIDs with their TableID 80 72 * types is returned in pid_cache. … … 84 76 85 77 // Sets 86 78 87 /// \brief Sets tuning mode: "mpeg", "dvb", "atsc", etc.88 void SetTuningMode(const QString &tuningmode);89 90 79 /** \brief Saves MPEG PIDs to cache to database 91 80 * \param pid_cache List of PIDs with their TableID types to be saved. 92 81 */ … … 96 85 protected: 97 86 /// \brief Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable 98 87 void SetSIStandard(const QString&); 99 void SetDTVInfo(uint atsc_major, uint atsc_minor, 100 uint dvb_orig_netid, 101 uint mpeg_tsid, int mpeg_pnum); 102 void ClearDTVInfo(void) { SetDTVInfo(0, 0, 0, 0, -1); } 88 void SetCachedATSCInfo(const QString &chan); 103 89 104 90 static void GetCachedPids(int chanid, pid_cache_t&); 105 91 static void SaveCachedPids(int chanid, const pid_cache_t&); … … 108 94 mutable QMutex dtvinfo_lock; 109 95 110 96 QString sistandard; ///< PSIP table standard: MPEG, DVB, ATSC, OpenCable 111 QString tuningMode;112 97 int currentProgramNum; 113 98 uint currentATSCMajorChannel; 114 99 uint currentATSCMinorChannel; -
libs/libmythtv/mpeg/atscstreamdata.cpp
107 107 108 108 void ATSCStreamData::Reset(int desiredProgram) 109 109 { 110 Reset(-1,-1);111 110 MPEGStreamData::Reset(desiredProgram); 112 111 AddListeningPID(ATSC_PSIP_PID); 113 112 } -
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/cardutil.cpp
448 448 return needsConf; 449 449 } 450 450 451 uint CardUtil::GetQuickTuning(uint cardid, const QString &input_name)452 {453 uint quicktune = 0;454 455 MSqlQuery query(MSqlQuery::InitCon());456 query.prepare(457 "SELECT quicktune "458 "FROM cardinput "459 "WHERE cardid = :CARDID AND "460 " inputname = :INPUTNAME");461 query.bindValue(":CARDID", cardid);462 query.bindValue(":INPUTNAME", input_name);463 464 if (!query.exec() || !query.isActive())465 MythContext::DBError("CardUtil::GetQuickTuning()", query);466 else if (query.next())467 quicktune = query.value(0).toUInt();468 469 return quicktune;470 }471 472 451 bool CardUtil::hasV4L2(int videofd) 473 452 { 474 453 (void) videofd; -
libs/libmythtv/videosource.cpp
1613 1613 }; 1614 1614 }; 1615 1615 1616 class QuickTune : public ComboBoxSetting, public CardInputDBStorage1617 {1618 public:1619 QuickTune(const CardInput &parent) :1620 ComboBoxSetting(this), CardInputDBStorage(this, parent, "quicktune")1621 {1622 setLabel(QObject::tr("Use quick tuning"));1623 addSelection(QObject::tr("Never"), "0", true);1624 //addSelection(QObject::tr("Live TV only"), "1", true);1625 addSelection(QObject::tr("Always"), "2", false);1626 setHelpText(QObject::tr(1627 "If enabled MythTV will tune using only the "1628 "MPEG program number. The program numbers "1629 "change more often than DVB or ATSC tuning "1630 "parameters, so this is slightly less reliable."));1631 };1632 };1633 1634 1616 class ExternalChannelCommand : 1635 1617 public LineEditSetting, public CardInputDBStorage 1636 1618 { … … 1770 1752 group->addChild(ci); 1771 1753 group->addChild(new InputDisplayName(*this)); 1772 1754 group->addChild(sourceid); 1773 1774 if (!isDTVcard) 1755 if (!isDVBcard) 1775 1756 { 1776 1757 group->addChild(new ExternalChannelCommand(*this)); 1777 1758 group->addChild(new PresetTuner(*this)); … … 1781 1762 { 1782 1763 // we place this in a group just so the margins match the DVB ones. 1783 1764 ConfigurationGroup *chgroup = 1784 new VerticalConfigurationGroup(false, false, true, true); 1785 chgroup->addChild(new QuickTune(*this)); 1765 new HorizontalConfigurationGroup(false, false, true, true); 1786 1766 chgroup->addChild(new FreeToAir(*this)); 1787 1767 group->addChild(chgroup); 1788 1768 } -
libs/libmythtv/iptvchannel.cpp
129 129 return false; 130 130 } 131 131 132 // Set the current channum to the new channel's channum 133 curchannelname = QDeepCopy<QString>(channum); 132 // Set the channel.. 133 curchannelname = channum; 134 currentProgramNum = 1; 134 135 135 // Set the dtv channel info for any additional multiplex tuning136 SetDTVInfo(/*atsc_major*/ 0, /*atsc_minor*/ 0,137 /*netid*/ 0,138 /*tsid*/ 0, /*mpeg_prog_num*/ 1);139 140 136 VERBOSE(VB_CHANNEL, LOC + "SetChannelByString() -- end"); 141 137 return true; 142 138 } -
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/hdhrchannel.h
29 29 30 30 bool Open(void); 31 31 void Close(void); 32 bool EnterPowerSavingMode(void);33 32 34 33 // Sets 35 34 bool SetChannelByString(const QString &chan); … … 63 62 bool DeviceSetTarget(unsigned short localPort); 64 63 bool DeviceClearTarget(void); 65 64 66 QString DeviceGet(const QString &name, bool report_error_return = true); 67 QString DeviceSet(const QString &name, const QString &value, 68 bool report_error_return = true); 65 QString DeviceGet(const QString &name); 66 QString DeviceSet(const QString &name, const QString &value); 69 67 70 QString TunerGet(const QString &name, bool report_error_return = true); 71 QString TunerSet(const QString &name, const QString &value, 72 bool report_error_return = true); 68 QString TunerGet(const QString &name); 69 QString TunerSet(const QString &name, const QString &value); 73 70 74 71 private: 75 72 hdhr_socket_t *_control_socket; 76 73 uint _device_id; 77 74 uint _device_ip; 78 75 uint _tuner; 79 bool _ignore_filters;80 76 vector<uint> _pids; 81 77 mutable QMutex _lock; 82 78 }; -
libs/libmythtv/dtvchannel.cpp
8 8 // MythTV headers 9 9 #include "mythcontext.h" 10 10 #include "mythdbcon.h" 11 #include "cardutil.h"12 11 13 12 #define LOC QString("DTVChan(%1): ").arg(GetDevice()) 14 13 #define LOC_WARN QString("DTVChan(%1) Warning: ").arg(GetDevice()) … … 16 15 17 16 DTVChannel::DTVChannel(TVRec *parent) 18 17 : ChannelBase(parent), 19 sistandard("mpeg"), tuningMode(QString::null), 20 currentProgramNum(-1), 18 sistandard("mpeg"), currentProgramNum(-1), 21 19 currentATSCMajorChannel(0), currentATSCMinorChannel(0), 22 20 currentTransportID(0), currentOriginalNetworkID(0) 23 21 { … … 89 87 } 90 88 } 91 89 92 void DTVChannel::SetDTVInfo(uint atsc_major, uint atsc_minor, 93 uint dvb_orig_netid, 94 uint mpeg_tsid, int mpeg_pnum) 90 void DTVChannel::SetCachedATSCInfo(const QString &chan) 95 91 { 96 QMutexLocker locker(&dtvinfo_lock); 97 currentProgramNum = mpeg_pnum; 98 currentATSCMajorChannel = atsc_major; 99 currentATSCMinorChannel = atsc_minor; 100 currentTransportID = mpeg_tsid; 101 currentOriginalNetworkID = dvb_orig_netid; 92 int progsep = chan.find("-"); 93 int chansep = chan.find("_"); 94 95 currentProgramNum = -1; 96 currentOriginalNetworkID = 0; 97 currentTransportID = 0; 98 currentATSCMajorChannel = 0; 99 currentATSCMinorChannel = 0; 100 101 if (progsep >= 0) 102 { 103 currentProgramNum = chan.right(chan.length() - progsep - 1).toInt(); 104 currentATSCMajorChannel = chan.left(progsep).toInt(); 105 } 106 else if (chansep >= 0) 107 { 108 currentATSCMinorChannel = 109 chan.right(chan.length() - chansep - 1).toInt(); 110 currentATSCMajorChannel = chan.left(chansep).toInt(); 111 } 112 else 113 { 114 bool ok; 115 int chanNum = chan.toInt(&ok); 116 if (ok && chanNum >= 10) 117 { 118 currentATSCMinorChannel = chanNum % 10; 119 currentATSCMajorChannel = chanNum / 10; 120 } 121 } 122 123 if (currentATSCMinorChannel > 0) 124 { 125 VERBOSE(VB_CHANNEL, LOC + 126 QString("SetCachedATSCInfo(%2): %3_%4").arg(chan) 127 .arg(currentATSCMajorChannel).arg(currentATSCMinorChannel)); 128 } 129 else if ((0 == currentATSCMajorChannel) && (0 == currentProgramNum)) 130 { 131 VERBOSE(VB_CHANNEL, LOC + 132 QString("SetCachedATSCInfo(%2): RESET").arg(chan)); 133 } 134 else 135 { 136 VERBOSE(VB_CHANNEL, LOC + 137 QString("SetCachedATSCInfo(%2): %3-%4").arg(chan) 138 .arg(currentATSCMajorChannel).arg(currentProgramNum)); 139 } 102 140 } 103 141 104 142 QString DTVChannel::GetSIStandard(void) const … … 110 148 void DTVChannel::SetSIStandard(const QString &si_std) 111 149 { 112 150 QMutexLocker locker(&dtvinfo_lock); 113 sistandard = QDeepCopy<QString>(si_std .lower());151 sistandard = QDeepCopy<QString>(si_std); 114 152 } 115 116 QString DTVChannel::GetSuggestedTuningMode(bool is_live_tv) const117 {118 uint cardid = GetCardID();119 QString input = GetCurrentInput();120 121 uint quickTuning = 0;122 if (cardid && !input.isEmpty())123 quickTuning = CardUtil::GetQuickTuning(cardid, input);124 125 bool useQuickTuning = (quickTuning && is_live_tv) || (quickTuning > 1);126 127 QMutexLocker locker(&dtvinfo_lock);128 if (!useQuickTuning && ((sistandard == "atsc") || (sistandard == "dvb")))129 return QDeepCopy<QString>(sistandard);130 131 return "mpeg";132 }133 134 QString DTVChannel::GetTuningMode(void) const135 {136 QMutexLocker locker(&dtvinfo_lock);137 return QDeepCopy<QString>(tuningMode);138 }139 140 void DTVChannel::SetTuningMode(const QString &tuning_mode)141 {142 QMutexLocker locker(&dtvinfo_lock);143 tuningMode = QDeepCopy<QString>(tuning_mode.lower());144 }
