This patchset adds new boxes and projection values from from https://developer.apple.com/av-foundation/Stereo-Video-ISOBMFF-Extensions.pdf
Vittorio Giovara (2): mov: Export frame packing information from pack box lavu/spherical: Add support for Spherical Immersive type libavformat/mov.c | 89 +++++++++++++++++++++++++++++++++++++++++++ libavutil/spherical.c | 1 + libavutil/spherical.h | 6 +++ 3 files changed, 96 insertions(+)
From a244d96e045439f9e3a4db99e2f479e8686221da Mon Sep 17 00:00:00 2001 From: Vittorio Giovara <vittorio.giovara@gmail.com> Date: Wed, 23 Jul 2025 23:42:14 +0200 Subject: [PATCH 2/2] lavu/spherical: Add support for Spherical Immersive type --- libavformat/mov.c | 3 +++ libavutil/spherical.c | 1 + libavutil/spherical.h | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 7c91322027..eeb406609c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6860,6 +6860,9 @@ static int mov_read_vexu_proj(MOVContext *c, AVIOContext *pb, MOVAtom atom) case MKTAG('f','i','s','h'): projection = AV_SPHERICAL_FISHEYE; break; + case MKTAG('p','r','i','m'): + projection = AV_SPHERICAL_PARAMETRIC_IMMERSIVE; + break; default: av_log(c->fc, AV_LOG_ERROR, "Invalid projection type in prji box: 0x%08X\n", tag); return AVERROR_INVALIDDATA; diff --git a/libavutil/spherical.c b/libavutil/spherical.c index 64ade1d0ec..71342faea9 100644 --- a/libavutil/spherical.c +++ b/libavutil/spherical.c @@ -62,6 +62,7 @@ static const char *const spherical_projection_names[] = { [AV_SPHERICAL_HALF_EQUIRECTANGULAR] = "half equirectangular", [AV_SPHERICAL_RECTILINEAR] = "rectilinear", [AV_SPHERICAL_FISHEYE] = "fisheye", + [AV_SPHERICAL_PARAMETRIC_IMMERSIVE] = "parametric immersive", }; const char *av_spherical_projection_name(enum AVSphericalProjection projection) diff --git a/libavutil/spherical.h b/libavutil/spherical.h index 2e90f7752d..4b78978eb9 100644 --- a/libavutil/spherical.h +++ b/libavutil/spherical.h @@ -82,6 +82,12 @@ enum AVSphericalProjection { * See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/fisheye */ AV_SPHERICAL_FISHEYE, + + /** + * Parametric Immersive projection (Apple). + * See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/parametricimmersive + */ + AV_SPHERICAL_PARAMETRIC_IMMERSIVE, }; /** -- 2.50.0
From e312beb0c66c96a5cf4ef1c822bd8efbdf5c3b44 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara <vittorio.giovara@gmail.com> Date: Wed, 23 Jul 2025 23:29:19 +0200 Subject: [PATCH 1/2] mov: Export frame packing information from pack box --- libavformat/mov.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index ccaa988e4b..7c91322027 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6596,6 +6596,85 @@ static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_pack(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + AVStream *st; + MOVStreamContext *sc; + int size = 0; + int64_t remaining; + uint32_t tag = 0; + enum AVStereo3DType type = AV_STEREO3D_2D; + + if (c->fc->nb_streams < 1) + return 0; + + st = c->fc->streams[c->fc->nb_streams - 1]; + sc = st->priv_data; + + remaining = atom.size; + while (remaining > 0) { + size = avio_rb32(pb); + if (size < 8 || size > remaining ) { + av_log(c->fc, AV_LOG_ERROR, "Invalid child size in pack box\n"); + return AVERROR_INVALIDDATA; + } + + tag = avio_rl32(pb); + switch (tag) { + case MKTAG('p','k','i','n'): { + if (size != 16) { + av_log(c->fc, AV_LOG_ERROR, "Invalid size of pkin box: %d\n", size); + return AVERROR_INVALIDDATA; + } + avio_skip(pb, 1); // version + avio_skip(pb, 3); // flags + + tag = avio_rl32(pb); + switch (tag) { + case MKTAG('s','i','d','e'): + type = AV_STEREO3D_SIDEBYSIDE; + break; + case MKTAG('o','v','e','r'): + type = AV_STEREO3D_TOPBOTTOM; + break; + case 0: + // This means value will be set in another layer + break; + default: + av_log(c->fc, AV_LOG_WARNING, "Unknown tag in pkin: 0x%08X\n", tag); + avio_skip(pb, size - 8); + break; + } + + break; + } + default: + av_log(c->fc, AV_LOG_WARNING, "Unknown tag in pack: 0x%08X\n", tag); + avio_skip(pb, size - 8); + break; + } + remaining -= size; + } + + if (remaining != 0) { + av_log(c->fc, AV_LOG_ERROR, "Broken pack box\n"); + return AVERROR_INVALIDDATA; + } + + if (type == AV_STEREO3D_2D) + return 0; + + if (!sc->stereo3d) { + sc->stereo3d = av_stereo3d_alloc_size(&sc->stereo3d_size); + if (!sc->stereo3d) + return AVERROR(ENOMEM); + } + + sc->stereo3d->type = type; + + return 0; +} + static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -7007,6 +7086,13 @@ static int mov_read_vexu(MOVContext *c, AVIOContext *pb, MOVAtom atom) return ret; break; } + case MKTAG('p','a','c','k'): { + MOVAtom pack = { tag, size - 8 }; + int ret = mov_read_pack(c, pb, pack); + 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); -- 2.50.0
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".