mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
SIsections: add parsing of PDC descriptor (VPS time)
Tdd the VPS time to the event if available. Not yet used for anything useful ;-) git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@888 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -90,6 +90,14 @@ struct descr_linkage_header {
|
||||
unsigned linkage_type : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
struct descr_pdc_header {
|
||||
unsigned descriptor_tag : 8;
|
||||
unsigned descriptor_length : 8;
|
||||
unsigned pil0 : 8;
|
||||
unsigned pil1 : 8;
|
||||
unsigned pil2 : 8;
|
||||
} __attribute__ ((packed)) ;
|
||||
|
||||
class SIlinkage {
|
||||
public:
|
||||
SIlinkage(const struct descr_linkage_header *link) {
|
||||
@@ -344,6 +352,7 @@ public:
|
||||
original_network_id = 0;
|
||||
transport_stream_id = 0;
|
||||
eventID = 0;
|
||||
vps = 0;
|
||||
// dauer=0;
|
||||
// startzeit=0;
|
||||
}
|
||||
@@ -383,6 +392,7 @@ public:
|
||||
SIparentalRatings ratings;
|
||||
SIlinkage_descs linkage_descs;
|
||||
SItimes times;
|
||||
time_t vps;
|
||||
// Der Operator zum sortieren
|
||||
bool operator < (const SIevent& e) const {
|
||||
return uniqueKey()<e.uniqueKey();
|
||||
|
@@ -170,6 +170,30 @@ void SIsectionEIT::parseLinkageDescriptor(const char *buf, SIevent &e, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
void SIsectionEIT::parsePDCDescriptor(const char *buf, SIevent &e, unsigned maxlen)
|
||||
{
|
||||
if (maxlen >= sizeof(struct descr_pdc_header))
|
||||
{
|
||||
const struct descr_pdc_header *s = (struct descr_pdc_header *)buf;
|
||||
time_t now = time(NULL);
|
||||
struct tm tm_r;
|
||||
struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
|
||||
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
|
||||
int month = t.tm_mon;
|
||||
t.tm_mon = ((s->pil1 >> 3) & 0x0F) - 1;
|
||||
t.tm_mday = ((s->pil0 & 0x0F) << 1) | ((s->pil1 & 0x80) >> 7);
|
||||
t.tm_hour = ((s->pil1 & 0x07) << 2) | ((s->pil2 & 0xC0) >> 6);
|
||||
t.tm_min = s->pil2 & 0x3F;
|
||||
t.tm_sec = 0;
|
||||
if (month == 11 && t.tm_mon == 0) // current month is dec, but event is in jan
|
||||
t.tm_year++;
|
||||
else if (month == 0 && t.tm_mon == 11) // current month is jan, but event is in dec
|
||||
t.tm_year--;
|
||||
e.vps = mktime(&t);
|
||||
// fprintf(stderr, "SIsectionEIT::parsePDCDescriptor: vps: %ld %s", e.vps, ctime(&e.vps));
|
||||
}
|
||||
}
|
||||
|
||||
void SIsectionEIT::parseComponentDescriptor(const char *buf, SIevent &e, unsigned maxlen)
|
||||
{
|
||||
if(maxlen>=sizeof(struct descr_component_header))
|
||||
@@ -454,6 +478,8 @@ void SIsectionEIT::parseDescriptors(const char *des, unsigned len, SIevent &e)
|
||||
parseParentalRatingDescriptor((const char *)desc, e, len);
|
||||
else if(desc->descriptor_tag==0x4A)
|
||||
parseLinkageDescriptor((const char *)desc, e, len);
|
||||
else if(desc->descriptor_tag==0x69)
|
||||
parsePDCDescriptor((const char *)desc, e, len);
|
||||
if((unsigned)(desc->descriptor_length+2)>len)
|
||||
break;
|
||||
len-=desc->descriptor_length+2;
|
||||
|
@@ -544,6 +544,7 @@ protected:
|
||||
void parseComponentDescriptor(const char *buf, SIevent &e, unsigned maxlen);
|
||||
void parseParentalRatingDescriptor(const char *buf, SIevent &e, unsigned maxlen);
|
||||
void parseLinkageDescriptor(const char *buf, SIevent &e, unsigned maxlen);
|
||||
void parsePDCDescriptor(const char *buf, SIevent &e, unsigned maxlen);
|
||||
#ifdef ENABLE_FREESATEPG
|
||||
std::string freesatHuffmanDecode(std::string input);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user