summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitar Petrovski <dimeptr@gmail.com>2011-10-29 12:54:47 +0200
committerDimitar Petrovski <dimeptr@gmail.com>2011-10-29 12:54:47 +0200
commite593a990f708d73ca5c1ad7636e39662722bcf05 (patch)
tree411500a6c33d56932b5478d875d63e27a63b9fb2
parent726d99a3ed5c12242e0e3c6416b3175c18dbedfd (diff)
parentb4da1b8b6dfec941cb97cc14c7fc14040a7695ff (diff)
downloadvdr-plugin-eepg-e593a990f708d73ca5c1ad7636e39662722bcf05.tar.gz
vdr-plugin-eepg-e593a990f708d73ca5c1ad7636e39662722bcf05.tar.bz2
Merge branch 'test-naepg2' into eit_test
use Tid to resolve conflicts with VDR
-rw-r--r--dish.c42
-rw-r--r--dish.h21
-rw-r--r--eepg.c58
-rw-r--r--eepg.h5
4 files changed, 77 insertions, 49 deletions
diff --git a/dish.c b/dish.c
index 021ac72..662e170 100644
--- a/dish.c
+++ b/dish.c
@@ -12,7 +12,7 @@
#include "dish.h"
#include <libsi/si.h>
-#include <libsi/descriptor.h>
+//#include <libsi/descriptor.h>
#include <string.h>
#include <string>
#include <stdlib.h>
@@ -22,23 +22,24 @@ namespace SI
{
// returns the value of a sequence of bits in the byte array
- static unsigned int getBits(int bitIndex, int bitCount, const unsigned char *byteptr, int length)
- {
- union {
- unsigned char b[4];
- unsigned long val;
- } chunk;
-
- int offset = bitIndex >> 3;
- int bitnum = bitIndex - (offset << 3);
- int rightend = 32 - bitnum - bitCount;
-
- chunk.b[3] = byteptr[offset];
- chunk.b[2] = (offset+1 < length) ? byteptr[offset+1] : 0;
- chunk.b[1] = (offset+2 < length) ? byteptr[offset+2] : 0;
- chunk.b[0] = 0; // Never need to look this far ahead.
-
- return (unsigned int)(((chunk.val & (0xFFFFFFFF >> bitnum)) >> rightend));
+ static unsigned int getBits(int bitIndex, int bitCount, const unsigned char *byteptr,
+ int length) {
+ union
+ {
+ unsigned char b[4];
+ unsigned long val;
+ } chunk;
+
+ int offset = bitIndex >> 3;
+ int bitnum = bitIndex - (offset << 3);
+ int rightend = 32 - bitnum - bitCount;
+
+ chunk.b[3] = byteptr[offset];
+ chunk.b[2] = (offset + 1 < length) ? byteptr[offset + 1] : 0;
+ chunk.b[1] = (offset + 2 < length) ? byteptr[offset + 2] : 0;
+ chunk.b[0] = 0; // Never need to look this far ahead.
+
+ return (unsigned int) ((((((chunk.val & (0xFFFFFFFF >> bitnum)) >> rightend)))));
}
DishDescriptor::DishDescriptor()
@@ -108,7 +109,7 @@ namespace SI
const char *DishDescriptor::getCategory()
{
- using namespace DISH_CATEGORIES;
+ using namespace DISH_CATEGORIES;
switch (DishCategory) {
case Action: return "Action";
@@ -478,7 +479,6 @@ namespace SI
return decompressed;
}
-
struct DishDescriptor::HuffmanTable DishDescriptor::Table128[SIZE_TABLE_128] = {
{ 0x0000, 0x20, 0x03 }, { 0x0100, 0x65, 0x04 }, { 0x0180, 0x74, 0x04 },
{ 0x0200, 0x61, 0x04 }, { 0x0280, 0x6F, 0x04 }, { 0x0300, 0x73, 0x04 },
@@ -613,4 +613,4 @@ struct DishDescriptor::HuffmanTable DishDescriptor::Table255[SIZE_TABLE_255] = {
{ 0x1FFD, 0x02, 0x0D }, { 0x1FFE, 0x01, 0x0D }, { 0x1FFF, 0x00, 0x0D }
};
-} //end of namespace
+} //end of namespace
diff --git a/dish.h b/dish.h
index 07f0547..369a4fd 100644
--- a/dish.h
+++ b/dish.h
@@ -243,12 +243,12 @@ namespace SI
#define SIZE_TABLE_128 128
#define SIZE_TABLE_255 255
-class UnimplementedDescriptor;
+using namespace std;
class DishDescriptor {
public:
DishDescriptor();
- virtual ~DishDescriptor();
+ virtual ~DishDescriptor();
const char* getName(void) const { return name; }
const char* getShortText(void);
const char *getDescription(void);
@@ -285,15 +285,14 @@ protected:
char* seriesId;
char* programId;
-
- struct HuffmanTable {
- unsigned int startingAddress;
- unsigned char character;
- unsigned char numberOfBits;
- };
- static HuffmanTable Table128[SIZE_TABLE_128];
- static HuffmanTable Table255[SIZE_TABLE_255];
-
+ struct HuffmanTable
+ {
+ unsigned int startingAddress;
+ unsigned char character;
+ unsigned char numberOfBits;
+ };
+ static HuffmanTable Table128[SIZE_TABLE_128];
+ static HuffmanTable Table255[SIZE_TABLE_255];
};
} /* namespace SI */
diff --git a/eepg.c b/eepg.c
index 6ee1c62..15e1329 100644
--- a/eepg.c
+++ b/eepg.c
@@ -10,6 +10,7 @@
* -Freesat patch written by dom /at/ suborbital.org.uk
*
*
+ * This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
@@ -109,6 +110,7 @@ public:
int RatingInfo;
int FixEpg;
int DisplayMessage;
+ int ProcessEIT;
#ifdef DEBUG
int LogLevel;
#endif
@@ -126,6 +128,7 @@ cSetupEEPG::cSetupEEPG (void)
RatingInfo = 1;
FixEpg = 0;
DisplayMessage = 1;
+ ProcessEIT = 0;
#ifdef DEBUG
LogLevel = 0;
#endif
@@ -162,6 +165,7 @@ cMenuSetupPremiereEpg::cMenuSetupPremiereEpg (void)
Add (new cMenuEditBoolItem (tr ("Display summary message"), &data.DisplayMessage));
#ifdef DEBUG
Add (new cMenuEditIntItem (tr ("Level of logging verbosity"), &data.LogLevel, 0, 5));
+ Add (new cMenuEditBoolItem (tr ("Process EIT info with EEPG"), &data.ProcessEIT));
#endif
}
@@ -175,6 +179,7 @@ void cMenuSetupPremiereEpg::Store (void)
SetupStore ("DisplayMessage", SetupPE.DisplayMessage);
#ifdef DEBUG
SetupStore ("LogLevel", SetupPE.LogLevel);
+ SetupStore ("ProcessEIT", SetupPE.ProcessEIT);
#endif
}
@@ -344,6 +349,7 @@ public:
cFilterEEPG (void);
virtual void SetStatus (bool On);
void Trigger (void);
+ static const int EIT_PID = 0x12;
};
cFilterEEPG::cFilterEEPG (void)
@@ -2149,6 +2155,7 @@ int cFilterEEPG::GetTitlesMHW2 (const u_char * Data, int Length)
CleanString (T->Text);
Pos += Len + 8; // Sub Theme starts here
T->ThemeId = ((Data[7] & 0x3f) << 6) | (Data[Pos] & 0x3f);
+ T->TableId = DEFAULT_TABLE_ID; //TODO locate the actual table id
T->EventId = (Data[Pos + 1] << 8) | Data[Pos + 2];
T->SummaryAvailable = (T->EventId != 0xFFFF);
LogI(3, prep("EventId %04x Titlenr %d:SummAv:%x,Name:%s."), T->EventId,
@@ -2474,6 +2481,7 @@ int cFilterEEPG::GetTitlesSKYBOX (const u_char * Data, int Length)
T->StartTime = ((MjdTime - 40587) * 86400) + ((Data[p + 2] << 9) | (Data[p + 3] << 1));
T->Duration = ((Data[p + 4] << 9) | (Data[p + 5] << 1));
T->ThemeId = Data[p + 6];
+ T->TableId = DEFAULT_TABLE_ID; //TODO locate the actual table id
//TODO Data[p + 7] is Quality value add it to description
//int quality = Data[p + 7];
switch (Data[p + 8] & 0x0F) {
@@ -2825,14 +2833,14 @@ extern bool SystemCharacterTableIsSingleByte;*/
class cEIT2:public SI::EIT
{
public:
- cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, bool OnlyRunningStatus = false);
+ cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, bool isEITPid = false, bool OnlyRunningStatus = false);
};
-cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, bool OnlyRunningStatus)
+cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, bool isEITPid, bool OnlyRunningStatus)
: SI::EIT (Data, false)
{
//LogD(2, prep("cEIT2::cEIT2"));
- if (Tid > 0 && Format == DISH_BEV) Tid--;
+ if (Tid > 0 && (Format == DISH_BEV || (SetupPE.ProcessEIT && isEITPid))) Tid--;
if (!CheckCRCAndParse ()) {
LogD(2, prep("!CheckCRCAndParse ()"));
@@ -2848,7 +2856,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
return; // only collect data for known channels
}
- LogD(4, prep("channelID: %s format:%d"), *channel->GetChannelID().ToString(), Format);
+ //LogD(5, prep("channelID: %s format:%d"), *channel->GetChannelID().ToString(), Format);
#ifdef USE_NOEPG
// only use epg from channels not blocked by noEPG-patch
@@ -2876,6 +2884,8 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
if (!SegmentStart)
SegmentStart = SiEitEvent.getStartTime ();
SegmentEnd = SiEitEvent.getStartTime () + SiEitEvent.getDuration ();
+ int versionNumber = getVersionNumber();
+
cEvent *newEvent = NULL;
cEvent *rEvent = NULL;
cEvent *pEvent = (cEvent *) pSchedule->GetEvent (SiEitEvent.getEventId (), SiEitEvent.getStartTime ());
@@ -2888,6 +2898,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
if (!pEvent)
continue;
} else {
+ //LogD(3, prep("existing event channelID: %s Title: %s TableID 0x%02X new TID 0x%02X Version %i, new version %i"), *channel->GetChannelID().ToString(), pEvent->Title(), pEvent->TableID(), Tid, pEvent->Version(), versionNumber);
// We have found an existing event, either through its event ID or its start time.
pEvent->SetSeen ();
// If the existing event has a zero table ID it was defined externally and shall
@@ -2964,14 +2975,14 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
continue;
}
#else
- if (pEvent->Version () == getVersionNumber ())
+ if (pEvent->Version () == versionNumber)
continue;
#endif /* DDEPGENTRY */
HasExternalData = ExternalData = true;
}
// If the new event has a higher table ID, let's skip it.
// The lower the table ID, the more "current" the information.
- else if (Tid > pEvent->TableID ())
+ else if (Tid > pEvent->TableID())
continue;
// If the new event comes from the same table and has the same version number
// as the existing one, let's skip it to avoid unnecessary work.
@@ -2979,7 +2990,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
// the actual Premiere transponder and the Sat.1/Pro7 transponder), but use different version numbers on
// each of them :-( So if one DVB card is tuned to the Premiere transponder, while an other one is tuned
// to the Sat.1/Pro7 transponder, events will keep toggling because of the bogus version numbers.
- else if (Tid == pEvent->TableID() && pEvent->Version() == getVersionNumber())
+ else if (Tid == pEvent->TableID() && pEvent->Version() == versionNumber)
continue;
}
if (!ExternalData) {
@@ -3000,7 +3011,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
}
if (OnlyRunningStatus)
continue; // do this before setting the version, so that the full update can be done later
- pEvent->SetVersion (getVersionNumber());
+ pEvent->SetVersion (versionNumber);
int LanguagePreferenceShort = -1;
int LanguagePreferenceExt = -1;
@@ -3065,8 +3076,8 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
if (DishEventDescriptor && NumContents == 1) {
DishEventDescriptor->setContent(Nibble);
}
- //LogD(2, prep("EEPGDEBUG:Nibble:%x-%x-%x-%x)"), Nibble.getContentNibbleLevel1(),Nibble.getContentNibbleLevel2()
- // , Nibble.getUserNibble1(), Nibble.getUserNibble2());
+// LogD(2, prep("EEPGDEBUG:Nibble:%x-%x-%x-%x)"), Nibble.getContentNibbleLevel1(),Nibble.getContentNibbleLevel2()
+// , Nibble.getUserNibble1(), Nibble.getUserNibble2());
}
pEvent->SetContents(Contents);
@@ -3245,19 +3256,23 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
decodeText2 (f, l, buffer, sizeof (buffer));
//ShortEventDescriptor->name.getText(buffer, sizeof(buffer));
pEvent->SetTitle (buffer);
+ LogD(3, prep("channelID: %s Title: %s"), *channel->GetChannelID().ToString(), pEvent->Title());
l = ShortEventDescriptor->text.getLength();
f = (unsigned char *) ShortEventDescriptor->text.getData().getData();
decodeText2 (f, l, buffer, sizeof (buffer));
//ShortEventDescriptor->text.getText(buffer, sizeof(buffer));
pEvent->SetShortText (buffer);
+ LogD(3, prep("ShortText: %s"), pEvent->ShortText());
} else if (!HasExternalData) {
pEvent->SetTitle (NULL);
pEvent->SetShortText (NULL);
+ LogD(3, prep("SetTitle (NULL)"));
}
if (ExtendedEventDescriptors) {
char buffer[Utf8BufSize (ExtendedEventDescriptors->getMaximumTextLength (": ")) + 1];
pEvent->SetDescription (ExtendedEventDescriptors->getText (buffer, sizeof (buffer), ": "));
- } else if (!HasExternalData)
+ LogD(3, prep("Description: %s"), pEvent->Description());
+ } else if (!HasExternalData) {
pEvent->SetDescription (NULL);
if (DishEventDescriptor) {
@@ -3315,6 +3330,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
//LogD(2, prep("DishDescription: %s"), DishExtendedEventDescriptor->getText());
//LogD(2, prep("DishShortText: %s"), DishExtendedEventDescriptor->getShortText());
}
+
}
delete ExtendedEventDescriptors;
delete ShortEventDescriptor;
@@ -3516,12 +3532,17 @@ void cFilterEEPG::ProcessNextFormat (bool FirstTime = false)
AddFilter (pid, 0xb0); //perhaps TID is equal to first data byte?
break;
case DISH_BEV:
- AddFilter (0x12, 0, 0); // event info, actual(0x4e)/other(0x4f) TS, present/following
+ AddFilter (EIT_PID, 0, 0); // event info, actual(0x4e)/other(0x4f) TS, present/following
AddFilter (0x0300, 0, 0); // Dish Network EEPG event info, actual(0x4e)/other(0x4f) TS, present/following
AddFilter (0x0441, 0, 0); // Dish Network EEPG event info, actual(0x4e)/other(0x4f) TS, present/following
// AddFilter (0x0441, 0x50, 0xf0); // Bell ExpressVU EEPG
// AddFilter (0x0441, 0x60, 0xf0); // Bell ExpressVU EEPG
break;
+ case EIT:
+ AddFilter (pid, 0x4e, 0xfe); //event info, actual(0x4e)/other(0x4f) TS, present/following
+ AddFilter (pid, 0x50, 0xf0); //event info, actual TS, schedule(0x50)/schedule for future days(0x5X)
+ AddFilter (pid, 0x60, 0xf0); //event info, other TS, schedule(0x60)/schedule for future days(0x6X)
+ break;
default:
break;
}
@@ -3535,7 +3556,7 @@ void cFilterEEPG::ProccessContinuous(u_short Pid, u_char Tid, int Length, const
cSchedules *Schedules = (cSchedules*)(cSchedules::Schedules(SchedulesLock));
//Look for other satelite positions only if Dish/Bell ExpressVU for the moment hardcoded pid check
if(Schedules)
- SI::cEIT2 EIT(Schedules, Source(), Tid, Data);
+ SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Pid == EIT_PID);
else//cEIT EIT (Schedules, Source (), Tid, Data);
{
@@ -3546,7 +3567,7 @@ void cFilterEEPG::ProccessContinuous(u_short Pid, u_char Tid, int Length, const
cSchedulesLock SchedulesLock;
cSchedules *Schedules = (cSchedules*)(cSchedules::Schedules(SchedulesLock));
if(Schedules)
- SI::cEIT2 EIT(Schedules, Source(), Tid, Data, true);
+ SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Pid == EIT_PID, true);
//cEIT EIT (Schedules, Source (), Tid, Data, true);
}
@@ -3690,6 +3711,11 @@ void cFilterEEPG::Process (u_short Pid, u_char Tid, const u_char * Data, int Len
&& !UnprocessedFormat[DISH_BEV]) {
UnprocessedFormat[DISH_BEV] = stream.getPid ();
}
+
+ // Enable EIT scan for all except DISH_BEV since it is already enabled
+ if (SetupPE.ProcessEIT && !UnprocessedFormat[DISH_BEV]) {
+ UnprocessedFormat[EIT] = EIT_PID;
+ }
} //if data[1] && data [3]
} //if streamtype
/*if (Format != PREMIERE) //any format found
@@ -3710,7 +3736,7 @@ void cFilterEEPG::Process (u_short Pid, u_char Tid, const u_char * Data, int Len
} //if pmtpid
else if (Source ()) {
- if ( Pid == 0x12 || Pid == 0x0300 || Pid == 0x0441 ) {
+ if ( Pid == EIT_PID || Pid == 0x0300 || Pid == 0x0441 ) {
if (Tid >= 0x4E)
ProccessContinuous(Pid, Tid, Length, Data);
return;
@@ -4368,6 +4394,8 @@ bool cPluginEEPG::SetupParse (const char *Name, const char *Value)
#ifdef DEBUG
else if (!strcasecmp (Name, "LogLevel"))
SetupPE.LogLevel = atoi (Value);
+ else if (!strcasecmp (Name, "ProcessEIT"))
+ SetupPE.ProcessEIT = atoi (Value);
#endif
else
return false;
diff --git a/eepg.h b/eepg.h
index 503e800..d306ca0 100644
--- a/eepg.h
+++ b/eepg.h
@@ -30,14 +30,15 @@ enum EFormat {
PREMIERE ,
FREEVIEW ,
DISH_BEV ,
+ EIT ,
//the highest number of EPG-formats that is supported by this plugin
- HIGHEST_FORMAT = DISH_BEV
+ HIGHEST_FORMAT = EIT
} Format;
#define NAGRA_TABLE_ID 0x55 //the lower the table Id, the more "current" it is; table_id 0x00 never gets overwritten, now/next are at 0x4e or 0x4f!
#define DEFAULT_TABLE_ID 0x30
-const char *FormatName[]= {"MediaHighWay 1","MediaHighWay 2","Sky Italy","Sky UK","NagraGuide","Premiere","FreeView","Dish/Bev"};
+const char *FormatName[]= {"MediaHighWay 1","MediaHighWay 2","Sky Italy","Sky UK","NagraGuide","Premiere","FreeView","Dish/Bev","EIT"};
struct sNode
{