aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-01-13 17:36:11 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:56 -0500
commitdfd8c04ec14b88bc2849e62d6ff9e36f31352b60 (patch)
tree896b74bee1a5c24b9854e32f3966aa9cc2aef8d0
parentc8793b035df7b18997d1cf34254064dac166f009 (diff)
V4L/DVB (7022): Fix timestamp presentation on vivi driver
Due to date overflow, vivi were not working fine anymore. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/vivi.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index c9d23633fe42..1db067c02815 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -173,7 +173,8 @@ struct vivi_dev {
173 struct vivi_dmaqueue vidq; 173 struct vivi_dmaqueue vidq;
174 174
175 /* Several counters */ 175 /* Several counters */
176 int h, m, s, us, jiffies; 176 int h, m, s, ms;
177 unsigned long jiffies;
177 char timestr[13]; 178 char timestr[13];
178 179
179 int mv_count; /* Controls bars movement */ 180 int mv_count; /* Controls bars movement */
@@ -348,10 +349,10 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf)
348 349
349 /* Updates stream time */ 350 /* Updates stream time */
350 351
351 dev->us += jiffies_to_usecs(jiffies-dev->jiffies); 352 dev->ms += jiffies_to_msecs(jiffies-dev->jiffies);
352 dev->jiffies = jiffies; 353 dev->jiffies = jiffies;
353 if (dev->us >= 1000000) { 354 if (dev->ms >= 1000) {
354 dev->us -= 1000000; 355 dev->ms -= 1000;
355 dev->s++; 356 dev->s++;
356 if (dev->s >= 60) { 357 if (dev->s >= 60) {
357 dev->s -= 60; 358 dev->s -= 60;
@@ -365,7 +366,7 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf)
365 } 366 }
366 } 367 }
367 sprintf(dev->timestr, "%02d:%02d:%02d:%03d", 368 sprintf(dev->timestr, "%02d:%02d:%02d:%03d",
368 dev->h, dev->m, dev->s, (dev->us + 500) / 1000); 369 dev->h, dev->m, dev->s, dev->ms);
369 370
370 dprintk(dev, 2, "vivifill at %s: Buffer 0x%08lx size= %d\n", 371 dprintk(dev, 2, "vivifill at %s: Buffer 0x%08lx size= %d\n",
371 dev->timestr, (unsigned long)tmpbuf, pos); 372 dev->timestr, (unsigned long)tmpbuf, pos);
@@ -1073,11 +1074,11 @@ found:
1073 dev->h = 0; 1074 dev->h = 0;
1074 dev->m = 0; 1075 dev->m = 0;
1075 dev->s = 0; 1076 dev->s = 0;
1076 dev->us = 0; 1077 dev->ms = 0;
1077 dev->mv_count = 0; 1078 dev->mv_count = 0;
1078 dev->jiffies = jiffies; 1079 dev->jiffies = jiffies;
1079 sprintf(dev->timestr, "%02d:%02d:%02d:%03d", 1080 sprintf(dev->timestr, "%02d:%02d:%02d:%03d",
1080 dev->h, dev->m, dev->s, (dev->us + 500) / 1000); 1081 dev->h, dev->m, dev->s, dev->ms);
1081 1082
1082 videobuf_queue_vmalloc_init(&fh->vb_vidq, &vivi_video_qops, 1083 videobuf_queue_vmalloc_init(&fh->vb_vidq, &vivi_video_qops,
1083 NULL, &dev->slock, fh->type, V4L2_FIELD_INTERLACED, 1084 NULL, &dev->slock, fh->type, V4L2_FIELD_INTERLACED,