All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com
Subject: [media-ctl PATCH 3/3] Compose rectangle support for media-ctl
Date: Fri,  4 May 2012 11:24:43 +0300	[thread overview]
Message-ID: <1336119883-14978-3-git-send-email-sakari.ailus@iki.fi> (raw)
In-Reply-To: <1336119883-14978-1-git-send-email-sakari.ailus@iki.fi>

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
---
 src/main.c       |   14 ++++++++++++++
 src/options.c    |    6 ++++--
 src/v4l2subdev.c |   22 ++++++++++++++++++----
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/src/main.c b/src/main.c
index 6de1031..6362f3e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -77,6 +77,20 @@ static void v4l2_subdev_print_format(struct media_entity *entity,
 		printf("\n\t\t crop.actual:%u,%u/%ux%u", rect.left, rect.top,
 		       rect.width, rect.height);
 
+	ret = v4l2_subdev_get_selection(entity, &rect, pad,
+					V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS,
+					which);
+	if (ret == 0)
+		printf("\n\t\t compose.bounds:%u,%u/%ux%u",
+		       rect.left, rect.top, rect.width, rect.height);
+
+	ret = v4l2_subdev_get_selection(entity, &rect, pad,
+					V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL,
+					which);
+	if (ret == 0)
+		printf("\n\t\t compose.actual:%u,%u/%ux%u",
+		       rect.left, rect.top, rect.width, rect.height);
+
 	printf("]");
 }
 
diff --git a/src/options.c b/src/options.c
index 4d9d48f..c0b3d3b 100644
--- a/src/options.c
+++ b/src/options.c
@@ -55,13 +55,15 @@ static void usage(const char *argv0, int verbose)
 	printf("\tlink            = pad, '->', pad, '[', flags, ']' ;\n");
 	printf("\tformat          = pad, '[', formats ']' ;\n");
 	printf("\tformats         = formats ',' formats ;\n");
-	printf("\tformats         = fmt | crop | frame interval ;\n");
+	printf("\tformats         = fmt | crop | compose | frame interval ;\n");
 	printf("\fmt              = 'fmt:', fcc, '/', size ;\n");
 	printf("\tpad             = entity, ':', pad number ;\n");
 	printf("\tentity          = entity number | ( '\"', entity name, '\"' ) ;\n");
 	printf("\tsize            = width, 'x', height ;\n");
-	printf("\tcrop            = 'crop.actual:', left, ',', top, '/', size ;\n");
+	printf("\tcrop            = 'crop.actual:', window ;\n");
+	printf("\tcompose         = 'compose.actual:', window ;\n");
 	printf("\tframe interval  = '@', numerator, '/', denominator ;\n");
+	printf("\twindow          = left, ',', top, '/', size ;\n");
 	printf("where the fields are\n");
 	printf("\tentity number   Entity numeric identifier\n");
 	printf("\tentity name     Entity name (string) \n");
diff --git a/src/v4l2subdev.c b/src/v4l2subdev.c
index 87b22fc..8e3a447 100644
--- a/src/v4l2subdev.c
+++ b/src/v4l2subdev.c
@@ -317,8 +317,8 @@ static int strhazit(const char *str, const char **p)
 
 static struct media_pad *v4l2_subdev_parse_pad_format(
 	struct media_device *media, struct v4l2_mbus_framefmt *format,
-	struct v4l2_rect *crop, struct v4l2_fract *interval, const char *p,
-	char **endp)
+	struct v4l2_rect *crop, struct v4l2_rect *compose,
+	struct v4l2_fract *interval, const char *p, char **endp)
 {
 	struct media_pad *pad;
 	char *end;
@@ -355,6 +355,15 @@ static struct media_pad *v4l2_subdev_parse_pad_format(
 			continue;
 		}
 
+		if (!strhazit("compose.actual:", &p)) {
+			ret = v4l2_subdev_parse_rectangle(compose, p, &end);
+			if (ret < 0)
+				return NULL;
+
+			for (p = end; isspace(*p); p++);
+			continue;
+		}
+
 		if (*p == '@') {
 			ret = v4l2_subdev_parse_frame_interval(interval, ++p, &end);
 			if (ret < 0)
@@ -468,13 +477,14 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media,
 	struct v4l2_mbus_framefmt format = { 0, 0, 0 };
 	struct media_pad *pad;
 	struct v4l2_rect crop = { -1, -1, -1, -1 };
+	struct v4l2_rect compose = crop;
 	struct v4l2_fract interval = { 0, 0 };
 	unsigned int i;
 	char *end;
 	int ret;
 
-	pad = v4l2_subdev_parse_pad_format(media, &format, &crop, &interval,
-					   p, &end);
+	pad = v4l2_subdev_parse_pad_format(media, &format, &crop, &compose,
+					   &interval, p, &end);
 	if (pad == NULL) {
 		media_dbg(media, "Unable to parse format\n");
 		return -EINVAL;
@@ -490,6 +500,10 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media,
 	if (ret < 0)
 		return ret;
 
+	ret = set_selection(pad, V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL, &compose);
+	if (ret < 0)
+		return ret;
+
 	if (pad->flags & MEDIA_PAD_FL_SOURCE) {
 		ret = set_format(pad, &format);
 		if (ret < 0)
-- 
1.7.2.5


  parent reply	other threads:[~2012-05-04  8:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04  8:24 [media-ctl PATCH 1/3] Support selections API for crop Sakari Ailus
2012-05-04  8:24 ` [media-ctl PATCH 2/3] New, more flexible syntax for media-ctl Sakari Ailus
2012-05-05 12:22   ` Laurent Pinchart
2012-05-05 13:09     ` Sakari Ailus
2012-05-05 22:54       ` Laurent Pinchart
2012-05-06 18:14         ` Sakari Ailus
2012-05-07 10:44           ` Laurent Pinchart
2012-05-07 12:29             ` Sakari Ailus
2012-05-04  8:24 ` Sakari Ailus [this message]
2012-05-05 11:39 ` [media-ctl PATCH 1/3] Support selections API for crop Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336119883-14978-3-git-send-email-sakari.ailus@iki.fi \
    --to=sakari.ailus@iki.fi \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.