Ticket #3842: 3842-validation-head-v2.patch
| File 3842-validation-head-v2.patch, 7.2 KB (added by , 18 years ago) |
|---|
-
libs/libmythtv/cardutil.h
107 107 (rawtype == "HDHOMERUN"); 108 108 } 109 109 110 static bool IsTuningDigital(const QString &rawtype) 111 { 112 return 113 (rawtype == "DVB") || (rawtype == "HDTV") || 114 (rawtype == "HDHOMERUN"); 115 } 116 117 static bool IsTuningAnalog(const QString &rawtype) 118 { 119 return (rawtype == "V4L"); 120 } 121 110 122 static int GetCardID(const QString &videodevice, 111 123 QString hostname = QString::null); 112 124 static uint GetChildCardID(uint cardid); -
libs/libmythtv/sourceutil.h
16 16 static bool GetListingsLoginData(uint sourceid, 17 17 QString &grabber, QString &userid, 18 18 QString &passwd, QString &lineupid); 19 static uint GetConnectionCount(uint sourceid); 20 static bool IsProperlyConnected(uint sourceid, bool strich = false); 19 21 static bool IsEncoder(uint sourceid, bool strict = false); 20 22 static bool IsUnscanable(uint sourceid); 21 23 static bool IsAnySourceScanable(void); -
libs/libmythtv/datadirect.cpp
686 686 { 687 687 int new_channels = 0; 688 688 689 if (!SourceUtil::GetConnectionCount(sourceid)) 690 { 691 VERBOSE(VB_IMPORTANT, LOC + 692 "Not inserting channels into disconnected source " 693 <<sourceid<<"."); 694 return -1; 695 } 696 697 if (!SourceUtil::IsProperlyConnected(sourceid, true)) 698 return -1; 699 689 700 // Find all the channels in the dd_v_station temp table 690 701 // where there is no channel with the same xmltvid in the 691 702 // DB using the same source. … … 706 717 return -1; 707 718 } 708 719 709 bool is_encoder = SourceUtil::IsEncoder(sourceid, true); 720 bool is_encoder = (SourceUtil::IsEncoder(sourceid, true) || 721 SourceUtil::IsUnscanable(sourceid)); 710 722 711 723 while (query.next()) 712 724 { … … 750 762 bool DataDirectProcessor::UpdateChannelsUnsafe( 751 763 uint sourceid, bool filter_new_channels) 752 764 { 765 if (filter_new_channels && 766 !SourceUtil::IsProperlyConnected(sourceid, false)) 767 { 768 return false; 769 } 770 753 771 MSqlQuery dd_station_info(MSqlQuery::DDCon()); 754 772 dd_station_info.prepare( 755 773 "SELECT callsign, stationname, stationid," … … 770 788 " atsc_minor_chan = :MINORCHAN " 771 789 "WHERE xmltvid = :STATIONID AND sourceid = :SOURCEID"); 772 790 773 bool is_encoder = SourceUtil::IsEncoder(sourceid, true); 791 bool is_encoder = (SourceUtil::IsEncoder(sourceid, true) || 792 SourceUtil::IsUnscanable(sourceid)); 774 793 775 794 while (dd_station_info.next()) 776 795 { -
libs/libmythtv/videosource.cpp
1924 1924 1925 1925 if (cardid && srcid) 1926 1926 { 1927 save(); // save info for fetch.. 1928 1927 1929 QString cardtype = CardUtil::GetRawCardType(crdid, 0); 1928 1930 1929 1931 if (!CardUtil::IsUnscanable(cardtype) && -
libs/libmythtv/sourceutil.cpp
114 114 return list; 115 115 } 116 116 117 uint SourceUtil::GetConnectionCount(uint sourceid) 118 { 119 QStringList types = get_cardtypes(sourceid); 120 return types.size(); 121 } 122 123 bool SourceUtil::IsProperlyConnected(uint sourceid, bool strict) 124 { 125 QStringList types = get_cardtypes(sourceid); 126 QMap<QString,uint> counts; 127 QStringList::const_iterator it = types.begin(); 128 for (; it != types.end(); ++it) 129 { 130 counts[*it]++; 131 132 counts[CardUtil::IsEncoder(*it) ? "ENCODER" : "NOT_ENCODER"]++; 133 counts[CardUtil::IsUnscanable(*it) ? "NO_SCAN" : "SCAN"]++; 134 135 if (CardUtil::IsTuningAnalog(*it)) 136 counts["ANALOG_TUNING"]++; 137 else if (CardUtil::IsTuningDigital(*it)) 138 counts["DIGITAL_TUNING"]++; 139 else 140 counts["OTHER_TUNING"]++; 141 } 142 143 bool tune_mismatch = counts["ANALOG_TUNING"] && counts["DIGITAL_TUNING"]; 144 bool enc_mismatch = counts["ENCODER"] && counts["NOT_ENCODER"]; 145 bool scan_mismatch = counts["SCAN"] && counts["NO_SCAN"]; 146 bool fw_mismatch = (counts["FIREWIRE"] && 147 (counts["FIREWIRE"] < types.size())); 148 149 if (tune_mismatch) 150 { 151 uint a = counts["ANALOG_TUNERS"]; 152 uint d = counts["DIGITAL_TUNERS"]; 153 VERBOSE(VB_GENERAL, QString("SourceUtil::IsProperlyConnected(): ") + 154 QString("Source ID %1 ").arg(sourceid) + 155 QString("appears to be connected\n\t\t\tto %1 analog tuner%2,") 156 .arg(a).arg((1 == a) ? "":"s") + 157 QString("and %1 digital tuner%2.\n\t\t\t") 158 .arg(d).arg((1 == d) ? "":"s") + 159 QString("Can't mix analog and digital tuning information.")); 160 } 161 162 if (enc_mismatch) 163 { 164 uint a = counts["ENCODER"]; 165 uint d = counts["NOT_ENCODER"]; 166 VERBOSE(VB_GENERAL, QString("SourceUtil::IsProperlyConnected(): ") + 167 QString("Source ID %1 ").arg(sourceid) + 168 QString("appears to be connected\n\t\t\tto %1 encoder%2, ") 169 .arg(a).arg((1 == a) ? "":"s") + 170 QString("and %1 non-encoder%2. ") 171 .arg(d).arg((1 == d) ? "":"s") + 172 QString("This is probably a bad idea.")); 173 } 174 175 if (scan_mismatch) 176 { 177 uint a = counts["SCAN"]; 178 uint d = counts["NO_SCAN"]; 179 VERBOSE(VB_GENERAL, QString("SourceUtil::IsProperlyConnected(): ") + 180 QString("Source ID %1 ").arg(sourceid) + 181 QString("appears to be connected\n\t\t\t" 182 "to %1 scanable input%2, ") 183 .arg(a).arg((1 == a) ? "":"s") + 184 QString("and %1 non-scanable input%2. ") 185 .arg(d).arg((1 == d) ? "":"s") + 186 QString("This may be a problem.")); 187 } 188 189 if (fw_mismatch) 190 { 191 VERBOSE(VB_GENERAL, QString("SourceUtil::IsProperlyConnected(): ") + 192 QString( 193 "Source ID %1 appears to be connected\n\t\t\t" 194 "to both firewire and non-firewire inputs. " 195 "This is probably a bad idea.").arg(sourceid)); 196 } 197 198 if (!strict) 199 return !tune_mismatch; 200 201 return !tune_mismatch && !enc_mismatch && !scan_mismatch && !fw_mismatch; 202 } 203 117 204 bool SourceUtil::IsEncoder(uint sourceid, bool strict) 118 205 { 119 206 bool encoder = true;
