Ticket #2944: 2944-v4.patch
| File 2944-v4.patch, 30.8 KB (added by , 20 years ago) |
|---|
-
libs/libmythtv/cardutil.h
164 164 static bool IgnoreEncrypted(uint cardid, const QString &inputname); 165 165 static bool TVOnly(uint cardid, const QString &inputname); 166 166 static bool IsInNeedOfExternalInputConf(uint cardid); 167 static uint GetQuickTuning(uint cardid, const QString &inputname); 167 168 168 169 // DVB info 169 170 static bool IsDVB(uint cardid, const QString &_inputname); -
libs/libmythtv/dbcheck.cpp
10 10 #include "mythdbcon.h" 11 11 12 12 /// This is the DB schema version expected by the running MythTV instance. 13 const QString currentDatabaseVersion = "117 5";13 const QString currentDatabaseVersion = "1176"; 14 14 15 15 static bool UpdateDBVersionNumber(const QString &newnumber); 16 16 static bool performActualUpdate(const QString updates[], QString version, … … 2803 2803 return false; 2804 2804 } 2805 2805 2806 if (dbver == "1175") 2807 { 2808 const QString updates[] = { 2809 "ALTER TABLE cardinput ADD COLUMN quicktune TINYINT NOT NULL default '0';", 2810 "" 2811 }; 2812 if (!performActualUpdate(updates, "1176", dbver)) 2813 return false; 2814 } 2815 2806 2816 //"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22 2807 2817 //"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22 2808 2818 //"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22 -
libs/libmythtv/hdhrsignalmonitor.cpp
98 98 if (!GetStreamData()) 99 99 return false; 100 100 101 UpdateListeningForEIT(); 102 101 103 const QMap<uint, bool> &listening = GetStreamData()->ListeningPIDs(); 102 104 103 105 // 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_FILTERS 30 29 31 #define LOC QString("HDHRChan(%1): ").arg(GetDevice()) 30 32 #define LOC_ERR QString("HDHRChan(%1), Error: ").arg(GetDevice()) 31 33 … … 83 85 } 84 86 } 85 87 88 bool HDHRChannel::EnterPowerSavingMode(void) 89 { 90 return QString::null != TunerSet("channel", "none", false); 91 } 92 86 93 bool HDHRChannel::FindDevice(void) 87 94 { 88 95 if (!_device_id) … … 134 141 return true; 135 142 } 136 143 137 QString HDHRChannel::DeviceGet(const QString &name )144 QString HDHRChannel::DeviceGet(const QString &name, bool report_error_return) 138 145 { 139 146 QMutexLocker locker(&_lock); 140 147 … … 152 159 return QString::null; 153 160 } 154 161 155 if (error) { 156 VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceGet(%1): %2").arg(name).arg(error)); 162 if (report_error_return && error) 163 { 164 VERBOSE(VB_IMPORTANT, LOC_ERR + 165 QString("DeviceGet(%1): %2").arg(name).arg(error)); 166 157 167 return QString::null; 158 168 } 159 169 160 170 return QString(value); 161 171 } 162 172 163 QString HDHRChannel::DeviceSet(const QString &name, const QString &val) 173 QString HDHRChannel::DeviceSet(const QString &name, const QString &val, 174 bool report_error_return) 164 175 { 165 176 QMutexLocker locker(&_lock); 166 177 … … 175 186 if (hdhomerun_control_set(_control_socket, name, val, &value, &error) < 0) 176 187 { 177 188 VERBOSE(VB_IMPORTANT, LOC_ERR + "Set request failed" + ENO); 189 178 190 return QString::null; 179 191 } 180 192 181 if (error) { 182 VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DeviceSet(%1 %2): %3").arg(name).arg(val).arg(error)); 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 183 198 return QString::null; 184 199 } 185 200 186 201 return QString(value); 187 202 } 188 203 189 QString HDHRChannel::TunerGet(const QString &name )204 QString HDHRChannel::TunerGet(const QString &name, bool report_error_return) 190 205 { 191 return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name)); 206 return DeviceGet(QString("/tuner%1/%2").arg(_tuner).arg(name), 207 report_error_return); 192 208 } 193 209 194 QString HDHRChannel::TunerSet(const QString &name, const QString &value) 210 QString HDHRChannel::TunerSet(const QString &name, const QString &value, 211 bool report_error_return) 195 212 { 196 return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value); 213 return DeviceSet(QString("/tuner%1/%2").arg(_tuner).arg(name), value, 214 report_error_return); 197 215 } 198 216 199 217 bool HDHRChannel::DeviceSetTarget(unsigned short localPort) … … 257 275 if (!inputName.isEmpty()) 258 276 return SwitchToInput(inputName, channum); 259 277 260 SetCachedATSCInfo(""); 278 ClearDTVInfo(); 279 _ignore_filters = false; 261 280 262 281 InputMap::const_iterator it = inputs.find(currentInputID); 263 282 if (it == inputs.end()) … … 312 331 curchannelname = QDeepCopy<QString>(channum); 313 332 314 333 // Set the major and minor channel for any additional multiplex tuning 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)); 334 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num); 321 335 322 336 // Set this as the future start channel for this source 323 inputs[currentInputID]->startChanNum = curchannelname;337 inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname); 324 338 339 // Turn on the HDHomeRun program filtering if it is supported 340 // 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 325 347 return true; 326 348 } 327 349 … … 423 445 it = lower_bound(_pids.begin(), _pids.end(), pid); 424 446 if (it != _pids.end() && *it == pid) 425 447 { 448 #ifdef DEBUG_PID_FILTERS 426 449 VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<") NOOP"); 450 #endif // DEBUG_PID_FILTERS 427 451 return true; 428 452 } 429 453 430 454 _pids.insert(it, pid); 431 455 456 #ifdef DEBUG_PID_FILTERS 432 457 VERBOSE(VB_CHANNEL, "AddPID(0x"<<hex<<pid<<dec<<")"); 458 #endif // DEBUG_PID_FILTERS 433 459 434 460 if (do_update) 435 461 return UpdateFilters(); … … 444 470 it = lower_bound(_pids.begin(), _pids.end(), pid); 445 471 if (it == _pids.end()) 446 472 { 473 #ifdef DEBUG_PID_FILTERS 447 474 VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") NOOP"); 448 return true; 475 #endif // DEBUG_PID_FILTERS 476 477 return true; 449 478 } 450 479 451 480 if (*it == pid) 452 481 { 482 #ifdef DEBUG_PID_FILTERS 453 483 VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- found"); 484 #endif // DEBUG_PID_FILTERS 454 485 _pids.erase(it); 455 486 } 456 487 else 457 488 { 489 #ifdef DEBUG_PID_FILTERS 458 490 VERBOSE(VB_CHANNEL, "DelPID(0x"<<hex<<pid<<dec<<") -- failed"); 491 #endif // DEBUG_PID_FILTERS 459 492 } 460 493 461 494 if (do_update) … … 467 500 { 468 501 QMutexLocker locker(&_lock); 469 502 503 #ifdef DEBUG_PID_FILTERS 470 504 VERBOSE(VB_CHANNEL, "DelAllPID()"); 505 #endif // DEBUG_PID_FILTERS 506 471 507 _pids.clear(); 472 508 473 509 return UpdateFilters(); … … 493 529 vector<uint> range_min; 494 530 vector<uint> range_max; 495 531 532 if (_ignore_filters) 533 return true; 534 496 535 for (uint i = 0; i < _pids.size(); i++) 497 536 { 498 537 uint pid_min = _pids[i]; … … 528 567 529 568 QString new_filter = TunerSet("filter", filter); 530 569 570 #ifdef DEBUG_PID_FILTERS 531 571 QString msg = QString("Filter: '%1'").arg(filter); 532 572 if (filter != new_filter) 533 573 msg += QString("\n\t\t\t\t'%2'").arg(new_filter); 534 574 535 575 VERBOSE(VB_CHANNEL, msg); 576 #endif // DEBUG_PID_FILTERS 536 577 537 578 return filter == new_filter; 538 579 } -
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);77 75 78 76 void CheckOptions(DTVMultiplex &t) const; 79 77 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 it 45 virtual bool EnterPowerSavingMode(void) { return true; } 44 46 45 47 // Gets 46 48 … … 67 69 /// \brief Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable 68 70 QString GetSIStandard(void) const; 69 71 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 70 78 /** \brief Returns cached MPEG PIDs for last tuned channel. 71 79 * \param pid_cache List of PIDs with their TableID 72 80 * types is returned in pid_cache. … … 76 84 77 85 // Sets 78 86 87 /// \brief Sets tuning mode: "mpeg", "dvb", "atsc", etc. 88 void SetTuningMode(const QString &tuningmode); 89 79 90 /** \brief Saves MPEG PIDs to cache to database 80 91 * \param pid_cache List of PIDs with their TableID types to be saved. 81 92 */ … … 85 96 protected: 86 97 /// \brief Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable 87 98 void SetSIStandard(const QString&); 88 void SetCachedATSCInfo(const QString &chan); 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); } 89 103 90 104 static void GetCachedPids(int chanid, pid_cache_t&); 91 105 static void SaveCachedPids(int chanid, const pid_cache_t&); … … 94 108 mutable QMutex dtvinfo_lock; 95 109 96 110 QString sistandard; ///< PSIP table standard: MPEG, DVB, ATSC, OpenCable 111 QString tuningMode; 97 112 int currentProgramNum; 98 113 uint currentATSCMajorChannel; 99 114 uint currentATSCMinorChannel; -
libs/libmythtv/mpeg/atscstreamdata.cpp
107 107 108 108 void ATSCStreamData::Reset(int desiredProgram) 109 109 { 110 Reset(-1,-1); 110 111 MPEGStreamData::Reset(desiredProgram); 111 112 AddListeningPID(ATSC_PSIP_PID); 112 113 } -
libs/libmythtv/dvbchannel.cpp
238 238 QString loc_err = LOC_ERR + tmp; 239 239 240 240 VERBOSE(VB_CHANNEL, loc); 241 242 ClearDTVInfo(); 243 241 244 if (fd_frontend < 0) 242 245 { 243 246 VERBOSE(VB_IMPORTANT, loc_err + "Channel object " … … 272 275 if (it == inputs.end()) 273 276 return false; 274 277 275 // Initialize all the tuning parameters 278 // Get the input data for the channel 279 QString tvformat, modulation, freqtable, freqid, si_std; 280 int finetune; 281 uint64_t frequency; 282 int mpeg_prog_num; 283 uint atsc_major, atsc_minor, mplexid, tsid, netid; 284 285 if (!ChannelUtil::GetChannelData( 286 (*it)->sourceid, channum, 287 tvformat, modulation, freqtable, freqid, 288 finetune, frequency, 289 si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid, 290 mplexid, commfree)) 291 { 292 VERBOSE(VB_IMPORTANT, loc_err + 293 "Unable to find channel in database."); 294 295 return false; 296 } 297 298 // Initialize basic the tuning parameters 276 299 DTVMultiplex tuning; 277 if (! InitChannelParams(tuning, (*it)->sourceid, channum))300 if (!mplexid || !tuning.FillFromDB(card_type, mplexid)) 278 301 { 279 302 VERBOSE(VB_IMPORTANT, loc_err + 280 "Failed to initialize channeloptions");303 "Failed to initialize multiplex options"); 281 304 282 305 return false; 283 306 } 284 307 308 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num); 309 310 // Try to fix any problems with the multiplex 285 311 CheckOptions(tuning); 286 312 287 313 if (!Tune(tuning, "")) 288 314 { 289 315 VERBOSE(VB_IMPORTANT, loc_err + "Tuning to frequency."); 290 316 317 ClearDTVInfo(); 291 318 return false; 292 319 } 293 320 … … 332 359 return SetChannelByString((*it)->startChanNum); 333 360 } 334 361 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 failure339 */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 371 362 /** \fn DVBChannel::CheckOptions(DTVMultiplex&) const 372 363 * \brief Checks tuning for problems, and tries to fix them. 373 364 */ -
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 451 472 bool CardUtil::hasV4L2(int videofd) 452 473 { 453 474 (void) videofd; -
libs/libmythtv/videosource.cpp
1569 1569 }; 1570 1570 }; 1571 1571 1572 class QuickTune : public ComboBoxSetting, public CardInputDBStorage 1573 { 1574 public: 1575 QuickTune(const CardInput &parent) : 1576 ComboBoxSetting(this), CardInputDBStorage(this, parent, "quicktune") 1577 { 1578 setLabel(QObject::tr("Use quick tuning")); 1579 addSelection(QObject::tr("Never"), "0", true); 1580 //addSelection(QObject::tr("Live TV only"), "1", true); 1581 addSelection(QObject::tr("Always"), "2", false); 1582 setHelpText(QObject::tr( 1583 "If enabled MythTV will tune using only the " 1584 "MPEG program number. The program numbers " 1585 "change more often than DVB or ATSC tuning " 1586 "parameters, so this is slightly less reliable.")); 1587 }; 1588 }; 1589 1572 1590 class ExternalChannelCommand : 1573 1591 public LineEditSetting, public CardInputDBStorage 1574 1592 { … … 1708 1726 group->addChild(ci); 1709 1727 group->addChild(new InputDisplayName(*this)); 1710 1728 group->addChild(sourceid); 1711 if (!isDVBcard) 1729 1730 if (!isDTVcard) 1712 1731 { 1713 1732 group->addChild(new ExternalChannelCommand(*this)); 1714 1733 group->addChild(new PresetTuner(*this)); … … 1718 1737 { 1719 1738 // we place this in a group just so the margins match the DVB ones. 1720 1739 ConfigurationGroup *chgroup = 1721 new HorizontalConfigurationGroup(false, false, true, true); 1740 new VerticalConfigurationGroup(false, false, true, true); 1741 chgroup->addChild(new QuickTune(*this)); 1722 1742 chgroup->addChild(new FreeToAir(*this)); 1723 1743 group->addChild(chgroup); 1724 1744 } -
libs/libmythtv/iptvchannel.cpp
129 129 return false; 130 130 } 131 131 132 // Set the channel.. 133 curchannelname = channum; 134 currentProgramNum = 1; 132 // Set the current channum to the new channel's channum 133 curchannelname = QDeepCopy<QString>(channum); 135 134 135 // Set the dtv channel info for any additional multiplex tuning 136 SetDTVInfo(/*atsc_major*/ 0, /*atsc_minor*/ 0, 137 /*netid*/ 0, 138 /*tsid*/ 0, /*mpeg_prog_num*/ 1); 139 136 140 VERBOSE(VB_CHANNEL, LOC + "SetChannelByString() -- end"); 137 141 return true; 138 142 } -
libs/libmythtv/tv_rec.cpp
774 774 changeState = false; 775 775 776 776 eitScanStartTime = QDateTime::currentDateTime(); 777 if ((internalState == kState_None) && (genOpt.cardtype == "DVB")) 777 if ((internalState == kState_None) && 778 CardUtil::IsEITCapable(genOpt.cardtype)) 778 779 { 779 780 // Add some randomness to avoid all cards starting 780 781 // EIT scanning at nearly the same time. … … 998 999 MythEvent me("RECORDING_LIST_CHANGE"); 999 1000 gContext->dispatch(me); 1000 1001 pauseNotify = true; 1001 }1002 1002 1003 if (GetDTVChannel()) 1004 GetDTVChannel()->EnterPowerSavingMode(); 1005 } 1006 1003 1007 DVBRecorder *TVRec::GetDVBRecorder(void) 1004 1008 { 1005 1009 #ifdef USING_DVB … … 1071 1075 } 1072 1076 VERBOSE(VB_IMPORTANT, LOC_ERR + msg1 + "\n\t\t\t" + msg2); 1073 1077 } 1078 1079 if (GetDTVChannel()) 1080 GetDTVChannel()->EnterPowerSavingMode(); 1074 1081 } 1075 1082 1076 1083 void TVRec::CloseChannel(void) … … 1668 1675 sd->SetCaching(true); 1669 1676 } 1670 1677 1671 QString sistandard = dtvchan->GetSIStandard(); 1678 uint neededVideo = 0; 1679 uint neededAudio = 0; 1672 1680 1681 ProgramInfo *rec = lastTuningRequest.program; 1682 RecordingProfile profile; 1683 load_profile(genOpt.cardtype, tvchain, rec, profile); 1684 const Setting *setting = profile.byName("recordingtype"); 1685 if (setting) 1686 { 1687 neededVideo = (setting->getValue() == "tv") ? 1 : 0; 1688 neededAudio = (setting->getValue() == "audio") ? 1 : 0; 1689 } 1690 1691 const QString tuningmode = dtvchan->GetTuningMode(); 1692 1673 1693 // Check if this is an ATSC Channel 1674 1694 int major = dtvchan->GetMajorChannel(); 1675 1695 int minor = dtvchan->GetMinorChannel(); 1676 if ((minor > 0) && ( sistandard== "atsc"))1696 if ((minor > 0) && (tuningmode == "atsc")) 1677 1697 { 1678 1698 QString msg = QString("ATSC channel: %1_%2").arg(major).arg(minor); 1679 1699 VERBOSE(VB_RECORD, LOC + msg); … … 1690 1710 asd->Reset(major, minor); 1691 1711 sm->SetStreamData(sd); 1692 1712 sm->SetChannel(major, minor); 1693 sd->SetVideoStreamsRequired(1); 1713 sd->SetVideoStreamsRequired(neededVideo); 1714 sd->SetAudioStreamsRequired(neededAudio); 1694 1715 1695 1716 // Try to get pid of VCT from cache and 1696 1717 // require MGT if we don't have VCT pid. … … 1704 1725 // Check if this is an DVB channel 1705 1726 int progNum = dtvchan->GetProgramNumber(); 1706 1727 #ifdef USING_DVB 1707 if ((progNum >= 0) && ( sistandard== "dvb"))1728 if ((progNum >= 0) && (tuningmode == "dvb")) 1708 1729 { 1709 1730 int netid = dtvchan->GetOriginalNetworkID(); 1710 1731 int tsid = dtvchan->GetTransportID(); 1711 1732 1712 uint neededVideo = 0;1713 uint neededAudio = 0;1714 1715 1733 DVBStreamData *dsd = dynamic_cast<DVBStreamData*>(sd); 1716 1734 if (!dsd) 1717 1735 { … … 1721 1739 GetDTVRecorder()->SetStreamData(dsd); 1722 1740 } 1723 1741 1724 ProgramInfo *rec = lastTuningRequest.program;1725 RecordingProfile profile;1726 load_profile(genOpt.cardtype, tvchain, rec, profile);1727 const Setting *setting = profile.byName("recordingtype");1728 if (setting)1729 {1730 neededVideo = (setting->getValue() == "tv") ? 1 : 0;1731 neededAudio = (setting->getValue() == "audio") ? 1 : 0;1732 }1733 1734 1742 VERBOSE(VB_RECORD, LOC + 1735 1743 QString("DVB service_id %1 on net_id %2 tsid %3") 1736 1744 .arg(progNum).arg(netid).arg(tsid)); … … 1782 1790 sd->Reset(progNum); 1783 1791 sm->SetStreamData(sd); 1784 1792 sm->SetProgramNumber(progNum); 1785 sd->SetVideoStreamsRequired(1); 1793 sd->SetVideoStreamsRequired(neededVideo); 1794 sd->SetAudioStreamsRequired(neededAudio); 1795 1786 1796 sm->AddFlags(SignalMonitor::kDTVSigMon_WaitForPAT | 1787 1797 SignalMonitor::kDTVSigMon_WaitForPMT | 1788 1798 SignalMonitor::kDVBSigMon_WaitForPos); … … 1793 1803 } 1794 1804 1795 1805 QString msg = "No valid DTV info, ATSC maj(%1) min(%2), MPEG pn(%3)"; 1796 VERBOSE(VB_ RECORD, LOC_ERR + msg.arg(major).arg(minor).arg(progNum));1806 VERBOSE(VB_IMPORTANT, LOC_ERR + msg.arg(major).arg(minor).arg(progNum)); 1797 1807 return false; 1798 1808 } 1799 1809 … … 2321 2331 long long bitrate; 2322 2332 if (genOpt.cardtype == "MPEG") 2323 2333 bitrate = 10080000LL; // use DVD max bit rate 2324 else if (genOpt.cardtype == "HDTV") 2334 else if (genOpt.cardtype == "DBOX2") 2335 bitrate = 10080000LL; // use DVD max bit rate 2336 else if (!CardUtil::IsEncoder(genOpt.cardtype)) 2325 2337 bitrate = 19400000LL; // 1080i 2326 else if (genOpt.cardtype == "FIREWIRE")2327 bitrate = 19400000LL; // 1080i2328 else if (genOpt.cardtype == "DVB")2329 bitrate = 19400000LL; // 1080i2330 2338 else // frame grabber 2331 2339 bitrate = 10080000LL; // use DVD max bit rate, probably too big 2332 2340 … … 3392 3400 */ 3393 3401 void TVRec::TuningFrequency(const TuningRequest &request) 3394 3402 { 3395 if (request.minorChan) 3403 DTVChannel *dtvchan = GetDTVChannel(); 3404 if (dtvchan) 3396 3405 { 3397 MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData(); 3398 ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg); 3399 channel->SetChannelByString(request.channel); 3400 atsc->SetDesiredChannel(request.majorChan, request.minorChan); 3406 MPEGStreamData *mpeg = NULL; 3407 3408 if (GetDTVRecorder()) 3409 mpeg = GetDTVRecorder()->GetStreamData(); 3410 3411 const QString tuningmode = (HasFlags(kFlagEITScannerRunning)) ? 3412 dtvchan->GetSIStandard() : 3413 dtvchan->GetSuggestedTuningMode( 3414 kState_WatchingLiveTV == internalState); 3415 3416 dtvchan->SetTuningMode(tuningmode); 3417 3418 if (request.minorChan && (tuningmode == "atsc")) 3419 { 3420 channel->SetChannelByString(request.channel); 3421 3422 ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg); 3423 if (atsc) 3424 atsc->SetDesiredChannel(request.majorChan, request.minorChan); 3425 } 3426 else if (request.progNum >= 0) 3427 { 3428 channel->SetChannelByString(request.channel); 3429 3430 if (mpeg) 3431 mpeg->SetDesiredProgram(request.progNum); 3432 } 3401 3433 } 3402 else if (request.progNum >= 0) 3403 { 3404 MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData(); 3405 channel->SetChannelByString(request.channel); 3406 mpeg->SetDesiredProgram(request.progNum); 3407 } 3434 3408 3435 if (request.IsOnSameMultiplex()) 3409 3436 { 3410 3437 QStringList slist; -
libs/libmythtv/recordingprofile.cpp
1037 1037 this, SLOT(FiltersChanged(const QString&))); 1038 1038 } 1039 1039 } 1040 else if (type.upper() == "DVB")1040 else 1041 1041 { 1042 1042 addChild(new RecordingType(*this)); 1043 1043 } -
libs/libmythtv/channel.cpp
441 441 if (!inputName.isEmpty()) 442 442 return ChannelBase::SwitchToInput(inputName, channum); 443 443 444 SetCachedATSCInfo("");444 ClearDTVInfo(); 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 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)); 519 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num); 523 520 524 521 // Set this as the future start channel for this source 525 inputs[currentInputID]->startChanNum = curchannelname;522 inputs[currentInputID]->startChanNum = QDeepCopy<QString>(curchannelname); 526 523 527 524 return true; 528 525 } -
libs/libmythtv/hdhrchannel.h
29 29 30 30 bool Open(void); 31 31 void Close(void); 32 bool EnterPowerSavingMode(void); 32 33 33 34 // Sets 34 35 bool SetChannelByString(const QString &chan); … … 62 63 bool DeviceSetTarget(unsigned short localPort); 63 64 bool DeviceClearTarget(void); 64 65 65 QString DeviceGet(const QString &name); 66 QString DeviceSet(const QString &name, const QString &value); 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); 67 69 68 QString TunerGet(const QString &name); 69 QString TunerSet(const QString &name, const QString &value); 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); 70 73 71 74 private: 72 75 hdhr_socket_t *_control_socket; 73 76 uint _device_id; 74 77 uint _device_ip; 75 78 uint _tuner; 79 bool _ignore_filters; 76 80 vector<uint> _pids; 77 81 mutable QMutex _lock; 78 82 }; -
libs/libmythtv/dtvchannel.cpp
8 8 // MythTV headers 9 9 #include "mythcontext.h" 10 10 #include "mythdbcon.h" 11 #include "cardutil.h" 11 12 12 13 #define LOC QString("DTVChan(%1): ").arg(GetDevice()) 13 14 #define LOC_WARN QString("DTVChan(%1) Warning: ").arg(GetDevice()) … … 15 16 16 17 DTVChannel::DTVChannel(TVRec *parent) 17 18 : ChannelBase(parent), 18 sistandard("mpeg"), currentProgramNum(-1), 19 sistandard("mpeg"), tuningMode(QString::null), 20 currentProgramNum(-1), 19 21 currentATSCMajorChannel(0), currentATSCMinorChannel(0), 20 22 currentTransportID(0), currentOriginalNetworkID(0) 21 23 { … … 87 89 } 88 90 } 89 91 90 void DTVChannel::SetCachedATSCInfo(const QString &chan) 92 void DTVChannel::SetDTVInfo(uint atsc_major, uint atsc_minor, 93 uint dvb_orig_netid, 94 uint mpeg_tsid, int mpeg_pnum) 91 95 { 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 } 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; 140 102 } 141 103 142 104 QString DTVChannel::GetSIStandard(void) const … … 148 110 void DTVChannel::SetSIStandard(const QString &si_std) 149 111 { 150 112 QMutexLocker locker(&dtvinfo_lock); 151 sistandard = QDeepCopy<QString>(si_std );113 sistandard = QDeepCopy<QString>(si_std.lower()); 152 114 } 115 116 QString DTVChannel::GetSuggestedTuningMode(bool is_live_tv) const 117 { 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) const 135 { 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 }
