Permalink
Browse files

Update Dish Network EIT to support programid and seriesID parsing.

This patch from Mark Buechler has been sitting around for some time, and it only affects code related to Dish network EIT parsing, so there's little to no harm in applying it, even though I'm unable to test it beyond compilation.

Fixes #9155.
  • Loading branch information...
1 parent d950637 commit 2a65380b0e1769f70debc99e1089145b0b6b59c1 Robert McNamara committed Jun 9, 2011
@@ -374,6 +374,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit)
QString rating_system = QString("");
QString advisory = QString("");
float stars = 0.0;
+ QDate originalairdate;
if (EITFixUp::kFixDish & fix)
{
@@ -420,6 +421,10 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit)
DishEventTagsDescriptor tags(tags_data);
seriesId = tags.seriesid();
programId = tags.programid();
+ originalairdate = tags.originalairdate(); // future use
+
+ if (programId.startsWith("MV") || programId.startsWith("SP"))
+ seriesId = "";
}
const unsigned char *properties_data =
@@ -3,6 +3,7 @@
#include "dishdescriptors.h"
#include "atsc_huffman.h"
#include "programinfo.h" // for subtitle types and audio and video properties
+#include "dvbtables.h"
QString DishEventNameDescriptor::Name(uint compression_type) const
{
@@ -81,31 +82,84 @@ void DishEventPropertiesDescriptor::decompress_properties(uint compression_type)
QString DishEventTagsDescriptor::programid(void) const
{
- QString id;
+ QString prefix = QString("");
if (DescriptorLength() != 8)
return QString::null;
- id.sprintf("%02x%02x%02x%02x%02x%02x%02x", _data[3], _data[4], _data[5],
- _data[6], _data[7], _data[8],
- _data[9]);
+ QString series = seriesid();
+ series.remove(0, 2);
- return id;
+ uint episode = ((_data[6] & 0x3f) << 0x08) | _data[7];
+
+ if (_data[2] == 0x7c)
+ prefix = "MV";
+ else if (_data[2] == 0x7d)
+ prefix = "SP";
+ else if (_data[2] == 0x7e)
+ {
+ if (episode > 0)
+ prefix = "EP";
+ else
+ prefix = "SH";
+ } else
+ return prefix;
+
+ QString id = QString("%1%2%3").arg(prefix).arg(series).arg(episode, 4, 0);
+
+ return id;
}
-QString DishEventTagsDescriptor::seriesid(void) const
+QString DishEventTagsDescriptor::seriesid(void) const
{
- QString id;
+ QString prefix = QString("");
if (DescriptorLength() != 8)
return QString::null;
- id.sprintf("%02x%02x%02x%01x", _data[3], _data[4], _data[5],
- ((_data[6] & 0xf0) >> 0x04));
+ if (_data[2] == 0x7c)
+ prefix = "MV";
+ else if (_data[2] == 0x7d)
+ prefix = "SP";
+ else if (_data[2] == 0x7e)
+ prefix = "EP";
+ else
+ return prefix;
+
+ uint series = (_data[3] << 0x12) | (_data[4] << 0x0a) | (_data[5] << 0x02) |
+ ((_data[6] & 0xc0) >> 0x06);
+
+ QString id = QString("%1%2").arg(prefix).arg(series, 8, 0);
return id;
}
+QDate DishEventTagsDescriptor::originalairdate(void) const
+{
+ unsigned char mjd[5];
+
+ if (DescriptorLength() != 8)
+ return QDate::QDate();
+
+ mjd[0] = _data[8];
+ mjd[1] = _data[9];
+ mjd[2] = 0;
+ mjd[3] = 0;
+ mjd[4] = 0;
+
+ QDateTime t = dvbdate2qt(mjd);
+
+ if (!t.isValid())
+ return QDate::QDate();
+
+ QDate originalairdate = t.date();
+
+ if (originalairdate.year() < 1940)
+ return QDate::QDate();
+
+ return originalairdate;
+}
+
QMutex DishEventMPAADescriptor::mpaaRatingsLock;
map<uint,QString> DishEventMPAADescriptor::mpaaRatingsDesc;
bool DishEventMPAADescriptor::mpaaRatingsExists = false;
@@ -8,6 +8,7 @@
#include <qmutex.h>
#include <QString>
+#include <QDate>
#include "atscdescriptors.h"
@@ -47,7 +48,7 @@ class DishEventVCHIPDescriptor : public MPEGDescriptor
{
public:
DishEventVCHIPDescriptor(const unsigned char* data)
- : MPEGDescriptor(data)
+ : MPEGDescriptor(data)
{
// Name bits loc expected value
// descriptor_tag 8 0.0 0x95
@@ -144,12 +145,10 @@ class DishEventTagsDescriptor : public MPEGDescriptor
assert(DescriptorID::dish_event_tags == DescriptorTag());
// descriptor_length 8 1.0
}
- // unknown 8 2.0
- // seriesid 28 3.0
+ // seriesid 64 2.0
QString seriesid(void) const;
-
- // programid 42 3.0
QString programid(void) const;
+ QDate originalairdate(void) const;
};
typedef enum

0 comments on commit 2a65380

Please sign in to comment.