[FFmpeg-devel] [PATCH v3 4/5] avformat/mov: Add support for exporting Video Extension Usage info
James Almer
jamrial at gmail.com
Mon Jun 17 23:07:10 EEST 2024
On 6/17/2024 4:20 PM, Derek Buitenhuis wrote:
> This box is provided by files created by the Apple Vision Pro, as well
> as the iPhone 15+ when capture for Vision Pro is enabled.
>
> The boxes are a mix of things documented by Apple in some PDFs, their
> API docs, and reverse engineering. Ideally we will have a real spec
> one day.
>
> Links:
> *https://developer.apple.com/av-foundation/Stereo-Video-ISOBMFF-Extensions.pdf
> *https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_horizontaldisparityadjustment
> *https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_stereocamerabaseline
> *https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_heroeye
>
> Signed-off-by: Derek Buitenhuis<derek.buitenhuis at gmail.com>
> ---
> libavformat/mov.c | 283 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 283 insertions(+)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 9016cd5ad0..5724b4ef93 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -6477,6 +6477,288 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> return 0;
> }
>
> +static int mov_read_vexu_proj(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> + AVStream *st;
> + MOVStreamContext *sc;
> + int size;
> + uint32_t tag;
> + enum AVSphericalProjection projection;
> +
> + if (c->fc->nb_streams < 1)
> + return 0;
> +
> + st = c->fc->streams[c->fc->nb_streams - 1];
> + sc = st->priv_data;
> +
> + if (atom.size != 16) {
> + av_log(c->fc, AV_LOG_ERROR, "Invalid size for proj box: %"PRIu64"\n", atom.size);
> + return AVERROR_INVALIDDATA;
> + }
> +
> + size = avio_rb32(pb);
> + if (size != 16) {
> + av_log(c->fc, AV_LOG_ERROR, "Invalid size for prji box: %d\n", size);
> + return AVERROR_INVALIDDATA;
> + }
> +
> + tag = avio_rl32(pb);
> + if (tag != MKTAG('p','r','j','i')) {
> + av_log(c->fc, AV_LOG_ERROR, "Invalid child box of proj box: 0x%08X\n", tag);
> + return AVERROR_INVALIDDATA;
> + }
> +
> + avio_skip(pb, 1); // version
> + avio_skip(pb, 3); // flags
> +
> + tag = avio_rl32(pb);
> + switch (tag) {
> + case MKTAG('r','e','c','t'):
> + projection = AV_SPHERICAL_RECTILINEAR;
> + break;
> + case MKTAG('e','q','u','i'):
> + projection = AV_SPHERICAL_EQUIRECTANGULAR;
> + break;
> + case MKTAG('h','e','q','u'):
> + projection = AV_SPHERICAL_HALF_EQUIRECTANGULAR;
> + break;
> + case MKTAG('f','i','s','h'):
> + projection = AV_SPHERICAL_FISHEYE;
> + break;
> + default:
> + av_log(c->fc, AV_LOG_ERROR, "Invalid projection type in prji box: 0x%08X\n", tag);
> + return AVERROR_INVALIDDATA;
> + }
> +
> + sc->spherical = av_spherical_alloc(&sc->spherical_size);
> + if (!sc->spherical)
> + return AVERROR(ENOMEM);
> +
> + sc->spherical->projection = projection;
> +
> + return 0;
> +}
> +
> +static int mov_read_eyes(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> + AVStream *st;
> + MOVStreamContext *sc;
> + int size, flags = 0;
> + int64_t remaining;
> + uint32_t tag, baseline = 0;
> + enum AVStereo3DView view = AV_STEREO3D_VIEW_PACKED;
> + enum AVStereo3DPrimaryEye primary_eye = AV_PRIMARY_EYE_NONE;
> + AVRational horizontal_disparity_adjustment = { 0, 0 };
nit: { 0, 1 }.
Should be ok either way.
More information about the ffmpeg-devel
mailing list