From abdf840de983369cc3e65364304fb761c015d5b1 Mon Sep 17 00:00:00 2001
From: Todor Tomov <ttomov@mm-sol.com>
Date: Thu, 12 Aug 2010 13:55:33 +0300
Subject: Change crop rectangle format from L,T/WxH to (L,T)/WxH

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 main.c    | 7 +++++--
 options.c | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c
index e143b8c..ec1ff1f 100644
--- a/main.c
+++ b/main.c
@@ -209,7 +209,8 @@ static int parse_crop(struct v4l2_rect *crop, const char *p, char **endp)
 {
 	char *end;
 
-	for (; isspace(*p); ++p);
+	if (*p++ != '(')
+		return -EINVAL;
 
 	crop->left = strtoul(p, &end, 10);
 	if (*end != ',')
@@ -217,6 +218,8 @@ static int parse_crop(struct v4l2_rect *crop, const char *p, char **endp)
 
 	p = end + 1;
 	crop->top = strtoul(p, &end, 10);
+	if (*end++ != ')')
+		return -EINVAL;
 	if (*end != '/')
 		return -EINVAL;
 
@@ -274,7 +277,7 @@ static struct media_entity_pad *parse_pad_format(struct media_device *media,
 		return NULL;
 
 	for (p = end; isspace(*p); p++);
-	if (isdigit(*p)) {
+	if (*p == '(') {
 		ret = parse_crop(crop, p, &end);
 		if (ret < 0)
 			return NULL;
diff --git a/options.c b/options.c
index f4a551b..4f8df71 100644
--- a/options.c
+++ b/options.c
@@ -55,7 +55,7 @@ static void usage(const char *argv0, int verbose)
 	printf("\tpad             = entity, ':', pad number ;\n");
 	printf("\tentity          = entity number | ( '\"', entity name, '\"' ) ;\n");
 	printf("\tsize            = width, 'x', height ;\n");
-	printf("\tcrop            = left, ',', top, '/', size ;\n");
+	printf("\tcrop            = '(', left, ',', top, ')', '/', size ;\n");
 	printf("\tframe interval  = numerator, '/', denominator ;\n");
 	printf("where the fields are\n");
 	printf("\tentity number   Entity numeric identifier\n");
-- 
cgit v1.2.3