diff mbox series

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

Message ID AM7PR03MB666082440CF7E14F0BE53A688F5A9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 7512293cf912c65fa657eab680afd5e18fd47603
Headers show
Series [FFmpeg-devel] avformat/matroskaenc: Fix writing AV_SPHERICAL_EQUIRECTANGULAR | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 20, 2022, 4:43 p.m. UTC
According to the documentation, the ISOBMFF 'equi' box must
be present for equirectangular projections.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Comments

Hendrik Leppkes Jan. 20, 2022, 5:30 p.m. UTC | #1
On Thu, Jan 20, 2022 at 5:44 PM Andreas Rheinhardt
<andreas.rheinhardt@outlook.com> wrote:
>
> According to the documentation, the ISOBMFF 'equi' box must
> be present for equirectangular projections.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/matroskaenc.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
>

LGTM
diff mbox series

Patch

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;