mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 23:58:17 +00:00
Try YV12 & I420 image formats too.
This commit is contained in:
parent
087b1dabda
commit
9ecf541b67
1 changed files with 19 additions and 2 deletions
|
@ -174,8 +174,17 @@ main(int argc, char *argv[])
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
GstVaapiWindow *window;
|
GstVaapiWindow *window;
|
||||||
GstVaapiSurface *surface;
|
GstVaapiSurface *surface;
|
||||||
GstVaapiImage *image;
|
GstVaapiImage *image = NULL;
|
||||||
|
GstVaapiImageFormat format;
|
||||||
guint flags = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
|
guint flags = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
static const GstVaapiImageFormat image_formats[] = {
|
||||||
|
GST_VAAPI_IMAGE_NV12,
|
||||||
|
GST_VAAPI_IMAGE_YV12,
|
||||||
|
GST_VAAPI_IMAGE_I420,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
static const GstVaapiChromaType chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
|
static const GstVaapiChromaType chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
|
||||||
static const guint width = 320;
|
static const guint width = 320;
|
||||||
|
@ -193,14 +202,22 @@ main(int argc, char *argv[])
|
||||||
if (!surface)
|
if (!surface)
|
||||||
g_error("could not create Gst/VA surface");
|
g_error("could not create Gst/VA surface");
|
||||||
|
|
||||||
image = gst_vaapi_image_new(display, GST_VAAPI_IMAGE_NV12, width, height);
|
for (i = 0; image_formats[i]; i++) {
|
||||||
|
image = gst_vaapi_image_new(display, image_formats[i], width, height);
|
||||||
|
if (image) {
|
||||||
|
format = image_formats[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!image)
|
if (!image)
|
||||||
g_error("could not create Gst/VA image");
|
g_error("could not create Gst/VA image");
|
||||||
|
|
||||||
if (!draw_rgb_rects(image))
|
if (!draw_rgb_rects(image))
|
||||||
g_error("could not draw RGB rectangles");
|
g_error("could not draw RGB rectangles");
|
||||||
|
|
||||||
if (!gst_vaapi_surface_put_image(surface, image))
|
if (!gst_vaapi_surface_put_image(surface, image))
|
||||||
g_error("could not upload image");
|
g_error("could not upload image");
|
||||||
|
|
||||||
if (!gst_vaapi_surface_sync(surface))
|
if (!gst_vaapi_surface_sync(surface))
|
||||||
g_error("could not complete image upload");
|
g_error("could not complete image upload");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue