Index: libs/libmythtv/eithelper.cpp
===================================================================
--- libs/libmythtv/eithelper.cpp	(Revision 11241)
+++ libs/libmythtv/eithelper.cpp	(Arbeitskopie)
@@ -346,6 +346,151 @@
     }
 }
 
+// This function gets special eit data from the german provider Premiere 
+// for the option channels Premiere Sport and Premiere Direct 
+// Because the passive eit scan looks only on the channel with the lowest
+// channum per transponder, you have to make sure that both portal channels
+// have the lowest channel number
+void EITHelper::AddEIT(const DVBPremiereEventInformationTable *eit)
+{
+    // set fixup for Premiere
+    uint fix = fixup[133 << 16];
+    fix |= EITFixUp::kFixGenericDVB;
+
+    QString title         = QString::null;
+    QString subtitle      = QString::null;
+    QString description   = QString::null;
+    QString category      = QString::null;
+    MythCategoryType category_type = kCategoryNone;
+    bool hdtv = false, stereo = false, subtitled = false;
+    
+    // Parse descriptors
+    desc_list_t list = MPEGDescriptor::Parse(
+        eit->Descriptors(), eit->DescriptorsLength());
+    
+    const unsigned char *bestShortEvent =
+        MPEGDescriptor::FindBestMatch(
+            list, DescriptorID::short_event, languagePreferences);
+
+    unsigned char enc_ch[1] = { 0x05 };
+    const unsigned char *enc =
+        (fix & EITFixUp::kEFixPro7Sat) ? enc_ch : NULL;
+
+    if (bestShortEvent)
+    {
+        ShortEventDescriptor sed(bestShortEvent);
+        if (enc)
+        {
+            title    = sed.EventName(enc, 1);
+            subtitle = sed.Text(enc, 1);
+        }
+        else
+        {
+            title    = sed.EventName();
+            subtitle = sed.Text();
+        }
+    }
+
+    vector<const unsigned char*> bestExtendedEvents =
+        MPEGDescriptor::FindBestMatches(
+            list, DescriptorID::extended_event, languagePreferences);
+
+    description = "";
+    for (uint j = 0; j < bestExtendedEvents.size(); j++)
+    {
+        if (!bestExtendedEvents[j])
+        {
+            description = "";
+            break;
+        }
+
+        ExtendedEventDescriptor eed(bestExtendedEvents[j]);
+        if (enc)
+            description += eed.Text(enc, 1);
+        else
+            description += eed.Text();
+    }
+
+    desc_list_t components =
+        MPEGDescriptor::FindAll(list, DescriptorID::component);
+    for (uint j = 0; j < components.size(); j++)
+    {
+        ComponentDescriptor component(components[j]);
+        hdtv      |= component.IsHDTV();
+        stereo    |= component.IsStereo();
+        subtitled |= component.IsReallySubtitled();
+    }
+
+    const unsigned char *content_data =
+        MPEGDescriptor::Find(list, DescriptorID::content);
+    if (content_data)
+    {
+        ContentDescriptor content(content_data);
+        // fix events without real content data
+        if (content.Nibble(0)==0x00){ 
+            if(content.UserNibble(0)==0x1) 
+            {
+                category_type = kCategoryMovie;
+            }
+            else if(content.UserNibble(0)==0x0) 
+            {
+                category_type = kCategorySports;
+                category = QObject::tr("Sports");
+            }
+        }
+        else 
+        {   
+          category_type = content.GetMythCategory(0);
+          category      = content.GetDescription(0);
+        }
+    }
+
+    // Find Transmissions
+    desc_list_t transmissions =
+        MPEGDescriptor::FindAll(list, DescriptorID::pr_event_transmission);
+    for(uint j=0; j< transmissions.size(); j++)
+    {
+        PremiereTransmissionDescriptor transmission(transmissions[j]);
+        uint networkid = transmission.OriginalNetworkID();
+        uint tsid      = transmission.TSID();
+        uint serviceid = transmission.ServiceID();
+        
+        // Fix wrong channel information 
+        if     (tsid==0x03 && serviceid==0xf0) { tsid=0x02; serviceid=0xe0; } 
+        else if(tsid==0x03 && serviceid==0xf1) { tsid=0x02; serviceid=0xe1; } 
+        else if(tsid==0x03 && serviceid==0xf5) { tsid=0x03; serviceid=0xdc; } 
+        else if(tsid==0x04 && serviceid==0xd2) { tsid=0x11; serviceid=0xe2; } 
+        else if(tsid==0x11 && serviceid==0xd3) { tsid=0x11; serviceid=0xe3; } 
+        
+        uint chanid = GetChanID(serviceid, networkid, tsid);
+
+        if (!chanid)
+        {
+            VERBOSE(VB_GENERAL, LOC + QString("NIT %1 TID %2 SID %3 COUNT %4 NOT FOUND").arg(networkid).arg(tsid).arg(serviceid).arg(transmission.TransmissionCount()));
+            continue;
+        }
+
+        unsigned char startdate[5];
+        memcpy(startdate, transmission.StartDate(), 2);
+        for (uint k=0; k<transmission.TransmissionCount(); k+=3)
+        {
+            memcpy(&startdate[2], transmission.StartTime(k), 3);
+            QDateTime starttime = MythUTCToLocal(dvbdate2qt(startdate));
+            EITFixUp::TimeFix(starttime);
+            QDateTime endtime   = starttime.addSecs(eit->DurationInSeconds());
+
+            DBEvent *event = new DBEvent(chanid,
+                                         title,     subtitle,      description,
+                                         category,  category_type,
+                                         starttime, endtime,       fix,
+                                         false,     subtitled,
+                                         stereo,    hdtv);
+            db_events.enqueue(event);
+            
+        }
+    }
+}
+
 void EITHelper::PruneCache(uint timestamp)
 {
     eitcache->PruneOldEntries(timestamp);
Index: libs/libmythtv/eithelper.h
===================================================================
--- libs/libmythtv/eithelper.h	(Revision 11241)
+++ libs/libmythtv/eithelper.h	(Arbeitskopie)
@@ -47,6 +47,7 @@
 class EventInformationTable;
 class ExtendedTextTable;
 class DVBEventInformationTable;
+class DVBPremiereEventInformationTable;
 
 class EITHelper
 {
@@ -70,10 +71,12 @@
     void AddETT(uint atsc_major, uint atsc_minor,
                 const ExtendedTextTable     *ett);
     void AddEIT(const DVBEventInformationTable *eit);
+    void AddEIT(const DVBPremiereEventInformationTable *eit);
 #else // if !USING_BACKEND
     void AddEIT(uint, uint, const EventInformationTable*) {}
     void AddETT(uint, uint, const ExtendedTextTable*) {}
     void AddEIT(const DVBEventInformationTable*) {}
+    void AddEIT(const DVBPremiereEventInformationTable*) {}
 #endif // !USING_BACKEND
 
     void PruneCache(uint timestamp);
Index: libs/libmythtv/mpeg/dvbtables.cpp
===================================================================
--- libs/libmythtv/mpeg/dvbtables.cpp	(Revision 11241)
+++ libs/libmythtv/mpeg/dvbtables.cpp	(Arbeitskopie)
@@ -186,6 +186,16 @@
     return secsSince1970;
 }
 
+bool DVBPremiereEventInformationTable::IsEIT(uint table_id)
+{
+    bool is_eit = false;
+
+    // Premiere Event Information for option channels
+    is_eit |= TableID::PR_EIT == table_id;
+
+    return is_eit;
+}
+
 /** \fn dvbdate2qt(const unsigned char*)
  *  \return UTC time
  */
Index: libs/libmythtv/mpeg/dvbstreamdata.cpp
===================================================================
--- libs/libmythtv/mpeg/dvbstreamdata.cpp	(Revision 11241)
+++ libs/libmythtv/mpeg/dvbstreamdata.cpp	(Arbeitskopie)
@@ -137,6 +137,10 @@
         is_eit |= (TableID::DN_EITbego <= table_id &&
                    TableID::DN_EITendo >= table_id);
     }
