diff dv.c @ 1629:aedce96c28ff libavformat

* Fixing seeking with DV-AVI (by Jeff Downs <heydowns at borg dot com>)
author romansh
date Thu, 11 Jan 2007 22:32:19 +0000
parents 0899bfe4105c
children a81bd08b5ff2
line wrap: on
line diff
--- a/dv.c	Wed Jan 10 10:30:03 2007 +0000
+++ b/dv.c	Thu Jan 11 22:32:19 2007 +0000
@@ -358,8 +358,13 @@
     return offset;
 }
 
-void dv_flush_audio_packets(DVDemuxContext *c)
+void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
 {
+    c->frames= frame_offset;
+    if (c->ach)
+        c->abytes= av_rescale(c->frames,
+                          c->ast[0]->codec->bit_rate * (int64_t)c->sys->frame_rate_base,
+                          8*c->sys->frame_rate);
     c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
 }
 
@@ -419,13 +424,8 @@
     DVDemuxContext *c = r->dv_demux;
     int64_t offset= dv_frame_offset(s, c, timestamp, flags);
 
-    c->frames= offset / c->sys->frame_size;
-    if (c->ach)
-        c->abytes= av_rescale(c->frames,
-                          c->ast[0]->codec->bit_rate * (int64_t)c->sys->frame_rate_base,
-                          8*c->sys->frame_rate);
+    dv_offset_reset(c, offset / c->sys->frame_size);
 
-    dv_flush_audio_packets(c);
     return url_fseek(&s->pb, offset, SEEK_SET);
 }