[Ffmpeg-devel] Bug? Subtitles not detected in vob

Wolfram Gloger wmglo
Wed Jan 10 17:44:58 CET 2007


> well if you call av_estimate_timings at 80% of a file it would with
> your change estimate the bitrate and duration based on the last 20% or?


> now seek back to the start, maybe the seek code ignores duration and
> start time but thats not guranteed and actually the seek code should
> use the duration and start time instead of redoing the estimation ...

Agreed.  I keep getting mixed up between av_find_stream_info and
av_estimate_timings.  av_estimate_timings really just computes two
global stream parameters (start_time and duration) and that certainly
should cover the whole file.

However, I would argue for av_find_stream_info to be callable anywhere
within the stream (as it can return significantly different parameters
eg. in MPEG-TS), and since it calls av_estimate_timings()...

> > Although this does not affect the issue at hand (just checked), I
> > would propose this change also because it makes av_estimate_timings
> > more generic (i.e. it can be called after seeking).
> i think iam fine with this change

...so here that change without further side-effects.


--- trunk/libavformat/utils.c	Mon Jan  8 16:01:14 2007
+++ ffmpeg/libavformat/utils.c	Wed Jan 10 17:39:27 2007
@@ -1561,6 +1561,7 @@
     int read_size, i, ret;
     int64_t end_time;
     int64_t filesize, offset, duration;
+    offset_t old_offset;
     /* free previous packet */
     if (ic->cur_st && ic->cur_st->parser)
@@ -1580,6 +1581,7 @@
     /* we read the first packets to get the first PTS (not fully
        accurate, but it is enough now) */
+    old_offset = url_fseek(&ic->pb, 0, SEEK_CUR);
     url_fseek(&ic->pb, 0, SEEK_SET);
     read_size = 0;
     for(;;) {
@@ -1646,7 +1648,7 @@
-    url_fseek(&ic->pb, 0, SEEK_SET);
+    url_fseek(&ic->pb, old_offset, SEEK_SET);
 static void av_estimate_timings(AVFormatContext *ic)

More information about the ffmpeg-devel mailing list