[FFmpeg-devel] [PATCH] movenc: Always write the trun data_offset

Bryan Huh bryan at box.com
Thu Oct 30 04:49:11 CET 2014


Yes. Even with his change to the if-statement, I am proposing the same
change: to remove the if-statement.

It would be nice to get this sanity-checked by Martin though.

On Wed, Oct 29, 2014 at 7:24 PM, Michael Niedermayer <michaelni at gmx.at>
wrote:

> On Tue, Oct 28, 2014 at 11:05:54PM +0000, Bryan Huh wrote:
> > The MOV_TRUN_DATA_OFFSET flag was always getting set, so data_offset is
> > being expected and read. The offset was computed correctly anyway during
> > fragment-flush. Alternatively, I could have selectively set the flag
> > only when base-data-offset is defined, but certain players (Chrome)
> > seem to fail when no data-offset is provided in the trun.
> > ---
> >  libavformat/movenc.c | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index a43752a..923cf92 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -3187,13 +3187,8 @@ static int mov_write_trun_tag(AVIOContext *pb,
> MOVMuxContext *mov,
> >      avio_wb24(pb, flags);
> >
> >      avio_wb32(pb, track->entry); /* sample count */
> > -    if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET &&
> > -        !(mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) &&
> > -        track->track_id != 1)
> > -        avio_wb32(pb, 0); /* Later tracks follow immediately after the
> previous one */
> > -    else
> > -        avio_wb32(pb, moof_size + 8 + track->data_offset +
> > -                      track->cluster[0].pos); /* data offset */
> > +    avio_wb32(pb, moof_size + 8 + track->data_offset +
> > +                  track->cluster[0].pos); /* data offset */
> >      if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS)
> >          avio_wb32(pb, get_sample_flags(track, &track->cluster[0]));
>
> martin made some changes to this code, which conflict with this
> patch, is this patch still needed ?
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The real ebay dictionary, page 3
> "Rare item" - "Common item with rare defect or maybe just a lie"
> "Professional" - "'Toy' made in china, not functional except as doorstop"
> "Experts will know" - "The seller hopes you are not an expert"
>


More information about the ffmpeg-devel mailing list