+    if (DVB_PR_SPORT_EIT_PID == pid || DVB_PR_DIRECT_EIT_PID == pid)
+    {
+        is_eit |= TableID::PR_EIT == table_id;
+    }
     if (is_eit)
     {
         uint service_id = psip.TableIDExtension();
@@ -292,6 +296,27 @@
         return true;
     }
 
+    if ((DVB_PR_SPORT_EIT_PID || DVB_PR_DIRECT_EIT_PID) &&
+        DVBPremiereEventInformationTable::IsEIT(psip.TableID()))
+    {
+        QMutexLocker locker(&_listener_lock);
+        if (!_dvb_eit_listeners.size() && !_eit_helper)
+            return true;
+
+        uint service_id = psip.TableIDExtension();
+        SetVersionEIT(psip.TableID(), service_id, psip.Version());
+        SetEITSectionSeen(psip.TableID(), service_id, psip.Section());
+
+        DVBPremiereEventInformationTable eit(psip);
+        for (uint i = 0; i < _dvb_eit_listeners.size(); i++)
+            _dvb_eit_listeners[i]->HandleEIT(&eit);
+
+        if (_eit_helper)
+            _eit_helper->AddEIT(&eit);
+
+        return true;
+    }
+
     return false;
 }
 
@@ -337,6 +362,16 @@
         {
             add_pids.push_back(DVB_DNLONG_EIT_PID);
         }
+        if (find(cur_pids.begin(), cur_pids.end(),
+                 (uint) DVB_PR_SPORT_EIT_PID) == cur_pids.end())
+        {
+            add_pids.push_back(DVB_PR_SPORT_EIT_PID);
+        }
+        if (find(cur_pids.begin(), cur_pids.end(),
+                 (uint) DVB_PR_DIRECT_EIT_PID) == cur_pids.end())
+        {
+            add_pids.push_back(DVB_PR_DIRECT_EIT_PID);
+        }
     }
     else
     {
@@ -352,6 +387,16 @@
         {
             del_pids.push_back(DVB_DNLONG_EIT_PID);
         }
+        if (find(cur_pids.begin(), cur_pids.end(),
+                 (uint) DVB_PR_SPORT_EIT_PID) != cur_pids.end())
+        {
+            del_pids.push_back(DVB_PR_SPORT_EIT_PID);
+        }
+        if (find(cur_pids.begin(), cur_pids.end(),
+                 (uint) DVB_PR_DIRECT_EIT_PID) != cur_pids.end())
+        {
+            del_pids.push_back(DVB_PR_DIRECT_EIT_PID);
+        }
     }
 
     return add_pids.size() || del_pids.size();
Index: libs/libmythtv/mpeg/mpegtables.h
===================================================================
--- libs/libmythtv/mpeg/mpegtables.h	(Revision 11241)
+++ libs/libmythtv/mpeg/mpegtables.h	(Arbeitskopie)
@@ -186,6 +186,10 @@
     // Dishnet longterm EIT is on pid 0x300
     DVB_DNLONG_EIT_PID = 0x0300,
 
+    // Premiere EIT for Direct/Sport PPV
+    DVB_PR_DIRECT_EIT_PID = 0x0b11,
+    DVB_PR_SPORT_EIT_PID = 0x0b12,
+
     ATSC_PSIP_PID = 0x1ffb,
 };
 
@@ -231,6 +235,9 @@
         // Dishnet Longterm EIT data
         DN_EITbego = 0x80, // always on pid 0x300
         DN_EITendo = 0xfe, // always on pid 0x300
+        
+        // Premiere Eit for Direct and Sport
+        PR_EIT     = 0xA0,
 
         // ATSC
         STUFFING = 0x80,
Index: libs/libmythtv/mpeg/streamlisteners.h
===================================================================
--- libs/libmythtv/mpeg/streamlisteners.h	(Revision 11241)
+++ libs/libmythtv/mpeg/streamlisteners.h	(Arbeitskopie)
@@ -32,6 +32,7 @@
 class NetworkInformationTable;
 class ServiceDescriptionTable;
 class DVBEventInformationTable;
+class DVBPremiereEventInformationTable;
 
 class MPEGStreamListener
 {
@@ -108,6 +109,7 @@
     virtual ~DVBEITStreamListener() {}
   public:
     virtual void HandleEIT(const DVBEventInformationTable*) = 0;
+    virtual void HandleEIT(const DVBPremiereEventInformationTable*) = 0;
 };
 
 
