diff mbox

[2/4] media-ctl: print the configured frame interval

Message ID 20170207160850.10299-3-p.zabel@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Philipp Zabel Feb. 7, 2017, 4:08 p.m. UTC
After the pad format, also print the frame interval, if already configured.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 utils/media-ctl/media-ctl.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Sakari Ailus Feb. 12, 2017, 10:38 p.m. UTC | #1
On Tue, Feb 07, 2017 at 05:08:48PM +0100, Philipp Zabel wrote:
> After the pad format, also print the frame interval, if already configured.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
diff mbox

Patch

diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
index 50adbe91..1be880c6 100644
--- a/utils/media-ctl/media-ctl.c
+++ b/utils/media-ctl/media-ctl.c
@@ -79,6 +79,7 @@  static void v4l2_subdev_print_format(struct media_entity *entity,
 	unsigned int pad, enum v4l2_subdev_format_whence which)
 {
 	struct v4l2_mbus_framefmt format;
+	struct v4l2_fract interval = { 0, 0 };
 	struct v4l2_rect rect;
 	int ret;
 
@@ -86,10 +87,17 @@  static void v4l2_subdev_print_format(struct media_entity *entity,
 	if (ret != 0)
 		return;
 
+	ret = v4l2_subdev_get_frame_interval(entity, &interval, pad);
+	if (ret != 0 && ret != -ENOTTY)
+		return;
+
 	printf("\t\t[fmt:%s/%ux%u",
 	       v4l2_subdev_pixelcode_to_string(format.code),
 	       format.width, format.height);
 
+	if (interval.numerator || interval.denominator)
+		printf("@%u/%u", interval.numerator, interval.denominator);
+
 	if (format.field)
 		printf(" field:%s", v4l2_subdev_field_to_string(format.field));