vaapiconvert: change direct-rendering=0 to vaPutImage and support YUY2 colorspace...
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapiimage.c
index ba727c8..143ef8d 100644 (file)
@@ -1568,18 +1568,31 @@ _image_convert_to_yuv411(
 gboolean
 gst_vaapi_convert_buffer_to_image(
     GstVaapiImage *image,
-    GstBuffer *inbuf, // inbuf : I420
-    guint32 in_format)
+    GstBuffer *inbuf
+    )
 {
     GstVaapiImagePrivate *priv;
     guint width, height;
     GstVaapiImageFormat image_format;
     gboolean success = TRUE;
+    GstCaps *buffer_caps;
+    GstStructure *structure;
+    guint32 in_format = 0;
 
     priv = image->priv;
     gst_vaapi_image_get_size(image, &width, &height);
     image_format = gst_vaapi_image_get_format(image);
 
+    /* get buffer format */
+    buffer_caps = GST_BUFFER_CAPS(inbuf);
+    if (!buffer_caps)
+        return FALSE;
+    structure = gst_caps_get_structure(buffer_caps, 0);
+    if (!structure)
+        return FALSE;
+    if (!gst_structure_get_fourcc(structure, "format", &in_format))
+        return FALSE;
+
     /* currently only support YUV convert */
     if ( (in_format != GST_MAKE_FOURCC('N','V','1','2')
           && in_format != GST_MAKE_FOURCC('Y','V','1','2')