Ticket #5530: csat-eit-20080711.diff
File csat-eit-20080711.diff, 33.3 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/libmythtv.pro
192 192 HEADERS += mpeg/iso6937tables.h 193 193 HEADERS += mpeg/tsstats.h mpeg/streamlisteners.h 194 194 HEADERS += mpeg/h264utils.h 195 HEADERS += mpeg/csatcaraibesdescriptors.h 196 HEADERS += mpeg/csatcaraibestables.h 195 197 196 198 SOURCES += mpeg/tspacket.cpp mpeg/pespacket.cpp 197 199 SOURCES += mpeg/mpegtables.cpp mpeg/atsctables.cpp … … 205 207 SOURCES += mpeg/freesat_huffman.cpp 206 208 SOURCES += mpeg/iso6937tables.cpp 207 209 SOURCES += mpeg/h264utils.cpp 210 SOURCES += mpeg/csatcaraibesdescriptors.cpp 211 SOURCES += mpeg/csatcaraibestables.cpp 208 212 209 213 DEFINES += USING_H264TOOLS 210 214 -
libs/libmythtv/eithelper.cpp
20 20 #include "atsctables.h" 21 21 #include "dvbtables.h" 22 22 #include "premieretables.h" 23 #include "csatcaraibestables.h" 23 24 #include "dishdescriptors.h" 24 25 #include "premieredescriptors.h" 25 26 #include "util.h" … … 513 514 } 514 515 } 515 516 517 // This function gets special eit data from the French provider 518 // Canal Satellite Caraibes. It probably applies to this provider 519 // in France. This EIT is available for all channels for 7-10 days 520 void EITHelper::AddEIT(CSatCaraibesInformationTable *cit) 521 { 522 QString title = QString::null; 523 QString subtitle = QString::null; 524 QString description = QString::null; 525 QString category = QString::null; 526 MythCategoryType category_type = kCategoryNone; 527 unsigned char subtitle_type=0, audio_props=0, video_props=0; 528 uint fix = fixup[ 601LL << 32 | 1 << 16 | 0 ] | EITFixUp::kFixGenericDVB; 529 if (!cit->IsReady()) { 530 VERBOSE(VB_EIT,LOC+"CSAT EIT NOT READY YET"); 531 return; 532 } 533 for (uint i = 0;i < cit->NbSchedules();i++) { 534 const CSatCaraibesSchedule& schedule = cit->GetSchedule(i); 535 QString title = schedule.title; 536 const vector<CSatCaraibesShowing>& showings = schedule.showings; 537 QMap<uint, QString>::const_iterator sum; 538 bool sum_available = false; 516 539 540 if (schedule.key) { 541 /* If the summary is not there we go on with the next schedule */ 542 if (!(cit->GetSummary(i, sum))) continue; 543 sum_available = true; 544 } 545 for (vector<CSatCaraibesShowing>::const_iterator it = showings.begin(); 546 it != showings.end();it++) { 547 QDateTime starttime = (*it).Start; 548 // EITFixUp::TimeFix(starttime); 549 QDateTime endtime = starttime.addSecs(schedule.duration*60); 550 uint chanid; 551 DBEvent *event; 552 const CSatCaraibesChannelInfo& info = cit->GetChannelInfoFromIndex((*it).channel_index); 553 chanid = GetChanID(info.tsid,info.serviceid,info.orignetworkid); 554 VERBOSE(VB_EIT, LOC + 555 QString("CSATCARAIBES EIT for NIT %1, TID %2, SID %3, " 556 "T: %4, Start: %5, Dur: %6 Thm: %7, summ: %8") 557 .arg(info.orignetworkid).arg(info.tsid).arg(info.serviceid) 558 .arg(title).arg(starttime.toString()).arg(schedule.duration) 559 .arg(schedule.theme).arg((sum_available ? *sum :"No summary"))); 560 561 if (!chanid) 562 { 563 VERBOSE(VB_EIT, LOC + 564 QString("CSATCARAIBES EIT for NIT %1, TID %2, SID %3, " 565 "title: %4. Channel not found!") 566 .arg(info.orignetworkid).arg(info.tsid).arg(info.serviceid) 567 .arg(title)); 568 continue; 569 } 570 571 /* event = new DBEvent(chanid, 572 title, QString::null, sum_available ? (*sum).value():"", 573 category, category_type, 574 starttime, endtime, fix, 575 subtitle_type, 576 audio_props, 577 video_props, 578 "", ""); 579 db_events.enqueue(event);*/ 580 } 581 } 582 } 583 517 584 void EITHelper::PruneEITCache(uint timestamp) 518 585 { 519 586 eitcache->PruneOldEntries(timestamp); … … 856 923 fix[ 1094LL << 32 | 1 << 16 | 17028 ] = // NT1 857 924 fix[ 1100LL << 32 | 1 << 16 | 8710 ] = // NRJ 12 858 925 EITFixUp::kEFixForceISO8859_15; 926 927 // IntelSat 903 DVB-S french channels (CanalSat Caraibes) 928 // The original network id is the same as the previous one 929 // at least transport ids are different 930 // For now all channels are marked as needing fixup 931 fix[ 601LL << 32 | 1 << 16 | 0 ] = 932 fix[ 602LL << 32 | 1 << 16 | 0 ] = 933 fix[ 603LL << 32 | 1 << 16 | 0 ] = 934 fix[ 604LL << 32 | 1 << 16 | 0 ] = 935 EITFixUp::kEFixForceISO8859_15; 859 936 } 860 937 861 938 static int calc_eit_utc_offset(void) -
libs/libmythtv/eithelper.h
53 53 class ExtendedTextTable; 54 54 class DVBEventInformationTable; 55 55 class PremiereContentInformationTable; 56 class CSatCaraibesInformationTable; 56 57 57 58 class EITHelper 58 59 { … … 77 78 const ExtendedTextTable *ett); 78 79 void AddEIT(const DVBEventInformationTable *eit); 79 80 void AddEIT(const PremiereContentInformationTable *eit); 81 void AddEIT(CSatCaraibesInformationTable *eit); 80 82 #else // if !USING_BACKEND 81 83 void AddEIT(uint, uint, const EventInformationTable*) {} 82 84 void AddETT(uint, uint, const ExtendedTextTable*) {} 83 85 void AddEIT(const DVBEventInformationTable*) {} 84 86 void AddEIT(const PremiereContentInformationTable*) {} 87 void AddEIT(CSatCaraibesInformationTable *eit); 85 88 #endif // !USING_BACKEND 86 89 87 90 // EIT cache handling -
libs/libmythtv/mpeg/dvbtables.cpp
148 148 return false; 149 149 } 150 150 151 void BouquetAssociationTable::Parse(void) 152 { 153 const unsigned char * p = psipdata()+8; 154 uint looplen, len = (p[0] & 0x0F) << 8 + p[1]; // Name descriptor length 155 desc_list_t desc; 156 p += 2; 157 desc = MPEGDescriptor::ParseOnlyInclude(p, len, DescriptorID::bouquet_name); 158 if (desc.empty()) 159 VERBOSE(VB_SIPARSER,"Curious: BAT without bouquet name!"); 160 else 161 bouquet_name = QString::fromLatin1((const char*)(desc[0]+2), 162 MPEGDescriptor(desc[0]).DescriptorLength()); 163 p += len; 164 looplen = (p[0] & 0x0F) << 8 + p[1]; 165 p += 2; // Now point on first TS desc 166 while (looplen) { 167 _ptrs.push_back(p); // Add first TS position 168 p += 4; // Skip TS and network ID 169 len = (p[0] & 0x0F) << 8 + p[1]; // Get length of descriptors 170 p += 2; 171 looplen -= 6; 172 p += len; 173 looplen -= len; 174 } 175 } 176 151 177 void DVBEventInformationTable::Parse(void) const 152 178 { 153 179 _ptrs.clear(); … … 177 203 // Dish Network Long Term Future Event Information for all transports 178 204 is_eit |= (TableID::DN_EITbego <= table_id && 179 205 TableID::DN_EITendo >= table_id); 206 // Canal Satellite long term EIT for all transports 207 is_eit |= (table_id == TableID::CSATCARAIBES_CHANNELS || 208 table_id == TableID::CSATCARAIBES_THEMES || 209 table_id == TableID::CSATCARAIBES_SCHED || 210 table_id == TableID::CSATCARAIBES_SUMMARIES); 180 211 181 212 return is_eit; 182 213 } -
libs/libmythtv/mpeg/csatcaraibesdescriptors.h
1 // -*- Mode: c++ -*- 2 #ifndef _CSATCAR_DESCRIPTORS_H_ 3 #define _CSATCAR_DESCRIPTORS_H_ 4 5 #include <stdint.h> 6 #include <inttypes.h> 7 8 #include <qstring.h> 9 #include <qdatetime.h> 10 11 #include "dvbdescriptors.h" 12 13 class CSatCaraibesChannelsDescriptor : public MPEGDescriptor 14 { 15 public: 16 CSatCaraibesChannelsDescriptor(const unsigned char* data) : MPEGDescriptor(data) 17 { 18 assert(DescriptorID::csat_channels_ind == DescriptorTag()); 19 Parse(); 20 } 21 22 void Parse(void); 23 const QMap<uint,uint>& GetIndexes() const 24 { 25 return channels_indexes; 26 } 27 28 private: 29 /* Maps a Program ID to an index used by the EIT */ 30 QMap<uint,uint> channels_indexes; 31 }; 32 33 #endif // _CSATCAR_DESCRIPTORS_H_ -
libs/libmythtv/mpeg/csatcaraibestables.cpp
1 #include "csatcaraibesdescriptors.h" 2 #include "csatcaraibestables.h" 3 4 /************** Channels *********************************/ 5 6 void CSatCaraibesChannelsTable::Parse() 7 { 8 int pos = 0; 9 10 /* FIXME: There is for sure a clean way to do this 11 Lookup a 00 01 sequence* 12 */ 13 14 while ((pos<SectionLength()) && ((psipdata()[pos]!=0) || (psipdata()[pos+1]!=1))) pos++; 15 16 assert(pos<SectionLength()); 17 18 /* skip 4 bytes */ 19 pos += 4; 20 while (pos<SectionLength()) { 21 _ptrs.push_back(psipdata()[pos]*256+psipdata()[pos+1]); 22 pos += 14; 23 } 24 } 25 26 /******************* Schedule ******************************/ 27 28 void CSatCaraibesScheduleTable::Parse() 29 { 30 uint nb_titles, i; 31 unsigned char * pos; 32 33 /* Skip section length */ 34 nb_titles = psipdata()[1]; 35 pos = psipdata() + 2; 36 for (i = 0;i < nb_titles;i++) { 37 _ptrs.push_back(pos); 38 /* Skip titles */ 39 pos += *pos+1; 40 /* Skip 4 bytes per showing */ 41 pos += ((*pos >> 4) & 0x07)*4; 42 } 43 } 44 45 void CSatCaraibesScheduleTable::GetSchedules(vector<CSatCaraibesSchedule>& schedules) const 46 { 47 QDateTime date = QDateTime::currentDateTime(); 48 QDate today = QDate::currentDate(); 49 50 for (uint i = 0;i < NbSchedules();i++) { 51 const unsigned char * p = _ptrs[i]; 52 CSatCaraibesSchedule schedule; 53 uint j; 54 55 schedule.title = QString::fromLatin1((const char *) (p+1), *p); 56 p += p[0]; 57 /* 0x85 at the end means incomplete, so add dots */ 58 if (*p==0x85) 59 schedule.title.append("..."); 60 p++; 61 if (*p & 0x80) schedule.key = 0; 62 else schedule.key = Section() << 12 + (_ptrs[i]-psipdata()); 63 /* Get corresponding showings */ 64 j = (*p & 0x70) >> 4; 65 schedule.duration = ( (p[0] & 0x0F)*256 + p[1] ) * 60; 66 schedule.theme = (p[2] >> 4) & 0x0F; 67 p += 3; 68 for (;j > 0;j--) { 69 CSatCaraibesShowing s; 70 71 s.channel_index = *p & 0x7F; 72 p++; 73 s.Start = QDateTime(today).addDays(*p >> 3) 74 .addSecs(((p[0] & 0x07)*256+p[1])*60); 75 schedule.showings.push_back(s); 76 } 77 schedules.push_back(schedule); 78 } 79 } 80 81 /******************* Summaries *******************************/ 82 83 uint CSatCaraibesSummaryTable::TitleKey() const 84 { 85 uint sched_off = (psipdata()[0] &0x0F)*256+psipdata()[1]; 86 uint sched_sect = psipdata()[5]; 87 return (sched_off + sched_sect << 12); 88 } 89 90 /* FIXME: this is a bit crude. Eg \0x0a chars are used 91 to break lines, we should escape them 92 Also there is sometimes a second part of the summary 93 that we do not use here 94 */ 95 QString CSatCaraibesSummaryTable::toString() const 96 { 97 uint len = psipdata()[8]; 98 99 return QString::fromLatin1((const char*)(psipdata()+15), len); 100 } 101 102 /******************* Themes **************************/ 103 104 static MythCategoryType ConvertTheme(const QString& str) 105 { 106 if (str == "CINEMA") return string_to_myth_category_type("movies"); 107 if (str == "SPORT") return string_to_myth_category_type("sports"); 108 if (str == "SERIE") return string_to_myth_category_type("series"); 109 return kCategoryNone; 110 } 111 112 void CSatCaraibesThemesTable::GetThemes(vector<CSatCaraibesTheme>& v) const 113 { 114 CSatCaraibesTheme t; 115 /* Points on themes string */ 116 const unsigned char * p = psipdata() + 0x109; 117 for (int i = 9;i < 0x100;i += 0x10) { 118 /* A zero length is possible */ 119 if (psipdata()[i] & 0x7F) { 120 t.theme = QString::fromAscii((const char *)p, psipdata()[i] & 0x7F); 121 t.category = ConvertTheme(t.theme); 122 p += psipdata()[i] & 0x7F; 123 } else { 124 t.theme = QString::null; 125 t.category = kCategoryNone; 126 } 127 v.push_back(t); 128 } 129 } 130 131 /************** Information table ******************/ 132 133 void CSatCaraibesInformationTable::AddSummary(const CSatCaraibesSummaryTable& t) 134 { 135 summaries.insert(t.TitleKey(), t.toString()); 136 } 137 138 bool CSatCaraibesInformationTable::HasScheduleSection(uint section) const 139 { 140 for (uint i = 0; i < sections.size();i++) 141 if (section == sections[i]) return true; 142 return false; 143 } 144 145 void CSatCaraibesInformationTable::AddSchedules(const CSatCaraibesScheduleTable& t) 146 { 147 if (!HasScheduleSection(t.Section())) { 148 /* Record section */ 149 sections.push_back(t.Section()); 150 /* Get all schedules */ 151 t.GetSchedules(schedules); 152 nb_sections = t.LastSection()+1; 153 } 154 } 155 156 void CSatCaraibesInformationTable::AddChannelsInfo(const BouquetAssociationTable * bat) 157 { 158 for (uint i = 0; i < bat->NBTransports();i++) 159 { 160 desc_list_t desc = 161 MPEGDescriptor::Parse(bat->TransportDescriptors(i), 162 bat->TransportDescriptorsLoopLength(i)); 163 const unsigned char * private_data = 164 MPEGDescriptor::Find(desc, DescriptorID::private_data_specifier); 165 166 /* Check if this looks like CanalSat private table 167 Canal+ is 0x000000c0 168 */ 169 if (!private_data || (MPEGDescriptor(private_data).DescriptorLength()!=4) 170 || ((uint32_t)*(private_data+4)!=0x000000c0)) 171 continue; 172 private_data = MPEGDescriptor::Find(desc, DescriptorID::csat_channels_ind); 173 if (private_data) { 174 CSatCaraibesChannelsDescriptor csat(private_data); 175 176 const QMap<uint,uint>& indexes = csat.GetIndexes(); 177 CSatCaraibesChannelInfo info; 178 QMap<uint,uint>::const_iterator it = indexes.begin(); 179 180 info.tsid = bat->TSID(i); 181 info.orignetworkid = bat->OriginalNetworkID(i); 182 VERBOSE(VB_SIPARSER,QString("TSID %1 OrigNetworkid %2").arg(info.tsid).arg(info.orignetworkid)); 183 for (;it != indexes.end();it++) { 184 info.serviceid = it.key(); 185 channels.insert(it.data(), info); 186 VERBOSE(VB_SIPARSER, 187 QString("Index %1 Serviceid %2").arg(it.data()).arg(it.key())); 188 } 189 } 190 } 191 } -
libs/libmythtv/mpeg/dvbstreamdata.cpp
17 17 : MPEGStreamData(desired_program, cacheTables), 18 18 _desired_netid(desired_netid), _desired_tsid(desired_tsid), 19 19 _dvb_eit_dishnet_long(false), 20 _dvb_eit_csatcaraibes(true), 20 21 _nit_version(-2), _nito_version(-2) 21 22 { 22 23 SetVersionNIT(-1,0); … … 243 244 244 245 return true; 245 246 } 247 case TableID::BAT: 248 { 249 BouquetAssociationTable bat(psip); 250 /* For now we use the BAT only for Canal Satellite 251 * Caraibes (French provider) 252 */ 253 if (bat.BouquetName()=="CanalSatellite Caraibes") { 254 VERBOSE(VB_SIPARSER,"Bat processed to get channels info, CanalSat Caraibes"); 255 _csat_info.AddChannelsInfo(&bat); 256 } 257 else VERBOSE(VB_SIPARSER,"BAT but not canalsat"); 258 return true; 259 } 246 260 case TableID::SDT: 247 261 { 248 262 uint tsid = psip.TableIDExtension(); … … 370 384 return true; 371 385 } 372 386 387 if (CSATCARAIBES_EIT_PID1 == pid) { 388 switch (psip.TableID()) 389 { 390 /*case TableID::CSATCARAIBES_CHANNELS: 391 if (_csat_info.HasChannels()) return true; 392 _csat_info.AddChannels(psip);*/ 393 break; 394 case TableID::CSATCARAIBES_THEMES: 395 if (_csat_info.HasThemes()) return true; 396 _csat_info.AddThemes(psip); 397 break; 398 case TableID::CSATCARAIBES_SCHED: 399 if (_csat_info.HasSeenAllSchedules()) return true; 400 _csat_info.AddSchedules(psip); 401 break; 402 case TableID::CSATCARAIBES_SUMMARIES: 403 { 404 CSatCaraibesSummaryTable summary(psip); 405 if (!(summary.IsValid())) return false; 406 _csat_info.AddSummary(summary); 407 break; 408 } 409 default: 410 return false; 411 } 412 if (_eit_helper) 413 _eit_helper->AddEIT(&_csat_info); 414 } 373 415 return false; 374 416 } 375 417 … … 416 458 add_pids.push_back(DVB_DNLONG_EIT_PID); 417 459 } 418 460 461 if (_dvb_eit_csatcaraibes && 462 find(cur_pids.begin(), cur_pids.end(), 463 (uint) CSATCARAIBES_EIT_PID1) == cur_pids.end()) 464 { 465 add_pids.push_back(CSATCARAIBES_EIT_PID1); 466 VERBOSE(VB_EIT,"Added CSAT PID!"); 467 } 468 419 469 if (_desired_netid == PREMIERE_ONID && 420 470 find(cur_pids.begin(), cur_pids.end(), 421 471 (uint) PREMIERE_EIT_DIREKT_PID) == cur_pids.end()) … … 451 501 del_pids.push_back(DVB_DNLONG_EIT_PID); 452 502 } 453 503 504 if (_dvb_eit_csatcaraibes && 505 find(cur_pids.begin(), cur_pids.end(), 506 (uint) CSATCARAIBES_EIT_PID1) == cur_pids.end()) 507 { 508 del_pids.push_back(CSATCARAIBES_EIT_PID1); 509 } 454 510 if (_desired_netid == PREMIERE_ONID && 455 511 find(cur_pids.begin(), cur_pids.end(), 456 512 (uint) PREMIERE_EIT_DIREKT_PID) != cur_pids.end()) -
libs/libmythtv/mpeg/mpegtables.h
191 191 PREMIERE_EIT_DIREKT_PID = 0x0b11, 192 192 PREMIERE_EIT_SPORT_PID = 0x0b12, 193 193 194 // Canal Sat longterm EIT is on pid 0x114 and 0x153 195 CSATCARAIBES_EIT_PID1 = 0x114, 196 // CSATCARAIBES_EIT_PID2 = 0x153, 197 194 198 ATSC_PSIP_PID = 0x1ffb, 195 199 }; 196 200 … … 241 245 DN_EITbego = 0x80, // always on pid 0x300 242 246 DN_EITendo = 0xfe, // always on pid 0x300 243 247 248 // Canal Sat Caraibes Longterm EIT data 249 CSATCARAIBES_CHANNELS = 0x90, // always on pid 0x114 250 CSATCARAIBES_SCHED = 0x92, // always on pid 0x114 251 CSATCARAIBES_SUMMARIES = 0x94, //always on pid 0x114 252 CSATCARAIBES_THEMES = 0x91, //always on pid 0x114 253 244 254 // ARIB 245 255 ARIBbeg = 0x80, 246 256 ARIBend = 0x8f, -
libs/libmythtv/mpeg/streamlisteners.h
31 31 class DirectedChannelChangeSelectionCodeTable; 32 32 33 33 class NetworkInformationTable; 34 class BouquetAssociationTable; 34 35 class ServiceDescriptionTable; 35 36 class TimeDateTable; 36 37 class DVBEventInformationTable; … … 143 144 public: 144 145 virtual void HandleEIT(const DVBEventInformationTable*) = 0; 145 146 virtual void HandleEIT(const PremiereContentInformationTable*) = 0; 147 virtual void HandleBAT(const BouquetAssociationTable*) = 0; 146 148 }; 147 149 148 150 -
libs/libmythtv/mpeg/dvbdescriptors.h
1812 1812 QString toString() const { return QString("DVBContentIdentifierDescriptor(stub)"); } 1813 1813 }; 1814 1814 1815 /* Used by Canal+ (French Sat provider) in the BAT 1816 For Canal+: data is 4 bytes, equal to 0x000000C0 1817 */ 1818 class DVBPrivateDataSpecifierDescriptor : public MPEGDescriptor 1819 { 1820 public: 1821 DVBPrivateDataSpecifierDescriptor(const unsigned char * data) : MPEGDescriptor(data) 1822 { 1823 assert(DescriptorID::private_data_specifier == DescriptorTag()); 1824 } 1825 }; 1815 1826 1816 1827 #endif -
libs/libmythtv/mpeg/csatcaraibesdescriptors.cpp
1 #include "mpegdescriptors.h" 2 #include "csatcaraibesdescriptors.h" 3 4 /****************** Schedule *******************************/ 5 6 void CSatCaraibesChannelsDescriptor::Parse(void) 7 { 8 const unsigned char * p = _data+2; 9 10 for (uint i = DescriptorLength();i >= 4;) 11 { 12 uint key = p[0] << 8 + p[1]; 13 /* MSBit of LSByte seems to be 1 when it is a radio 14 * and MSByte seems to be 0 always 15 */ 16 17 uint index = p[3] << 8 + p[4]; 18 channels_indexes.insert(key, index); 19 i -= 4; 20 p += 4; 21 } 22 } -
libs/libmythtv/mpeg/dvbtables.h
164 164 mutable vector<const unsigned char*> _ptrs; // used to parse 165 165 }; 166 166 167 /** \class BouquetAssociationTable 168 * \brief Tells what channels can be found on each transponder 169 * for one bouquet (a bunch of channels from one provider) 170 * Note: French Provider Canal+ uses this to associate channels 171 * with an index used in their proprietary EIT 172 */ 173 174 class BouquetAssociationTable : public PSIPTable 175 { 176 public: 177 BouquetAssociationTable(const PSIPTable& table) : PSIPTable(table) 178 { 179 assert(TableID::BAT == TableID()); 180 Parse(); 181 } 182 ~BouquetAssociationTable() { ; } 183 184 // table_id 8 0.0 0x4a 185 // section_syntax_indicator 1 1.0 1 186 // reserved_future_use 1 1.1 1 187 // reserved 2 1.2 3 188 // section_length 12 1.4 0 189 // Bouquet ID 16 3.0 0 190 // reserved 2 5.0 3 191 // version_number 5 5.2 0 192 // current_next_indicator 1 5.7 1 193 // section_number 8 6.0 0x00 194 // last_section_number 8 7.0 0x00 195 // reserved 4 8 0x0d 196 // Bouquet descriptors len 12 8.4 197 // for (i=0;i<N;i++) 198 // Descriptor(); 199 // reserved 4 10+N.0 200 // Transport stream loop len 12 201 // for (i=0;i<N;i++) { 202 // transport_stream_id 16 203 // original_network_id 16 204 // reserved 4 205 // transport descriptor len 12 206 // for (j=0;j<N;j++) 207 // Descriptor(); 208 // } 209 // crc 32 210 uint TSID(uint i) const 211 { return _ptrs[i][0] << 8 + _ptrs[i][1]; } 212 213 /// original_network_id 16 8.0 214 uint OriginalNetworkID(uint i) const 215 { return _ptrs[i][2] << 8 + _ptrs[i][3]; } 216 217 /* Returns a pointer to the first descriptor following 218 the TS and Network ID, and the loop length */ 219 const unsigned char * TransportDescriptors(uint i) const 220 { return _ptrs[i]+6; } 221 uint TransportDescriptorsLoopLength(uint i) const 222 { return (_ptrs[i][4] &0x0F)<< 8 + _ptrs[i][5]; } 223 void Parse(void); 224 uint NBTransports() const 225 { 226 return _ptrs.size(); 227 } 228 QString BouquetName() const 229 { return bouquet_name; } 230 231 private: 232 /* point on the transport descriptors */ 233 mutable vector<const unsigned char*> _ptrs; 234 mutable QString bouquet_name; 235 }; 236 167 237 class DiscontinuityInformationTable : public PSIPTable 168 238 { 169 239 DiscontinuityInformationTable(const PSIPTable& table) : PSIPTable(table) -
libs/libmythtv/mpeg/mpegdescriptors.h
124 124 // ATSC 125 125 atsc_stuffing = 0x80, 126 126 audio_stream = 0x81, 127 /* Seems to be used also for user-defined 128 For CanalSat Caraibes this is used in 129 the BAT to provide channel indexes */ 130 csat_channels_ind = 0x81, 127 131 caption_service = 0x86, 128 132 content_advisory = 0x87, 129 133 -
libs/libmythtv/mpeg/csatcaraibestables.h
1 // -*- Mode: c++ -*- 2 #ifndef _CSATCARAIBES_TABLES_H_ 3 #define _CSATCARAIBES_TABLES_H_ 4 5 #include <qstring.h> 6 #include <qmap.h> 7 #include <stdint.h> // uint32_t 8 #include "mpegtables.h" 9 #include "dvbdescriptors.h" 10 #include "dvbtables.h" 11 #include "mpegtables.h" 12 13 /* Parses the channels table which contains the program number 14 in a certain order. The index in this table is used by 15 the other tables to refer to the channel (I dont know why 16 this indirection is needed, but well) 17 This class is not directly used to emit EIT events. 18 */ 19 20 class CSatCaraibesChannelsTable : public PSIPTable 21 { 22 public: 23 CSatCaraibesChannelsTable(const PSIPTable & table) : PSIPTable(table) 24 { 25 if (IsValid()) Parse(); 26 } 27 28 bool IsValid() const { 29 return TableID()==TableID::CSATCARAIBES_CHANNELS; 30 } 31 void Parse(); 32 uint ChannelByIndex(uint index) const { 33 assert(index<_ptrs.size()); 34 return _ptrs[index]; 35 } 36 const vector<uint>& Channels() const { 37 return _ptrs; 38 } 39 private: 40 mutable vector<uint> _ptrs; 41 }; 42 43 typedef struct CSatCaraibesShowing 44 { 45 QDateTime Start; 46 uint channel_index; 47 }; 48 49 typedef struct CSatCaraibesSchedule { 50 QString title; 51 uint duration; /* In minutes */ 52 uint key; /* Key that links it to its summary; ==0 means no summary */ 53 short unsigned int theme; 54 vector<CSatCaraibesShowing> showings; 55 }; 56 57 class CSatCaraibesScheduleTable : public PSIPTable 58 { 59 public: 60 CSatCaraibesScheduleTable(const PSIPTable& table) : PSIPTable(table) 61 { 62 } 63 64 void Parse(); 65 bool IsValid() { 66 return TableID()==TableID::CSATCARAIBES_SCHED; 67 } 68 void GetSchedules(vector<CSatCaraibesSchedule>& schedules) const; 69 uint GetKey(uint i) const 70 { 71 return Section() << 12 + (_ptrs[i]-psipdata()); 72 } 73 uint NbSchedules() const 74 { 75 return _ptrs.size(); 76 } 77 78 private: 79 80 mutable vector<const unsigned char *> _ptrs; 81 }; 82 83 class CSatCaraibesSummaryTable : public PSIPTable 84 { 85 public: 86 CSatCaraibesSummaryTable(const PSIPTable & table) : PSIPTable(table) 87 { 88 } 89 90 bool IsValid() { 91 return TableID()==TableID::CSATCARAIBES_SUMMARIES; 92 } 93 QString toString() const; 94 uint TitleKey() const; 95 }; 96 97 typedef struct CSatCaraibesTheme { 98 QString theme; 99 MythCategoryType category; 100 }; 101 102 class CSatCaraibesThemesTable : public PSIPTable 103 { 104 public: 105 CSatCaraibesThemesTable(const PSIPTable & table) : PSIPTable(table) 106 { 107 } 108 109 void GetThemes(vector<CSatCaraibesTheme>&) const; 110 }; 111 112 /* This struct holds all the needed info to find the chanid 113 of the channel 114 */ 115 116 typedef struct CSatCaraibesChannelInfo { 117 uint tsid, orignetworkid, serviceid; 118 }; 119 120 class CSatCaraibesInformationTable 121 { 122 public: 123 CSatCaraibesInformationTable() {} 124 125 void Reset() { 126 themes.clear(); 127 channels.clear(); 128 summaries.clear(); 129 schedules.clear(); 130 } 131 bool HasThemes() const 132 { 133 return themes.empty(); 134 } 135 bool HasChannels() const 136 { 137 return channels.empty(); 138 } 139 void AddThemes(const CSatCaraibesThemesTable& t) 140 { 141 t.GetThemes(themes); 142 } 143 /* void AddChannels(const CSatCaraibesChannelsTable& c) { 144 channels = c.Channels(); 145 }*/ 146 void AddSummary(const CSatCaraibesSummaryTable& s); 147 void AddSchedules(const CSatCaraibesScheduleTable& t); 148 bool HasSeenAllSchedules(void) 149 { 150 if (schedules.empty()) return false; 151 return (nb_sections == schedules.size()); 152 } 153 bool HasScheduleSection(uint section) const; 154 155 /* Returns true when the channels, themes, and at least 156 one schedule and one summaries table has been gathered */ 157 bool IsReady() const 158 { 159 /* Summaries can be empty */ 160 return !(themes.empty() || channels.empty() || 161 schedules.empty()); 162 } 163 uint NbSchedules() const 164 { return schedules.size(); } 165 const CSatCaraibesSchedule & GetSchedule(uint i) const 166 { 167 return schedules[i]; 168 } 169 void AddChannelsInfo(const BouquetAssociationTable *); 170 const CSatCaraibesChannelInfo& GetChannelInfoFromIndex(uint index) 171 { 172 return channels[index]; 173 } 174 /* Returns true if summary is found and then it points to it 175 else returns false */ 176 bool GetSummary(uint i, QMap<uint,QString>::const_iterator& it) const 177 { 178 it = summaries.find(schedules[i].key); 179 return it!=summaries.end(); 180 } 181 182 private: 183 mutable vector<CSatCaraibesTheme> themes; 184 185 /* Maps the index to the channel info */ 186 mutable QMap<uint, CSatCaraibesChannelInfo> channels; 187 mutable vector<CSatCaraibesSchedule> schedules; 188 /* Maps the key (see summary) to the description */ 189 mutable QMap<uint,QString> summaries; 190 191 /* Used to check if the sections have been seen */ 192 mutable vector<uint> sections; 193 /* Number of sections needed to make up the whole schedules */ 194 uint nb_sections; 195 }; 196 197 #endif // _CSATCARAIBES_TABLES_H_ -
libs/libmythtv/mpeg/dvbstreamdata.h
4 4 #define DVBSTREAMDATA_H_ 5 5 6 6 #include "mpegstreamdata.h" 7 #include "csatcaraibestables.h" 7 8 8 9 typedef NetworkInformationTable* nit_ptr_t; 9 10 typedef vector<const NetworkInformationTable*> nit_vec_t; … … 195 196 bool _dvb_eit_dishnet_long; 196 197 /// Tell us if the DVB service has EIT 197 198 dvb_has_eit_t _dvb_has_eit; 199 /// true means use the proprietary eit from 200 /// French provider Canal Satellite Caraibes 201 bool _dvb_eit_csatcaraibes; 198 202 199 203 // Signals 200 204 dvb_main_listener_vec_t _dvb_main_listeners; … … 211 215 // Premiere private ContentInformationTable 212 216 QMap<uint, int> _cit_version; 213 217 sections_map_t _cit_section_seen; 214 218 /// Canal Satellite (French provider) 219 CSatCaraibesInformationTable _csat_info; 215 220 int _nito_version; 216 221 QMap<uint, int> _sdto_versions; 217 222 sections_t _nito_section_seen; -
libs/libmythtv/dtvsignalmonitor.h
100 100 void HandleTDT(const TimeDateTable*); 101 101 void HandleNIT(const NetworkInformationTable*); 102 102 void HandleSDT(uint, const ServiceDescriptionTable*); 103 void HandleBAT(const BouquetAssociationTable*); 103 104 104 105 void IgnoreEncrypted(bool ignore) { ignore_encrypted = ignore; } 105 106 -
libs/libmythtv/dtvsignalmonitor.cpp
469 469 AddFlags(kDTVSigMon_CryptMatch); 470 470 } 471 471 472 void DTVSignalMonitor::HandleBAT(const BouquetAssociationTable * bat) 473 { 474 VERBOSE(VB_SIPARSER,"BAT detected"); 475 476 } 477 472 478 ATSCStreamData *DTVSignalMonitor::GetATSCStreamData() 473 479 { 474 480 return dynamic_cast<ATSCStreamData*>(stream_data);