Don't set formats on remote pads if the remote entity is not a subdev
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 20 May 2010 22:45:48 +0000 (00:45 +0200)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 20 May 2010 22:45:48 +0000 (00:45 +0200)
When setting format on an output pad, the same format is automatically
set on the remote pads, if any. As the format setting API is
subdev-specific, skip remote pads that belong to a non-subdev entity.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
main.c

diff --git a/main.c b/main.c
index 40058fe..fad538d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -300,7 +300,7 @@ static int setup_format(struct media_device *media, const char *p, char **endp)
                return ret;
 
        /* If the pad is an output pad, automatically set the same format on
-        * the remote inputs, if any.
+        * the remote subdev input pads, if any.
         */
        if (pad->type == MEDIA_PAD_TYPE_OUTPUT) {
                for (i = 0; i < pad->entity->info.links; ++i) {
@@ -310,7 +310,8 @@ static int setup_format(struct media_device *media, const char *p, char **endp)
                        if (!(link->flags & MEDIA_LINK_FLAG_ACTIVE))
                                continue;
 
-                       if (link->source == pad) {
+                       if (link->source == pad &&
+                           link->sink->entity->info.type == MEDIA_ENTITY_TYPE_SUBDEV) {
                                remote_format = format;
                                set_format(link->sink, &remote_format);
                        }