From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: linux-media@vger.kernel.org
Cc: m.chehab@samsung.com, gjasny@googlemail.com, hdegoede@redhat.com,
hans.verkuil@cisco.com, b.zolnierkie@samsung.com,
sakari.ailus@linux.intel.com, kyungmin.park@samsung.com,
Jacek Anaszewski <j.anaszewski@samsung.com>
Subject: [v4l-utils RFC v3 06/11] mediactl: Add subdev_fmt property to the media_entity
Date: Thu, 06 Nov 2014 11:11:37 +0100 [thread overview]
Message-ID: <1415268702-23685-7-git-send-email-j.anaszewski@samsung.com> (raw)
In-Reply-To: <1415268702-23685-1-git-send-email-j.anaszewski@samsung.com>
Add subdev_fmt field to the structure media_entity.
Added is also API for setting the media_entity
format and comparing two subdev formats.
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
utils/media-ctl/libmediactl.c | 6 ++++++
utils/media-ctl/libv4l2subdev.c | 34 ++++++++++++++++++++++++++++++++++
utils/media-ctl/mediactl-priv.h | 3 +++
utils/media-ctl/mediactl.h | 12 ++++++++++++
utils/media-ctl/v4l2subdev.h | 12 ++++++++++++
5 files changed, 67 insertions(+)
diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
index 10f0491..27e7329 100644
--- a/utils/media-ctl/libmediactl.c
+++ b/utils/media-ctl/libmediactl.c
@@ -1260,3 +1260,9 @@ int media_entity_get_fd(struct media_entity *entity)
{
return entity->fd;
}
+
+void media_entity_set_subdev_fmt(struct media_entity *entity,
+ struct v4l2_subdev_format *fmt)
+{
+ entity->subdev_fmt = *fmt;
+}
diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index 99ac6b2..449565c 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -786,3 +786,37 @@ int v4l2_subdev_validate_v4l2_ctrl(struct media_device *media,
entity->info.name);
return 0;
}
+
+int v4l2_subdev_format_compare(struct v4l2_mbus_framefmt *fmt1,
+ struct v4l2_mbus_framefmt *fmt2)
+{
+ if (fmt1 == NULL || fmt2 == NULL)
+ return 0;
+
+ if (fmt1->width != fmt2->width) {
+ printf("width mismatch\n");
+ return 0;
+ }
+
+ if (fmt1->height != fmt2->height) {
+ printf("height mismatch\n");
+ return 0;
+ }
+
+ if (fmt1->code != fmt2->code) {
+ printf("mbus code mismatch\n");
+ return 0;
+ }
+
+ if (fmt1->field != fmt2->field) {
+ printf("field mismatch\n");
+ return 0;
+ }
+
+ if (fmt1->colorspace != fmt2->colorspace) {
+ printf("colorspace mismatch\n");
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/utils/media-ctl/mediactl-priv.h b/utils/media-ctl/mediactl-priv.h
index b9e9b20..b2c466b 100644
--- a/utils/media-ctl/mediactl-priv.h
+++ b/utils/media-ctl/mediactl-priv.h
@@ -23,6 +23,7 @@
#define __MEDIA_PRIV_H__
#include <linux/media.h>
+#include <linux/v4l2-subdev.h>
#include "mediactl.h"
@@ -34,6 +35,8 @@ struct media_entity {
unsigned int max_links;
unsigned int num_links;
+ struct v4l2_subdev_format subdev_fmt;
+
char devname[32];
int fd;
};
diff --git a/utils/media-ctl/mediactl.h b/utils/media-ctl/mediactl.h
index 0dc7f95..d28b0a8 100644
--- a/utils/media-ctl/mediactl.h
+++ b/utils/media-ctl/mediactl.h
@@ -42,6 +42,7 @@ struct media_pad {
struct media_device;
struct media_entity;
+struct v4l2_subdev_format;
/**
* @brief Create a new media device.
@@ -611,4 +612,15 @@ int media_entity_get_sink_pad_index(struct media_entity *entity);
*/
int media_entity_get_fd(struct media_entity *entity);
+/**
+ * @brief Set sub-device format
+ * @param entity - media entity
+ * @param fmt - pointer to the sub-device format structure
+ *
+ * This function sets the format of the sub-device related
+ * to this entity.
+ */
+void media_entity_set_subdev_fmt(struct media_entity *entity,
+ struct v4l2_subdev_format *fmt);
+
#endif
diff --git a/utils/media-ctl/v4l2subdev.h b/utils/media-ctl/v4l2subdev.h
index 3bc0412..2c9d507 100644
--- a/utils/media-ctl/v4l2subdev.h
+++ b/utils/media-ctl/v4l2subdev.h
@@ -270,4 +270,16 @@ int v4l2_subdev_validate_v4l2_ctrl(struct media_device *media,
struct media_entity *entity,
__u32 ctrl_id);
+/**
+ * @brief Compare mbus formats
+ * @param fmt1 - 1st mbus format to compare
+ * @param fmt2 - 2nd mbus format to compare
+ *
+ * Check whether two mbus formats are compatible.
+ *
+ * @return 1 if formats are compatible, 0 otherwise
+ */
+int v4l2_subdev_format_compare(struct v4l2_mbus_framefmt *fmt1,
+ struct v4l2_mbus_framefmt *fmt2);
+
#endif
--
1.7.9.5
next prev parent reply other threads:[~2014-11-06 10:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 10:11 [v4l-utils RFC v3 00/11] Add a plugin for the Exynos4 camera Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 01/11] mediactl: Introduce ctrl_to_subdev configuration Jacek Anaszewski
2014-11-06 12:20 ` Sakari Ailus
2014-11-06 10:11 ` [v4l-utils RFC v3 02/11] mediactl: Separate entity and pad parsing Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 03/11] mediatext: Add library Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 04/11] mediactl: Add media device graph helpers Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 05/11] mediactl: Add media_device creation helpers Jacek Anaszewski
2014-11-06 10:11 ` Jacek Anaszewski [this message]
2014-11-06 10:11 ` [v4l-utils RFC v3 07/11] mediactl: Add VYUY8_2X8 media bus format Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 08/11] mediactl: Add support for media device pipelines Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 09/11] mediactl: Add media device ioctl API Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 10/11] mediactl: Close only pipeline sub-devices Jacek Anaszewski
2014-11-06 10:11 ` [v4l-utils RFC v3 11/11] Add a libv4l plugin for Exynos4 camera Jacek Anaszewski
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=1415268702-23685-7-git-send-email-j.anaszewski@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=gjasny@googlemail.com \
--cc=hans.verkuil@cisco.com \
--cc=hdegoede@redhat.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=sakari.ailus@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox