diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2010-08-11 09:28:09 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2010-08-11 10:51:10 +0200 |
commit | a753dba7ed68896912f291f7ca01edb85a66db75 (patch) | |
tree | fc4e03efbbcfde0c876df896513cdfd387d22ef6 /subdev.c | |
parent | 74004e698ba7479d2cab0ecb5c2259d44072f6e0 (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 'subdev.c')
-rw-r--r-- | subdev.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -198,3 +198,25 @@ int v4l2_subdev_set_frame_interval(struct media_entity *entity, *interval = ival.interval; return 0; } + +void v4l2_subdev_print_format(struct media_entity *entity, + unsigned int pad, enum v4l2_subdev_format which) +{ + struct v4l2_mbus_framefmt format; + struct v4l2_rect rect; + int ret; + + ret = v4l2_subdev_get_format(entity, &format, pad, which); + if (ret != 0) + return; + + printf("[%s %ux%u", pixelcode_to_string(format.code), + format.width, format.height); + + ret = v4l2_subdev_get_crop(entity, &rect, pad, which); + if (ret == 0) + printf(" (%u,%u)/%ux%u", rect.left, rect.top, + rect.width, rect.height); + printf("]"); +} + |