diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2010-11-22 16:19:51 +0100 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2010-11-22 16:19:51 +0100 |
| commit | 75a14a64a63132874f26b4715cde33e69dbf4b34 (patch) | |
| tree | bed899e3a6640f7a915faae2ba4ed9d873565370 /lib/dvb | |
| parent | fb91533bb1d293bdb0691bfcc1d15da9268782fe (diff) | |
| download | enigma2-75a14a64a63132874f26b4715cde33e69dbf4b34.tar.gz enigma2-75a14a64a63132874f26b4715cde33e69dbf4b34.zip | |
add possibility to query CAID/CAPID combination from python
refs bug #621
Diffstat (limited to 'lib/dvb')
| -rw-r--r-- | lib/dvb/pmt.cpp | 41 | ||||
| -rw-r--r-- | lib/dvb/pmt.h | 12 |
2 files changed, 41 insertions, 12 deletions
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index ea4b96c5..4a826c12 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -149,7 +149,7 @@ void eDVBServicePMTHandler::PATready(int) serviceEvent(eventNoPAT); } -PyObject *eDVBServicePMTHandler::getCaIds() +PyObject *eDVBServicePMTHandler::getCaIds(bool pair) { ePyObject ret; @@ -161,16 +161,29 @@ PyObject *eDVBServicePMTHandler::getCaIds() if (cnt) { ret=PyList_New(cnt); - std::set<uint16_t>::iterator it(prog.caids.begin()); - while(cnt--) - PyList_SET_ITEM(ret, cnt, PyInt_FromLong(*it++)); + std::set<program::capid_pair>::iterator it(prog.caids.begin()); + if (pair) + { + while(cnt--) + { + ePyObject tuple = PyTuple_New(2); + PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(it->caid)); + PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((it++)->capid)); + PyList_SET_ITEM(ret, cnt, tuple); + } + } + else + { + while(cnt--) + PyList_SET_ITEM(ret, cnt, PyInt_FromLong((it++)->caid)); + } } } return ret ? (PyObject*)ret : (PyObject*)PyList_New(0); } -int eDVBServicePMTHandler::getProgramInfo(struct program &program) +int eDVBServicePMTHandler::getProgramInfo(program &program) { ePtr<eTable<ProgramMapSection> > ptr; int cached_apid_ac3 = -1; @@ -460,7 +473,10 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) case CA_DESCRIPTOR: { CaDescriptor *descr = (CaDescriptor*)(*desc); - program.caids.insert(descr->getCaSystemId()); + program::capid_pair pair; + pair.caid = descr->getCaSystemId(); + pair.capid = descr->getCaPid(); + program.caids.insert(pair); break; } default: @@ -523,7 +539,10 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) if ((*desc)->getTag() == CA_DESCRIPTOR) { CaDescriptor *descr = (CaDescriptor*)(*desc); - program.caids.insert(descr->getCaSystemId()); + program::capid_pair pair; + pair.caid = descr->getCaSystemId(); + pair.capid = descr->getCaPid(); + program.caids.insert(pair); } } } @@ -589,8 +608,12 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) program.textPid = cached_tpid; } CAID_LIST &caids = m_service->m_ca; - for (CAID_LIST::iterator it(caids.begin()); it != caids.end(); ++it) - program.caids.insert(*it); + for (CAID_LIST::iterator it(caids.begin()); it != caids.end(); ++it) { + program::capid_pair pair; + pair.caid = *it; + pair.capid = -1; // not known yet + program.caids.insert(pair); + } if ( cnt ) ret = 0; } diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index 483c06b1..4a506a41 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -181,11 +181,17 @@ public: struct program { + struct capid_pair + { + uint16_t caid; + int capid; + bool operator< (const struct capid_pair &t) { return t.caid < caid; } + }; std::vector<videoStream> videoStreams; std::vector<audioStream> audioStreams; int defaultAudioStream; std::vector<subtitleStream> subtitleStreams; - std::set<uint16_t> caids; + std::set<capid_pair> caids; int pcrPid; int pmtPid; int textPid; @@ -193,10 +199,10 @@ public: PyObject *createPythonObject(); }; - int getProgramInfo(struct program &program); + int getProgramInfo(program &program); int getDataDemux(ePtr<iDVBDemux> &demux); int getDecodeDemux(ePtr<iDVBDemux> &demux); - PyObject *getCaIds(); + PyObject *getCaIds(bool pair=false); // caid / ecmpid pair int getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel); int getServiceReference(eServiceReferenceDVB &service) { service = m_reference; return 0; } |
