summaryrefslogtreecommitdiff
path: root/media.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-08-11 09:28:09 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-08-11 10:51:10 +0200
commita753dba7ed68896912f291f7ca01edb85a66db75 (patch)
treefc4e03efbbcfde0c876df896513cdfd387d22ef6 /media.c
parent74004e698ba7479d2cab0ecb5c2259d44072f6e0 (diff)
Add a --get-format option
The option takes a pad name as argument and returns the active format (and optional crop settings if available) for that pad. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'media.c')
-rw-r--r--media.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/media.c b/media.c
index 05fc76c..aaa1005 100644
--- a/media.c
+++ b/media.c
@@ -315,7 +315,6 @@ static void media_print_topology_text(struct media_device *media)
{
unsigned int i, j, k;
unsigned int padding;
- int ret;
printf("Device topology\n");
@@ -334,26 +333,11 @@ static void media_print_topology_text(struct media_device *media)
for (j = 0; j < entity->info.pads; j++) {
struct media_entity_pad *pad = &entity->pads[j];
- struct v4l2_mbus_framefmt format;
- struct v4l2_rect rect;
-
- printf("\tpad%u: %s", j, media_pad_type_to_string(pad->type));
-
- if (entity->info.type == MEDIA_ENTITY_TYPE_SUBDEV) {
- ret = v4l2_subdev_get_format(entity, &format, j,
- V4L2_SUBDEV_FORMAT_ACTIVE);
- if (ret == 0) {
- printf(" [%s %ux%u", pixelcode_to_string(format.code),
- format.width, format.height);
-
- ret = v4l2_subdev_get_crop(entity, &rect, j,
- V4L2_SUBDEV_FORMAT_ACTIVE);
- if (ret == 0)
- printf(" (%u,%u)/%ux%u", rect.left, rect.top,
- rect.width, rect.height);
- printf("]");
- }
- }
+
+ printf("\tpad%u: %s ", j, media_pad_type_to_string(pad->type));
+
+ if (entity->info.type == MEDIA_ENTITY_TYPE_SUBDEV)
+ v4l2_subdev_print_format(entity, j, V4L2_SUBDEV_FORMAT_ACTIVE);
printf("\n");