[FFmpeg-devel] movenc: add write_btrt option

Eran Kornblau eran.kornblau at kaltura.com
Thu Apr 7 11:42:02 EEST 2022


> 
> 
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of "zhilizhao(???)"
> Sent: Wednesday, 6 April 2022 11:46
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] movenc: add write_btrt option
> 
> > On Apr 3, 2022, at 1:07 PM, Eran Kornblau <eran.kornblau at kaltura.com> wrote:
> >
> > Trying my luck in a new thread…
> >
> > This patch is in continuation to this discussion –
> > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fffmp
> > eg.org%2Fpipermail%2Fffmpeg-devel%2F2022-March%2F294623.html&data=
> > 04%7C01%7C%7Cb9907958f97048f5645708da17a9f3c8%7C0c503748de3f4e2597e268
> > 19d53a42b6%7C1%7C0%7C637848315958196733%7CUnknown%7CTWFpbGZsb3d8eyJWIj
> > oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am
> > p;sdata=flQc21b5EVWTy%2Bkmw%2FncIWzdLqUxY5XFislPRs5Ij6o%3D&reserve
> > d=0
> >
> > supports forcing or disabling the writing of the btrt atom.
> > the default behavior is to write the atom only for mp4 mode.
> > ---
> >  libavformat/movenc.c | 30 +++++++++++++++++++-----------  
> > libavformat/movenc.h |  1 +
> >  2 files changed, 20 insertions(+), 11 deletions(-)
> >
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 
> > 4c868919ae..b75f1c6909 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> >
> […]
> >
> > -    if (track->mode == MODE_MP4 &&
> > -            ((ret = mov_write_btrt_tag(pb, track)) < 0))
> > -        return ret;
> > +    if ((mov->write_btrt == -1 && track->mode == MODE_MP4) || mov->write_btrt == 1) {
> > +        if ((ret = mov_write_btrt_tag(pb, track)) < 0) {
> > +            return ret;
> > +        }
> > +    }
> 
> I prefer to handle the auto mode (mov->write_btrt == -1) in a single place, so we don’t need to change multiple lines if the condition changed, e.g., enable btrt for MODE_MOV. Please correct me if I’m wrong, mov_init() has all of the contexts to overwrite mov->write_btrt.
> 
Makes sense, thanks for the feedback!
Updated patch attached

Eran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-movenc-add-write_btrt-option.patch
Type: application/octet-stream
Size: 4544 bytes
Desc: 0001-movenc-add-write_btrt-option.patch
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220407/04f5e2ae/attachment.obj>


More information about the ffmpeg-devel mailing list