procqueue: introduce and use shared cat_name definitions

Let's use the common string representation for item category
names, defined in the shared header, instead of defining
them in every file.

Change-Id: Ie0c449d77fa383cad27f67b8ce902bd071342dbb
This commit is contained in:
Vadim Yanitskiy 2018-01-15 00:25:44 +06:00
parent 2254861efb
commit 6f34c8f301
6 changed files with 19 additions and 10 deletions

View File

@ -30,6 +30,10 @@ enum osmo_gapk_pq_item_type {
OSMO_GAPK_ITEM_TYPE_PROC,
};
#define OSMO_GAPK_CAT_NAME_SOURCE "source"
#define OSMO_GAPK_CAT_NAME_SINK "sink"
#define OSMO_GAPK_CAT_NAME_PROC "proc"
struct osmo_gapk_pq_item {
/*! input frame size (in bytes). '0' in case of variable frames */
unsigned int len_in;

View File

@ -143,7 +143,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->cat_name = in_out_n ?
OSMO_GAPK_CAT_NAME_SOURCE : OSMO_GAPK_CAT_NAME_SINK;
item->sub_name = "alsa";
item->len_in = in_out_n ? 0 : blk_len;

View File

@ -80,7 +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->cat_name = in_out_n ?
OSMO_GAPK_CAT_NAME_SOURCE : OSMO_GAPK_CAT_NAME_SINK;
item->sub_name = "file";
item->len_in = in_out_n ? 0 : blk_len;

View File

@ -226,7 +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->cat_name = in_out_n ?
OSMO_GAPK_CAT_NAME_SOURCE : OSMO_GAPK_CAT_NAME_SINK;
item->sub_name = "rtp";
item->len_in = in_out_n ? 0 : blk_len;

View File

@ -151,7 +151,7 @@ static int init_gen_queue(struct osmo_gapk_pq *pq,
/* Fill in meta information */
src_rand->type = OSMO_GAPK_ITEM_TYPE_SOURCE;
src_rand->cat_name = "source";
src_rand->cat_name = OSMO_GAPK_CAT_NAME_SOURCE;
src_rand->sub_name = "random";
/* Set I/O buffer lengths */
@ -237,7 +237,7 @@ static int init_chk_queue(struct osmo_gapk_pq *pq,
/* Fill in meta information */
sink_chk->type = OSMO_GAPK_ITEM_TYPE_SINK;
sink_chk->cat_name = "sink";
sink_chk->cat_name = OSMO_GAPK_CAT_NAME_SINK;
sink_chk->sub_name = "checker";
/* Set I/O buffer lengths */

View File

@ -283,16 +283,18 @@ int main(int argc, char **argv)
assert(queue_desc == NULL);
/* Fill in some data */
q3_i0->cat_name = "source";
q3_i0->cat_name = OSMO_GAPK_CAT_NAME_SOURCE;
q3_i0->sub_name = "file";
q3_i1->cat_name = "proc";
q3_i1->cat_name = OSMO_GAPK_CAT_NAME_PROC;
q3_i1->sub_name = "dummy";
q3_i2->cat_name = "sink";
q3_i2->cat_name = OSMO_GAPK_CAT_NAME_SINK;
q3_i2->sub_name = "alsa";
q2_i0->cat_name = "source";
q2_i0->cat_name = OSMO_GAPK_CAT_NAME_SOURCE;
q2_i0->sub_name = "dummy";
q2_i1->cat_name = "sink";
q2_i1->cat_name = OSMO_GAPK_CAT_NAME_SINK;
q2_i1->sub_name = "dummy";
q1_i0->cat_name = "dummy";