---
 Changelog               |    1 +
 libavcodec/avcodec.h    |   23 +++++++++
 libavutil/Makefile      |    1 +
 libavutil/frame.h       |    4 ++
 libavutil/stereoscopy.h |  130 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 159 insertions(+)
 create mode 100644 libavutil/stereoscopy.h

diff --git a/Changelog b/Changelog
index 37e5a60..a2cd0c3 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version 10:
 - Go2Webinar decoder
 - WavPack encoding through libwavpack
 - Added the -n parameter to avconv
+- stereo3d metadata
 
 
 version 9:
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index bd9a80c..d54b081 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -803,6 +803,29 @@ typedef struct AVPanScan{
     int16_t position[3][2];
 }AVPanScan;
 
+/**
+ * Stereo 3D area.
+ * This specifies the area which should be displayed.
+ * Normally there is only one (or less) of such area per frame.
+ */
+typedef struct AVStereo3D {
+    /**
+     * type
+     * - encoding: Set by libavcodec.
+     * - decoding: Set by libavcodec.
+     */
+    int type;
+
+    /**
+     * additional data
+     * - encoding: Set by libavcodec.
+     * - decoding: Set by libavcodec.
+     */
+    int extra;
+
+    /* free space? what additional metadata could be added? */
+} AVStereo3D;
+
 #define FF_QSCALE_TYPE_MPEG1 0
 #define FF_QSCALE_TYPE_MPEG2 1
 #define FF_QSCALE_TYPE_H264  2
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 910f6f0..db33ff7 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -41,6 +41,7 @@ HEADERS = adler32.h                                           
          \
           rational.h                                                    \
           samplefmt.h                                                   \
           sha.h                                                         \
+          stereoscopy.h                                                 \
           time.h                                                        \
           version.h                                                     \
           xtea.h                                                        \
diff --git a/libavutil/frame.h b/libavutil/frame.h
index d71948d..4270f6b 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -35,6 +35,10 @@ enum AVFrameSideDataType {
      * The data is the AVPanScan struct defined in libavcodec.
      */
     AV_FRAME_DATA_PANSCAN,
+    /**
+     * The data is the AVStereo3D struct defined in libavcodec.
+     */
+    AV_FRAME_DATA_STEREO3D,
 };
 
 typedef struct AVFrameSideData {
diff --git a/libavutil/stereoscopy.h b/libavutil/stereoscopy.h
new file mode 100644
index 0000000..e354515
--- /dev/null
+++ b/libavutil/stereoscopy.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2013 Vittorio Giovara <[email protected]>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+/* How views are packed within the frame or container*/
+enum AVStereo3DType {
+    /* Video is not stereoscopic */
+    AV_STEREO3D_NONE,
+
+    /* Video is not stereoscopic but metadata has to be there */
+    AV_STEREO3D_NOT_REALLY,
+
+    /* Views are colored funny */
+    AV_STEREO3D_ANAGLYPH,
+
+    /* Views are in two different streams
+     *  could be per container (like Matroska)
+     *  or per frame (like MVC Stereo profile)
+     */
+    AV_STEREO3D_MULTISTREAM,
+
+    /* Views are alternated temporally
+     *
+     *     frame0   frame1   frame2   ...
+     *    LLLLLLLL RRRRRRRR LLLLLLLL
+     *    LLLLLLLL RRRRRRRR LLLLLLLL
+     *    LLLLLLLL RRRRRRRR LLLLLLLL
+     *    ...      ...      ...
+     */
+    AV_STEREO3D_FRAMESEQUENCE,
+
+    /* Views are packed in a checkerboard-like structure per pixel
+     *
+     *    LRLRLRLR
+     *    RLRLRLRL
+     *    LRLRLRLR
+     *    ...
+     */
+    AV_STEREO3D_CHECKERS,
+
+    /* Views are packed per line, as if interlaced
+     *
+     *    LLLLLLLL
+     *    RRRRRRRR
+     *    LLLLLLLL
+     *    ...
+     */
+    AV_STEREO3D_LINES,
+
+    /* Views are packed per column
+     *
+     *    LRLRLRLR
+     *    LRLRLRLR
+     *    LRLRLRLR
+     *    ...
+     */
+    AV_STEREO3D_COLUMNS,
+
+    /* Views are next to each other
+     *
+     *    LLLLRRRR
+     *    LLLLRRRR
+     *    LLLLRRRR
+     *    ...
+     */
+    AV_STEREO3D_SIDEBYSIDE,
+
+    /* Views are on top of each other
+     *
+     *    LLLLLLLL
+     *    LLLLLLLL
+     *    RRRRRRRR
+     *    RRRRRRRR
+     */
+    AV_STEREO3D_TOPBOTTOM,
+};
+
+
+enum AVStereo3DInfo {
+    /* Views are assumed to be at full resolution and is
+     * "Left is Left" mode, with no other fancy stuff
+     */
+    AV_STEREO3D_NORMAL                   = 0x00000000,
+
+    /* View are at half resolution */
+    AV_STEREO3D_SIZE_HALF                = 0x00000001,
+
+    /* Invert views, L becomes R and R becomes L */
+    AV_STEREO3D_ORDER_INVERT             = 0x00000002,
+
+    /* When upscaling apply a checkerboard pattern, like
+     *
+     *     LLLLRRRR          L L L L    R R R R
+     *     LLLLRRRR    =>     L L L L  R R R R
+     *     LLLLRRRR          L L L L    R R R R
+     *     LLLLRRRR           L L L L  R R R R
+     */
+    AV_STEREO3D_QUINCUNX                 = 0x00000004,
+
+    /* Video surface also contains a depth map */
+    AV_STEREO3D_DEPTH                    = 0x00000008,
+};
+
+// Unused for now
+enum AVStereo3DAnalgyph {
+    AV_STEREO3D_ANAGLYPH_RED_CYAN,
+    AV_STEREO3D_ANAGLYPH_GREEN_MAGENTA,
+    AV_STEREO3D_ANAGLYPH_AMBER_BLUE,
+    AV_STEREO3D_ANAGLYPH_RED_GREEN,
+    AV_STEREO3D_ANAGLYPH_RED_BLUE,
+    AV_STEREO3D_ANAGLYPH_MAGENTA_CYAN,
+};
+
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to