summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index d8bd150..4f3271c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,6 +27,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -129,8 +130,8 @@ static const char *media_pad_type_to_string(unsigned flag)
__u32 flag;
const char *name;
} flags[] = {
- { MEDIA_PAD_FL_SINK, "Input" },
- { MEDIA_PAD_FL_SOURCE, "Output" },
+ { MEDIA_PAD_FL_SINK, "Sink" },
+ { MEDIA_PAD_FL_SOURCE, "Source" },
};
unsigned int i;
@@ -219,6 +220,15 @@ static void media_print_topology_dot(struct media_device *media)
static void media_print_topology_text(struct media_device *media)
{
+ static const struct {
+ __u32 flag;
+ char *name;
+ } link_flags[] = {
+ { MEDIA_LNK_FL_ENABLED, "ENABLED" },
+ { MEDIA_LNK_FL_IMMUTABLE, "IMMUTABLE" },
+ { MEDIA_LNK_FL_DYNAMIC, "DYNAMIC" },
+ };
+
unsigned int i, j, k;
unsigned int padding;
@@ -251,20 +261,26 @@ static void media_print_topology_text(struct media_device *media)
struct media_link *link = &entity->links[k];
struct media_pad *source = link->source;
struct media_pad *sink = link->sink;
+ bool first = true;
+ unsigned int i;
if (source->entity == entity && source->index == j)
- printf("\t\t-> '%s':pad%u [",
+ printf("\t\t-> \"%s\":%u [",
sink->entity->info.name, sink->index);
else if (sink->entity == entity && sink->index == j)
- printf("\t\t<- '%s':pad%u [",
+ printf("\t\t<- \"%s\":%u [",
source->entity->info.name, source->index);
else
continue;
- if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
- printf("IMMUTABLE,");
- if (link->flags & MEDIA_LNK_FL_ENABLED)
- printf("ACTIVE");
+ for (i = 0; i < ARRAY_SIZE(link_flags); i++) {
+ if (!(link->flags & link_flags[i].flag))
+ continue;
+ if (!first)
+ printf(",");
+ printf("%s", link_flags[i].name);
+ first = false;
+ }
printf("]\n");
}