Ticket #2418: eitsupport-premiere.diff
File eitsupport-premiere.diff, 14.6 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/eithelper.cpp
346 346 } 347 347 } 348 348 349 // This function gets special eit data from the german provider Premiere 350 // for the option channels Premiere Sport and Premiere Direct 351 // Because the passive eit scan looks only on the channel with the lowest 352 // channum per transponder, you have to make sure that both portal channels 353 // have the lowest channel number 354 void EITHelper::AddEIT(const DVBPremiereEventInformationTable *eit) 355 { 356 // set fixup for Premiere 357 uint fix = fixup[133 << 16]; 358 fix |= EITFixUp::kFixGenericDVB; 359 360 QString title = QString::null; 361 QString subtitle = QString::null; 362 QString description = QString::null; 363 QString category = QString::null; 364 MythCategoryType category_type = kCategoryNone; 365 bool hdtv = false, stereo = false, subtitled = false; 366 367 // Parse descriptors 368 desc_list_t list = MPEGDescriptor::Parse( 369 eit->Descriptors(), eit->DescriptorsLength()); 370 371 const unsigned char *bestShortEvent = 372 MPEGDescriptor::FindBestMatch( 373 list, DescriptorID::short_event, languagePreferences); 374 375 unsigned char enc_ch[1] = { 0x05 }; 376 const unsigned char *enc = 377 (fix & EITFixUp::kEFixPro7Sat) ? enc_ch : NULL; 378 379 if (bestShortEvent) 380 { 381 ShortEventDescriptor sed(bestShortEvent); 382 if (enc) 383 { 384 title = sed.EventName(enc, 1); 385 subtitle = sed.Text(enc, 1); 386 } 387 else 388 { 389 title = sed.EventName(); 390 subtitle = sed.Text(); 391 } 392 } 393 394 vector<const unsigned char*> bestExtendedEvents = 395 MPEGDescriptor::FindBestMatches( 396 list, DescriptorID::extended_event, languagePreferences); 397 398 description = ""; 399 for (uint j = 0; j < bestExtendedEvents.size(); j++) 400 { 401 if (!bestExtendedEvents[j]) 402 { 403 description = ""; 404 break; 405 } 406 407 ExtendedEventDescriptor eed(bestExtendedEvents[j]); 408 if (enc) 409 description += eed.Text(enc, 1); 410 else 411 description += eed.Text(); 412 } 413 414 desc_list_t components = 415 MPEGDescriptor::FindAll(list, DescriptorID::component); 416 for (uint j = 0; j < components.size(); j++) 417 { 418 ComponentDescriptor component(components[j]); 419 hdtv |= component.IsHDTV(); 420 stereo |= component.IsStereo(); 421 subtitled |= component.IsReallySubtitled(); 422 } 423 424 const unsigned char *content_data = 425 MPEGDescriptor::Find(list, DescriptorID::content); 426 if (content_data) 427 { 428 ContentDescriptor content(content_data); 429 // fix events without real content data 430 if (content.Nibble(0)==0x00){ 431 if(content.UserNibble(0)==0x1) 432 { 433 category_type = kCategoryMovie; 434 } 435 else if(content.UserNibble(0)==0x0) 436 { 437 category_type = kCategorySports; 438 category = QObject::tr("Sports"); 439 } 440 } 441 else 442 { 443 category_type = content.GetMythCategory(0); 444 category = content.GetDescription(0); 445 } 446 } 447 448 // Find Transmissions 449 desc_list_t transmissions = 450 MPEGDescriptor::FindAll(list, DescriptorID::pr_event_transmission); 451 for(uint j=0; j< transmissions.size(); j++) 452 { 453 PremiereTransmissionDescriptor transmission(transmissions[j]); 454 uint networkid = transmission.OriginalNetworkID(); 455 uint tsid = transmission.TSID(); 456 uint serviceid = transmission.ServiceID(); 457 458 // Fix wrong channel information 459 if (tsid==0x03 && serviceid==0xf0) { tsid=0x02; serviceid=0xe0; } 460 else if(tsid==0x03 && serviceid==0xf1) { tsid=0x02; serviceid=0xe1; } 461 else if(tsid==0x03 && serviceid==0xf5) { tsid=0x03; serviceid=0xdc; } 462 else if(tsid==0x04 && serviceid==0xd2) { tsid=0x11; serviceid=0xe2; } 463 else if(tsid==0x11 && serviceid==0xd3) { tsid=0x11; serviceid=0xe3; } 464 465 uint chanid = GetChanID(serviceid, networkid, tsid); 466 467 if (!chanid) 468 { 469 VERBOSE(VB_GENERAL, LOC + QString("NIT %1 TID %2 SID %3 COUNT %4 NOT FOUND").arg(networkid).arg(tsid).arg(serviceid).arg(transmission.TransmissionCount())); 470 continue; 471 } 472 473 unsigned char startdate[5]; 474 memcpy(startdate, transmission.StartDate(), 2); 475 for (uint k=0; k<transmission.TransmissionCount(); k+=3) 476 { 477 memcpy(&startdate[2], transmission.StartTime(k), 3); 478 QDateTime starttime = MythUTCToLocal(dvbdate2qt(startdate)); 479 EITFixUp::TimeFix(starttime); 480 QDateTime endtime = starttime.addSecs(eit->DurationInSeconds()); 481 482 DBEvent *event = new DBEvent(chanid, 483 title, subtitle, description, 484 category, category_type, 485 starttime, endtime, fix, 486 false, subtitled, 487 stereo, hdtv); 488 db_events.enqueue(event); 489 490 } 491 } 492 } 493 349 494 void EITHelper::PruneCache(uint timestamp) 350 495 { 351 496 eitcache->PruneOldEntries(timestamp); -
libs/libmythtv/eithelper.h
47 47 class EventInformationTable; 48 48 class ExtendedTextTable; 49 49 class DVBEventInformationTable; 50 class DVBPremiereEventInformationTable; 50 51 51 52 class EITHelper 52 53 { … … 70 71 void AddETT(uint atsc_major, uint atsc_minor, 71 72 const ExtendedTextTable *ett); 72 73 void AddEIT(const DVBEventInformationTable *eit); 74 void AddEIT(const DVBPremiereEventInformationTable *eit); 73 75 #else // if !USING_BACKEND 74 76 void AddEIT(uint, uint, const EventInformationTable*) {} 75 77 void AddETT(uint, uint, const ExtendedTextTable*) {} 76 78 void AddEIT(const DVBEventInformationTable*) {} 79 void AddEIT(const DVBPremiereEventInformationTable*) {} 77 80 #endif // !USING_BACKEND 78 81 79 82 void PruneCache(uint timestamp); -
libs/libmythtv/mpeg/dvbtables.cpp
186 186 return secsSince1970; 187 187 } 188 188 189 bool DVBPremiereEventInformationTable::IsEIT(uint table_id) 190 { 191 bool is_eit = false; 192 193 // Premiere Event Information for option channels 194 is_eit |= TableID::PR_EIT == table_id; 195 196 return is_eit; 197 } 198 189 199 /** \fn dvbdate2qt(const unsigned char*) 190 200 * \return UTC time 191 201 */ -
libs/libmythtv/mpeg/dvbstreamdata.cpp
137 137 is_eit |= (TableID::DN_EITbego <= table_id && 138 138 TableID::DN_EITendo >= table_id); 139 139 } 140 if (DVB_PR_SPORT_EIT_PID == pid || DVB_PR_DIRECT_EIT_PID == pid) 141 { 142 is_eit |= TableID::PR_EIT == table_id; 143 } 140 144 if (is_eit) 141 145 { 142 146 uint service_id = psip.TableIDExtension(); … … 292 296 return true; 293 297 } 294 298 299 if ((DVB_PR_SPORT_EIT_PID || DVB_PR_DIRECT_EIT_PID) && 300 DVBPremiereEventInformationTable::IsEIT(psip.TableID())) 301 { 302 QMutexLocker locker(&_listener_lock); 303 if (!_dvb_eit_listeners.size() && !_eit_helper) 304 return true; 305 306 uint service_id = psip.TableIDExtension(); 307 SetVersionEIT(psip.TableID(), service_id, psip.Version()); 308 SetEITSectionSeen(psip.TableID(), service_id, psip.Section()); 309 310 DVBPremiereEventInformationTable eit(psip); 311 for (uint i = 0; i < _dvb_eit_listeners.size(); i++) 312 _dvb_eit_listeners[i]->HandleEIT(&eit); 313 314 if (_eit_helper) 315 _eit_helper->AddEIT(&eit); 316 317 return true; 318 } 319 295 320 return false; 296 321 } 297 322 … … 337 362 { 338 363 add_pids.push_back(DVB_DNLONG_EIT_PID); 339 364 } 365 if (find(cur_pids.begin(), cur_pids.end(), 366 (uint) DVB_PR_SPORT_EIT_PID) == cur_pids.end()) 367 { 368 add_pids.push_back(DVB_PR_SPORT_EIT_PID); 369 } 370 if (find(cur_pids.begin(), cur_pids.end(), 371 (uint) DVB_PR_DIRECT_EIT_PID) == cur_pids.end()) 372 { 373 add_pids.push_back(DVB_PR_DIRECT_EIT_PID); 374 } 340 375 } 341 376 else 342 377 { … … 352 387 { 353 388 del_pids.push_back(DVB_DNLONG_EIT_PID); 354 389 } 390 if (find(cur_pids.begin(), cur_pids.end(), 391 (uint) DVB_PR_SPORT_EIT_PID) != cur_pids.end()) 392 { 393 del_pids.push_back(DVB_PR_SPORT_EIT_PID); 394 } 395 if (find(cur_pids.begin(), cur_pids.end(), 396 (uint) DVB_PR_DIRECT_EIT_PID) != cur_pids.end()) 397 { 398 del_pids.push_back(DVB_PR_DIRECT_EIT_PID); 399 } 355 400 } 356 401 357 402 return add_pids.size() || del_pids.size(); -
libs/libmythtv/mpeg/mpegtables.h
186 186 // Dishnet longterm EIT is on pid 0x300 187 187 DVB_DNLONG_EIT_PID = 0x0300, 188 188 189 // Premiere EIT for Direct/Sport PPV 190 DVB_PR_DIRECT_EIT_PID = 0x0b11, 191 DVB_PR_SPORT_EIT_PID = 0x0b12, 192 189 193 ATSC_PSIP_PID = 0x1ffb, 190 194 }; 191 195 … … 231 235 // Dishnet Longterm EIT data 232 236 DN_EITbego = 0x80, // always on pid 0x300 233 237 DN_EITendo = 0xfe, // always on pid 0x300 238 239 // Premiere Eit for Direct and Sport 240 PR_EIT = 0xA0, 234 241 235 242 // ATSC 236 243 STUFFING = 0x80, -
libs/libmythtv/mpeg/streamlisteners.h
32 32 class NetworkInformationTable; 33 33 class ServiceDescriptionTable; 34 34 class DVBEventInformationTable; 35 class DVBPremiereEventInformationTable; 35 36 36 37 class MPEGStreamListener 37 38 { … … 108 109 virtual ~DVBEITStreamListener() {} 109 110 public: 110 111 virtual void HandleEIT(const DVBEventInformationTable*) = 0; 112 virtual void HandleEIT(const DVBPremiereEventInformationTable*) = 0; 111 113 }; 112 114 113 115 -
libs/libmythtv/mpeg/dvbdescriptors.h
1651 1651 QString toString() const { return QString("UKChannelListDescriptor(stub)"); } 1652 1652 }; 1653 1653 1654 class PremiereTransmissionDescriptor : public MPEGDescriptor 1655 { 1656 public: 1657 PremiereTransmissionDescriptor(const unsigned char* data) : MPEGDescriptor(data) 1658 { 1659 // assert(DescriptorID::transmission == DescriptorTag()); 1660 } 1661 1662 // event_id 8 0.0 1663 uint EventID() const 1664 { return (_data[0]); } 1665 // transmission_length 8 1.0 1666 uint TransmissionLength() const 1667 { return (_data[1]); } 1668 // transport id 16 2.0 1669 uint TSID() const 1670 { return (_data[2] << 8) | _data[3]; } 1671 // network id 16 4.0 1672 uint OriginalNetworkID() const 1673 { return (_data[4] << 8) | _data[5]; } 1674 // service id 16 6.0 1675 uint ServiceID() const 1676 { return (_data[6] << 8) | _data[7]; } 1677 1678 // start date 16 8.0 1679 const unsigned char* StartDate() const 1680 { return &_data[8]; } 1681 // transmission count 8 10.0 1682 uint TransmissionCount() const 1683 { return (_data[10]); } 1684 // for(i=0;i<N;i++) 1685 // start_time 24 11.0+x 1686 const unsigned char* StartTime(uint j) const 1687 { return &_data[11 + j]; } 1688 1689 QString toString() const { return QString("TransmissionDescriptor(stub)"); } 1690 }; 1691 1692 1654 1693 #endif -
libs/libmythtv/mpeg/dvbtables.h
286 286 mutable vector<const unsigned char*> _ptrs; // used to parse 287 287 }; 288 288 289 class DVBPremiereEventInformationTable : public PSIPTable 290 { 291 public: 292 DVBPremiereEventInformationTable(const PSIPTable& table) : PSIPTable(table) 293 { 294 // table_id 8 0.0 0xA0 295 assert(IsEIT(TableID())); 296 // section_syntax_indicator 1 1.0 1 297 // private_indicator 1 1.1 1 298 // reserved 2 1.2 3 299 // section_length 12 1.4 300 // reserved 2 5.0 3 301 // version_number 5 5.2 302 // current_next_indicator 1 5.7 1 303 // section_number 8 6.0 304 // last_section_number 8 7.0 305 } 289 306 307 // content_id 32 0.0 308 uint ContentID(void) const 309 { return (psipdata()[0]<<24) | (psipdata()[1]<<16) | (psipdata()[2]<<8) | psipdata()[3]; } 310 311 // event_duration 24 4.0 312 uint DurationInSeconds() const 313 { return ((byteBCD2int(psipdata()[4]) * 3600) + 314 (byteBCD2int(psipdata()[5]) * 60) + 315 (byteBCD2int(psipdata()[6]))); } 316 // descriptor length 8 8.0 317 uint DescriptorsLength() const 318 { return ((psipdata()[7] & 0x0F) << 8) | psipdata()[8]; } 319 320 uint EventCount(void) const 321 { return 1; } 322 323 // descriptor length x 9.0 324 const unsigned char* Descriptors() const 325 { return &psipdata()[9]; } 326 327 static bool IsEIT(uint table_id); 328 329 private: 330 mutable vector<const unsigned char*> _ptrs; // used to parse 331 }; 290 332 #endif // _DVB_TABLES_H_ -
libs/libmythtv/mpeg/mpegdescriptors.h
129 129 DCC_arriving_request = 0xA9, 130 130 DRM_control = 0xAA, 131 131 atsc_content_identifier = 0xB6, 132 133 // PREMIERE 134 pr_event_transmission = 0xF2, 132 135 }; 133 136 }; 134 137