summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-09-05 08:39:48 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-01 17:13:32 -0300
commit1a806401656129e5fed10da24973e59e9f1d2e88 (patch)
treec2225570ee174f87a98c37f23f08e8b8e4f8ecf4 /drivers/media
parent30634e8e41d413b0084ba29f843361a1fd9fbdce (diff)
[media] ivtv: DECODER_CMD v4l2-compliance fixes
VIDIOC_DECODER_CMD didn't return EPERM when calling PAUSE or RESUME if no decoding is in progress. VIDIOC_G_ENC_INDEX didn't set entries_cap or return 0 if no decoding was in progress. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/pci/ivtv/ivtv-ioctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 4e40c4e301e..0b0250a7583 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -289,6 +289,8 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
case V4L2_DEC_CMD_PAUSE:
dc->flags &= V4L2_DEC_CMD_PAUSE_TO_BLACK;
if (try) break;
+ if (!atomic_read(&itv->decoding))
+ return -EPERM;
if (itv->output_mode != OUT_MPG)
return -EBUSY;
if (atomic_read(&itv->decoding) > 0) {
@@ -301,6 +303,8 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
case V4L2_DEC_CMD_RESUME:
dc->flags = 0;
if (try) break;
+ if (!atomic_read(&itv->decoding))
+ return -EPERM;
if (itv->output_mode != OUT_MPG)
return -EBUSY;
if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
@@ -1250,6 +1254,9 @@ static int ivtv_g_enc_index(struct file *file, void *fh, struct v4l2_enc_idx *id
if (entries > V4L2_ENC_IDX_ENTRIES)
entries = V4L2_ENC_IDX_ENTRIES;
idx->entries = 0;
+ idx->entries_cap = IVTV_MAX_PGM_INDEX;
+ if (!atomic_read(&itv->capturing))
+ return 0;
for (i = 0; i < entries; i++) {
*e = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX];
if ((e->flags & V4L2_ENC_IDX_FRAME_MASK) <= V4L2_ENC_IDX_FRAME_B) {