diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2017-09-09 21:44:16 +0300 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2017-12-31 12:20:59 +0100 |
commit | 459791c488c6b66a5cd0d7cff9392a7a0b8ca733 (patch) | |
tree | ac36081f2321258247c101d53eeac7744a8e403c /src | |
parent | 408be3638b3cd84462632ae8fe0b92e93064ca57 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/libosmogapk.map | 1 | ||||
-rw-r--r-- | src/pq_alsa.c | 2 | ||||
-rw-r--r-- | src/pq_codec.c | 4 | ||||
-rw-r--r-- | src/pq_file.c | 2 | ||||
-rw-r--r-- | src/pq_format.c | 4 | ||||
-rw-r--r-- | src/pq_rtp.c | 2 | ||||
-rw-r--r-- | src/procqueue.c | 17 |
7 files changed, 32 insertions, 0 deletions
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_create; 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 @@ pq_queue_alsa_op(struct osmo_gapk_pq *pq, const char *alsa_dev, unsigned int blk 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 @@ osmo_gapk_pq_queue_codec(struct osmo_gapk_pq *pq, const struct osmo_gapk_codec_d 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 @@ pq_queue_file_op(struct osmo_gapk_pq *pq, FILE *fh, unsigned int blk_len, int in 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 @@ osmo_gapk_pq_queue_fmt_convert(struct osmo_gapk_pq *pq, const struct osmo_gapk_f 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 @@ pq_queue_rtp_op(struct osmo_gapk_pq *pq, int udp_fd, unsigned int blk_len, int i 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 @@ osmo_gapk_pq_execute(struct osmo_gapk_pq *pq) 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; +} |