summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-12-21 13:00:02 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-04-08 10:32:49 +0200
commit28212f9aa0d44a85818c9a1fdf7e743bf0d69e12 (patch)
tree8ba652898dfd11027a2380c6d7369bede7a89175
parentb16cbe7bce0fd8d9d940473a2272b6b0148795c3 (diff)
Update to the latest media kernel API
The media kernel API has seen many changes during the review process, update the media-ctl application accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/main.c50
-rw-r--r--src/media.c20
-rw-r--r--src/media.h2
3 files changed, 36 insertions, 36 deletions
diff --git a/src/main.c b/src/main.c
index 0bc6135..461dae1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -111,13 +111,13 @@ static const char *media_entity_type_to_string(unsigned type)
__u32 type;
const char *name;
} types[] = {
- { MEDIA_ENTITY_TYPE_DEVNODE, "Node" },
- { MEDIA_ENTITY_TYPE_V4L2_SUBDEV, "V4L2 subdev" },
+ { MEDIA_ENT_T_DEVNODE, "Node" },
+ { MEDIA_ENT_T_V4L2_SUBDEV, "V4L2 subdev" },
};
unsigned int i;
- type &= MEDIA_ENTITY_TYPE_MASK;
+ type &= MEDIA_ENT_TYPE_MASK;
for (i = 0; i < ARRAY_SIZE(types); i++) {
if (types[i].type == type)
@@ -143,15 +143,15 @@ static const char *media_entity_subtype_to_string(unsigned type)
"Lens",
};
- unsigned int subtype = type & MEDIA_ENTITY_SUBTYPE_MASK;
+ unsigned int subtype = type & MEDIA_ENT_SUBTYPE_MASK;
- switch (type & MEDIA_ENTITY_TYPE_MASK) {
- case MEDIA_ENTITY_TYPE_DEVNODE:
+ switch (type & MEDIA_ENT_TYPE_MASK) {
+ case MEDIA_ENT_T_DEVNODE:
if (subtype >= ARRAY_SIZE(node_types))
subtype = 0;
return node_types[subtype];
- case MEDIA_ENTITY_TYPE_V4L2_SUBDEV:
+ case MEDIA_ENT_T_V4L2_SUBDEV:
if (subtype >= ARRAY_SIZE(subdev_types))
subtype = 0;
return subdev_types[subtype];
@@ -166,8 +166,8 @@ static const char *media_pad_type_to_string(unsigned flag)
__u32 flag;
const char *name;
} flags[] = {
- { MEDIA_PAD_FLAG_INPUT, "Input" },
- { MEDIA_PAD_FLAG_OUTPUT, "Output" },
+ { MEDIA_PAD_FL_SINK, "Input" },
+ { MEDIA_PAD_FL_SOURCE, "Output" },
};
unsigned int i;
@@ -192,17 +192,17 @@ static void media_print_topology_dot(struct media_device *media)
unsigned int npads;
switch (media_entity_type(entity)) {
- case MEDIA_ENTITY_TYPE_DEVNODE:
+ case MEDIA_ENT_T_DEVNODE:
printf("\tn%08x [label=\"%s\\n%s\", shape=box, style=filled, "
"fillcolor=yellow]\n",
entity->info.id, entity->info.name, entity->devname);
break;
- case MEDIA_ENTITY_TYPE_V4L2_SUBDEV:
+ case MEDIA_ENT_T_V4L2_SUBDEV:
printf("\tn%08x [label=\"{{", entity->info.id);
for (j = 0, npads = 0; j < entity->info.pads; ++j) {
- if (!(entity->pads[j].flags & MEDIA_PAD_FLAG_INPUT))
+ if (!(entity->pads[j].flags & MEDIA_PAD_FL_SINK))
continue;
printf("%s<port%u> %u", npads ? " | " : "", j, j);
@@ -215,7 +215,7 @@ static void media_print_topology_dot(struct media_device *media)
printf(" | {");
for (j = 0, npads = 0; j < entity->info.pads; ++j) {
- if (!(entity->pads[j].flags & MEDIA_PAD_FLAG_OUTPUT))
+ if (!(entity->pads[j].flags & MEDIA_PAD_FL_SOURCE))
continue;
printf("%s<port%u> %u", npads ? " | " : "", j, j);
@@ -236,16 +236,16 @@ static void media_print_topology_dot(struct media_device *media)
continue;
printf("\tn%08x", link->source->entity->info.id);
- if (media_entity_type(link->source->entity) == MEDIA_ENTITY_TYPE_V4L2_SUBDEV)
+ if (media_entity_type(link->source->entity) == MEDIA_ENT_T_V4L2_SUBDEV)
printf(":port%u", link->source->index);
printf(" -> ");
printf("n%08x", link->sink->entity->info.id);
- if (media_entity_type(link->sink->entity) == MEDIA_ENTITY_TYPE_V4L2_SUBDEV)
+ if (media_entity_type(link->sink->entity) == MEDIA_ENT_T_V4L2_SUBDEV)
printf(":port%u", link->sink->index);
- if (link->flags & MEDIA_LINK_FLAG_IMMUTABLE)
+ if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
printf(" [style=bold]");
- else if (!(link->flags & MEDIA_LINK_FLAG_ENABLED))
+ else if (!(link->flags & MEDIA_LNK_FL_ENABLED))
printf(" [style=dashed]");
printf("\n");
}
@@ -279,7 +279,7 @@ static void media_print_topology_text(struct media_device *media)
printf("\tpad%u: %s ", j, media_pad_type_to_string(pad->flags));
- if (media_entity_type(entity) == MEDIA_ENTITY_TYPE_V4L2_SUBDEV)
+ if (media_entity_type(entity) == MEDIA_ENT_T_V4L2_SUBDEV)
v4l2_subdev_print_format(entity, j, V4L2_SUBDEV_FORMAT_ACTIVE);
printf("\n");
@@ -298,9 +298,9 @@ static void media_print_topology_text(struct media_device *media)
else
continue;
- if (link->flags & MEDIA_LINK_FLAG_IMMUTABLE)
+ if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
printf("IMMUTABLE,");
- if (link->flags & MEDIA_LINK_FLAG_ENABLED)
+ if (link->flags & MEDIA_LNK_FL_ENABLED)
printf("ACTIVE");
printf("]\n");
@@ -670,7 +670,7 @@ static int setup_format(struct media_device *media, const char *p, char **endp)
return -EINVAL;
}
- if (pad->flags & MEDIA_PAD_FLAG_OUTPUT) {
+ if (pad->flags & MEDIA_PAD_FL_SOURCE) {
ret = set_crop(pad, &crop);
if (ret < 0)
return ret;
@@ -680,7 +680,7 @@ static int setup_format(struct media_device *media, const char *p, char **endp)
if (ret < 0)
return ret;
- if (pad->flags & MEDIA_PAD_FLAG_INPUT) {
+ if (pad->flags & MEDIA_PAD_FL_SINK) {
ret = set_crop(pad, &crop);
if (ret < 0)
return ret;
@@ -694,16 +694,16 @@ static int setup_format(struct media_device *media, const char *p, char **endp)
/* If the pad is an output pad, automatically set the same format on
* the remote subdev input pads, if any.
*/
- if (pad->flags & MEDIA_PAD_FLAG_OUTPUT) {
+ if (pad->flags & MEDIA_PAD_FL_SOURCE) {
for (i = 0; i < pad->entity->num_links; ++i) {
struct media_link *link = &pad->entity->links[i];
struct v4l2_mbus_framefmt remote_format;
- if (!(link->flags & MEDIA_LINK_FLAG_ENABLED))
+ if (!(link->flags & MEDIA_LNK_FL_ENABLED))
continue;
if (link->source == pad &&
- link->sink->entity->info.type == MEDIA_ENTITY_TYPE_V4L2_SUBDEV) {
+ link->sink->entity->info.type == MEDIA_ENT_T_V4L2_SUBDEV) {
remote_format = format;
set_format(link->sink, &remote_format);
}
diff --git a/src/media.c b/src/media.c
index 512330a..7e4174d 100644
--- a/src/media.c
+++ b/src/media.c
@@ -38,13 +38,13 @@ struct media_pad *media_entity_remote_source(struct media_pad *pad)
{
unsigned int i;
- if (!(pad->flags & MEDIA_PAD_FLAG_INPUT))
+ if (!(pad->flags & MEDIA_PAD_FL_SINK))
return NULL;
for (i = 0; i < pad->entity->num_links; ++i) {
struct media_link *link = &pad->entity->links[i];
- if (!(link->flags & MEDIA_LINK_FLAG_ENABLED))
+ if (!(link->flags & MEDIA_LNK_FL_ENABLED))
continue;
if (link->sink == pad)
@@ -112,14 +112,14 @@ int media_setup_link(struct media_device *media,
/* source pad */
ulink.source.entity = source->entity->info.id;
ulink.source.index = source->index;
- ulink.source.flags = MEDIA_PAD_FLAG_OUTPUT;
+ ulink.source.flags = MEDIA_PAD_FL_SOURCE;
/* sink pad */
ulink.sink.entity = sink->entity->info.id;
ulink.sink.index = sink->index;
- ulink.sink.flags = MEDIA_PAD_FLAG_INPUT;
+ ulink.sink.flags = MEDIA_PAD_FL_SINK;
- ulink.flags = flags | (link->flags & MEDIA_LINK_FLAG_IMMUTABLE);
+ ulink.flags = flags | (link->flags & MEDIA_LNK_FL_IMMUTABLE);
ret = ioctl(media->fd, MEDIA_IOC_SETUP_LINK, &ulink);
if (ret < 0) {
@@ -144,12 +144,12 @@ int media_reset_links(struct media_device *media)
for (j = 0; j < entity->num_links; j++) {
struct media_link *link = &entity->links[j];
- if (link->flags & MEDIA_LINK_FLAG_IMMUTABLE ||
+ if (link->flags & MEDIA_LNK_FL_IMMUTABLE ||
link->source->entity != entity)
continue;
ret = media_setup_link(media, link->source, link->sink,
- link->flags & ~MEDIA_LINK_FLAG_ENABLED);
+ link->flags & ~MEDIA_LNK_FL_ENABLED);
if (ret < 0)
return ret;
}
@@ -264,7 +264,7 @@ static int media_enum_entities(struct media_device *media)
entity = &media->entities[media->entities_count];
memset(entity, 0, sizeof(*entity));
entity->fd = -1;
- entity->info.id = id | MEDIA_ENTITY_ID_FLAG_NEXT;
+ entity->info.id = id | MEDIA_ENT_ID_FLAG_NEXT;
ret = ioctl(media->fd, MEDIA_IOC_ENUM_ENTITIES, &entity->info);
if (ret < 0) {
@@ -287,8 +287,8 @@ static int media_enum_entities(struct media_device *media)
media->entities_count++;
/* Find the corresponding device name. */
- if (media_entity_type(entity) != MEDIA_ENTITY_TYPE_DEVNODE &&
- media_entity_type(entity) != MEDIA_ENTITY_TYPE_V4L2_SUBDEV)
+ if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE &&
+ media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV)
continue;
sprintf(sysname, "/sys/dev/char/%u:%u", entity->info.v4l.major,
diff --git a/src/media.h b/src/media.h
index 80cf976..b91a2ac 100644
--- a/src/media.h
+++ b/src/media.h
@@ -100,7 +100,7 @@ struct media_pad *media_entity_remote_source(struct media_pad *pad);
*/
static inline unsigned int media_entity_type(struct media_entity *entity)
{
- return entity->info.type & MEDIA_ENTITY_TYPE_MASK;
+ return entity->info.type & MEDIA_ENT_TYPE_MASK;
}
/**