]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: vicodec: support SOURCE_CHANGE event for decoders only
authorHans Verkuil <hverkuil@xs4all.nl>
Thu, 31 Jan 2019 13:21:44 +0000 (08:21 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 7 Feb 2019 16:51:08 +0000 (11:51 -0500)
The SOURCE_CHANGE event is decoder specific, so don't allow it for
encoders.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vicodec/vicodec-core.c

index b5a9dee94c91cadd202020945cf3a0d1a6d4dcc3..212da185e4f2b98f9dcabd96fbe27b9f77870d25 100644 (file)
@@ -1118,9 +1118,14 @@ static int vicodec_enum_framesizes(struct file *file, void *fh,
 static int vicodec_subscribe_event(struct v4l2_fh *fh,
                                const struct v4l2_event_subscription *sub)
 {
+       struct vicodec_ctx *ctx = container_of(fh, struct vicodec_ctx, fh);
+
        switch (sub->type) {
-       case V4L2_EVENT_EOS:
        case V4L2_EVENT_SOURCE_CHANGE:
+               if (ctx->is_enc)
+                       return -EINVAL;
+               /* fall through */
+       case V4L2_EVENT_EOS:
                return v4l2_event_subscribe(fh, sub, 0, NULL);
        default:
                return v4l2_ctrl_subscribe_event(fh, sub);