-
-int pd_add(struct srd_decoder_instance *di, int output_type,
- char *proto_id)
-{
- struct srd_pd_output *pdo;
-
- if (!(pdo = g_try_malloc(sizeof(struct srd_pd_output))))
- return -1;
-
- /* pdo_id is just a simple index, nothing is deleted from this list anyway. */
- pdo->pdo_id = g_slist_length(di->pd_output);
- pdo->output_type = output_type;
- pdo->decoder = di->decoder;
- pdo->proto_id = g_strdup(proto_id);
- di->pd_output = g_slist_append(di->pd_output, pdo);
-
- return pdo->pdo_id;
-}
-
-struct srd_decoder_instance *get_di_by_decobject(void *decobject)
-{
- GSList *l, *s;
- struct srd_decoder_instance *di;
-
- for (l = di_list; l; l = l->next) {
- di = l->data;
- if (decobject == di->py_instance)
- return di;
- /* Check decoders stacked on top of this one. */
- for (s = di->next_di; s; s = s->next) {
- di = s->data;
- if (decobject == di->py_instance)
- return di;
- }
- }
-
- return NULL;
-}
-
-int srd_register_callback(int output_type, void *cb)
+/**
+ * Register/add a decoder output callback function.
+ *
+ * The function will be called when a protocol decoder sends output back
+ * to the PD controller (except for Python objects, which only go up the
+ * stack).
+ *
+ * @param output_type The output type this callback will receive. Only one
+ * callback per output type can be registered.
+ * @param cb The function to call. Must not be NULL.
+ * @param cb_data Private data for the callback function. Can be NULL.
+ */
+SRD_API int srd_pd_output_callback_add(int output_type,
+ srd_pd_output_callback_t cb, void *cb_data)