libs: add query for GstVaapiVideoPool object types.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 23 May 2013 16:45:23 +0000 (18:45 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 23 May 2013 17:01:34 +0000 (19:01 +0200)
Add API to identify the underlying GstVaapiVideoPool object type.

docs/reference/libs/libs-sections.txt
gst-libs/gst/vaapi/gstvaapiimagepool.c
gst-libs/gst/vaapi/gstvaapisurfacepool.c
gst-libs/gst/vaapi/gstvaapivideopool.c
gst-libs/gst/vaapi/gstvaapivideopool.h
gst-libs/gst/vaapi/gstvaapivideopool_priv.h

index 423704c..e25b0e6 100644 (file)
@@ -5,7 +5,6 @@ GstVaapiSurfacePool
 gst_vaapi_surface_pool_new
 <SUBSECTION Standard>
 GST_VAAPI_SURFACE_POOL
-gst_vaapi_surface_pool_get_type
 </SECTION>
 
 <SECTION>
@@ -13,6 +12,7 @@ gst_vaapi_surface_pool_get_type
 <TITLE>GstVaapiVideoPool</TITLE>
 GstVaapiVideoPool
 gst_vaapi_video_pool_get_display
+gst_vaapi_video_pool_get_object_type
 gst_vaapi_video_pool_get_object
 gst_vaapi_video_pool_put_object
 gst_vaapi_video_pool_add_object
index 7f262e9..dd3868a 100644 (file)
@@ -105,7 +105,8 @@ gst_vaapi_image_pool_new(GstVaapiDisplay *display, GstCaps *caps)
     if (!pool)
         return NULL;
 
-    gst_vaapi_video_pool_init(pool, display);
+    gst_vaapi_video_pool_init(pool, display,
+        GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE);
     if (!gst_vaapi_image_pool_set_caps(pool, caps))
         goto error;
     return pool;
index d39588d..f429b9d 100644 (file)
@@ -105,7 +105,8 @@ gst_vaapi_surface_pool_new(GstVaapiDisplay *display, GstCaps *caps)
     if (!pool)
         return NULL;
 
-    gst_vaapi_video_pool_init(pool, display);
+    gst_vaapi_video_pool_init(pool, display,
+        GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_SURFACE);
     if (!gst_vaapi_surface_pool_set_caps(pool, caps))
         goto error;
     return pool;
index 360c9ed..23912e6 100644 (file)
@@ -54,8 +54,10 @@ gst_vaapi_video_pool_alloc_object(GstVaapiVideoPool *pool)
 }
 
 void
-gst_vaapi_video_pool_init(GstVaapiVideoPool *pool, GstVaapiDisplay *display)
+gst_vaapi_video_pool_init(GstVaapiVideoPool *pool, GstVaapiDisplay *display,
+    GstVaapiVideoPoolObjectType object_type)
 {
+    pool->object_type   = object_type;
     pool->display       = gst_vaapi_display_ref(display);
     pool->used_objects  = NULL;
     pool->used_count    = 0;
@@ -133,6 +135,23 @@ gst_vaapi_video_pool_get_display(GstVaapiVideoPool *pool)
 }
 
 /**
+ * gst_vaapi_video_pool_get_object_type:
+ * @pool: a #GstVaapiVideoPool
+ *
+ * Retrieves the type of objects the video @pool supports.
+ *
+ * Return value: the #GstVaapiVideoPoolObjectType of the underlying pool
+ *   objects
+ */
+GstVaapiVideoPoolObjectType
+gst_vaapi_video_pool_get_object_type(GstVaapiVideoPool *pool)
+{
+    g_return_val_if_fail(pool != NULL, (GstVaapiVideoPoolObjectType)0);
+
+    return pool->object_type;
+}
+
+/**
  * gst_vaapi_video_pool_get_object:
  * @pool: a #GstVaapiVideoPool
  *
index 2f13277..03b6cff 100644 (file)
@@ -34,6 +34,18 @@ G_BEGIN_DECLS
 
 typedef struct _GstVaapiVideoPool               GstVaapiVideoPool;
 
+/**
+ * GstVaapiVideoPoolObjectType:
+ * @GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE: #GstVaapiImage objects.
+ * @GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_SURFACE: #GstVaapiSurface objects.
+ *
+ * The set of all supported #GstVaapiVideoPool object types.
+ */
+typedef enum {
+    GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE = 1,
+    GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_SURFACE
+} GstVaapiVideoPoolObjectType;
+
 GstVaapiVideoPool *
 gst_vaapi_video_pool_ref(GstVaapiVideoPool *pool);
 
@@ -47,6 +59,9 @@ gst_vaapi_video_pool_replace(GstVaapiVideoPool **old_pool_ptr,
 GstVaapiDisplay *
 gst_vaapi_video_pool_get_display(GstVaapiVideoPool *pool);
 
+GstVaapiVideoPoolObjectType
+gst_vaapi_video_pool_get_object_type(GstVaapiVideoPool *pool);
+
 gpointer
 gst_vaapi_video_pool_get_object(GstVaapiVideoPool *pool);
 
index df66480..8da750e 100644 (file)
@@ -44,6 +44,7 @@ struct _GstVaapiVideoPool {
     /*< private >*/
     GstVaapiMiniObject  parent_instance;
 
+    guint               object_type;
     GstVaapiDisplay    *display;
     GQueue              free_objects;
     GList              *used_objects;
@@ -67,7 +68,8 @@ struct _GstVaapiVideoPoolClass {
 
 G_GNUC_INTERNAL
 void
-gst_vaapi_video_pool_init(GstVaapiVideoPool *pool, GstVaapiDisplay *display);
+gst_vaapi_video_pool_init(GstVaapiVideoPool *pool, GstVaapiDisplay *display,
+    GstVaapiVideoPoolObjectType object_type);
 
 G_GNUC_INTERNAL
 void