diff --git a/gst-libs/gst/video/video-info.c b/gst-libs/gst/video/video-info.c index 7a8f4ad4fd..4e90250bdc 100644 --- a/gst-libs/gst/video/video-info.c +++ b/gst-libs/gst/video/video-info.c @@ -731,11 +731,7 @@ fill_planes (GstVideoInfo * info) gint bpp = 0, i; width = (gsize) info->width; - if (GST_VIDEO_INFO_INTERLACE_MODE (info) == - GST_VIDEO_INTERLACE_MODE_ALTERNATE) - height = (gsize) info->height / 2; - else - height = (gsize) info->height; + height = (gsize) GST_VIDEO_INFO_FIELD_HEIGHT (info); /* Sanity check the resulting frame size for overflows */ for (i = 0; i < GST_VIDEO_INFO_N_COMPONENTS (info); i++) diff --git a/gst-libs/gst/video/video-info.h b/gst-libs/gst/video/video-info.h index 36268a9f09..674ac6a51d 100644 --- a/gst-libs/gst/video/video-info.h +++ b/gst-libs/gst/video/video-info.h @@ -351,6 +351,15 @@ GType gst_video_info_get_type (void); #define GST_VIDEO_INFO_FLAGS(i) ((i)->flags) #define GST_VIDEO_INFO_WIDTH(i) ((i)->width) #define GST_VIDEO_INFO_HEIGHT(i) ((i)->height) +/** + * GST_VIDEO_INFO_FIELD_HEIGHT: + * + * The height of a field. It's the height of the full frame unless split-field + * (alternate) interlacing is in use. + * + * Since: 1.16. + */ +#define GST_VIDEO_INFO_FIELD_HEIGHT(i) ((i)->interlace_mode == GST_VIDEO_INTERLACE_MODE_ALTERNATE? (i)->height / 2 : (i)->height) #define GST_VIDEO_INFO_SIZE(i) ((i)->size) #define GST_VIDEO_INFO_VIEWS(i) ((i)->views) #define GST_VIDEO_INFO_PAR_N(i) ((i)->par_n) @@ -381,7 +390,7 @@ GType gst_video_info_get_type (void); #define GST_VIDEO_INFO_COMP_OFFSET(i,c) GST_VIDEO_FORMAT_INFO_OFFSET((i)->finfo,(i)->offset,(c)) #define GST_VIDEO_INFO_COMP_STRIDE(i,c) GST_VIDEO_FORMAT_INFO_STRIDE((i)->finfo,(i)->stride,(c)) #define GST_VIDEO_INFO_COMP_WIDTH(i,c) GST_VIDEO_FORMAT_INFO_SCALE_WIDTH((i)->finfo,(c),(i)->width) -#define GST_VIDEO_INFO_COMP_HEIGHT(i,c) GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT((i)->finfo,(c),(i)->height) +#define GST_VIDEO_INFO_COMP_HEIGHT(i,c) GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT((i)->finfo,(c),GST_VIDEO_INFO_FIELD_HEIGHT(i)) #define GST_VIDEO_INFO_COMP_PLANE(i,c) GST_VIDEO_FORMAT_INFO_PLANE((i)->finfo,(c)) #define GST_VIDEO_INFO_COMP_PSTRIDE(i,c) GST_VIDEO_FORMAT_INFO_PSTRIDE((i)->finfo,(c)) #define GST_VIDEO_INFO_COMP_POFFSET(i,c) GST_VIDEO_FORMAT_INFO_POFFSET((i)->finfo,(c))