[FFmpeg-devel] movenc: add write_btrt option
"zhilizhao(赵志立)"
quinkblack at foxmail.com
Wed Apr 6 11:46:18 EEST 2022
> 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://ffmpeg.org/pipermail/ffmpeg-devel/2022-March/294623.html
>
> 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.
More information about the ffmpeg-devel
mailing list