aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2024-06-21 15:20:37 -0300
committerJames Almer <jamrial@gmail.com>2024-07-07 12:38:57 -0300
commitaa8230c7baad1be07f77da735c9740b3f031c5fd (patch)
tree9f0ad3ee278d27078442cb0fec473c2856cbc040 /libavformat/movenc.c
parent6a428876fc4f1128644dcbc8e8fd814e1754262f (diff)
downloadffmpeg-aa8230c7baad1be07f77da735c9740b3f031c5fd.tar.gz
avformat/movenc: add support for writting hfov boxes
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index afc2af2fef..b5c02d2198 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2195,6 +2195,17 @@ static inline int64_t rescale_rational(AVRational q, int b)
return av_rescale(q.num, b, q.den);
}
+static void mov_write_hfov_tag(AVFormatContext *s, AVIOContext *pb,
+ const AVStereo3D *stereo3d)
+{
+ if (!stereo3d->horizontal_field_of_view.num)
+ return;
+
+ avio_wb32(pb, 12); /* size */
+ ffio_wfourcc(pb, "hfov");
+ avio_wb32(pb, rescale_rational(stereo3d->horizontal_field_of_view, 1000));
+}
+
static void mov_write_vexu_proj_tag(AVFormatContext *s, AVIOContext *pb,
const AVSphericalMapping *spherical_mapping)
{
@@ -2770,6 +2781,8 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
if (stereo3d || spherical_mapping)
mov_write_vexu_tag(s, pb, stereo3d, spherical_mapping);
+ if (stereo3d)
+ mov_write_hfov_tag(s, pb, stereo3d);
}
if (track->mode == MODE_MP4) {