summaryrefslogtreecommitdiff
path: root/libavcodec/pngdec.c
diff options
context:
space:
mode:
authorKirill Gavrilov <kirill@sview.ru>2015-10-27 18:27:03 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-10-30 12:46:56 +0100
commit1720791e36f9cc24c05efea5bb275ab52156ce50 (patch)
tree76b37115ae52e258ea3bc04c66e31727d6fd624c /libavcodec/pngdec.c
parent00b62968d079e63bf22028f253ac297292436ebe (diff)
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: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/pngdec.c')
-rw-r--r--libavcodec/pngdec.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 5fa7a2dfdf..b52bf602e5 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -21,6 +21,8 @@
#include "libavutil/avstring.h"
#include "libavutil/imgutils.h"
+#include "libavutil/stereo3d.h"
+
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
@@ -608,6 +610,22 @@ static int decode_frame(AVCodecContext *avctx,
bytestream2_skip(&s->gb, 4); /* crc */
}
break;
+ case MKTAG('s', 'T', 'E', 'R'): {
+ int mode = bytestream2_get_byte(&s->gb);
+ AVStereo3D *stereo3d = av_stereo3d_create_side_data(p);
+ if (!stereo3d)
+ goto the_end;
+
+ if (mode == 0 || mode == 1) {
+ stereo3d->type = AV_STEREO3D_SIDEBYSIDE;
+ stereo3d->flags = mode ? 0 : AV_STEREO3D_FLAG_INVERT;
+ } else {
+ av_log(avctx, AV_LOG_WARNING,
+ "Unknown value in sTER chunk (%d)\n", mode);
+ }
+ bytestream2_skip(&s->gb, 4); /* crc */
+ break;
+ }
case MKTAG('I', 'E', 'N', 'D'):
if (!(s->state & PNG_ALLIMAGE))
goto fail;