From: "Mohammed (Shaan) Huzaifa Danish" <sha...@gmail.com>

---
 libavcodec/h264_sei.c   | 4 +++-
 libavcodec/h264_sei.h   | 1 +
 libavcodec/h264_slice.c | 2 ++
 libavutil/stereo3d.h    | 4 ++++
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 03fca9017f..337270cb6e 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -315,7 +315,9 @@ static int 
decode_frame_packing_arrangement(H264SEIFramePacking *h,
         h->content_interpretation_type    = get_bits(gb, 6);
 
         // the following skips: spatial_flipping_flag, frame0_flipped_flag,
-        // field_views_flag, current_frame_is_frame0_flag,
+        // field_views_flag
+        skip_bits(gb, 3);
+        h->current_frame_is_frame0_flag   = get_bits1(gb);
         // frame0_self_contained_flag, frame1_self_contained_flag
         skip_bits(gb, 6);
 
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index f6ac6034da..c3a19dd831 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking {
     int arrangement_type;
     int content_interpretation_type;
     int quincunx_subsampling;
+    int current_frame_is_frame0_flag;
 } H264SEIFramePacking;
 
 typedef struct H264SEIDisplayOrientation {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 5dd01d836e..f5b78bfe29 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1112,6 +1112,8 @@ static int h264_export_frame_props(H264Context *h)
 
         if (fp->content_interpretation_type == 2)
             stereo->flags = AV_STEREO3D_FLAG_INVERT;
+        if (fp->current_frame_is_frame0_flag)
+            stereo->flags |= AV_STEREO3D_FLAG_FRAME0;
     }
 
     if (h->sei.display_orientation.present &&
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index 0fa9f63a2c..4c8ab5c40a 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -146,6 +146,10 @@ enum AVStereo3DType {
  * Inverted views, Right/Bottom represents the left view.
  */
 #define AV_STEREO3D_FLAG_INVERT     (1 << 0)
+/**
+ * This frame is frame0 (left view), otherwise it's the right view.
+ */
+#define AV_STEREO3D_FLAG_FRAME0     (1 << 1)
 
 /**
  * Stereo 3D type: this structure describes how two videos are packed
-- 
2.12.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to