+
+ py_value = Py_BuildValue("{sssisd}",
+ "driver", "demo",
+ "unitsize", _unitsize, //FIXME: Pass in a unitsize that matches the selected LA
+ "starttime", 129318231823.0 //TODO: Fill with something reasonable.
+ );
+ /* Create an instance of the Decoder class */
+ py_instance = PyObject_Call(py_res, py_args, py_value);
+ if (!py_instance) {
+ if (PyErr_Occurred())
+ PyErr_Print(); /* Returns void. */
+ Py_XDECREF(py_value); /* TODO: Ref. stolen upon error? */
+ Py_XDECREF(py_res);
+ Py_XDECREF(py_mod);
+ fprintf(stderr, "Unable to create instance of Decoder class in PD module %s\n", name);
+ return SRD_ERR_PYTHON; /* TODO: More specific error? */
+ }
+ d->py_instance = py_instance;
+
+ /* TODO: Handle func, inputformats, outputformats. */
+ /* Note: They must at least be set to NULL, will segfault otherwise. */
+ d->func = NULL;
+ d->inputformats = NULL;
+ d->outputformats = NULL;