I wrote:
> I eventually enabled some debug output in avidec.c in libavformat and
> used that together with strace to narrow down the problem.
> avi_read_seek() seeks to the correct position but then
> avi_read_packet(), having detected that the position is beyond the
> declared file length, seeks again.  I cannot see what the purpose of
> this seek is, and removing it fixes the problem for me:
> 
> --- ffmpeg-0.cvs20060329.orig/libavformat/avidec.c
> +++ ffmpeg-0.cvs20060329/libavformat/avidec.c
> @@ -594,7 +594,6 @@
>  
>          if (i >= avi->movi_end) {
>              if (avi->is_odml) {
> -                url_fskip(pb, avi->riff_end - i);
>                  avi->riff_end = avi->movi_end = url_fsize(pb);
>              } else
>                  break;
> -- END --

After some further experimentation with the above change, I believe the
seek is necessary when reading past the first DML index (rather than
starting beyond it).  This change seems to result in correct behaviour
in both cases:

--- ffmpeg-0.cvs20060329.orig/libavformat/avidec.c
+++ ffmpeg-0.cvs20060329/libavformat/avidec.c
@@ -594,7 +594,8 @@
 
         if (i >= avi->movi_end) {
             if (avi->is_odml) {
-                url_fskip(pb, avi->riff_end - i);
+                if (i < avi->riff_end)
+                    url_fskip(pb, avi->riff_end - i);
                 avi->riff_end = avi->movi_end = url_fsize(pb);
             } else
                 break;
-- END --

Ben.

-- 
Ben Hutchings -- [EMAIL PROTECTED] shortened to [EMAIL PROTECTED]
If you've signed my GPG key, please send a signature on and to the new uid.
Time is nature's way of making sure that everything doesn't happen at once.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to