Hi, The attached patch preserves spherical orientation when a vexu box follows sv3d, and avoids replacing an existing allocation in either reader. The regression test reports 0/0/0 before the fix and the expected 45/30/15 afterward.
Please add this 1009-byte synthetic sample to the FATE suite as mov/spherical-sv3d-vexu.mp4: https://streams.videolan.org/ffmpeg/incoming/spherical-sv3d-vexu.mp4 Tested on master 94cba3150c6b83057ed48b833689adc806715cc0: - New FATE test fails before the fix and passes afterward. - 301 tests in the minimal MOV/MPEG-4 build pass. - Valgrind reports no errors or definite leaks for both box orders, either box alone, and seven malformed/truncated variants. The full external FATE sample suite was not run. Thanks, Jonathan
From 949ba3d3f8e9bd7b1d4ae845e45ee149f3a797ad Mon Sep 17 00:00:00 2001 From: Jonathan Thomas <[email protected]> Date: Sat, 17 Oct 2026 16:23:58 -0500 Subject: [PATCH] avformat/mov: preserve spherical orientation when reading vexu The vexu projection box carries no yaw, pitch or roll. Allocating a new spherical mapping discards the orientation previously read from sv3d and leaks the existing mapping. Reuse the mapping in both readers, also avoiding a leak when sv3d follows vexu. Add a regression test for nonzero orientation in a file containing sv3d followed by vexu. Fixes: 5c173763212aef7c34d611a65271d9e4655d6350 Signed-off-by: Jonathan Thomas <[email protected]> --- libavformat/mov.c | 16 ++++++++++------ tests/fate/mov.mak | 3 +++ tests/ref/fate/mov-spherical-sv3d-vexu | 8 ++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 tests/ref/fate/mov-spherical-sv3d-vexu diff --git a/libavformat/mov.c b/libavformat/mov.c index f7c1292..972a4d2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7343,9 +7343,11 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } - sc->spherical = av_spherical_alloc(&sc->spherical_size); - if (!sc->spherical) - return AVERROR(ENOMEM); + if (!sc->spherical) { + sc->spherical = av_spherical_alloc(&sc->spherical_size); + if (!sc->spherical) + return AVERROR(ENOMEM); + } sc->spherical->projection = projection; @@ -7427,9 +7429,11 @@ static int mov_read_vexu_proj(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR_INVALIDDATA; } - sc->spherical = av_spherical_alloc(&sc->spherical_size); - if (!sc->spherical) - return AVERROR(ENOMEM); + if (!sc->spherical) { + sc->spherical = av_spherical_alloc(&sc->spherical_size); + if (!sc->spherical) + return AVERROR(ENOMEM); + } sc->spherical->projection = projection; diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index e36ddff..aa13612 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -59,6 +59,8 @@ fate-ffprobe-show-groups-tmcd: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -v error -s -show_entries stream_group=:stream_group_disposition=:stream_group_tags=:stream_group_components=:stream_group_stream_disposition=:stream_group_stream_tags=:stream_group_stream_side_data=:stream=index \ -of compact $(TARGET_SAMPLES)/mov/fcp_export8-236.mov +FATE_MOV_FFPROBE-$(call ALLYES, MOV_DEMUXER MPEG4_DECODER FILE_PROTOCOL) += fate-mov-spherical-sv3d-vexu + FATE_MOV_FASTSTART = fate-mov-faststart-4gb-overflow \ FATE_SAMPLES_FFMPEG += $(FATE_MOV-yes) $(FATE_MOV_REMUX-yes) @@ -160,6 +162,7 @@ fate-mov-displaymatrix: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stre fate-mov-read-amve: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mov/amve.mov fate-mov-spherical-mono: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mov/spherical.mov +fate-mov-spherical-sv3d-vexu: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data=projection,yaw,pitch,roll -select_streams v -v 0 $(TARGET_SAMPLES)/mov/spherical-sv3d-vexu.mp4 fate-mov-dovi-hvce-mp4-read: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mov/dovi-p7-hvce.mp4 diff --git a/tests/ref/fate/mov-spherical-sv3d-vexu b/tests/ref/fate/mov-spherical-sv3d-vexu new file mode 100644 index 0000000..938f8d6 --- /dev/null +++ b/tests/ref/fate/mov-spherical-sv3d-vexu @@ -0,0 +1,8 @@ +[STREAM] +[SIDE_DATA] +projection=equirectangular +yaw=45 +pitch=30 +roll=15 +[/SIDE_DATA] +[/STREAM] -- 2.25.1
_______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
