procqueue: add item catedory and sub-category fields

This change adds two meta-information fields to the processing
queue item structure. Both of them will be used for more
detailed logging and for the human-readable processing
queue description.
diff --git a/include/osmocom/gapk/procqueue.h b/include/osmocom/gapk/procqueue.h
index f5b8d53..c2f2675 100644
--- a/include/osmocom/gapk/procqueue.h
+++ b/include/osmocom/gapk/procqueue.h
@@ -53,6 +53,10 @@
 	struct llist_head list;
 	/*! \brief type of item */
 	enum osmo_gapk_pq_item_type type;
+	/*! \brief category name (src, format, codec, sink) */
+	const char *cat_name;
+	/*! \brief sub-category name (file, rtp-amr, amr, alsa) */
+	const char *sub_name;
 };
 
 #define VAR_BUF_SIZE	320
@@ -70,6 +74,7 @@
 int osmo_gapk_pq_prepare(struct osmo_gapk_pq *pq);
 int osmo_gapk_pq_execute(struct osmo_gapk_pq *pq);
 void osmo_gapk_pq_destroy(struct osmo_gapk_pq *pq);
+char *osmo_gapk_pq_describe(struct osmo_gapk_pq *pq);
 
 /* Processing queue item management */
 struct osmo_gapk_pq_item *osmo_gapk_pq_add_item(struct osmo_gapk_pq *pq);
diff --git a/src/libosmogapk.map b/src/libosmogapk.map
index e704c31..5fd7a7a 100644
--- a/src/libosmogapk.map
+++ b/src/libosmogapk.map
@@ -12,6 +12,7 @@
 osmo_gapk_pq_prepare;
 osmo_gapk_pq_execute;
 osmo_gapk_pq_destroy;
+osmo_gapk_pq_describe;
 
 osmo_gapk_pq_add_item;
 
diff --git a/src/pq_alsa.c b/src/pq_alsa.c
index 3025c2a..5cdd9ce 100644
--- a/src/pq_alsa.c
+++ b/src/pq_alsa.c
@@ -142,6 +142,8 @@
 
 	item->type = in_out_n ?
 		OSMO_GAPK_ITEM_TYPE_SOURCE : OSMO_GAPK_ITEM_TYPE_SINK;
+	item->cat_name = in_out_n ? "source" : "sink";
+	item->sub_name = "alsa";
 
 	item->len_in  = in_out_n ? 0 : blk_len;
 	item->len_out = in_out_n ? blk_len : 0;
diff --git a/src/pq_codec.c b/src/pq_codec.c
index db99d5c..b5dac5d 100644
--- a/src/pq_codec.c
+++ b/src/pq_codec.c
@@ -74,6 +74,10 @@
 	item->exit = codec->codec_exit;
 	item->wait = NULL;
 
+	/* Meta information */
+	item->cat_name = "codec";
+	item->sub_name = codec->name;
+
 	LOGPGAPK(LOGL_DEBUG, "PQ: Adding codec %s, %s format %s\n", codec->name,
 		enc_dec_n ? "encoding to" : "decoding from", fmt->name);
 
diff --git a/src/pq_file.c b/src/pq_file.c
index 73a7099..8a8f9c6 100644
--- a/src/pq_file.c
+++ b/src/pq_file.c
@@ -80,6 +80,8 @@
 
 	item->type = in_out_n ?
 		OSMO_GAPK_ITEM_TYPE_SOURCE : OSMO_GAPK_ITEM_TYPE_SINK;
+	item->cat_name = in_out_n ? "source" : "sink";
+	item->sub_name = "file";
 
 	item->len_in  = in_out_n ? 0 : blk_len;
 	item->len_out = in_out_n ? blk_len : 0;
diff --git a/src/pq_format.c b/src/pq_format.c
index dad1d9e..c2bb52e 100644
--- a/src/pq_format.c
+++ b/src/pq_format.c
@@ -73,5 +73,9 @@
 	item->proc = pq_cb_fmt_convert;
 	item->wait = NULL;
 
+	/* Meta information */
+	item->cat_name = "format";
+	item->sub_name = fmt->name;
+
 	return 0;
 }
diff --git a/src/pq_rtp.c b/src/pq_rtp.c
index 799b324..faab6c8 100644
--- a/src/pq_rtp.c
+++ b/src/pq_rtp.c
@@ -226,6 +226,8 @@
 
 	item->type = in_out_n ?
 		OSMO_GAPK_ITEM_TYPE_SOURCE : OSMO_GAPK_ITEM_TYPE_SINK;
+	item->cat_name = in_out_n ? "source" : "sink";
+	item->sub_name = "rtp";
 
 	item->len_in  = in_out_n ? 0 : blk_len;
 	item->len_out = in_out_n ? blk_len : 0;
diff --git a/src/procqueue.c b/src/procqueue.c
index 2c7b7fc..4de7a6a 100644
--- a/src/procqueue.c
+++ b/src/procqueue.c
@@ -176,3 +176,20 @@
 
 	return 0;
 }
+
+char *
+osmo_gapk_pq_describe(struct osmo_gapk_pq *pq)
+{
+	struct osmo_gapk_pq_item *item;
+	char *result = NULL;
+	int i = 0;
+
+	/* Iterate over all items in queue */
+	llist_for_each_entry(item, &pq->items, list) {
+		result = talloc_asprintf_append(result, "%s/%s%s",
+			item->cat_name, item->sub_name,
+			++i < pq->n_items ? " -> " : "");
+	}
+
+	return result;
+}