diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2007-01-05 15:00:59 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2007-01-05 15:00:59 +0000 |
| commit | 211d70fe8a326748743da7642f8b1f3ca10adc94 (patch) | |
| tree | b14e6f0a286cb820d767d681ffef7085bc9ec19f /lib/dvb/pmt.cpp | |
| parent | 6e5762dc8d5995342e03e4b74722d6ddff85af0e (diff) | |
| download | enigma2-211d70fe8a326748743da7642f8b1f3ca10adc94.tar.gz enigma2-211d70fe8a326748743da7642f8b1f3ca10adc94.zip | |
add eDVBServicePMTHandler::program::createPythonObject
Diffstat (limited to 'lib/dvb/pmt.cpp')
| -rw-r--r-- | lib/dvb/pmt.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 8db4ba9f..1b1455e4 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -856,3 +856,46 @@ void eDVBCAService::sendCAPMT() ++m_sendstate; } } + +static PyObject *createTuple(int pid, const char *type) +{ + PyObject *r = PyTuple_New(2); + PyTuple_SetItem(r, 0, PyInt_FromLong(pid)); + PyTuple_SetItem(r, 1, PyString_FromString(type)); + return r; +} + +PyObject *eDVBServicePMTHandler::program::createPythonObject() +{ + PyObject *r = PyDict_New(); + + PyObject *l = PyList_New(0); + + PyList_Append(l, createTuple(0, "pat")); + + if (pmtPid != -1) + PyList_Append(l, createTuple(pmtPid, "pmt")); + + for (std::vector<eDVBServicePMTHandler::videoStream>::const_iterator + i(videoStreams.begin()); + i != videoStreams.end(); ++i) + PyList_Append(l, createTuple(i->pid, "video")); + + for (std::vector<eDVBServicePMTHandler::audioStream>::const_iterator + i(audioStreams.begin()); + i != audioStreams.end(); ++i) + PyList_Append(l, createTuple(i->pid, "audio")); + + for (std::vector<eDVBServicePMTHandler::subtitleStream>::const_iterator + i(subtitleStreams.begin()); + i != subtitleStreams.end(); ++i) + PyList_Append(l, createTuple(i->pid, "subtitle")); + + PyList_Append(l, createTuple(pcrPid, "pcr")); + + if (textPid != -1) + PyList_Append(l, createTuple(textPid, "text")); + + PyDict_SetItemString(r, "pids", l); + return r; +} |
