serviceEvent(eventNoPAT);
}
-PyObject *eDVBServicePMTHandler::getCaIds()
+PyObject *eDVBServicePMTHandler::getCaIds(bool pair)
{
ePyObject ret;
if ( !getProgramInfo(prog) )
{
- int cnt=prog.caids.size();
- if (cnt)
+ if (pair)
{
+ int cnt=prog.caids.size();
+ if (cnt)
+ {
+ ret=PyList_New(cnt);
+ std::list<program::capid_pair>::iterator it(prog.caids.begin());
+ 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
+ {
+ std::set<program::capid_pair> set(prog.caids.begin(), prog.caids.end());
+ std::set<program::capid_pair>::iterator it(set.begin());
+ int cnt=set.size();
ret=PyList_New(cnt);
- std::set<uint16_t>::iterator it(prog.caids.begin());
while(cnt--)
- PyList_SET_ITEM(ret, cnt, PyInt_FromLong(*it++));
+ 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;
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.push_back(pair);
}
else if ((*desc)->getTag() == REGISTRATION_DESCRIPTOR)
{
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.push_back(pair);
break;
}
default:
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.push_back(pair);
+ }
if ( cnt )
ret = 0;
}