+int srd_session_start(int num_probes, int unitsize, uint64_t samplerate)
+{
+ PyObject *args;
+ GSList *d, *s;
+ struct srd_decoder_instance *di;
+ int ret;
+
+ if (!(args = Py_BuildValue("{s:l}", "samplerate", (long)samplerate))) {
+ srd_err("unable to build python object for metadata");
+ return SRD_ERR_PYTHON;
+ }
+
+ /* Run the start() method on all decoders receiving frontend data. */
+ for (d = di_list; d; d = d->next) {
+ di = d->data;
+ di->num_probes = num_probes;
+ di->unitsize = unitsize;
+ di->samplerate = samplerate;
+ if ((ret = srd_instance_start(di, args) != SRD_OK))
+ return ret;
+
+ /* Run the start() method on all decoders up the stack from this one. */
+ for (s = di->next_di; s; s = s->next) {
+ /* These don't need probes, unitsize and samplerate. */
+ di = s->data;
+ if ((ret = srd_instance_start(di, args) != SRD_OK))
+ return ret;
+ }
+ }
+
+ Py_DECREF(args);
+
+ return SRD_OK;
+}
+