diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2013-09-30 09:34:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-10-28 13:26:54 -0400 |
commit | 64ba40accce3e6bb916a36390d3e202085804da8 (patch) | |
tree | d0036b0c2c37589c0121b0abbb0f61ef4a2979ad /drivers/media/platform | |
parent | 57625593589b51fbe713bcf3dbc97a8d92c2277f (diff) |
[media] coda: v4l2-compliance fix: implement try_decoder_cmd
Implement try_decoder_cmd to let userspace determine available commands
and flags.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/coda.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 4820bd57ed40..b541c069ffe9 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -835,23 +835,34 @@ static int coda_streamoff(struct file *file, void *priv, | |||
835 | return ret; | 835 | return ret; |
836 | } | 836 | } |
837 | 837 | ||
838 | static int coda_decoder_cmd(struct file *file, void *fh, | 838 | static int coda_try_decoder_cmd(struct file *file, void *fh, |
839 | struct v4l2_decoder_cmd *dc) | 839 | struct v4l2_decoder_cmd *dc) |
840 | { | 840 | { |
841 | struct coda_ctx *ctx = fh_to_ctx(fh); | ||
842 | |||
843 | if (dc->cmd != V4L2_DEC_CMD_STOP) | 841 | if (dc->cmd != V4L2_DEC_CMD_STOP) |
844 | return -EINVAL; | 842 | return -EINVAL; |
845 | 843 | ||
846 | if ((dc->flags & V4L2_DEC_CMD_STOP_TO_BLACK) || | 844 | if (dc->flags & V4L2_DEC_CMD_STOP_TO_BLACK) |
847 | (dc->flags & V4L2_DEC_CMD_STOP_IMMEDIATELY)) | ||
848 | return -EINVAL; | 845 | return -EINVAL; |
849 | 846 | ||
850 | if (dc->stop.pts != 0) | 847 | if (!(dc->flags & V4L2_DEC_CMD_STOP_IMMEDIATELY) && (dc->stop.pts != 0)) |
851 | return -EINVAL; | 848 | return -EINVAL; |
852 | 849 | ||
850 | return 0; | ||
851 | } | ||
852 | |||
853 | static int coda_decoder_cmd(struct file *file, void *fh, | ||
854 | struct v4l2_decoder_cmd *dc) | ||
855 | { | ||
856 | struct coda_ctx *ctx = fh_to_ctx(fh); | ||
857 | int ret; | ||
858 | |||
859 | ret = coda_try_decoder_cmd(file, fh, dc); | ||
860 | if (ret < 0) | ||
861 | return ret; | ||
862 | |||
863 | /* Ignore decoder stop command silently in encoder context */ | ||
853 | if (ctx->inst_type != CODA_INST_DECODER) | 864 | if (ctx->inst_type != CODA_INST_DECODER) |
854 | return -EINVAL; | 865 | return 0; |
855 | 866 | ||
856 | /* Set the strem-end flag on this context */ | 867 | /* Set the strem-end flag on this context */ |
857 | ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG; | 868 | ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG; |
@@ -894,6 +905,7 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = { | |||
894 | .vidioc_streamon = coda_streamon, | 905 | .vidioc_streamon = coda_streamon, |
895 | .vidioc_streamoff = coda_streamoff, | 906 | .vidioc_streamoff = coda_streamoff, |
896 | 907 | ||
908 | .vidioc_try_decoder_cmd = coda_try_decoder_cmd, | ||
897 | .vidioc_decoder_cmd = coda_decoder_cmd, | 909 | .vidioc_decoder_cmd = coda_decoder_cmd, |
898 | 910 | ||
899 | .vidioc_subscribe_event = coda_subscribe_event, | 911 | .vidioc_subscribe_event = coda_subscribe_event, |