[FFmpeg-cvslog] avformat/matroskaenc: Fix writing AV_SPHERICAL_EQUIRECTANGULAR

Andreas Rheinhardt git at videolan.org
Thu Jan 20 20:11:35 EET 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Jan 20 16:33:17 2022 +0100| [7512293cf912c65fa657eab680afd5e18fd47603] | committer: Andreas Rheinhardt

avformat/matroskaenc: Fix writing AV_SPHERICAL_EQUIRECTANGULAR

According to the documentation, the ISOBMFF 'equi' box must
be present for equirectangular projections.

Reviewed-by: Hendrik Leppkes <h.leppkes at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7512293cf912c65fa657eab680afd5e18fd47603
---

 libavformat/matroskaenc.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 8c10a8c133..38d9485288 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1305,17 +1305,21 @@ static void mkv_write_video_projection(AVFormatContext *s, EbmlWriter *writer,
 
     switch (spherical->projection) {
     case AV_SPHERICAL_EQUIRECTANGULAR:
-        ebml_writer_add_uint(writer, MATROSKA_ID_VIDEOPROJECTIONTYPE,
-                             MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR);
-        break;
     case AV_SPHERICAL_EQUIRECTANGULAR_TILE:
         ebml_writer_add_uint(writer, MATROSKA_ID_VIDEOPROJECTIONTYPE,
                              MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR);
         AV_WB32(private,      0); // version + flags
-        AV_WB32(private +  4, spherical->bound_top);
-        AV_WB32(private +  8, spherical->bound_bottom);
-        AV_WB32(private + 12, spherical->bound_left);
-        AV_WB32(private + 16, spherical->bound_right);
+        if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR) {
+            AV_WB32(private +  4, 0);
+            AV_WB32(private +  8, 0);
+            AV_WB32(private + 12, 0);
+            AV_WB32(private + 16, 0);
+        } else {
+            AV_WB32(private +  4, spherical->bound_top);
+            AV_WB32(private +  8, spherical->bound_bottom);
+            AV_WB32(private + 12, spherical->bound_left);
+            AV_WB32(private + 16, spherical->bound_right);
+        }
         ebml_writer_add_bin(writer, MATROSKA_ID_VIDEOPROJECTIONPRIVATE,
                             private, 20);
         break;



More information about the ffmpeg-cvslog mailing list