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>
__u32 type;
const char *name;
} types[] = {
__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" },
- type &= MEDIA_ENTITY_TYPE_MASK;
+ type &= MEDIA_ENT_TYPE_MASK;
for (i = 0; i < ARRAY_SIZE(types); i++) {
if (types[i].type == type)
for (i = 0; i < ARRAY_SIZE(types); i++) {
if (types[i].type == type)
- 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];
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];
if (subtype >= ARRAY_SIZE(subdev_types))
subtype = 0;
return subdev_types[subtype];
__u32 flag;
const char *name;
} flags[] = {
__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 npads;
switch (media_entity_type(entity)) {
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;
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) {
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);
continue;
printf("%s<port%u> %u", npads ? " | " : "", j, j);
printf(" | {");
for (j = 0, npads = 0; j < entity->info.pads; ++j) {
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);
continue;
printf("%s<port%u> %u", npads ? " | " : "", j, j);
continue;
printf("\tn%08x", link->source->entity->info.id);
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);
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);
printf(":port%u", link->sink->index);
- if (link->flags & MEDIA_LINK_FLAG_IMMUTABLE)
+ if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
- else if (!(link->flags & MEDIA_LINK_FLAG_ENABLED))
+ else if (!(link->flags & MEDIA_LNK_FL_ENABLED))
printf(" [style=dashed]");
printf("\n");
}
printf(" [style=dashed]");
printf("\n");
}
printf("\tpad%u: %s ", j, media_pad_type_to_string(pad->flags));
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");
v4l2_subdev_print_format(entity, j, V4L2_SUBDEV_FORMAT_ACTIVE);
printf("\n");
- if (link->flags & MEDIA_LINK_FLAG_IMMUTABLE)
+ if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
- if (link->flags & MEDIA_LINK_FLAG_ENABLED)
+ if (link->flags & MEDIA_LNK_FL_ENABLED)
printf("ACTIVE");
printf("]\n");
printf("ACTIVE");
printf("]\n");
- if (pad->flags & MEDIA_PAD_FLAG_OUTPUT) {
+ if (pad->flags & MEDIA_PAD_FL_SOURCE) {
ret = set_crop(pad, &crop);
if (ret < 0)
return ret;
ret = set_crop(pad, &crop);
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;
ret = set_crop(pad, &crop);
if (ret < 0)
return ret;
/* If the pad is an output pad, automatically set the same format on
* the remote subdev input pads, if any.
*/
/* 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;
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 &&
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);
}
remote_format = format;
set_format(link->sink, &remote_format);
}
- 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];
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)
continue;
if (link->sink == pad)
/* source pad */
ulink.source.entity = source->entity->info.id;
ulink.source.index = source->index;
/* 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;
/* 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) {
ret = ioctl(media->fd, MEDIA_IOC_SETUP_LINK, &ulink);
if (ret < 0) {
for (j = 0; j < entity->num_links; j++) {
struct media_link *link = &entity->links[j];
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->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;
}
if (ret < 0)
return ret;
}
entity = &media->entities[media->entities_count];
memset(entity, 0, sizeof(*entity));
entity->fd = -1;
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) {
ret = ioctl(media->fd, MEDIA_IOC_ENUM_ENTITIES, &entity->info);
if (ret < 0) {
media->entities_count++;
/* Find the corresponding device name. */
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,
continue;
sprintf(sysname, "/sys/dev/char/%u:%u", entity->info.v4l.major,
*/
static inline unsigned int media_entity_type(struct media_entity *entity)
{
*/
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;