summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-09 22:10:36 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-09 22:10:57 +0100
commit1dab49c344409e6a5a0bf86ad0d0488bc192f933 (patch)
tree2fa0c2a1bda55fe079a404b545bcd0aae474bfb3 /libavcodec/mpeg12dec.c
parent2c9fc694f50a01c10448b4ed08b4d6adcfaaa3a7 (diff)
parentbacc2869f37b17b2a89e1083289fdaf7f95f27bc (diff)
Merge commit 'bacc2869f37b17b2a89e1083289fdaf7f95f27bc'
* commit 'bacc2869f37b17b2a89e1083289fdaf7f95f27bc': mpeg12dec: parse frame packing arrangement user_data and save relevant stereo3d information Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r--libavcodec/mpeg12dec.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 11048670af..e50f518436 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -27,6 +27,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/stereo3d.h"
#include "internal.h"
#include "avcodec.h"
#include "dsputil.h"
@@ -2213,6 +2214,37 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
return;
avctx->dtg_active_format = p[0] & 0x0f;
}
+ } else if (buf_end - p >= 6 &&
+ p[0] == 'J' && p[1] == 'P' && p[2] == '3' && p[3] == 'D' &&
+ p[4] == 0x03) { // S3D_video_format_length
+ // the 0x7F mask ignores the reserved_bit value
+ const uint8_t S3D_video_format_type = p[5] & 0x7F;
+
+ if (S3D_video_format_type == 0x03 ||
+ S3D_video_format_type == 0x04 ||
+ S3D_video_format_type == 0x08 ||
+ S3D_video_format_type == 0x23) {
+ Mpeg1Context *s1 = avctx->priv_data;
+ MpegEncContext *s = &s1->mpeg_enc_ctx;
+ AVStereo3D *stereo = av_stereo3d_create_side_data(&s->current_picture_ptr->f);
+ if (!stereo)
+ return;
+
+ switch (S3D_video_format_type) {
+ case 0x03:
+ stereo->type = AV_STEREO3D_SIDEBYSIDE;
+ break;
+ case 0x04:
+ stereo->type = AV_STEREO3D_TOPBOTTOM;
+ break;
+ case 0x08:
+ stereo->type = AV_STEREO3D_2D;
+ break;
+ case 0x23:
+ stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
+ break;
+ }
+ }
} else if (mpeg_decode_a53_cc(avctx, p, buf_size)) {
return;
}