[FFmpeg-cvslog] avformat/mov: Add support for reading and exporting horizontal field of view
Derek Buitenhuis
git at videolan.org
Tue Jun 18 16:55:53 EEST 2024
ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Thu May 30 20:34:24 2024 +0100| [8e7ca22b36e7727d0778d8604b29f81ca1202f19] | committer: Derek Buitenhuis
avformat/mov: Add support for reading and exporting horizontal field of view
These boxes are created by the Apple Vision Pro and the iPhone 15+ when
capture for the Vision Pro is enabled.
Based off of the swift API:
* https://developer.apple.com/documentation/coremedia/kcmformatdescriptionextension_horizontalfieldofview
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e7ca22b36e7727d0778d8604b29f81ca1202f19
---
libavformat/mov.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5724b4ef93..367af8478b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6759,6 +6759,34 @@ static int mov_read_vexu(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+static int mov_read_hfov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ AVStream *st;
+ MOVStreamContext *sc;
+
+ if (c->fc->nb_streams < 1)
+ return 0;
+
+ st = c->fc->streams[c->fc->nb_streams - 1];
+ sc = st->priv_data;
+
+ if (atom.size != 4) {
+ av_log(c->fc, AV_LOG_ERROR, "Invalid size of hfov box: %"PRIu64"\n", atom.size);
+ return AVERROR_INVALIDDATA;
+ }
+
+
+ if (!sc->stereo3d) {
+ sc->stereo3d = av_stereo3d_alloc();
+ if (!sc->stereo3d)
+ return AVERROR(ENOMEM);
+ }
+
+ sc->stereo3d->horizontal_field_of_view = avio_rb32(pb);
+
+ return 0;
+}
+
static int mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_t len)
{
int ret = 0;
@@ -8878,6 +8906,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('s','t','3','d'), mov_read_st3d }, /* stereoscopic 3D video box */
{ MKTAG('s','v','3','d'), mov_read_sv3d }, /* spherical video box */
{ MKTAG('v','e','x','u'), mov_read_vexu }, /* video extension usage */
+{ MKTAG('h','f','o','v'), mov_read_hfov },
{ MKTAG('d','O','p','s'), mov_read_dops },
{ MKTAG('d','m','l','p'), mov_read_dmlp },
{ MKTAG('S','m','D','m'), mov_read_smdm },
More information about the ffmpeg-cvslog
mailing list