GST_VAAPI_DISPLAY_LOCK(display);
#if VA_CHECK_VERSION(0,34,0)
- VASurfaceAttrib *p_attrib = NULL;
int num_attrib = 0;
+ VASurfaceAttrib attrib;
+ attrib.flags = VA_SURFACE_ATTRIB_SETTABLE;
+ attrib.type = VASurfaceAttribPixelFormat;
+ attrib.value.type = VAGenericValueTypeInteger;
+ attrib.value.value.i = VA_FOURCC_NV12;
+ num_attrib = 1;
+
if(priv->fourcc) {
- VASurfaceAttrib attrib;
- attrib.flags = VA_SURFACE_ATTRIB_SETTABLE;
- attrib.type = VASurfaceAttribPixelFormat;
- attrib.value.type = VAGenericValueTypeInteger;
attrib.value.value.i = priv->fourcc;
- p_attrib = &attrib;
- num_attrib = 1;
}
status = vaCreateSurfaces(
GST_VAAPI_DISPLAY_VADISPLAY(display),
priv->width,
priv->height,
&surface_id, 1,
- p_attrib, num_attrib);
+ &attrib, num_attrib);
#else
// I don't add VA_CHECK_VERSION for each place where fourcc is mentioned, but leave
// a warning here if it is used by mistake.
if (!gst_vaapi_uploader_ensure_display(sink->uploader, sink->display))
return GST_FLOW_NOT_SUPPORTED;
- gint width, height;
- gst_structure_get_int(structure, "width", &width);
- gst_structure_get_int(structure, "height", &height);
-
- dst_caps = gst_caps_new_simple ("video/x-surface",
- // "format", G_TYPE_STRING, "I420", // leave format as empty, so video driver default format will be use to create surface pool.
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- NULL);
- gboolean ret = gst_vaapi_uploader_ensure_caps(sink->uploader, caps, dst_caps);
- gst_caps_unref(dst_caps);
- if(!ret) return GST_FLOW_NOT_SUPPORTED;
+ if (!gst_vaapi_uploader_ensure_caps(sink->uploader, caps, NULL))
+ return GST_FLOW_NOT_SUPPORTED;
if (!gst_vaapi_uploader_has_direct_rendering(sink->uploader)) {
return GST_FLOW_OK;
}
if (!ensure_image_pool(uploader, src_caps))
return FALSE;
- if (!ensure_surface_pool(uploader, out_caps ? out_caps : src_caps))
- return FALSE;
-
- priv = uploader->priv;
- priv->direct_rendering = 0;
structure = gst_caps_get_structure(src_caps, 0);
if (!structure)
return FALSE;
gst_structure_get_int(structure, "width", &width);
gst_structure_get_int(structure, "height", &height);
+ GstCaps *default_out_caps = NULL;
+ if (out_caps == NULL) {
+ default_out_caps = gst_caps_new_simple ("video/x-surface",
+ // "format", G_TYPE_STRING, "I420", // leave format as empty, so video driver default format will be use to create surface pool.
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ NULL);
+ }
+
+ if (!ensure_surface_pool(uploader, out_caps ? out_caps : default_out_caps))
+ return FALSE;
+ if (default_out_caps) gst_caps_unref(default_out_caps);
+
+ priv = uploader->priv;
+ priv->direct_rendering = 0;
/* Translate from Gst video format to VA image format */
if (!gst_video_format_parse_caps(src_caps, &vformat, NULL, NULL))