Index: libs/libmythtv/mpeg/dvbdescriptors.h
===================================================================
--- libs/libmythtv/mpeg/dvbdescriptors.h	(Revision 11241)
+++ libs/libmythtv/mpeg/dvbdescriptors.h	(Arbeitskopie)
@@ -1651,4 +1651,43 @@
     QString toString() const { return QString("UKChannelListDescriptor(stub)"); }
 };
 
+class PremiereTransmissionDescriptor : public MPEGDescriptor
+{
+  public:
+    PremiereTransmissionDescriptor(const unsigned char* data) : MPEGDescriptor(data)
+    {
+//        assert(DescriptorID::transmission == DescriptorTag());
+    }
+
+    // event_id                 8   0.0
+    uint EventID() const
+        { return (_data[0]); }
+    // transmission_length      8   1.0
+    uint TransmissionLength() const
+        { return (_data[1]); }
+    // transport id            16   2.0
+    uint TSID() const
+        { return (_data[2] << 8) | _data[3]; }
+    // network id              16   4.0
+    uint OriginalNetworkID() const
+        { return (_data[4] << 8) | _data[5]; }
+    // service id              16   6.0
+    uint ServiceID() const
+        { return (_data[6] << 8) | _data[7]; }
+
+    // start date              16   8.0
+    const unsigned char* StartDate() const
+        { return &_data[8]; }  
+    // transmission count       8  10.0
+    uint TransmissionCount() const
+        { return (_data[10]); }
+    // for(i=0;i<N;i++) 
+    //   start_time            24  11.0+x
+    const unsigned char* StartTime(uint j) const
+        { return &_data[11 + j];  }
+      
+    QString toString() const { return QString("TransmissionDescriptor(stub)"); }
+};
+
+
 #endif
Index: libs/libmythtv/mpeg/dvbtables.h
===================================================================
--- libs/libmythtv/mpeg/dvbtables.h	(Revision 11241)
+++ libs/libmythtv/mpeg/dvbtables.h	(Arbeitskopie)
@@ -286,5 +286,47 @@
     mutable vector<const unsigned char*> _ptrs; // used to parse
 };
 
+class DVBPremiereEventInformationTable : public PSIPTable
+{
+  public:
+    DVBPremiereEventInformationTable(const PSIPTable& table) : PSIPTable(table)
+    {
+    // table_id                 8   0.0       0xA0
+        assert(IsEIT(TableID()));
+    // section_syntax_indicator 1   1.0          1
+    // private_indicator        1   1.1          1
+    // reserved                 2   1.2          3
+    // section_length          12   1.4
+    // reserved                 2   5.0          3
+    // version_number           5   5.2
+    // current_next_indicator   1   5.7          1
+    // section_number           8   6.0
+    // last_section_number      8   7.0
+    }
 
+    // content_id              32   0.0
+    uint ContentID(void) const
+        { return (psipdata()[0]<<24) | (psipdata()[1]<<16) | (psipdata()[2]<<8) | psipdata()[3]; }
+
+    // event_duration          24   4.0
+    uint DurationInSeconds() const 
+        { return ((byteBCD2int(psipdata()[4]) * 3600) +
+                  (byteBCD2int(psipdata()[5]) * 60) +
+                  (byteBCD2int(psipdata()[6]))); }
+    // descriptor length        8   8.0
+    uint DescriptorsLength() const
+        { return ((psipdata()[7] & 0x0F) << 8) | psipdata()[8]; }
+
+    uint EventCount(void) const
+        { return 1; }
+    
+    // descriptor length        x   9.0
+    const unsigned char* Descriptors() const
+        { return &psipdata()[9]; }
+
+    static bool IsEIT(uint table_id);
+    
+  private:
+    mutable vector<const unsigned char*> _ptrs; // used to parse
+};
 #endif // _DVB_TABLES_H_
Index: libs/libmythtv/mpeg/mpegdescriptors.h
===================================================================
--- libs/libmythtv/mpeg/mpegdescriptors.h	(Revision 11241)
+++ libs/libmythtv/mpeg/mpegdescriptors.h	(Arbeitskopie)
@@ -129,6 +129,9 @@
         DCC_arriving_request        = 0xA9,
         DRM_control                 = 0xAA,
         atsc_content_identifier     = 0xB6,
+
+        // PREMIERE
+        pr_event_transmission       = 0xF2,
     };
 };
 

