1 /* 2 * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com> 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 /** 22 * @file 23 * Stereoscopic video 24 */ 25 module ffmpeg.libavutil.stereo3d; 26 27 import ffmpeg.libavutil; 28 29 30 extern (C) @nogc nothrow: 31 32 /** 33 * @addtogroup lavu_video 34 * @{ 35 * 36 * @defgroup lavu_video_stereo3d Stereo3D types and functions 37 * @{ 38 */ 39 40 /** 41 * @addtogroup lavu_video_stereo3d 42 * A stereoscopic video file consists in multiple views embedded in a single 43 * frame, usually describing two views of a scene. This file describes all 44 * possible codec-independent view arrangements. 45 * */ 46 47 /** 48 * List of possible 3D Types 49 */ 50 enum AVStereo3DType 51 { 52 /** 53 * Video is not stereoscopic (and metadata has to be there). 54 */ 55 AV_STEREO3D_2D = 0, 56 57 /** 58 * Views are next to each other. 59 * 60 * @code{.unparsed} 61 * LLLLRRRR 62 * LLLLRRRR 63 * LLLLRRRR 64 * ... 65 * @endcode 66 */ 67 AV_STEREO3D_SIDEBYSIDE = 1, 68 69 /** 70 * Views are on top of each other. 71 * 72 * @code{.unparsed} 73 * LLLLLLLL 74 * LLLLLLLL 75 * RRRRRRRR 76 * RRRRRRRR 77 * @endcode 78 */ 79 AV_STEREO3D_TOPBOTTOM = 2, 80 81 /** 82 * Views are alternated temporally. 83 * 84 * @code{.unparsed} 85 * frame0 frame1 frame2 ... 86 * LLLLLLLL RRRRRRRR LLLLLLLL 87 * LLLLLLLL RRRRRRRR LLLLLLLL 88 * LLLLLLLL RRRRRRRR LLLLLLLL 89 * ... ... ... 90 * @endcode 91 */ 92 AV_STEREO3D_FRAMESEQUENCE = 3, 93 94 /** 95 * Views are packed in a checkerboard-like structure per pixel. 96 * 97 * @code{.unparsed} 98 * LRLRLRLR 99 * RLRLRLRL 100 * LRLRLRLR 101 * ... 102 * @endcode 103 */ 104 AV_STEREO3D_CHECKERBOARD = 4, 105 106 /** 107 * Views are next to each other, but when upscaling 108 * apply a checkerboard pattern. 109 * 110 * @code{.unparsed} 111 * LLLLRRRR L L L L R R R R 112 * LLLLRRRR => L L L L R R R R 113 * LLLLRRRR L L L L R R R R 114 * LLLLRRRR L L L L R R R R 115 * @endcode 116 */ 117 AV_STEREO3D_SIDEBYSIDE_QUINCUNX = 5, 118 119 /** 120 * Views are packed per line, as if interlaced. 121 * 122 * @code{.unparsed} 123 * LLLLLLLL 124 * RRRRRRRR 125 * LLLLLLLL 126 * ... 127 * @endcode 128 */ 129 AV_STEREO3D_LINES = 6, 130 131 /** 132 * Views are packed per column. 133 * 134 * @code{.unparsed} 135 * LRLRLRLR 136 * LRLRLRLR 137 * LRLRLRLR 138 * ... 139 * @endcode 140 */ 141 AV_STEREO3D_COLUMNS = 7 142 } 143 144 /** 145 * List of possible view types. 146 */ 147 enum AVStereo3DView 148 { 149 /** 150 * Frame contains two packed views. 151 */ 152 AV_STEREO3D_VIEW_PACKED = 0, 153 154 /** 155 * Frame contains only the left view. 156 */ 157 AV_STEREO3D_VIEW_LEFT = 1, 158 159 /** 160 * Frame contains only the right view. 161 */ 162 AV_STEREO3D_VIEW_RIGHT = 2 163 } 164 165 /** 166 * Inverted views, Right/Bottom represents the left view. 167 */ 168 enum AV_STEREO3D_FLAG_INVERT = 1 << 0; 169 170 /** 171 * Stereo 3D type: this structure describes how two videos are packed 172 * within a single video surface, with additional information as needed. 173 * 174 * @note The struct must be allocated with av_stereo3d_alloc() and 175 * its size is not a part of the public ABI. 176 */ 177 struct AVStereo3D 178 { 179 /** 180 * How views are packed within the video. 181 */ 182 AVStereo3DType type; 183 184 /** 185 * Additional information about the frame packing. 186 */ 187 int flags; 188 189 /** 190 * Determines which views are packed. 191 */ 192 AVStereo3DView view; 193 } 194 195 /** 196 * Allocate an AVStereo3D structure and set its fields to default values. 197 * The resulting struct can be freed using av_freep(). 198 * 199 * @return An AVStereo3D filled with default values or NULL on failure. 200 */ 201 AVStereo3D* av_stereo3d_alloc (); 202 203 /** 204 * Allocate a complete AVFrameSideData and add it to the frame. 205 * 206 * @param frame The frame which side data is added to. 207 * 208 * @return The AVStereo3D structure to be filled by caller. 209 */ 210 AVStereo3D* av_stereo3d_create_side_data (AVFrame* frame); 211 212 /** 213 * Provide a human-readable name of a given stereo3d type. 214 * 215 * @param type The input stereo3d type value. 216 * 217 * @return The name of the stereo3d value, or "unknown". 218 */ 219 const(char)* av_stereo3d_type_name (uint type); 220 221 /** 222 * Get the AVStereo3DType form a human-readable name. 223 * 224 * @param name The input string. 225 * 226 * @return The AVStereo3DType value, or -1 if not found. 227 */ 228 int av_stereo3d_from_name (const(char)* name); 229 230 /** 231 * @} 232 * @} 233 */ 234 235 /* AVUTIL_STEREO3D_H */