[vlc-devel] [PATCH 2/7] avcodec/video: add code to read stereo 3d metadata

Mohammed (Shaan) Huzaifa Danish shaan3 at gmail.com
Thu Jul 13 11:11:23 CEST 2017


From: Mohammed Danish <shaan3 at gmail.com>

---
 modules/codec/avcodec/video.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 506d15a209..16d2e6f446 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -46,6 +46,10 @@
 #include "avcodec.h"
 #include "va.h"
 
+#if LIBAVUTIL_VERSION_CHECK( 52, 20, 0, 58, 100 )
+#include <libavutil/stereo3d.h>
+#endif
+
 #include "../codec/cc.h"
 
 /*****************************************************************************
@@ -838,6 +842,45 @@ static void DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p
     }
 #endif
 
+#if LIBAVUTIL_VERSION_CHECK( 52, 20, 0, 58, 100 )
+    const AVFrameSideData *p_stereo3d_data =
+            av_frame_get_side_data( frame,
+                                    AV_FRAME_DATA_STEREO3D );
+    if( p_stereo3d_data )
+    {
+        const struct AVStereo3D *stereo_data =
+                (const AVStereo3D *) p_stereo3d_data->data;
+        switch (stereo_data->type)
+        {
+        case AV_STEREO3D_SIDEBYSIDE:
+            p_pic->format.multiview_mode = MULTIVIEW_STEREO_SBS;
+            break;
+        case AV_STEREO3D_TOPBOTTOM:
+            p_pic->format.multiview_mode = MULTIVIEW_STEREO_TB;
+            break;
+        case AV_STEREO3D_FRAMESEQUENCE:
+            p_pic->format.multiview_mode = MULTIVIEW_STEREO_FRAME;
+            break;
+        case AV_STEREO3D_COLUMNS:
+            p_pic->format.multiview_mode = MULTIVIEW_STEREO_ROW;
+            break;
+        case AV_STEREO3D_LINES:
+            p_pic->format.multiview_mode = MULTIVIEW_STEREO_COL;
+            break;
+        case AV_STEREO3D_CHECKERBOARD:
+            p_pic->format.multiview_mode = MULTIVIEW_STEREO_CHECKERBOARD;
+            break;
+        case AV_STEREO3D_2D:
+            p_pic->format.multiview_mode = MULTIVIEW_2D;
+            break;
+        default:
+            p_pic->format.multiview_mode = MULTIVIEW_UNKNOWN;
+            break;
+        }
+        p_dec->fmt_out.video.multiview_mode = p_pic->format.multiview_mode;
+    }
+#endif
+
     if (format_changed)
         decoder_UpdateVideoFormat( p_dec );
 
-- 
2.12.2.windows.2



More information about the vlc-devel mailing list