libs: add query for GstVaapiVideoPool object types.

Add API to identify the underlying GstVaapiVideoPool object type.
This commit is contained in:
Gwenole Beauchesne 2013-05-23 18:45:23 +02:00
parent 67eea92044
commit 809c7e097b
6 changed files with 43 additions and 5 deletions

View 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

View 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;

View 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;

View 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;
@ -132,6 +134,23 @@ gst_vaapi_video_pool_get_display(GstVaapiVideoPool *pool)
return pool->display;
}
/**
* 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

View 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);

View 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