]> err.no Git - linux-2.6/commitdiff
V4L/DVB (5916): ivtv: fix pause/continue/play handling
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 22 Jul 2007 11:46:38 +0000 (08:46 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Mon, 30 Jul 2007 19:26:32 +0000 (16:26 -0300)
Pausing a decoder followed by a Play command would do nothing. Fixed.
Pausing a decoder running at non-standard speed following by a Continue
would reset the speed to 100%. Fixed.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/ivtv/ivtv-driver.h
drivers/media/video/ivtv/ivtv-fileops.c
drivers/media/video/ivtv/ivtv-ioctl.c

index 91b588d261ae2a2f81189ba08c14aa7631567573..8abb34a35816917c5af6392beb873020e387dafe 100644 (file)
@@ -417,6 +417,7 @@ struct ivtv_mailbox_data {
 #define IVTV_F_I_WORK_HANDLER_YUV  17  /* there is work to be done for YUV */
 #define IVTV_F_I_WORK_HANDLER_PIO  18  /* there is work to be done for PIO */
 #define IVTV_F_I_PIO              19   /* PIO in progress */
+#define IVTV_F_I_DEC_PAUSED       20   /* the decoder is paused */
 
 /* Event notifications */
 #define IVTV_F_I_EV_DEC_STOPPED           28   /* decoder stopped event */
index 8e97a938398f729fa7386da8bde213d1ecaa30e8..baa17cbee5e1b75aec14539ec7e57dac22c79af7 100644 (file)
@@ -757,6 +757,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
            itv->output_mode = OUT_NONE;
 
        itv->speed = 0;
+       clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
        ivtv_release_stream(s);
 }
 
index 4773453e8dab2b8e966523f2948965616ec3fdf6..047624b9e2717f0ded7af8e2403e908ee60c3091 100644 (file)
@@ -285,6 +285,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
 
                if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG)
                        return -EBUSY;
+               if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
+                       /* forces ivtv_set_speed to be called */
+                       itv->speed = 0;
+               }
                return ivtv_start_decoding(id, vc->play.speed);
        }
 
@@ -309,6 +313,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
                if (atomic_read(&itv->decoding) > 0) {
                        ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1,
                                (vc->flags & VIDEO_CMD_FREEZE_TO_BLACK) ? 1 : 0);
+                       set_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
                }
                break;
 
@@ -317,8 +322,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
                if (try) break;
                if (itv->output_mode != OUT_MPG)
                        return -EBUSY;
-               if (atomic_read(&itv->decoding) > 0) {
-                       ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, 0, 0);
+               if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
+                       int speed = itv->speed;
+                       itv->speed = 0;
+                       return ivtv_start_decoding(id, speed);
                }
                break;