[FFmpeg-devel] [PATCH 4/5] avformat/mov: Add support for exporting Video Extension Usage info

James Almer jamrial at gmail.com
Mon Jun 10 22:38:43 EEST 2024


On 6/10/2024 3:44 PM, Derek Buitenhuis wrote:
> +static int mov_read_vexu(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> +    int size;
> +    int64_t remaining;
> +    uint32_t tag;
> +
> +    if (c->fc->nb_streams < 1)
> +        return 0;
> +
> +    if (atom.size < 8) {
> +        av_log(c->fc, AV_LOG_ERROR, "Empty video extension usage box\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +
> +    remaining = atom.size;
> +    while (remaining > 0) {

Maybe this loop should call mov_read_default, with proj and eyes added 
to mov_default_parse_table[]. Although i don't know if eyes may show up 
as child for other parent boxes or not.
At least with proj, i see it can be a child for sv3d, where only prhd is 
expected as a child box in turn. But it shouldn't a problem to add a 
mov_read_proj that handles both prhd and prji for this purpose.

> +        size = avio_rb32(pb);
> +        if (size < 8 || size > remaining ) {
> +            av_log(c->fc, AV_LOG_ERROR, "Invalid child size in vexu box\n");
> +            return AVERROR_INVALIDDATA;
> +        }
> +
> +        tag = avio_rl32(pb);
> +        switch (tag) {
> +        case MKTAG('p','r','o','j'): {
> +            MOVAtom proj = { tag, size - 8 };
> +            int ret = mov_read_vexu_proj(c, pb, proj);
> +            if (ret < 0)
> +                return ret;
> +            break;
> +        }
> +        case MKTAG('e','y','e','s'): {
> +            MOVAtom eyes = { tag, size - 8 };
> +            int ret = mov_read_eyes(c, pb, eyes);
> +            if (ret < 0)
> +                return ret;
> +            break;
> +        }
> +        default:
> +            av_log(c->fc, AV_LOG_WARNING, "Unknown tag in vexu: 0x%08X\n", tag);
> +            avio_skip(pb, size - 8);
> +            break;
> +        }
> +        remaining -= size;
> +    }
> +
> +    if (remaining != 0) {
> +        av_log(c->fc, AV_LOG_ERROR, "Broken vexu box\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +
> +    return 0;
> +}


More information about the ffmpeg-devel mailing list