[FFmpeg-devel] [PATCH 1/2] avformat/mov: Rework the AVIF parser to handle multiple items

Vignesh Venkatasubramanian vigneshv at google.com
Wed Jul 13 19:12:28 EEST 2022


On Mon, Jul 11, 2022 at 3:25 PM James Zern
<jzern-at-google.com at ffmpeg.org> wrote:
>
> On Thu, Jun 30, 2022 at 2:04 PM Vignesh Venkatasubramanian
> <vigneshv-at-google.com at ffmpeg.org> wrote:
> >
> > Stores the item ids of all the items found in the file and
> > processes the primary item at the end of the meta box. This patch
> > does not change any behavior. It sets up the code for parsing
> > alpha channel (and possibly images with 'grid') in follow up
> > patches.
> >
> > Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
> > ---
> >  libavformat/isom.h |   4 ++
> >  libavformat/mov.c  | 148 ++++++++++++++++++++++++++++-----------------
> >  2 files changed, 97 insertions(+), 55 deletions(-)
> >
> > [...]
>
> @@ -4692,9 +4755,25 @@ static int mov_read_meta(MOVContext *c,
> AVIOContext *pb, MOVAtom atom)
>          tag = avio_rl32(pb);
>          atom.size -= 4;
>          if (tag == MKTAG('h','d','l','r')) {
> +            int ret;
>              avio_seek(pb, -8, SEEK_CUR);
>              atom.size += 8;
> -            return mov_read_default(c, pb, atom);
> +            ret = mov_read_default(c, pb, atom);
> +            if (ret < 0)
>
> In some other cases these two lines are combined, if ((ret = ...
>

Done.

> +                return ret;
> +            if (c->is_still_picture_avif) {
> +                int ret;
> +                // Add a stream for the YUV planes (primary item).
> +                ret = avif_add_stream(c, c->primary_item_id);
> +                if (ret)
>
> This could be updated too and use '< 0' to match other code.
>

Done.

> +                    return ret;
> +                // For still AVIF images, the meta box contains all the
> +                // necessary information that would generally be
> provided by the
> +                // moov box. So simply mark that we have found the moov box so
> +                // that parsing can continue.
> +                c->found_moov = 1;
> +            }
> +            return ret;
>          }
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



-- 
Vignesh


More information about the ffmpeg-devel mailing list