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

Michael Niedermayer michaelni at gmx.at
Thu Oct 30 04:55:59 CET 2014


On Wed, Oct 29, 2014 at 08:49:11PM -0700, Bryan Huh wrote:
> 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.

ok, cc-ing martin


> 
> 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"
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141030/df4b7a6d/attachment.asc>


More information about the ffmpeg-devel mailing list