diff options
Diffstat (limited to 'drivers/media/pci/ivtv/ivtv-ioctl.c')
-rw-r--r-- | drivers/media/pci/ivtv/ivtv-ioctl.c | 7 |
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 4e40c4e301ed..0b0250a7583f 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, | |||
289 | case V4L2_DEC_CMD_PAUSE: | 289 | case V4L2_DEC_CMD_PAUSE: |
290 | dc->flags &= V4L2_DEC_CMD_PAUSE_TO_BLACK; | 290 | dc->flags &= V4L2_DEC_CMD_PAUSE_TO_BLACK; |
291 | if (try) break; | 291 | if (try) break; |
292 | if (!atomic_read(&itv->decoding)) | ||
293 | return -EPERM; | ||
292 | if (itv->output_mode != OUT_MPG) | 294 | if (itv->output_mode != OUT_MPG) |
293 | return -EBUSY; | 295 | return -EBUSY; |
294 | if (atomic_read(&itv->decoding) > 0) { | 296 | if (atomic_read(&itv->decoding) > 0) { |
@@ -301,6 +303,8 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
301 | case V4L2_DEC_CMD_RESUME: | 303 | case V4L2_DEC_CMD_RESUME: |
302 | dc->flags = 0; | 304 | dc->flags = 0; |
303 | if (try) break; | 305 | if (try) break; |
306 | if (!atomic_read(&itv->decoding)) | ||
307 | return -EPERM; | ||
304 | if (itv->output_mode != OUT_MPG) | 308 | if (itv->output_mode != OUT_MPG) |
305 | return -EBUSY; | 309 | return -EBUSY; |
306 | if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) { | 310 | 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 | |||
1250 | if (entries > V4L2_ENC_IDX_ENTRIES) | 1254 | if (entries > V4L2_ENC_IDX_ENTRIES) |
1251 | entries = V4L2_ENC_IDX_ENTRIES; | 1255 | entries = V4L2_ENC_IDX_ENTRIES; |
1252 | idx->entries = 0; | 1256 | idx->entries = 0; |
1257 | idx->entries_cap = IVTV_MAX_PGM_INDEX; | ||
1258 | if (!atomic_read(&itv->capturing)) | ||
1259 | return 0; | ||
1253 | for (i = 0; i < entries; i++) { | 1260 | for (i = 0; i < entries; i++) { |
1254 | *e = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX]; | 1261 | *e = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX]; |
1255 | if ((e->flags & V4L2_ENC_IDX_FRAME_MASK) <= V4L2_ENC_IDX_FRAME_B) { | 1262 | if ((e->flags & V4L2_ENC_IDX_FRAME_MASK) <= V4L2_ENC_IDX_FRAME_B) { |