libs: va: Add API to peek the allocator's display.
authorHe Junyan <junyan.he@intel.com>
Fri, 4 Nov 2022 09:06:37 +0000 (17:06 +0800)
committerHe Junyan <junyan.he@intel.com>
Sat, 5 Nov 2022 05:39:34 +0000 (13:39 +0800)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3322>

subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.h

index a9e8d91..a50d420 100644 (file)
@@ -1902,6 +1902,30 @@ gst_va_allocator_set_hacks (GstAllocator * allocator, guint32 hacks)
   self->hacks = hacks;
 }
 
+/**
+ * gst_va_allocator_peek_display:
+ * @allocator: a #GstAllocator
+ *
+ * Returns: (type #GstVaDisplay) (transfer none): the display which this
+ *     @allocator belongs to. The reference of the display is unchanged.
+ *
+ * Since: 1.22
+ */
+GstVaDisplay *
+gst_va_allocator_peek_display (GstAllocator * allocator)
+{
+  if (!allocator)
+    return NULL;
+
+  if (GST_IS_VA_DMABUF_ALLOCATOR (allocator)) {
+    return GST_VA_DMABUF_ALLOCATOR (allocator)->display;
+  } else if (GST_IS_VA_ALLOCATOR (allocator)) {
+    return GST_VA_ALLOCATOR (allocator)->display;
+  }
+
+  return NULL;
+}
+
 /*============ Utilities =====================================================*/
 
 /**
index 23d54d2..780c21d 100644 (file)
@@ -118,6 +118,8 @@ gboolean              gst_va_allocator_get_format         (GstAllocator * alloca
 GST_VA_API
 void                  gst_va_allocator_set_hacks          (GstAllocator * allocator,
                                                            guint32 hacks);
+GST_VA_API
+GstVaDisplay *        gst_va_allocator_peek_display       (GstAllocator * allocator);
 
 GST_VA_API
 VASurfaceID           gst_va_memory_get_surface           (GstMemory * mem);