| 1 | /* GStreamer |
| 2 | * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public |
| 15 | * License along with this library; if not, write to the |
| 16 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __GST_VIDEO_INFO_H__ |
| 21 | #define __GST_VIDEO_INFO_H__ |
| 22 | |
| 23 | #include <gst/gst.h> |
| 24 | #include <gst/video/video-format.h> |
| 25 | #include <gst/video/video-color.h> |
| 26 | |
| 27 | G_BEGIN_DECLS |
| 28 | |
| 29 | #include <gst/video/video-enumtypes.h> |
| 30 | |
| 31 | typedef struct _GstVideoInfo GstVideoInfo; |
| 32 | |
| 33 | /** |
| 34 | * GST_CAPS_FEATURE_FORMAT_INTERLACED: |
| 35 | * |
| 36 | * Name of the caps feature indicating that the stream is interlaced. |
| 37 | * |
| 38 | * Currently it is only used for video with 'interlace-mode=alternate' |
| 39 | * to ensure backwards compatibility for this new mode. |
| 40 | * In this mode each buffer carries a single field of interlaced video. |
| 41 | * @GST_VIDEO_BUFFER_FLAG_TOP_FIELD and @GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD |
| 42 | * indicate whether the buffer carries a top or bottom field. The order of |
| 43 | * buffers/fields in the stream and the timestamps on the buffers indicate the |
| 44 | * temporal order of the fields. |
| 45 | * Top and bottom fields are expected to alternate in this mode. |
| 46 | * The frame rate in the caps still signals the frame rate, so the notional field |
| 47 | * rate will be twice the frame rate from the caps |
| 48 | * (see @GST_VIDEO_INFO_FIELD_RATE_N). |
| 49 | * |
| 50 | * Since: 1.16. |
| 51 | */ |
| 52 | #define GST_CAPS_FEATURE_FORMAT_INTERLACED "format:Interlaced" |
| 53 | |
| 54 | /** |
| 55 | * GstVideoInterlaceMode: |
| 56 | * @GST_VIDEO_INTERLACE_MODE_PROGRESSIVE: all frames are progressive |
| 57 | * @GST_VIDEO_INTERLACE_MODE_INTERLEAVED: 2 fields are interleaved in one video |
| 58 | * frame. Extra buffer flags describe the field order. |
| 59 | * @GST_VIDEO_INTERLACE_MODE_MIXED: frames contains both interlaced and |
| 60 | * progressive video, the buffer flags describe the frame and fields. |
| 61 | * @GST_VIDEO_INTERLACE_MODE_FIELDS: 2 fields are stored in one buffer, use the |
| 62 | * frame ID to get access to the required field. For multiview (the |
| 63 | * 'views' property > 1) the fields of view N can be found at frame ID |
| 64 | * (N * 2) and (N * 2) + 1. |
| 65 | * Each field has only half the amount of lines as noted in the |
| 66 | * height property. This mode requires multiple GstVideoMeta metadata |
| 67 | * to describe the fields. |
| 68 | * @GST_VIDEO_INTERLACE_MODE_ALTERNATE: 1 field is stored in one buffer, |
| 69 | * @GST_VIDEO_BUFFER_FLAG_TF or @GST_VIDEO_BUFFER_FLAG_BF indicates if |
| 70 | * the buffer is carrying the top or bottom field, respectively. The top and |
| 71 | * bottom buffers must alternate in the pipeline, with this mode |
| 72 | * (Since: 1.16). |
| 73 | * |
| 74 | * The possible values of the #GstVideoInterlaceMode describing the interlace |
| 75 | * mode of the stream. |
| 76 | */ |
| 77 | typedef enum { |
| 78 | GST_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0, |
| 79 | GST_VIDEO_INTERLACE_MODE_INTERLEAVED, |
| 80 | GST_VIDEO_INTERLACE_MODE_MIXED, |
| 81 | GST_VIDEO_INTERLACE_MODE_FIELDS, |
| 82 | GST_VIDEO_INTERLACE_MODE_ALTERNATE, |
| 83 | } GstVideoInterlaceMode; |
| 84 | |
| 85 | GST_VIDEO_API |
| 86 | const gchar * gst_video_interlace_mode_to_string (GstVideoInterlaceMode mode); |
| 87 | |
| 88 | GST_VIDEO_API |
| 89 | GstVideoInterlaceMode gst_video_interlace_mode_from_string (const gchar * mode); |
| 90 | |
| 91 | /** |
| 92 | * GstVideoMultiviewMode: |
| 93 | * @GST_VIDEO_MULTIVIEW_MODE_NONE: A special value indicating |
| 94 | * no multiview information. Used in GstVideoInfo and other places to |
| 95 | * indicate that no specific multiview handling has been requested or |
| 96 | * provided. This value is never carried on caps. |
| 97 | * @GST_VIDEO_MULTIVIEW_MODE_MONO: All frames are monoscopic. |
| 98 | * @GST_VIDEO_MULTIVIEW_MODE_LEFT: All frames represent a left-eye view. |
| 99 | * @GST_VIDEO_MULTIVIEW_MODE_RIGHT: All frames represent a right-eye view. |
| 100 | * @GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE: Left and right eye views are |
| 101 | * provided in the left and right half of the frame respectively. |
| 102 | * @GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX: Left and right eye |
| 103 | * views are provided in the left and right half of the frame, but |
| 104 | * have been sampled using quincunx method, with half-pixel offset |
| 105 | * between the 2 views. |
| 106 | * @GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED: Alternating vertical |
| 107 | * columns of pixels represent the left and right eye view respectively. |
| 108 | * @GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED: Alternating horizontal |
| 109 | * rows of pixels represent the left and right eye view respectively. |
| 110 | * @GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM: The top half of the frame |
| 111 | * contains the left eye, and the bottom half the right eye. |
| 112 | * @GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD: Pixels are arranged with |
| 113 | * alternating pixels representing left and right eye views in a |
| 114 | * checkerboard fashion. |
| 115 | * @GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME: Left and right eye views |
| 116 | * are provided in separate frames alternately. |
| 117 | * @GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME: Multiple |
| 118 | * independent views are provided in separate frames in sequence. |
| 119 | * This method only applies to raw video buffers at the moment. |
| 120 | * Specific view identification is via the `GstVideoMultiviewMeta` |
| 121 | * and #GstVideoMeta(s) on raw video buffers. |
| 122 | * @GST_VIDEO_MULTIVIEW_MODE_SEPARATED: Multiple views are |
| 123 | * provided as separate #GstMemory framebuffers attached to each |
| 124 | * #GstBuffer, described by the `GstVideoMultiviewMeta` |
| 125 | * and #GstVideoMeta(s) |
| 126 | * |
| 127 | * All possible stereoscopic 3D and multiview representations. |
| 128 | * In conjunction with #GstVideoMultiviewFlags, describes how |
| 129 | * multiview content is being transported in the stream. |
| 130 | */ |
| 131 | typedef enum { |
| 132 | GST_VIDEO_MULTIVIEW_MODE_NONE = -1, |
| 133 | GST_VIDEO_MULTIVIEW_MODE_MONO = 0, |
| 134 | /* Single view modes */ |
| 135 | GST_VIDEO_MULTIVIEW_MODE_LEFT, |
| 136 | GST_VIDEO_MULTIVIEW_MODE_RIGHT, |
| 137 | /* Stereo view modes */ |
| 138 | GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE, |
| 139 | GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX, |
| 140 | GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED, |
| 141 | GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED, |
| 142 | GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM, |
| 143 | GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD, |
| 144 | /* Padding for new frame packing modes */ |
| 145 | |
| 146 | GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME = 32, |
| 147 | /* Multivew mode(s) */ |
| 148 | GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME, |
| 149 | GST_VIDEO_MULTIVIEW_MODE_SEPARATED |
| 150 | /* future expansion for annotated modes */ |
| 151 | } GstVideoMultiviewMode; |
| 152 | |
| 153 | /** |
| 154 | * GstVideoMultiviewFramePacking: |
| 155 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE: A special value indicating |
| 156 | * no frame packing info. |
| 157 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO: All frames are monoscopic. |
| 158 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT: All frames represent a left-eye view. |
| 159 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT: All frames represent a right-eye view. |
| 160 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE: Left and right eye views are |
| 161 | * provided in the left and right half of the frame respectively. |
| 162 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX: Left and right eye |
| 163 | * views are provided in the left and right half of the frame, but |
| 164 | * have been sampled using quincunx method, with half-pixel offset |
| 165 | * between the 2 views. |
| 166 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED: Alternating vertical |
| 167 | * columns of pixels represent the left and right eye view respectively. |
| 168 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED: Alternating horizontal |
| 169 | * rows of pixels represent the left and right eye view respectively. |
| 170 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM: The top half of the frame |
| 171 | * contains the left eye, and the bottom half the right eye. |
| 172 | * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD: Pixels are arranged with |
| 173 | * alternating pixels representing left and right eye views in a |
| 174 | * checkerboard fashion. |
| 175 | * |
| 176 | * #GstVideoMultiviewFramePacking represents the subset of #GstVideoMultiviewMode |
| 177 | * values that can be applied to any video frame without needing extra metadata. |
| 178 | * It can be used by elements that provide a property to override the |
| 179 | * multiview interpretation of a video stream when the video doesn't contain |
| 180 | * any markers. |
| 181 | * |
| 182 | * This enum is used (for example) on playbin, to re-interpret a played |
| 183 | * video stream as a stereoscopic video. The individual enum values are |
| 184 | * equivalent to and have the same value as the matching #GstVideoMultiviewMode. |
| 185 | * |
| 186 | */ |
| 187 | typedef enum { |
| 188 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE = GST_VIDEO_MULTIVIEW_MODE_NONE, |
| 189 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO = GST_VIDEO_MULTIVIEW_MODE_MONO, |
| 190 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT = GST_VIDEO_MULTIVIEW_MODE_LEFT, |
| 191 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT = GST_VIDEO_MULTIVIEW_MODE_RIGHT, |
| 192 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE = GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE, |
| 193 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX = GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX, |
| 194 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED = GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED, |
| 195 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED = GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED, |
| 196 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM = GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM, |
| 197 | GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD = GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD |
| 198 | } GstVideoMultiviewFramePacking; |
| 199 | |
| 200 | #define GST_VIDEO_MULTIVIEW_MAX_FRAME_PACKING GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD |
| 201 | |
| 202 | /** |
| 203 | * GstVideoMultiviewFlags: |
| 204 | * @GST_VIDEO_MULTIVIEW_FLAGS_NONE: No flags |
| 205 | * @GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST: For stereo streams, the |
| 206 | * normal arrangement of left and right views is reversed. |
| 207 | * @GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED: The left view is vertically |
| 208 | * mirrored. |
| 209 | * @GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED: The left view is horizontally |
| 210 | * mirrored. |
| 211 | * @GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED: The right view is |
| 212 | * vertically mirrored. |
| 213 | * @GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED: The right view is |
| 214 | * horizontally mirrored. |
| 215 | * @GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT: For frame-packed |
| 216 | * multiview modes, indicates that the individual |
| 217 | * views have been encoded with half the true width or height |
| 218 | * and should be scaled back up for display. This flag |
| 219 | * is used for overriding input layout interpretation |
| 220 | * by adjusting pixel-aspect-ratio. |
| 221 | * For side-by-side, column interleaved or checkerboard packings, the |
| 222 | * pixel width will be doubled. For row interleaved and top-bottom |
| 223 | * encodings, pixel height will be doubled. |
| 224 | * @GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO: The video stream contains both |
| 225 | * mono and multiview portions, signalled on each buffer by the |
| 226 | * absence or presence of the @GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW |
| 227 | * buffer flag. |
| 228 | * |
| 229 | * GstVideoMultiviewFlags are used to indicate extra properties of a |
| 230 | * stereo/multiview stream beyond the frame layout and buffer mapping |
| 231 | * that is conveyed in the #GstVideoMultiviewMode. |
| 232 | */ |
| 233 | typedef enum { |
| 234 | GST_VIDEO_MULTIVIEW_FLAGS_NONE = 0, |
| 235 | GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST = (1 << 0), |
| 236 | GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED = (1 << 1), |
| 237 | GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED = (1 << 2), |
| 238 | GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED = (1 << 3), |
| 239 | GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED = (1 << 4), |
| 240 | GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT = (1 << 14), |
| 241 | GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = (1 << 15) |
| 242 | } GstVideoMultiviewFlags; |
| 243 | |
| 244 | /** |
| 245 | * GstVideoFlags: |
| 246 | * @GST_VIDEO_FLAG_NONE: no flags |
| 247 | * @GST_VIDEO_FLAG_VARIABLE_FPS: a variable fps is selected, fps_n and fps_d |
| 248 | * denote the maximum fps of the video |
| 249 | * @GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA: Each color has been scaled by the alpha |
| 250 | * value. |
| 251 | * |
| 252 | * Extra video flags |
| 253 | */ |
| 254 | typedef enum { |
| 255 | GST_VIDEO_FLAG_NONE = 0, |
| 256 | GST_VIDEO_FLAG_VARIABLE_FPS = (1 << 0), |
| 257 | GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1) |
| 258 | } GstVideoFlags; |
| 259 | |
| 260 | /** |
| 261 | * GstVideoFieldOrder: |
| 262 | * @GST_VIDEO_FIELD_ORDER_UNKNOWN: unknown field order for interlaced content. |
| 263 | * The actual field order is signalled via buffer flags. |
| 264 | * @GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST: top field is first |
| 265 | * @GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST: bottom field is first |
| 266 | * |
| 267 | * Field order of interlaced content. This is only valid for |
| 268 | * interlace-mode=interleaved and not interlace-mode=mixed. In the case of |
| 269 | * mixed or GST_VIDEO_FIELD_ORDER_UNKOWN, the field order is signalled via |
| 270 | * buffer flags. |
| 271 | * |
| 272 | * Since: 1.12 |
| 273 | */ |
| 274 | typedef enum { |
| 275 | GST_VIDEO_FIELD_ORDER_UNKNOWN = 0, |
| 276 | GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST = 1, |
| 277 | GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST = 2, |
| 278 | } GstVideoFieldOrder; |
| 279 | |
| 280 | GST_VIDEO_API |
| 281 | const gchar * gst_video_field_order_to_string (GstVideoFieldOrder order); |
| 282 | |
| 283 | GST_VIDEO_API |
| 284 | GstVideoFieldOrder gst_video_field_order_from_string (const gchar * order); |
| 285 | |
| 286 | /** |
| 287 | * GstVideoInfo: |
| 288 | * @finfo: the format info of the video |
| 289 | * @interlace_mode: the interlace mode |
| 290 | * @flags: additional video flags |
| 291 | * @width: the width of the video |
| 292 | * @height: the height of the video |
| 293 | * @views: the number of views for multiview video |
| 294 | * @size: the default size of one frame |
| 295 | * @chroma_site: a #GstVideoChromaSite. |
| 296 | * @colorimetry: the colorimetry info |
| 297 | * @par_n: the pixel-aspect-ratio numerator |
| 298 | * @par_d: the pixel-aspect-ratio denominator |
| 299 | * @fps_n: the framerate numerator |
| 300 | * @fps_d: the framerate denominator |
| 301 | * @offset: offsets of the planes |
| 302 | * @stride: strides of the planes |
| 303 | * @multiview_mode: delivery mode for multiple views. (Since: 1.6) |
| 304 | * @multiview_flags: flags for multiple views configuration (Since: 1.6) |
| 305 | * |
| 306 | * Information describing image properties. This information can be filled |
| 307 | * in from GstCaps with gst_video_info_from_caps(). The information is also used |
| 308 | * to store the specific video info when mapping a video frame with |
| 309 | * gst_video_frame_map(). |
| 310 | * |
| 311 | * Use the provided macros to access the info in this structure. |
| 312 | */ |
| 313 | struct _GstVideoInfo { |
| 314 | const GstVideoFormatInfo *finfo; |
| 315 | |
| 316 | GstVideoInterlaceMode interlace_mode; |
| 317 | GstVideoFlags flags; |
| 318 | gint width; |
| 319 | gint height; |
| 320 | gsize size; |
| 321 | gint views; |
| 322 | |
| 323 | GstVideoChromaSite chroma_site; |
| 324 | GstVideoColorimetry colorimetry; |
| 325 | |
| 326 | gint par_n; |
| 327 | gint par_d; |
| 328 | gint fps_n; |
| 329 | gint fps_d; |
| 330 | |
| 331 | gsize offset[GST_VIDEO_MAX_PLANES]; |
| 332 | gint stride[GST_VIDEO_MAX_PLANES]; |
| 333 | |
| 334 | /* Union preserves padded struct size for backwards compat |
| 335 | * Consumer code should use the accessor macros for fields */ |
| 336 | union { |
| 337 | struct { /* < skip > */ |
| 338 | GstVideoMultiviewMode multiview_mode; |
| 339 | GstVideoMultiviewFlags multiview_flags; |
| 340 | GstVideoFieldOrder field_order; |
| 341 | } abi; |
| 342 | /*< private >*/ |
| 343 | gpointer _gst_reserved[GST_PADDING]; |
| 344 | } ABI; |
| 345 | }; |
| 346 | |
| 347 | #define GST_TYPE_VIDEO_INFO (gst_video_info_get_type ()) |
| 348 | GST_VIDEO_API |
| 349 | GType gst_video_info_get_type (void); |
| 350 | |
| 351 | /* general info */ |
| 352 | #define GST_VIDEO_INFO_FORMAT(i) (GST_VIDEO_FORMAT_INFO_FORMAT((i)->finfo)) |
| 353 | #define GST_VIDEO_INFO_NAME(i) (GST_VIDEO_FORMAT_INFO_NAME((i)->finfo)) |
| 354 | #define GST_VIDEO_INFO_IS_YUV(i) (GST_VIDEO_FORMAT_INFO_IS_YUV((i)->finfo)) |
| 355 | #define GST_VIDEO_INFO_IS_RGB(i) (GST_VIDEO_FORMAT_INFO_IS_RGB((i)->finfo)) |
| 356 | #define GST_VIDEO_INFO_IS_GRAY(i) (GST_VIDEO_FORMAT_INFO_IS_GRAY((i)->finfo)) |
| 357 | #define GST_VIDEO_INFO_HAS_ALPHA(i) (GST_VIDEO_FORMAT_INFO_HAS_ALPHA((i)->finfo)) |
| 358 | |
| 359 | #define GST_VIDEO_INFO_INTERLACE_MODE(i) ((i)->interlace_mode) |
| 360 | #define GST_VIDEO_INFO_IS_INTERLACED(i) ((i)->interlace_mode != GST_VIDEO_INTERLACE_MODE_PROGRESSIVE) |
| 361 | #define GST_VIDEO_INFO_FIELD_ORDER(i) ((i)->ABI.abi.field_order) |
| 362 | #define GST_VIDEO_INFO_FLAGS(i) ((i)->flags) |
| 363 | #define GST_VIDEO_INFO_WIDTH(i) ((i)->width) |
| 364 | #define GST_VIDEO_INFO_HEIGHT(i) ((i)->height) |
| 365 | /** |
| 366 | * GST_VIDEO_INFO_FIELD_HEIGHT: |
| 367 | * |
| 368 | * The height of a field. It's the height of the full frame unless split-field |
| 369 | * (alternate) interlacing is in use. |
| 370 | * |
| 371 | * Since: 1.16. |
| 372 | */ |
| 373 | #define GST_VIDEO_INFO_FIELD_HEIGHT(i) ((i)->interlace_mode == GST_VIDEO_INTERLACE_MODE_ALTERNATE? GST_ROUND_UP_2 ((i)->height) / 2 : (i)->height) |
| 374 | #define GST_VIDEO_INFO_SIZE(i) ((i)->size) |
| 375 | #define GST_VIDEO_INFO_VIEWS(i) ((i)->views) |
| 376 | #define GST_VIDEO_INFO_PAR_N(i) ((i)->par_n) |
| 377 | #define GST_VIDEO_INFO_PAR_D(i) ((i)->par_d) |
| 378 | #define GST_VIDEO_INFO_FPS_N(i) ((i)->fps_n) |
| 379 | #define GST_VIDEO_INFO_FIELD_RATE_N(i) ((GST_VIDEO_INFO_INTERLACE_MODE ((i)) == \ |
| 380 | GST_VIDEO_INTERLACE_MODE_ALTERNATE) ? \ |
| 381 | (i)->fps_n * 2 : (i)->fps_n) |
| 382 | #define GST_VIDEO_INFO_FPS_D(i) ((i)->fps_d) |
| 383 | |
| 384 | #define GST_VIDEO_INFO_COLORIMETRY(i) ((i)->colorimetry) |
| 385 | #define GST_VIDEO_INFO_CHROMA_SITE(i) ((i)->chroma_site) |
| 386 | |
| 387 | #define GST_VIDEO_INFO_MULTIVIEW_MODE(i) ((i)->ABI.abi.multiview_mode) |
| 388 | #define GST_VIDEO_INFO_MULTIVIEW_FLAGS(i) ((i)->ABI.abi.multiview_flags) |
| 389 | |
| 390 | /* dealing with GstVideoInfo flags */ |
| 391 | #define GST_VIDEO_INFO_FLAG_IS_SET(i,flag) ((GST_VIDEO_INFO_FLAGS(i) & (flag)) == (flag)) |
| 392 | #define GST_VIDEO_INFO_FLAG_SET(i,flag) (GST_VIDEO_INFO_FLAGS(i) |= (flag)) |
| 393 | #define GST_VIDEO_INFO_FLAG_UNSET(i,flag) (GST_VIDEO_INFO_FLAGS(i) &= ~(flag)) |
| 394 | |
| 395 | /* dealing with planes */ |
| 396 | #define GST_VIDEO_INFO_N_PLANES(i) (GST_VIDEO_FORMAT_INFO_N_PLANES((i)->finfo)) |
| 397 | #define GST_VIDEO_INFO_PLANE_OFFSET(i,p) ((i)->offset[p]) |
| 398 | #define GST_VIDEO_INFO_PLANE_STRIDE(i,p) ((i)->stride[p]) |
| 399 | /** |
| 400 | * GST_VIDEO_INFO_PLANE_HEIGHT: |
| 401 | * |
| 402 | * The padded height in pixels of a plane (padded size divided by the plane stride). |
| 403 | * In case of GST_VIDEO_INTERLACE_MODE_ALTERNATE info, this macro returns the |
| 404 | * plane heights used to hold a single field, not the full frame. |
| 405 | * |
| 406 | * The size passed as third argument is the size of the pixel data and should |
| 407 | * not contain any extra metadata padding. |
| 408 | * |
| 409 | * It is not valid to use this macro with a TILED format. |
| 410 | * |
| 411 | * Since: 1.18 |
| 412 | */ |
| 413 | #define GST_VIDEO_INFO_PLANE_HEIGHT(i,p,sizes) ((i)->stride[p] == 0 ? 0 : sizes[p] / (i)->stride[p]) |
| 414 | |
| 415 | /* dealing with components */ |
| 416 | #define GST_VIDEO_INFO_N_COMPONENTS(i) GST_VIDEO_FORMAT_INFO_N_COMPONENTS((i)->finfo) |
| 417 | #define GST_VIDEO_INFO_COMP_DEPTH(i,c) GST_VIDEO_FORMAT_INFO_DEPTH((i)->finfo,(c)) |
| 418 | #define GST_VIDEO_INFO_COMP_DATA(i,d,c) GST_VIDEO_FORMAT_INFO_DATA((i)->finfo,d,(c)) |
| 419 | #define GST_VIDEO_INFO_COMP_OFFSET(i,c) GST_VIDEO_FORMAT_INFO_OFFSET((i)->finfo,(i)->offset,(c)) |
| 420 | #define GST_VIDEO_INFO_COMP_STRIDE(i,c) GST_VIDEO_FORMAT_INFO_STRIDE((i)->finfo,(i)->stride,(c)) |
| 421 | #define GST_VIDEO_INFO_COMP_WIDTH(i,c) GST_VIDEO_FORMAT_INFO_SCALE_WIDTH((i)->finfo,(c),(i)->width) |
| 422 | #define GST_VIDEO_INFO_COMP_HEIGHT(i,c) GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT((i)->finfo,(c),GST_VIDEO_INFO_FIELD_HEIGHT(i)) |
| 423 | #define GST_VIDEO_INFO_COMP_PLANE(i,c) GST_VIDEO_FORMAT_INFO_PLANE((i)->finfo,(c)) |
| 424 | #define GST_VIDEO_INFO_COMP_PSTRIDE(i,c) GST_VIDEO_FORMAT_INFO_PSTRIDE((i)->finfo,(c)) |
| 425 | #define GST_VIDEO_INFO_COMP_POFFSET(i,c) GST_VIDEO_FORMAT_INFO_POFFSET((i)->finfo,(c)) |
| 426 | |
| 427 | GST_VIDEO_API |
| 428 | GstVideoInfo * gst_video_info_new (void); |
| 429 | |
| 430 | GST_VIDEO_API |
| 431 | void gst_video_info_init (GstVideoInfo *info); |
| 432 | |
| 433 | GST_VIDEO_API |
| 434 | GstVideoInfo * gst_video_info_copy (const GstVideoInfo *info); |
| 435 | |
| 436 | GST_VIDEO_API |
| 437 | void gst_video_info_free (GstVideoInfo *info); |
| 438 | |
| 439 | GST_VIDEO_API |
| 440 | GstVideoInfo * gst_video_info_new_from_caps (const GstCaps * caps); |
| 441 | |
| 442 | GST_VIDEO_API |
| 443 | gboolean gst_video_info_set_format (GstVideoInfo *info, GstVideoFormat format, |
| 444 | guint width, guint height); |
| 445 | |
| 446 | GST_VIDEO_API |
| 447 | gboolean gst_video_info_set_interlaced_format |
| 448 | (GstVideoInfo *info, |
| 449 | GstVideoFormat format, |
| 450 | GstVideoInterlaceMode mode, |
| 451 | guint width, |
| 452 | guint height); |
| 453 | |
| 454 | GST_VIDEO_API |
| 455 | gboolean gst_video_info_from_caps (GstVideoInfo *info, const GstCaps * caps); |
| 456 | |
| 457 | GST_VIDEO_API |
| 458 | GstCaps * gst_video_info_to_caps (const GstVideoInfo *info); |
| 459 | |
| 460 | GST_VIDEO_API |
| 461 | gboolean gst_video_info_convert (const GstVideoInfo *info, |
| 462 | GstFormat src_format, |
| 463 | gint64 src_value, |
| 464 | GstFormat dest_format, |
| 465 | gint64 *dest_value); |
| 466 | |
| 467 | GST_VIDEO_API |
| 468 | gboolean gst_video_info_is_equal (const GstVideoInfo *info, |
| 469 | const GstVideoInfo *other); |
| 470 | |
| 471 | #include <gst/video/video.h> |
| 472 | |
| 473 | GST_VIDEO_API |
| 474 | gboolean gst_video_info_align (GstVideoInfo * info, GstVideoAlignment * align); |
| 475 | |
| 476 | GST_VIDEO_API |
| 477 | gboolean gst_video_info_align_full (GstVideoInfo * info, GstVideoAlignment * align, gsize plane_size[GST_VIDEO_MAX_PLANES]); |
| 478 | |
| 479 | |
| 480 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoInfo, gst_video_info_free) |
| 481 | |
| 482 | G_END_DECLS |
| 483 | |
| 484 | #endif /* __GST_VIDEO_INFO_H__ */ |
| 485 | |