diff options
author | kos <kos@dev3> | 2012-08-31 10:40:24 (GMT) |
---|---|---|
committer | kos <kos@dev3> | 2012-08-31 10:40:24 (GMT) |
commit | 993ff2fb9432e8e0edf3a3cf341c5f343461ccf6 (patch) | |
tree | 27abd2ad568d05dfee2abe349ee8a9dfa55f9e11 /lib/dvb | |
parent | a7b0f491c6068b0e8cbc694c529909e361265ea5 (diff) |
set platform profile and check application version.
Diffstat (limited to 'lib/dvb')
-rw-r--r-- | lib/dvb/pmt.cpp | 48 | ||||
-rw-r--r-- | lib/dvb/pmt.h | 6 |
2 files changed, 49 insertions, 5 deletions
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 5b19ebd..74f896f 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -223,13 +223,22 @@ void saveData(int orgid, unsigned char* data, int sectionLength) close(fd); } +#include <dvbsi++/application_profile.h> +#include <dvbsi++/application_descriptor.h> +#define PACK_VERSION(major,minor,micro) (((major) << 16) + ((minor) << 8) + (micro)) +#define UNPACK_VERSION(version,major,minor,micro) { \ + major = (version)&0xff; \ + minor = (version>>8)&0xff; \ + micro = (version>>16)&0xff; \ +} void eDVBServicePMTHandler::AITready(int error) { eDebug("AITready"); ePtr<eTable<ApplicationInformationSection> > ptr; if (!m_AIT.getCurrent(ptr)) { - int orgid = 0, appid = 0; + short profilecode = 0; + int orgid = 0, appid = 0, profileVersion = 0; m_ApplicationName = m_HBBTVUrl = ""; eraseHbbTVApplications(&m_HbbTVApplications); @@ -259,7 +268,21 @@ void eDVBServicePMTHandler::AITready(int error) switch ((*desc)->getTag()) { case APPLICATION_DESCRIPTOR: + { + ApplicationDescriptor* applicationDescriptor = (ApplicationDescriptor*)(*desc); + ApplicationProfileList* applicationProfiles = applicationDescriptor->getApplicationProfiles(); + ApplicationProfileConstIterator interactionit = applicationProfiles->begin(); + for(; interactionit != applicationProfiles->end(); ++interactionit) + { + profilecode = (*interactionit)->getApplicationProfile(); + profileVersion = PACK_VERSION( + (*interactionit)->getVersionMajor(), + (*interactionit)->getVersionMinor(), + (*interactionit)->getVersionMicro() + ); + } break; + } case APPLICATION_NAME_DESCRIPTOR: { ApplicationNameDescriptor *nameDescriptor = (ApplicationNameDescriptor*)(*desc); @@ -314,7 +337,25 @@ void eDVBServicePMTHandler::AITready(int error) } } } - m_HbbTVApplications.push_back(new HbbTVApplicationInfo(controlCode, orgid, appid, hbbtvUrl, applicaionName)); + if(!hbbtvUrl.empty()) + { + char* uu = hbbtvUrl.c_str(); + if(!strncmp(uu, "http://", 7) || !strncmp(uu, "dvb://", 6) || !strncmp(uu, "https://", 8)) + { + switch(profileVersion) + { + case 65793: + case 66049: + m_HbbTVApplications.push_back(new HbbTVApplicationInfo(controlCode, orgid, appid, hbbtvUrl, applicaionName, profilecode)); + break; + case 1280: + case 65538: + default: + m_HbbTVApplications.push_back(new HbbTVApplicationInfo((-1)*controlCode, orgid, appid, hbbtvUrl, applicaionName, profilecode)); + break; + } + } + } } } @@ -392,12 +433,13 @@ PyObject *eDVBServicePMTHandler::getHbbTVApplications(void) { for(HbbTVApplicationInfoListConstIterator infoiter = m_HbbTVApplications.begin() ; infoiter != m_HbbTVApplications.end() ; ++infoiter) { - ePyObject tuple = PyTuple_New(5); + ePyObject tuple = PyTuple_New(6); PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((*infoiter)->m_ControlCode)); PyTuple_SET_ITEM(tuple, 1, PyString_FromString((*infoiter)->m_ApplicationName.c_str())); PyTuple_SET_ITEM(tuple, 2, PyString_FromString((*infoiter)->m_HbbTVUrl.c_str())); PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong((*infoiter)->m_OrgId)); PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong((*infoiter)->m_AppId)); + PyTuple_SET_ITEM(tuple, 5, PyInt_FromLong((*infoiter)->m_ProfileCode)); PyList_Append(ret, tuple); Py_DECREF(tuple); } diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index 9216adc..690932c 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -98,11 +98,13 @@ public: int m_OrgId; int m_AppId; int m_ControlCode; + short m_ProfileCode; std::string m_HbbTVUrl; std::string m_ApplicationName; public: - HbbTVApplicationInfo(int controlCode, int orgid, int appid, std::string hbbtvUrl, std::string applicationName) - : m_ControlCode(controlCode), m_HbbTVUrl(hbbtvUrl), m_ApplicationName(applicationName), m_OrgId(orgid), m_AppId(appid) + HbbTVApplicationInfo(int controlCode, int orgid, int appid, std::string hbbtvUrl, std::string applicationName, int profileCode) + : m_ControlCode(controlCode), m_HbbTVUrl(hbbtvUrl), m_ApplicationName(applicationName), m_OrgId(orgid), + m_AppId(appid), m_ProfileCode(profileCode) {} }; typedef std::list<HbbTVApplicationInfo *> HbbTVApplicationInfoList; |