media: vicodec: support SOURCE_CHANGE event for decoders only

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>
This commit is contained in:
Hans Verkuil 2019-01-31 08:21:44 -05:00 committed by Mauro Carvalho Chehab
parent 281ae39b60
commit 69a9005789
1 changed files with 6 additions and 1 deletions

View File

@ -1118,9 +1118,14 @@ static int vicodec_enum_framesizes(struct file *file, void *fh,
static int vicodec_subscribe_event(struct v4l2_fh *fh, static int vicodec_subscribe_event(struct v4l2_fh *fh,
const struct v4l2_event_subscription *sub) const struct v4l2_event_subscription *sub)
{ {
struct vicodec_ctx *ctx = container_of(fh, struct vicodec_ctx, fh);
switch (sub->type) { switch (sub->type) {
case V4L2_EVENT_EOS:
case V4L2_EVENT_SOURCE_CHANGE: 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); return v4l2_event_subscribe(fh, sub, 0, NULL);
default: default:
return v4l2_ctrl_subscribe_event(fh, sub); return v4l2_ctrl_subscribe_event(fh, sub);