GstVaapiImage * image_generate( GstVaapiDisplay *display, GstVaapiImageFormat format, guint width, guint height ) { const guint w = width; const guint h = height; GstVaapiImage *image; image = gst_vaapi_image_new(display, format, w, h); if (!image) return NULL; if (image_draw_rectangle(image, 0, 0, w/2, h/2, 0xffff0000) && image_draw_rectangle(image, w/2, 0, w/2, h/2, 0xff00ff00) && image_draw_rectangle(image, 0, h/2, w/2, h/2, 0xff0000ff) && image_draw_rectangle(image, w/2, h/2, w/2, h/2, 0xff000000)) return image; g_object_unref(image); return NULL; }
static gboolean image_draw_color_rectangles (GstVaapiImage * image, guint width, guint height, const guint32 colors[4], guint32 flags) { const guint w = width / 2; const guint h = height / 2; if (!image_draw_rectangle (image, 0, 0, w, h, colors[0], flags)) return FALSE; if (!image_draw_rectangle (image, w, 0, w, h, colors[1], flags)) return FALSE; if (!image_draw_rectangle (image, 0, h, w, h, colors[2], flags)) return FALSE; if (!image_draw_rectangle (image, w, h, w, h, colors[3], flags)) return FALSE; return TRUE; }