X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4c2cba9ccb6f754aac9378e2fc2c7b546e6d589c..a9f7393e1d00eb89b8282aae0ddc4f6da33d9ca1:/lib/dvb/pmt.cpp diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 842d6979..25ac5465 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -1143,8 +1143,8 @@ void eDVBCAService::sendCAPMT() 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)); + PyTuple_SET_ITEM(r, 0, PyInt_FromLong(pid)); + PyTuple_SET_ITEM(r, 1, PyString_FromString(type)); return r; } @@ -1154,17 +1154,18 @@ static inline void PyList_AppendSteal(PyObject *list, PyObject *item) Py_DECREF(item); } +extern void PutToDict(ePyObject &dict, const char*key, ePyObject item); // defined in dvb/frontend.cpp + PyObject *eDVBServicePMTHandler::program::createPythonObject() { - PyObject *r = PyDict_New(); + ePyObject r = PyDict_New(); + ePyObject l = PyList_New(0); - PyObject *l = PyList_New(0); - PyList_AppendSteal(l, createTuple(0, "pat")); if (pmtPid != -1) PyList_AppendSteal(l, createTuple(pmtPid, "pmt")); - + for (std::vector::const_iterator i(videoStreams.begin()); i != videoStreams.end(); ++i) @@ -1184,7 +1185,8 @@ PyObject *eDVBServicePMTHandler::program::createPythonObject() if (textPid != -1) PyList_AppendSteal(l, createTuple(textPid, "text")); - - PyDict_SetItemString(r, "pids", l); + + PutToDict(r, "pids", l); + return r; }