libs: change gst_vaapi_surface_new_with_dma_buf_handle()
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Mon, 30 May 2016 21:55:43 +0000 (23:55 +0200)
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Wed, 8 Jun 2016 08:19:01 +0000 (10:19 +0200)
Instead of passing the data already in GstVideoInfo, let's just pass the
GstVideoInfo structure.

https://bugzilla.gnome.org/show_bug.cgi?id=765435

gst-libs/gst/vaapi/gstvaapisurface_drm.c
gst-libs/gst/vaapi/gstvaapisurface_drm.h
gst/vaapi/gstvaapipluginbase.c

index 121b708..b6357d3 100644 (file)
@@ -139,21 +139,19 @@ fill_video_info (GstVideoInfo * vip, GstVideoFormat format, guint width,
  *   if creation from DRM PRIME fd failed, or is not supported
  */
 GstVaapiSurface *
-gst_vaapi_surface_new_with_dma_buf_handle (GstVaapiDisplay * display,
-    gint fd, guint size, GstVideoFormat format, guint width, guint height,
-    gsize offset[GST_VIDEO_MAX_PLANES], gint stride[GST_VIDEO_MAX_PLANES])
+gst_vaapi_surface_new_with_dma_buf_handle (GstVaapiDisplay * display, gint fd,
+    GstVideoInfo * vi)
 {
   GstVaapiBufferProxy *proxy;
   GstVaapiSurface *surface;
-  GstVideoInfo vi;
 
   proxy = gst_vaapi_buffer_proxy_new ((gintptr) fd,
-      GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF, size, NULL, NULL);
+      GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF, GST_VIDEO_INFO_SIZE (vi), NULL,
+      NULL);
   if (!proxy)
     return NULL;
 
-  fill_video_info (&vi, format, width, height, offset, stride);
-  surface = gst_vaapi_surface_new_from_buffer_proxy (display, proxy, &vi);
+  surface = gst_vaapi_surface_new_from_buffer_proxy (display, proxy, vi);
   gst_vaapi_buffer_proxy_unref (proxy);
   return surface;
 }
index 5073f55..1dd637d 100644 (file)
@@ -35,9 +35,8 @@ GstVaapiBufferProxy *
 gst_vaapi_surface_get_gem_buf_handle (GstVaapiSurface * surface);
 
 GstVaapiSurface *
-gst_vaapi_surface_new_with_dma_buf_handle (GstVaapiDisplay * display,
-    gint fd, guint size, GstVideoFormat format, guint width, guint height,
-    gsize offset[GST_VIDEO_MAX_PLANES], gint stride[GST_VIDEO_MAX_PLANES]);
+gst_vaapi_surface_new_with_dma_buf_handle (GstVaapiDisplay * display, gint fd,
+    GstVideoInfo * vi);
 
 GstVaapiSurface *
 gst_vaapi_surface_new_with_gem_buf_handle (GstVaapiDisplay * display,
index 7b91355..b623abd 100644 (file)
@@ -205,10 +205,8 @@ plugin_bind_dma_to_vaapi_buffer (GstVaapiPluginBase * plugin,
   meta = gst_buffer_get_vaapi_video_meta (outbuf);
   g_return_val_if_fail (meta != NULL, FALSE);
 
-  surface = gst_vaapi_surface_new_with_dma_buf_handle (plugin->display, fd,
-      GST_VIDEO_INFO_SIZE (vip), GST_VIDEO_INFO_FORMAT (vip),
-      GST_VIDEO_INFO_WIDTH (vip), GST_VIDEO_INFO_HEIGHT (vip),
-      vip->offset, vip->stride);
+  surface =
+      gst_vaapi_surface_new_with_dma_buf_handle (plugin->display, fd, vip);
   if (!surface)
     goto error_create_surface;