diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-03-10 16:29:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:44:29 -0400 |
commit | 25415cf3b8b3982b065e2227f079ea9cf7a97ef7 (patch) | |
tree | b516992ea40951cb161675f8c777f42c9e265fd4 /drivers/media/video/ivtv | |
parent | d4e7ee36f988d2757c218d61c2f334df0a1acd45 (diff) |
V4L/DVB (5412): Fix VIDIOC_TRY_ENCODER_CMD and VIDEO_TRY_COMMAND
VIDIOC_TRY_ENCODER_CMD did the same as VIDIOC_ENCODER_CMD, now it no longer
touches the encoder.
Both the encoder and decoder commands did not clear the flags field of unknown
flags.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 2a4edb150d3e..afb3702ed404 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -277,6 +277,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
277 | 277 | ||
278 | switch (vc->cmd) { | 278 | switch (vc->cmd) { |
279 | case VIDEO_CMD_PLAY: { | 279 | case VIDEO_CMD_PLAY: { |
280 | vc->flags = 0; | ||
280 | vc->play.speed = ivtv_validate_speed(itv->speed, vc->play.speed); | 281 | vc->play.speed = ivtv_validate_speed(itv->speed, vc->play.speed); |
281 | if (vc->play.speed < 0) | 282 | if (vc->play.speed < 0) |
282 | vc->play.format = VIDEO_PLAY_FMT_GOP; | 283 | vc->play.format = VIDEO_PLAY_FMT_GOP; |
@@ -288,6 +289,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
288 | } | 289 | } |
289 | 290 | ||
290 | case VIDEO_CMD_STOP: | 291 | case VIDEO_CMD_STOP: |
292 | vc->flags &= ~(VIDEO_CMD_STOP_IMMEDIATELY|VIDEO_CMD_STOP_TO_BLACK); | ||
291 | if (vc->flags & VIDEO_CMD_STOP_IMMEDIATELY) | 293 | if (vc->flags & VIDEO_CMD_STOP_IMMEDIATELY) |
292 | vc->stop.pts = 0; | 294 | vc->stop.pts = 0; |
293 | if (try) break; | 295 | if (try) break; |
@@ -300,6 +302,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
300 | return ivtv_stop_v4l2_decode_stream(s, vc->flags, vc->stop.pts); | 302 | return ivtv_stop_v4l2_decode_stream(s, vc->flags, vc->stop.pts); |
301 | 303 | ||
302 | case VIDEO_CMD_FREEZE: | 304 | case VIDEO_CMD_FREEZE: |
305 | vc->flags &= ~VIDEO_CMD_FREEZE_TO_BLACK; | ||
303 | if (try) break; | 306 | if (try) break; |
304 | if (itv->output_mode != OUT_MPG) | 307 | if (itv->output_mode != OUT_MPG) |
305 | return -EBUSY; | 308 | return -EBUSY; |
@@ -310,6 +313,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
310 | break; | 313 | break; |
311 | 314 | ||
312 | case VIDEO_CMD_CONTINUE: | 315 | case VIDEO_CMD_CONTINUE: |
316 | vc->flags = 0; | ||
313 | if (try) break; | 317 | if (try) break; |
314 | if (itv->output_mode != OUT_MPG) | 318 | if (itv->output_mode != OUT_MPG) |
315 | return -EBUSY; | 319 | return -EBUSY; |
@@ -1082,15 +1086,25 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1082 | struct v4l2_encoder_cmd *enc = arg; | 1086 | struct v4l2_encoder_cmd *enc = arg; |
1083 | int try = cmd == VIDIOC_TRY_ENCODER_CMD; | 1087 | int try = cmd == VIDIOC_TRY_ENCODER_CMD; |
1084 | 1088 | ||
1089 | memset(&enc->raw, 0, sizeof(enc->raw)); | ||
1085 | switch (enc->cmd) { | 1090 | switch (enc->cmd) { |
1086 | case V4L2_ENC_CMD_START: | 1091 | case V4L2_ENC_CMD_START: |
1092 | enc->flags = 0; | ||
1093 | if (try) | ||
1094 | return 0; | ||
1087 | return ivtv_start_capture(id); | 1095 | return ivtv_start_capture(id); |
1088 | 1096 | ||
1089 | case V4L2_ENC_CMD_STOP: | 1097 | case V4L2_ENC_CMD_STOP: |
1098 | enc->flags &= ~V4L2_ENC_CMD_STOP_AT_GOP_END; | ||
1099 | if (try) | ||
1100 | return 0; | ||
1090 | ivtv_stop_capture(id, enc->flags & V4L2_ENC_CMD_STOP_AT_GOP_END); | 1101 | ivtv_stop_capture(id, enc->flags & V4L2_ENC_CMD_STOP_AT_GOP_END); |
1091 | return 0; | 1102 | return 0; |
1092 | 1103 | ||
1093 | case V4L2_ENC_CMD_PAUSE: | 1104 | case V4L2_ENC_CMD_PAUSE: |
1105 | enc->flags = 0; | ||
1106 | if (try) | ||
1107 | return 0; | ||
1094 | if (!atomic_read(&itv->capturing)) | 1108 | if (!atomic_read(&itv->capturing)) |
1095 | return -EPERM; | 1109 | return -EPERM; |
1096 | if (test_and_set_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags)) | 1110 | if (test_and_set_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags)) |
@@ -1100,6 +1114,9 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1100 | break; | 1114 | break; |
1101 | 1115 | ||
1102 | case V4L2_ENC_CMD_RESUME: | 1116 | case V4L2_ENC_CMD_RESUME: |
1117 | enc->flags = 0; | ||
1118 | if (try) | ||
1119 | return 0; | ||
1103 | if (!atomic_read(&itv->capturing)) | 1120 | if (!atomic_read(&itv->capturing)) |
1104 | return -EPERM; | 1121 | return -EPERM; |
1105 | if (!test_and_clear_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags)) | 1122 | if (!test_and_clear_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags)) |
@@ -1107,6 +1124,8 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1107 | ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 1); | 1124 | ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 1); |
1108 | ivtv_unmute(itv); | 1125 | ivtv_unmute(itv); |
1109 | break; | 1126 | break; |
1127 | default: | ||
1128 | return -EINVAL; | ||
1110 | } | 1129 | } |
1111 | break; | 1130 | break; |
1112 | } | 1131 | } |