summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2021-05-18 15:36:36 -0400
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-05-19 15:17:56 +0000
commit3897b24f6978f527f4294f65bda10d255749ce57 (patch)
tree328cd7eb9114b88e8a90ba492999c9ec480f2361 /gst
parent42512c92de9fb49f1b2af48889313f0ff0c9fd6b (diff)
downloadgstreamer-plugins-base-3897b24f6978f527f4294f65bda10d255749ce57.tar.gz
video: Pass component index not plane index
While so far it worked, we are about to introduce a format that break this assuming. We have a format which consist of NV12 with alpha, and this format does not have a direct mapping of the component against their plane indexes. Fix this by using gst_video_format_info_component() introduced in 1.18 for this purpose. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1151>
Diffstat (limited to 'gst')
-rw-r--r--gst/compositor/compositor.c13
-rw-r--r--gst/rawparse/gstrawvideoparse.c4
2 files changed, 11 insertions, 6 deletions
diff --git a/gst/compositor/compositor.c b/gst/compositor/compositor.c
index 8a891f1fc..16012aa7e 100644
--- a/gst/compositor/compositor.c
+++ b/gst/compositor/compositor.c
@@ -1116,6 +1116,7 @@ _draw_background (GstCompositor * comp, GstVideoFrame * outframe,
num_planes = GST_VIDEO_FRAME_N_PLANES (outframe);
for (plane = 0; plane < num_planes; ++plane) {
const GstVideoFormatInfo *info;
+ gint comp[GST_VIDEO_MAX_COMPONENTS];
guint8 *pdata;
gsize rowsize, plane_stride;
gint yoffset;
@@ -1123,12 +1124,14 @@ _draw_background (GstCompositor * comp, GstVideoFrame * outframe,
info = outframe->info.finfo;
pdata = GST_VIDEO_FRAME_PLANE_DATA (outframe, plane);
plane_stride = GST_VIDEO_FRAME_PLANE_STRIDE (outframe, plane);
- rowsize = GST_VIDEO_FRAME_COMP_WIDTH (outframe, plane)
- * GST_VIDEO_FRAME_COMP_PSTRIDE (outframe, plane);
- height =
- GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info, plane, (y_end - y_start));
- yoffset = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info, plane, y_start);
+ gst_video_format_info_component (info, plane, comp);
+ rowsize = GST_VIDEO_FRAME_COMP_WIDTH (outframe, comp[0])
+ * GST_VIDEO_FRAME_COMP_PSTRIDE (outframe, comp[0]);
+ height = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info, comp[0],
+ (y_end - y_start));
+
+ yoffset = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info, comp[0], y_start);
pdata += yoffset * plane_stride;
for (i = 0; i < height; ++i) {
diff --git a/gst/rawparse/gstrawvideoparse.c b/gst/rawparse/gstrawvideoparse.c
index 066dd2aa7..fd1a993d6 100644
--- a/gst/rawparse/gstrawvideoparse.c
+++ b/gst/rawparse/gstrawvideoparse.c
@@ -1165,10 +1165,12 @@ gst_raw_video_parse_update_info (GstRawVideoParseConfig * config)
gint tile_height = 1 << GST_VIDEO_FORMAT_INFO_TILE_HS (info->finfo);
last_plane_size = x_tiles * y_tiles * tile_width * tile_height;
} else {
+ gint comp[GST_VIDEO_MAX_COMPONENTS];
+ gst_video_format_info_component (info->finfo, last_plane, comp);
last_plane_size =
GST_VIDEO_INFO_PLANE_STRIDE (info,
last_plane) * GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info->finfo,
- last_plane, config->height);
+ comp[0], config->height);
}
GST_VIDEO_INFO_SIZE (info) = last_plane_offset + last_plane_size;