[FFmpeg-devel] [PATCH] more mov edl fixes

Reimar Döffinger Reimar.Doeffinger
Mon Mar 16 18:35:28 CET 2009


On Mon, Mar 16, 2009 at 10:15:32AM -0700, Baptiste Coudurier wrote:
> Hi Reimar,
> 
> On 3/16/2009 6:49 AM, Reimar D?ffinger wrote:
> > Hello,
> > attached patch fixes sync of
> > http://samples.mplayerhq.hu/mov/weirdedl.mp4 (subtitles are supposed to
> > be exactly in sync, the audio is supposed to be delayed by exactly 3
> > seconds compared to how it plays now).
> > Two issues:
> > 1) it uses an "fillup" edl entry with time == -1 (implemented by the
> > second chunk of the patch).
> > 2) edl time values are relative to container, not track rate,
> > implemented in an ugly way by the first chunk.
> >
> > 
> > Index: libavformat/mov.c
> > ===================================================================
> > --- libavformat/mov.c	(revision 18004)
> > +++ libavformat/mov.c	(working copy)
> > @@ -1246,7 +1246,7 @@
> >      /* adjust first dts according to edit list */
> >      if (sc->time_offset) {
> >          assert(sc->time_offset % sc->time_rate == 0);
> > -        current_dts = - (sc->time_offset / sc->time_rate);
> > +        current_dts = - ((int64_t)sc->time_offset * sc->time_scale / mov->time_scale / sc->time_rate);
> >      }
> >  
> >      /* only use old uncompressed audio chunk demuxing when stts specifies it */
> > @@ -1741,12 +1741,12 @@
> >  
> >      for(i=0; i<edit_count; i++){
> >          int time;
> > -        get_be32(pb); /* Track duration */
> > +        int duration = get_be32(pb); /* Track duration */
> >          time = get_be32(pb); /* Media time */
> >          get_be32(pb); /* Media rate */
> > -        if (i == 0 && time != -1) {
> > -            sc->time_offset = time;
> > -            sc->time_rate = av_gcd(sc->time_rate, time);
> > +        if (i == 0) {
> > +            sc->time_offset = time != -1 ? time : -duration;
> > +            sc->time_rate = av_gcd(sc->time_rate, FFABS(sc->time_offset));
> >          }
> >      }
> 
> I think you can rescale here, using av_rescale. Values are available.

No, sc->time_scale is 0 here.




More information about the ffmpeg-devel mailing list