summaryrefslogtreecommitdiff
path: root/libavcodec/pngdec.c
diff options
context:
space:
mode:
authorKirill Gavrilov <kirill@sview.ru>2015-10-22 23:36:52 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2015-10-28 12:59:43 +0100
commitbea931c2eb776603074c463e127cb348d195bde7 (patch)
treeb860ca49096ee3ace2b6d8305689a99038a60a63 /libavcodec/pngdec.c
parent54cd1ab55513e0a12f90dba8036b0a54b16d8ff7 (diff)
avcodec/png: read and write stereo3d frame side data information
Use optional sTER chunk defining side-by-side stereo pair within "Extensions to the PNG 1.2 Specification", version 1.3.0. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pngdec.c')
-rw-r--r--libavcodec/pngdec.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 4cfdc588a5..99111d4ecc 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -24,6 +24,7 @@
#include "libavutil/avassert.h"
#include "libavutil/bprint.h"
#include "libavutil/imgutils.h"
+#include "libavutil/stereo3d.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
@@ -1164,6 +1165,21 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
av_log(avctx, AV_LOG_WARNING, "Broken zTXt chunk\n");
bytestream2_skip(&s->gb, length + 4);
break;
+ case MKTAG('s', 'T', 'E', 'R'): {
+ AVStereo3D *stereo3d = av_stereo3d_create_side_data(p);
+ if (!stereo3d) {
+ goto fail;
+ } else if (*s->gb.buffer == 0) {
+ stereo3d->type = AV_STEREO3D_SIDEBYSIDE;
+ stereo3d->flags = AV_STEREO3D_FLAG_INVERT;
+ } else if (*s->gb.buffer == 1) {
+ stereo3d->type = AV_STEREO3D_SIDEBYSIDE;
+ } else {
+ av_log(avctx, AV_LOG_WARNING, "Broken sTER chunk - unknown value\n");
+ }
+ bytestream2_skip(&s->gb, length + 4);
+ break;
+ }
case MKTAG('I', 'E', 'N', 'D'):
if (!(s->state & PNG_ALLIMAGE))
av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");