Ticket #5530: csat-eit-20080803.diff
File csat-eit-20080803.diff, 38.5 KB (added by , 16 years ago) |
---|
-
mythtv/libs/libmythtv/mpeg/csatcaraibeseit.cpp
diff -uN trunk/mythtv/libs/libmythtv/mpeg/csatcaraibeseit.cpp trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibeseit.cpp
old new 1 #include "csatcaraibeseit.h" 2 3 void CSatCaraibesEIT::ExtractSchedules(const CSatCaraibesScheduleTable& t) 4 { 5 QDate today = QDate::currentDate(); 6 7 for (uint i = 0;i < t.NbSchedules();i++) { 8 const unsigned char * p = t.GetSchedule(i); 9 CSatCaraibesSchedule schedule; 10 11 if (p[p[0]] != 0x85) 12 schedule.title = QString::fromLatin1((const char *) (p+1), p[0]); 13 else 14 schedule.title = QString::fromLatin1((const char *) (p+1), p[0] - 1).append("..."); 15 16 if (t.ScheduleHasSummary(i)) 17 schedule.key = t.GetKey(i); 18 else schedule.key = 0; 19 schedule.duration = t.GetDuration(i); 20 schedule.theme = t.GetTheme(i); 21 p = t.GetShowings(i); 22 for (uint j = t.GetNbShowings(i);j > 0;j--) { 23 CSatCaraibesShowing s; 24 25 s.channel_index = p[0] & 0x7F; 26 p++; 27 // FIXME: 6 hours shift hardcoded!! 28 s.Start = QDateTime(today).addDays(p[0] >> 3) 29 .addSecs(((p[0] & 0x07)*256+p[1])*60 + 6*3600); 30 schedule.showings.push_back(s); 31 /* Next schedule */ 32 p += 3; 33 } 34 schedules.push_back(schedule); 35 } 36 } 37 38 static MythCategoryType ConvertTheme(const QString& str) 39 { 40 if (str == "CINEMA") return string_to_myth_category_type("movies"); 41 if (str == "SPORT") return string_to_myth_category_type("sports"); 42 if (str == "SERIE") return string_to_myth_category_type("series"); 43 return kCategoryNone; 44 } 45 46 void CSatCaraibesEIT::AddThemes(const CSatCaraibesThemesTable& table) 47 { 48 for (int i = 0;i < table.NbThemes();i++) 49 { 50 uint len = table.GetThemeLength(i); 51 CSatCaraibesTheme t; 52 53 /* A zero length is possible */ 54 if (len) { 55 t.theme = QString::fromAscii(table.GetTheme(i), len); 56 t.category = ConvertTheme(t.theme); 57 } else { 58 t.theme = QString::null; 59 t.category = kCategoryNone; 60 } 61 themes.push_back(t); 62 } 63 } 64 65 /************** Information table ******************/ 66 67 void CSatCaraibesEIT::AddSummary(const CSatCaraibesSummaryTable& t) 68 { 69 /* FIXME: this is a bit crude. Eg \0x0a chars are used 70 to break lines, we should escape them 71 Also there is sometimes a second part of the summary 72 that we do not use here 73 */ 74 QString desc; 75 if (t.DotsToAppend()) 76 desc = QString::fromLatin1(t.SummaryString(),t.GetLength() - 1) + "..."; 77 else desc = QString::fromLatin1(t.SummaryString(),t.GetLength()); 78 summaries.insert(t.TitleKey(), desc); 79 } 80 81 bool CSatCaraibesEIT::HasSeenScheduleSection(uint section) const 82 { 83 for (uint i = 0; i < sections.size();i++) 84 if (section == sections[i]) return true; 85 return false; 86 } 87 88 void CSatCaraibesEIT::AddSchedules(const CSatCaraibesScheduleTable& t) 89 { 90 if (!HasSeenScheduleSection(t.Section())) 91 { 92 /* Record section */ 93 sections.push_back(t.Section()); 94 /* Get all schedules */ 95 ExtractSchedules(t); 96 nb_sections = t.LastSection()+1; 97 } 98 } 99 100 void CSatCaraibesEIT::RemoveSchedule(uint i) 101 { 102 CSatCaraibesSchedule sched = GetSchedule(i); 103 summaries.remove(sched.key); 104 schedules.erase(schedules.begin() + i); 105 } 106 107 void CSatCaraibesEIT::AddChannelsInfo(const CSatCaraibesChannelsTable& c) 108 { 109 for (uint i = 0; i < c.NbChannels();i++) 110 { 111 CSatCaraibesChannelInfo info; 112 info.tsid = c.GetTSId(i); 113 info.orignetworkid = CSATCARAIBES_ORIGNETWORKID; 114 info.serviceid = c.GetServiceID(i); 115 channels.push_back(info); 116 VERBOSE(VB_SIPARSER,"Channel index = " << i 117 << " Service = " << info.serviceid 118 << " TSID = "<< info.tsid); 119 } 120 } -
mythtv/libs/libmythtv/mpeg/csatcaraibeseit.cpp~
diff -uN trunk/mythtv/libs/libmythtv/mpeg/csatcaraibeseit.cpp~ trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibeseit.cpp~
old new 1 #include "csatcaraibesdescriptors.h" 2 #include "csatcaraibeseit.h" 3 4 void CSatCaraibesEIT::ExtractSchedules(const CSatCaraibesScheduleTable& t) 5 { 6 QDate today = QDate::currentDate(); 7 8 for (uint i = 0;i < t.NbSchedules();i++) { 9 const unsigned char * p = t.GetSchedule(i); 10 CSatCaraibesSchedule schedule; 11 12 if (p[p[0]] != 0x85) 13 schedule.title = QString::fromLatin1((const char *) (p+1), p[0]); 14 else 15 schedule.title = QString::fromLatin1((const char *) (p+1), p[0] - 1).append("..."); 16 17 if (t.ScheduleHasSummary(i)) 18 schedule.key = t.GetKey(i); 19 else schedule.key = 0; 20 schedule.duration = t.GetDuration(i); 21 schedule.theme = t.GetTheme(i); 22 p = t.GetShowings(i); 23 for (uint j = t.GetNbShowings(i);j > 0;j--) { 24 CSatCaraibesShowing s; 25 26 s.channel_index = p[0] & 0x7F; 27 p++; 28 // FIXME: 6 hours shift hardcoded!! 29 s.Start = QDateTime(today).addDays(p[0] >> 3) 30 .addSecs(((p[0] & 0x07)*256+p[1])*60 + 6*3600); 31 schedule.showings.push_back(s); 32 /* Next schedule */ 33 p += 3; 34 } 35 schedules.push_back(schedule); 36 } 37 } 38 39 static MythCategoryType ConvertTheme(const QString& str) 40 { 41 if (str == "CINEMA") return string_to_myth_category_type("movies"); 42 if (str == "SPORT") return string_to_myth_category_type("sports"); 43 if (str == "SERIE") return string_to_myth_category_type("series"); 44 return kCategoryNone; 45 } 46 47 void CSatCaraibesEIT::AddThemes(const CSatCaraibesThemesTable& table) 48 { 49 for (int i = 0;i < table.NbThemes();i++) 50 { 51 uint len = table.GetThemeLength(i); 52 CSatCaraibesTheme t; 53 54 /* A zero length is possible */ 55 if (len) { 56 t.theme = QString::fromAscii(table.GetTheme(i), len); 57 t.category = ConvertTheme(t.theme); 58 } else { 59 t.theme = QString::null; 60 t.category = kCategoryNone; 61 } 62 themes.push_back(t); 63 } 64 } 65 66 /************** Information table ******************/ 67 68 void CSatCaraibesEIT::AddSummary(const CSatCaraibesSummaryTable& t) 69 { 70 /* FIXME: this is a bit crude. Eg \0x0a chars are used 71 to break lines, we should escape them 72 Also there is sometimes a second part of the summary 73 that we do not use here 74 */ 75 QString desc; 76 if (t.DotsToAppend()) 77 desc = QString::fromLatin1(t.SummaryString(),t.GetLength() - 1) + "..."; 78 else desc = QString::fromLatin1(t.SummaryString(),t.GetLength()); 79 summaries.insert(t.TitleKey(), desc); 80 } 81 82 bool CSatCaraibesEIT::HasSeenScheduleSection(uint section) const 83 { 84 for (uint i = 0; i < sections.size();i++) 85 if (section == sections[i]) return true; 86 return false; 87 } 88 89 void CSatCaraibesEIT::AddSchedules(const CSatCaraibesScheduleTable& t) 90 { 91 if (!HasSeenScheduleSection(t.Section())) 92 { 93 /* Record section */ 94 sections.push_back(t.Section()); 95 /* Get all schedules */ 96 ExtractSchedules(t); 97 nb_sections = t.LastSection()+1; 98 } 99 } 100 101 void CSatCaraibesEIT::RemoveSchedule(uint i) 102 { 103 CSatCaraibesSchedule sched = GetSchedule(i); 104 summaries.remove(sched.key); 105 schedules.erase(schedules.begin() + i); 106 } 107 108 void CSatCaraibesEIT::AddChannelsInfo(const CSatCaraibesChannelsTable& c) 109 { 110 for (uint i = 0; i < c.NbChannels();i++) 111 { 112 CSatCaraibesChannelInfo info; 113 info.tsid = c.GetTSId(i); 114 info.orignetworkid = CSATCARAIBES_ORIGNETWORKID; 115 info.serviceid = c.GetServiceID(i); 116 channels.push_back(info); 117 VERBOSE(VB_SIPARSER,"Channel index = " << i 118 << " Service = " << info.serviceid 119 << " TSID = "<< info.tsid); 120 } 121 } -
mythtv/libs/libmythtv/mpeg/csatcaraibeseit.h
diff -uN trunk/mythtv/libs/libmythtv/mpeg/csatcaraibeseit.h trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibeseit.h
old new 1 // -*- Mode: c++ -*- 2 #ifndef _CSATCARAIBES_EIT_H_ 3 #define _CSATCARAIBES_EIT_H_ 4 5 #include <qstring.h> 6 #include <qmap.h> 7 #include <stdint.h> // uint32_t 8 #include "dvbdescriptors.h" 9 #include "csatcaraibestables.h" 10 11 typedef struct CSatCaraibesShowing 12 { 13 QDateTime Start; 14 uint channel_index; 15 }; 16 17 typedef struct CSatCaraibesSchedule { 18 QString title; 19 uint duration; /* In minutes */ 20 uint key; /* Key that links it to its summary; ==0 means no summary */ 21 short unsigned int theme; 22 vector<CSatCaraibesShowing> showings; 23 }; 24 25 typedef struct CSatCaraibesTheme { 26 QString theme; 27 MythCategoryType category; 28 }; 29 30 /* This struct holds all the needed info to find the chanid 31 of the channel 32 */ 33 34 typedef struct CSatCaraibesChannelInfo { 35 uint tsid, orignetworkid, serviceid; 36 }; 37 38 class CSatCaraibesEIT 39 { 40 public: 41 CSatCaraibesEIT() {} 42 43 void Reset() { 44 themes.clear(); 45 channels.clear(); 46 summaries.clear(); 47 schedules.clear(); 48 } 49 bool HasThemes() const 50 { 51 return !themes.empty(); 52 } 53 bool HasChannels() const 54 { 55 return !channels.empty(); 56 } 57 void AddThemes(const CSatCaraibesThemesTable&); 58 void AddSummary(const CSatCaraibesSummaryTable&); 59 void AddSchedules(const CSatCaraibesScheduleTable&); 60 /* Will remove schedule and the corresponding summaries */ 61 void RemoveSchedule(uint i); 62 bool HasSeenScheduleSection(uint section) const; 63 64 /* Returns true when the channels, themes, and at least 65 one schedule and one summaries table has been gathered */ 66 bool IsReady() const 67 { 68 /* Summaries can be empty */ 69 return !(themes.empty() || channels.empty() || 70 schedules.empty()); 71 } 72 uint NbSchedules() const 73 { return schedules.size(); } 74 const CSatCaraibesSchedule & GetSchedule(uint i) const 75 { 76 return schedules[i]; 77 } 78 void AddChannelsInfo(const CSatCaraibesChannelsTable&); 79 const CSatCaraibesChannelInfo * GetChannelInfoFromIndex(uint index) const 80 { 81 if (index >= channels.size()) 82 return NULL; 83 84 return &(channels[index]); 85 } 86 /* Returns true if summary is found and then it points to it 87 else returns false */ 88 bool GetSummary(uint i, QMap<uint,QString>::const_iterator& it) const 89 { 90 it = summaries.find(schedules[i].key); 91 return it!=summaries.end(); 92 } 93 94 bool IsComplete() const 95 { 96 if (nb_sections != sections.size()) 97 return false; 98 /* OK We got all sections, so if there is no (more) schedule 99 that means we have already added them to the DB and 100 we have completed */ 101 if (schedules.empty()) 102 return true; 103 /* FIXME: is it worth the trouble to go and check if each schedule 104 has got is summary, for now just pretend we did not complete */ 105 return false; 106 } 107 108 private: 109 void ExtractSchedules(const CSatCaraibesScheduleTable&); 110 111 mutable vector<CSatCaraibesTheme> themes; 112 113 /* vector of channel info, the schedules store an index 114 in this vector 115 */ 116 mutable vector<CSatCaraibesChannelInfo> channels; 117 mutable vector<CSatCaraibesSchedule> schedules; 118 /* Maps the key (see summary) to the description */ 119 mutable QMap<uint,QString> summaries; 120 121 /* Used to check if the sections have been seen */ 122 mutable vector<uint> sections; 123 /* Number of sections needed to make up the whole schedules */ 124 uint nb_sections; 125 }; 126 127 #endif // _CSATCARAIBES_EIT_H_ -
mythtv/libs/libmythtv/mpeg/csatcaraibestables.cpp
diff -uN trunk/mythtv/libs/libmythtv/mpeg/csatcaraibestables.cpp trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibestables.cpp
old new 1 #include "csatcaraibestables.h" 2 3 /******************* Channels ******************************/ 4 5 void CSatCaraibesChannelsTable::Parse() 6 { 7 /* FIXME: not sure about the 0x20 offset here */ 8 for (uint i = 0x20;i < Length();i += 14) 9 _ptrs.push_back(pesdata() + i); 10 } 11 12 /******************* Schedule ******************************/ 13 14 void CSatCaraibesScheduleTable::Parse() 15 { 16 uint nb_titles, i; 17 unsigned char * pos; 18 19 /* Skip section length */ 20 nb_titles = psipdata()[1]; 21 pos = psipdata() + 2; 22 for (i = 0;i < nb_titles;i++) { 23 _ptrs.push_back(pos); 24 /* Skip titles */ 25 pos += pos[0] + 1; 26 /* Skip 4 bytes per showing */ 27 pos += ((pos[0] & 0x70) >> 4) * 4 + 3; 28 } 29 } 30 31 /******************* Summaries *******************************/ 32 33 uint CSatCaraibesSummaryTable::TitleKey() const 34 { 35 uint sched_off = (pesdata()[3] &0x0F)*256+pesdata()[4]; 36 uint sched_sect = pesdata()[8]; 37 return (sched_off + (sched_sect << 12)); 38 } 39 40 /******************* Themes **************************/ 41 42 void CSatCaraibesThemesTable::Parse(void) 43 { 44 const unsigned char * p = pesdata() + 0x10C; 45 for (int i = 0x0C;i < 0x100;i += 0x10) 46 { 47 _ptrs.push_back((const char *)p); 48 /* Add length of the current title */ 49 p += pesdata()[i] & 0x7F; 50 } 51 } 52 53 uint CSatCaraibesThemesTable::GetThemeLength(uint i) const 54 { 55 return (pesdata()[0x0C + i*0x10] & 0x7F); 56 } -
mythtv/libs/libmythtv/mpeg/csatcaraibestables.h
diff -uN trunk/mythtv/libs/libmythtv/mpeg/csatcaraibestables.h trunk-work/mythtv/libs/libmythtv/mpeg/csatcaraibestables.h
old new 1 // -*- Mode: c++ -*- 2 #ifndef _CSATCARAIBES_TABLES_H_ 3 #define _CSATCARAIBES_TABLES_H_ 4 5 #include <qstring.h> 6 #include <stdint.h> // uint32_t 7 #include "mpegtables.h" 8 #include "dvbtables.h" 9 10 #define CSATCARAIBES_ORIGNETWORKID 1 11 12 class CSatCaraibesScheduleTable : public PSIPTable 13 { 14 public: 15 CSatCaraibesScheduleTable(const PSIPTable& table) : PSIPTable(table) 16 { 17 Parse(); 18 } 19 20 void Parse(); 21 bool IsValid() { 22 return TableID()==TableID::CSATCARAIBES_SCHED; 23 } 24 bool ScheduleHasSummary(uint i) const 25 { 26 const unsigned char * p = AfterTitle(i); 27 return (*p & 0x80) >> 7; 28 } 29 uint GetNbShowings(uint i) const 30 { 31 const unsigned char * p = AfterTitle(i); 32 return (*p & 0x70) >> 4; 33 } 34 const unsigned char * GetShowings(uint i) const 35 { 36 return AfterTitle(i) + 3; 37 } 38 uint GetDuration(uint i) const 39 { 40 const unsigned char * p = AfterTitle(i); 41 return ( ((p[0] & 0x0F) << 8) | p[1] ) * 60; 42 } 43 uint GetTheme(uint i) const 44 { 45 const unsigned char * p = AfterTitle(i); 46 return (p[2] & 0xF0) >> 4; 47 } 48 uint GetKey(uint i) const 49 { 50 return (Section() << 12) | (_ptrs[i]-pesdata()); 51 } 52 uint NbSchedules() const 53 { 54 return _ptrs.size(); 55 } 56 /* Returns a pointer on the Title: first byte is length, following 57 bytes are the string itself */ 58 const unsigned char * GetSchedule(uint i) const 59 { 60 return _ptrs[i]; 61 } 62 63 private: 64 const unsigned char * AfterTitle(uint i) const 65 { 66 return _ptrs[i] + _ptrs[i][0] + 1; 67 } 68 69 mutable vector<const unsigned char *> _ptrs; 70 }; 71 72 class CSatCaraibesSummaryTable : public PSIPTable 73 { 74 public: 75 CSatCaraibesSummaryTable(const PSIPTable & table) : PSIPTable(table) 76 { 77 } 78 79 bool IsValid() { 80 return TableID()==TableID::CSATCARAIBES_SUMMARY; 81 } 82 uint TitleKey() const; 83 uint GetLength() const 84 { 85 return pesdata()[11]-6; 86 } 87 const char * SummaryString(void) const 88 { 89 return (const char*)(pesdata()+18); 90 } 91 bool DotsToAppend(void) const 92 { 93 return pesdata()[12 + GetLength() - 1] == 0x85; 94 } 95 }; 96 97 class CSatCaraibesThemesTable : public PSIPTable 98 { 99 public: 100 CSatCaraibesThemesTable(const PSIPTable & table) : PSIPTable(table) 101 { 102 Parse(); 103 } 104 105 void Parse(void); 106 uint NbThemes(void) const 107 { 108 return _ptrs.size(); 109 } 110 const char * GetTheme(uint i) const 111 { 112 return _ptrs[i]; 113 } 114 /* Can be zero, just discard this theme */ 115 uint GetThemeLength(uint i) const; 116 private: 117 mutable vector<const char *> _ptrs; 118 }; 119 120 class CSatCaraibesChannelsTable : public PSIPTable 121 { 122 public: 123 CSatCaraibesChannelsTable(const PSIPTable & table) : PSIPTable(table) 124 { 125 Parse(); 126 } 127 128 void Parse(void); 129 uint NbChannels(void) const 130 { 131 return _ptrs.size(); 132 } 133 uint GetTSId(uint i) const 134 { 135 return (_ptrs[i][2] << 8) | _ptrs[i][3]; 136 } 137 uint GetServiceID(uint i) const 138 { 139 return (_ptrs[i][4] << 8) | _ptrs[i][5]; 140 } 141 private: 142 mutable vector<const unsigned char *> _ptrs; 143 }; 144 #endif // _CSATCARAIBES_TABLES_H_ -
mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp
diff -uN trunk/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp trunk-work/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp
old new 6 6 #include "dvbstreamdata.h" 7 7 #include "dvbtables.h" 8 8 #include "premieretables.h" 9 #include "csatcaraibestables.h" 10 #include "csatcaraibeseit.h" 9 11 #include "eithelper.h" 10 12 11 13 #define PREMIERE_ONID 133 … … 17 19 : MPEGStreamData(desired_program, cacheTables), 18 20 _desired_netid(desired_netid), _desired_tsid(desired_tsid), 19 21 _dvb_eit_dishnet_long(false), 22 _dvb_eit_csatcaraibes(true), 20 23 _nit_version(-2), _nito_version(-2) 21 24 { 22 25 SetVersionNIT(-1,0); … … 153 156 return EITSectionSeen(table_id, service_id, psip.Section()); 154 157 } 155 158 156 if ( ((PREMIERE_EIT_DIREKT_PID == pid) || (PREMIERE_EIT_SPORT_PID == pid)) &&157 TableID::PREMIERE_CIT == table_id)159 if (PREMIERE_EIT_DIREKT_PID == pid || PREMIERE_EIT_SPORT_PID == pid 160 && TableID::PREMIERE_CIT == table_id) 158 161 { 159 162 uint content_id = PremiereContentInformationTable(psip).ContentID(); 160 163 if (VersionCIT(content_id) != version) … … 162 165 return CITSectionSeen(content_id, psip.Section()); 163 166 } 164 167 168 if (CSATCARAIBES_EIT_PID1 == pid) 169 { 170 static uint sched_version = 0xFFF; 171 switch (table_id) { 172 case TableID::CSATCARAIBES_SCHED: 173 { 174 if (sched_version != psip.Version()) { 175 sched_version = psip.Version(); 176 QString str(QDateTime::currentDateTime().toString(Qt::LocalDate)); 177 VERBOSE(VB_EIT,"Date : " << str <<" " 178 << "New Sched version = " << sched_version); 179 } 180 return _csat_eit.IsComplete() || 181 _csat_eit.HasSeenScheduleSection(psip.Section()); 182 } 183 case TableID::CSATCARAIBES_THEMES: 184 { 185 return _csat_eit.HasThemes(); 186 } 187 case TableID::CSATCARAIBES_SUMMARY: 188 { 189 return _csat_eit.IsComplete(); 190 } 191 case TableID::CSATCARAIBES_CHANNELS: 192 { 193 return _csat_eit.HasChannels(); 194 } 195 default: 196 return false; 197 } 198 } 199 165 200 return false; 166 201 } 167 202 … … 369 404 370 405 return true; 371 406 } 372 407 408 /* FIXME: Do not hardcode transport here */ 409 if ((_desired_tsid == 601) && (CSATCARAIBES_EIT_PID1 == pid)) { 410 switch (psip.TableID()) 411 { 412 case TableID::CSATCARAIBES_THEMES: 413 { 414 CSatCaraibesThemesTable themes(psip); 415 _csat_eit.AddThemes(themes); 416 break; 417 } 418 case TableID::CSATCARAIBES_SCHED: 419 { 420 CSatCaraibesScheduleTable sched(psip); 421 _csat_eit.AddSchedules(sched); 422 break; 423 } 424 case TableID::CSATCARAIBES_CHANNELS: 425 { 426 CSatCaraibesChannelsTable channels(psip); 427 VERBOSE(VB_EIT,"ADDING CHANNELS"); 428 _csat_eit.AddChannelsInfo(channels); 429 break; 430 } 431 case TableID::CSATCARAIBES_SUMMARY: 432 { 433 CSatCaraibesSummaryTable summary(psip); 434 if (!(summary.IsValid())) return false; 435 _csat_eit.AddSummary(summary); 436 break; 437 } 438 default: 439 return false; 440 } 441 if (_eit_helper) 442 _eit_helper->AddEIT(&_csat_eit); 443 } 373 444 return false; 374 445 } 375 446 … … 392 463 QMutexLocker locker(&_listener_lock); 393 464 bool want_eit = (_eit_rate >= 0.5f) && HasAnyEIT(); 394 465 bool has_eit = in_use_pids.size(); 395 return want_eit != has_eit; 466 467 return ((_desired_tsid == 601) || (want_eit != has_eit)); 468 // return want_eit != has_eit; 396 469 } 397 470 398 471 bool DVBStreamData::GetEITPIDChanges(const uint_vec_t &cur_pids, … … 401 474 { 402 475 QMutexLocker locker(&_listener_lock); 403 476 477 // VERBOSE(VB_EIT,QString("GetEITPIDChanges tsid %1 eit_csat %2").arg(_desired_tsid).arg(_dvb_eit_csatcaraibes)); 478 404 479 if ((_eit_rate >= 0.5f) && HasAnyEIT()) 405 480 { 406 481 if (find(cur_pids.begin(), cur_pids.end(), … … 410 485 } 411 486 412 487 if (_dvb_eit_dishnet_long && 413 find(cur_pids.begin(), cur_pids.end(),414 (uint) DVB_DNLONG_EIT_PID) == cur_pids.end())488 (find(cur_pids.begin(), cur_pids.end(), 489 (uint) DVB_DNLONG_EIT_PID) == cur_pids.end())) 415 490 { 416 491 add_pids.push_back(DVB_DNLONG_EIT_PID); 417 492 } 418 493 494 /* FIXME: Avoid hardcoding the good transport here */ 495 if (_dvb_eit_csatcaraibes && (_desired_tsid == 601) && 496 (find(cur_pids.begin(), cur_pids.end(), 497 (uint) CSATCARAIBES_EIT_PID1) == cur_pids.end())) 498 { 499 add_pids.push_back(CSATCARAIBES_EIT_PID1); 500 VERBOSE(VB_EIT,"Added CSAT PID!"); 501 } 502 419 503 if (_desired_netid == PREMIERE_ONID && 420 504 find(cur_pids.begin(), cur_pids.end(), 421 505 (uint) PREMIERE_EIT_DIREKT_PID) == cur_pids.end()) … … 451 535 del_pids.push_back(DVB_DNLONG_EIT_PID); 452 536 } 453 537 538 if (_dvb_eit_csatcaraibes && 539 (find(cur_pids.begin(), cur_pids.end(), 540 (uint) CSATCARAIBES_EIT_PID1) /*!=*/ == cur_pids.end())) 541 { 542 VERBOSE(VB_EIT,"Deleted CSAT PID!"); 543 add_pids.push_back(CSATCARAIBES_EIT_PID1); 544 } 454 545 if (_desired_netid == PREMIERE_ONID && 455 546 find(cur_pids.begin(), cur_pids.end(), 456 547 (uint) PREMIERE_EIT_DIREKT_PID) != cur_pids.end()) -
mythtv/libs/libmythtv/mpeg/dvbstreamdata.h
diff -uN trunk/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h trunk-work/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h
old new 4 4 #define DVBSTREAMDATA_H_ 5 5 6 6 #include "mpegstreamdata.h" 7 #include "csatcaraibeseit.h" 8 7 9 8 10 typedef NetworkInformationTable* nit_ptr_t; 9 11 typedef vector<const NetworkInformationTable*> nit_vec_t; … … 195 197 bool _dvb_eit_dishnet_long; 196 198 /// Tell us if the DVB service has EIT 197 199 dvb_has_eit_t _dvb_has_eit; 200 /// true means use the proprietary eit from 201 /// French provider Canal Satellite Caraibes 202 bool _dvb_eit_csatcaraibes; 198 203 199 204 // Signals 200 205 dvb_main_listener_vec_t _dvb_main_listeners; … … 211 216 // Premiere private ContentInformationTable 212 217 QMap<uint, int> _cit_version; 213 218 sections_map_t _cit_section_seen; 214 219 /// Canal Satellite (French provider) 220 CSatCaraibesEIT _csat_eit; 215 221 int _nito_version; 216 222 QMap<uint, int> _sdto_versions; 217 223 sections_t _nito_section_seen; -
mythtv/libs/libmythtv/mpeg/dvbtables.cpp
diff -uN trunk/mythtv/libs/libmythtv/mpeg/dvbtables.cpp trunk-work/mythtv/libs/libmythtv/mpeg/dvbtables.cpp
old new 177 177 // Dish Network Long Term Future Event Information for all transports 178 178 is_eit |= (TableID::DN_EITbego <= table_id && 179 179 TableID::DN_EITendo >= table_id); 180 // Canal Satellite long term EIT for all transports 181 is_eit |= (table_id == TableID::CSATCARAIBES_CHANNELS || 182 table_id == TableID::CSATCARAIBES_THEMES || 183 table_id == TableID::CSATCARAIBES_SCHED || 184 table_id == TableID::CSATCARAIBES_SUMMARY); 180 185 181 186 return is_eit; 182 187 } -
mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
diff -uN trunk/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp trunk-work/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
old new 253 253 moreTablePackets = true; 254 254 255 255 PESPacket* partial = GetPartialPES(tspacket->PID()); 256 256 257 if (partial && partial->AddTSPacket(tspacket, broken) && !broken) 257 258 { 258 259 // check if it's safe to read pespacket's Length() … … 678 679 return false; 679 680 return PMTSectionSeen(psip.TableIDExtension(), psip.Section()); 680 681 } 681 682 /* FIXME: Shoud do something for BAT also, we need only one 683 and I dont think they change that much */ 682 684 return false; 683 685 } 684 686 … … 889 899 DONE_WITH_PES_PACKET(); 890 900 } 891 901 892 if (!psip->VerifyPSIP(!_have_CRC_bug ))902 if (!psip->VerifyPSIP(!_have_CRC_bug && psip->HasCRC())) 893 903 { 894 VERBOSE(VB_RECORD, "PSIP table is invalid"); 904 VERBOSE(VB_RECORD, QString("PSIP table %1 (pid %2) is invalid") 905 .arg(psip->TableID()).arg(tspacket->PID())); 895 906 DONE_WITH_PES_PACKET(); 896 907 } 897 908 … … 1023 1034 bool MPEGStreamData::IsListeningPID(uint pid) const 1024 1035 { 1025 1036 pid_map_t::const_iterator it = _pids_listening.find(pid); 1037 1026 1038 return it != _pids_listening.end(); 1027 1039 } 1028 1040 -
mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
diff -uN trunk/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h trunk-work/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
old new 113 113 // Listening 114 114 virtual void AddListeningPID( 115 115 uint pid, PIDPriority priority = kPIDPriorityNormal) 116 { _pids_listening[pid] = priority; }116 { _pids_listening[pid] = priority; VERBOSE(VB_RECORD,QString("Added %1 pid").arg(pid));} 117 117 virtual void AddNotListeningPID(uint pid) 118 118 { _pids_notlistening[pid] = kPIDPriorityNormal; } 119 119 virtual void AddWritingPID( -
mythtv/libs/libmythtv/mpeg/mpegtables.cpp
diff -uN trunk/mythtv/libs/libmythtv/mpeg/mpegtables.cpp trunk-work/mythtv/libs/libmythtv/mpeg/mpegtables.cpp
old new 154 154 { 155 155 has_crc = true; 156 156 } 157 // Canal Satellite Caraibes EIT 158 if ((TableID() == TableID::CSATCARAIBES_THEMES) || 159 (TableID() == TableID::CSATCARAIBES_SUMMARY) || 160 (TableID() == TableID::CSATCARAIBES_CHANNELS)) 161 has_crc = false; 157 162 } 158 163 break; 159 164 } -
mythtv/libs/libmythtv/mpeg/mpegtables.h
diff -uN trunk/mythtv/libs/libmythtv/mpeg/mpegtables.h trunk-work/mythtv/libs/libmythtv/mpeg/mpegtables.h
old new 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_SUMMARY = 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, -
mythtv/libs/libmythtv/mpeg/pespacket.cpp
diff -uN trunk/mythtv/libs/libmythtv/mpeg/pespacket.cpp trunk-work/mythtv/libs/libmythtv/mpeg/pespacket.cpp
old new 17 17 18 18 using namespace std; 19 19 20 bool PESPacket::HasCRC(void) const 21 { 22 /* CRC bit is placed differently for the packet of private type */ 23 if ((StreamID()>=0x80) && (StreamID()<=0xFF)) 24 return (_pesdata[1] & 0x80) >> 7; 25 else return (_pesdata[4] & 0x2) >> 1; 26 } 27 20 28 // return true if complete or broken 21 29 bool PESPacket::AddTSPacket(const TSPacket* packet, bool &broken) 22 30 { -
mythtv/libs/libmythtv/mpeg/pespacket.h
diff -uN trunk/mythtv/libs/libmythtv/mpeg/pespacket.h trunk-work/mythtv/libs/libmythtv/mpeg/pespacket.h
old new 183 183 /// 1 bit Additional Copy Info field is present 184 184 bool HasACI() const { return (_pesdata[4] & 0x4) >> 2; } 185 185 /// 1 bit Cyclic Redundancy Check present 186 virtual bool HasCRC() const { return (_pesdata[4] & 0x2) >> 1; }186 virtual bool HasCRC() const; 187 187 /// 1 bit Extension flags are present 188 188 bool HasExtensionFlags() const { return _pesdata[4] & 0x1; } 189 189 -
mythtv/libs/libmythtv/eithelper.cpp
diff -u trunk/mythtv/libs/libmythtv/eithelper.cpp trunk-work/mythtv/libs/libmythtv/eithelper.cpp
old new 20 20 #include "atsctables.h" 21 21 #include "dvbtables.h" 22 22 #include "premieretables.h" 23 #include "csatcaraibeseit.h" 23 24 #include "dishdescriptors.h" 24 25 #include "premieredescriptors.h" 25 26 #include "util.h" … … 91 86 92 87 if (!db_events.size()) 93 88 return 0; 94 89 VERBOSE(VB_EIT,"Process events, remaining "<<db_events.size()); 95 90 MSqlQuery query(MSqlQuery::InitCon()); 96 91 for (uint i = 0; (i < kChunkSize) && (i < db_events.size()); i++) 97 92 { … … 519 514 } 520 515 } 521 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(CSatCaraibesEIT *cit) 521 { 522 QString title = QString::null; 523 QString subtitle = QString::null; 524 QString description = QString::null; 525 QString category = QString::null; 526 vector<uint> eitToDelete; 527 bool toDelete; 528 MythCategoryType category_type = kCategoryNone; 529 unsigned char subtitle_type=0, audio_props=0, video_props=0; 530 uint fix = fixup[ 601LL << 32 | 1 << 16 | 0 ] | EITFixUp::kFixGenericDVB; 531 532 if (!cit->IsReady()) return; 533 for (uint i = 0;i < cit->NbSchedules();i++) 534 { 535 const CSatCaraibesSchedule& schedule = cit->GetSchedule(i); 536 QString title = schedule.title; 537 const vector<CSatCaraibesShowing>& showings = schedule.showings; 538 QMap<uint, QString>::const_iterator sum; 539 540 /* If the summary is not there we go on with the next schedule */ 541 if (schedule.key && !cit->GetSummary(i, sum)) continue; 542 543 toDelete = true; 544 for (vector<CSatCaraibesShowing>::const_iterator it = showings.begin(); 545 it != showings.end();it++) { 546 QDateTime starttime = (*it).Start; 547 // EITFixUp::TimeFix(starttime); 548 QDateTime endtime = starttime.addSecs(schedule.duration); 549 uint chanid; 550 DBEvent *event; 551 const CSatCaraibesChannelInfo * info = 552 cit->GetChannelInfoFromIndex((*it).channel_index); 553 554 if (!info) 555 { 556 VERBOSE(VB_EIT, LOC + 557 QString("CSATCARAIBES EIT for T: %1, Start: %2, Dur: %3 Thm: %4, chanind: %5 summ: %6") 558 .arg(title).arg(starttime.toString()).arg(schedule.duration) 559 .arg(schedule.theme).arg((*it).channel_index).arg((schedule.key ? *sum :"No summary"))); 560 VERBOSE(VB_EIT, LOC_ERR + "CSATCARAIBES: incorrect channel index"); 561 toDelete = false; 562 continue; 563 } 564 565 chanid = GetChanID(info->serviceid, info->orignetworkid, info->tsid); 566 /* VERBOSE(VB_EIT, LOC + 567 QString("CSATCARAIBES EIT for NIT %1, TID %2, SID %3, " 568 "T: %4, Start: %5, Dur: %6 Thm: %7, summ: %8") 569 .arg(info->orignetworkid).arg(info->tsid).arg(info->serviceid) 570 .arg(title).arg(starttime.toString()).arg(schedule.duration) 571 .arg(schedule.theme).arg((schedule.key ? *sum :"No summary")));*/ 572 573 if (!chanid) 574 { 575 /* VERBOSE(VB_EIT, LOC + 576 QString("CSATCARAIBES EIT for NIT %1, TID %2, SID %3, " 577 "title: %4. Channel not found!") 578 .arg(info->orignetworkid).arg(info->tsid).arg(info->serviceid) 579 .arg(title));*/ 580 toDelete = false; 581 continue; 582 } 583 584 event = new DBEvent(chanid, 585 title, QString::null, schedule.key ? *sum : "", 586 category, category_type, 587 starttime, endtime, fix, 588 subtitle_type, 589 audio_props, 590 video_props, 591 "", ""); 592 db_events.enqueue(event); 593 } 594 if (toDelete) 595 eitToDelete.push_back(i); 596 } 597 for (vector<uint>::const_reverse_iterator iter = eitToDelete.rbegin(); 598 iter != eitToDelete.rend(); ++iter) 599 cit->RemoveSchedule(*iter); 600 601 } 522 602 523 603 void EITHelper::PruneEITCache(uint timestamp) 524 604 { … … 862 942 fix[ 1094LL << 32 | 1 << 16 | 17028 ] = // NT1 863 943 fix[ 1100LL << 32 | 1 << 16 | 8710 ] = // NRJ 12 864 944 EITFixUp::kEFixForceISO8859_15; 945 946 // IntelSat 903 DVB-S french channels (CanalSat Caraibes) 947 // The original network id is the same as the previous one 948 // at least transport ids are different 949 // For now all channels are marked as needing fixup 950 fix[ 601LL << 32 | 1 << 16 | 0 ] = 951 fix[ 602LL << 32 | 1 << 16 | 0 ] = 952 fix[ 603LL << 32 | 1 << 16 | 0 ] = 953 fix[ 604LL << 32 | 1 << 16 | 0 ] = 954 EITFixUp::kEFixForceISO8859_15; 865 955 } 866 956 867 957 static int calc_eit_utc_offset(void) -
mythtv/libs/libmythtv/eithelper.h
diff -u trunk/mythtv/libs/libmythtv/eithelper.h trunk-work/mythtv/libs/libmythtv/eithelper.h
old new 53 53 class ExtendedTextTable; 54 54 class DVBEventInformationTable; 55 55 class PremiereContentInformationTable; 56 class CSatCaraibesEIT; 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(CSatCaraibesEIT *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(CSatCaraibesEIT *eit) {} 85 88 #endif // !USING_BACKEND 86 89 87 90 // EIT cache handling -
mythtv/libs/libmythtv/libmythtv.pro
Binary files trunk/mythtv/libs/libmythtv/eithelper.o and trunk-work/mythtv/libs/libmythtv/eithelper.o differ Binary files trunk/mythtv/libs/libmythtv/eit.o and trunk-work/mythtv/libs/libmythtv/eit.o differ diff -u trunk/mythtv/libs/libmythtv/libmythtv.pro trunk-work/mythtv/libs/libmythtv/libmythtv.pro
old new 192 192 HEADERS += mpeg/iso6937tables.h 193 193 HEADERS += mpeg/tsstats.h mpeg/streamlisteners.h 194 194 HEADERS += mpeg/h264utils.h 195 HEADERS += mpeg/csatcaraibestables.h 196 HEADERS += mpeg/csatcaraibeseit.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/csatcaraibestables.cpp 211 SOURCES += mpeg/csatcaraibeseit.cpp 208 212 209 213 DEFINES += USING_H264TOOLS 210 214