summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2013-02-20 16:34:58 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2013-12-09 16:02:43 +0100
commit5b10ef729f610fcbc9c485e7b643ce53268144cb (patch)
tree4b147db6c5e36bbf1021797ebd2b14c427bee0e4 /libavcodec/h264.c
parent7e244c68600f479270e979258e389ed5240885fb (diff)
h264: parse frame packing arrangement SEI messages and save relevant stereo3d information
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 86d453bba7..29a69608ec 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -27,6 +27,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
+#include "libavutil/stereo3d.h"
#include "internal.h"
#include "cabac.h"
#include "cabac_functions.h"
@@ -2029,6 +2030,46 @@ static void decode_postinit(H264Context *h, int setup_finished)
}
}
+ if (h->sei_frame_packing_present &&
+ h->frame_packing_arrangement_type >= 0 &&
+ h->frame_packing_arrangement_type <= 6 &&
+ h->content_interpretation_type > 0 &&
+ h->content_interpretation_type < 3) {
+ AVStereo3D *stereo = av_stereo3d_create_side_data(&cur->f);
+ if (!stereo)
+ return;
+
+ switch (h->frame_packing_arrangement_type) {
+ case 0:
+ stereo->type = AV_STEREO3D_CHECKERBOARD;
+ break;
+ case 1:
+ stereo->type = AV_STEREO3D_LINES;
+ break;
+ case 2:
+ stereo->type = AV_STEREO3D_COLUMNS;
+ break;
+ case 3:
+ if (h->quincunx_subsampling)
+ stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
+ else
+ stereo->type = AV_STEREO3D_SIDEBYSIDE;
+ break;
+ case 4:
+ stereo->type = AV_STEREO3D_TOPBOTTOM;
+ break;
+ case 5:
+ stereo->type = AV_STEREO3D_FRAMESEQUENCE;
+ break;
+ case 6:
+ stereo->type = AV_STEREO3D_2D;
+ break;
+ }
+
+ if (h->content_interpretation_type == 2)
+ stereo->flags = AV_STEREO3D_FLAG_INVERT;
+ }
+
// FIXME do something with unavailable reference frames
/* Sort B-frames into display order */