vlc | branch: master | Mohammed Danish <sha...@gmail.com> | Wed Jul 12 06:13:25 
2017 -0400| [7076180e34a3a076a8606c1d1394ad82af5f3103] | committer: Steve Lhomme

avcodec: add code to read stereo 3d metadata

Signed-off-by: Steve Lhomme <rob...@ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7076180e34a3a076a8606c1d1394ad82af5f3103
---

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

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index d0801db1ec..8b4f6252b7 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -47,6 +47,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"
 #define FRAME_INFO_DEPTH 64
 
@@ -864,6 +868,49 @@ static int 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;
+        default:
+        case AV_STEREO3D_2D:
+            p_pic->format.multiview_mode = MULTIVIEW_2D;
+            break;
+        }
+        if (p_dec->fmt_out.video.multiview_mode != 
p_pic->format.multiview_mode)
+        {
+            p_dec->fmt_out.video.multiview_mode = p_pic->format.multiview_mode;
+            format_changed = true;
+        }
+    }
+    else
+        p_pic->format.multiview_mode = p_dec->fmt_out.video.multiview_mode;
+#endif
+
     if (format_changed && decoder_UpdateVideoFormat( p_dec ))
         return -1;
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to