Commit 6c461797 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne

libs: use GstVaapiObject for VA objects.

parent 1f15c28a
This diff is collapsed.
......@@ -31,34 +31,14 @@
G_BEGIN_DECLS
#define GST_VAAPI_TYPE_CONTEXT \
(gst_vaapi_context_get_type())
#define GST_VAAPI_CONTEXT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_VAAPI_TYPE_CONTEXT, \
GstVaapiContext))
#define GST_VAAPI_CONTEXT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_VAAPI_TYPE_CONTEXT, \
GstVaapiContextClass))
#define GST_VAAPI_CONTEXT(obj) \
((GstVaapiContext *)(obj))
#define GST_VAAPI_IS_CONTEXT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_CONTEXT))
#define GST_VAAPI_IS_CONTEXT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_CONTEXT))
#define GST_VAAPI_CONTEXT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_VAAPI_TYPE_CONTEXT, \
GstVaapiContextClass))
((obj) != NULL)
typedef struct _GstVaapiContext GstVaapiContext;
typedef struct _GstVaapiContextInfo GstVaapiContextInfo;
typedef struct _GstVaapiContextPrivate GstVaapiContextPrivate;
typedef struct _GstVaapiContextClass GstVaapiContextClass;
/**
* GstVaapiContextInfo:
......@@ -75,31 +55,6 @@ struct _GstVaapiContextInfo {
guint ref_frames;
};
/**
* GstVaapiContext:
*
* A VA context wrapper.
*/
struct _GstVaapiContext {
/*< private >*/
GstVaapiObject parent_instance;
GstVaapiContextPrivate *priv;
};
/**
* GstVaapiContextClass:
*
* A VA context wrapper class.
*/
struct _GstVaapiContextClass {
/*< private >*/
GstVaapiObjectClass parent_class;
};
GType
gst_vaapi_context_get_type(void) G_GNUC_CONST;
GstVaapiContext *
gst_vaapi_context_new(
GstVaapiDisplay *display,
......@@ -110,7 +65,8 @@ gst_vaapi_context_new(
);
GstVaapiContext *
gst_vaapi_context_new_full(GstVaapiDisplay *display, GstVaapiContextInfo *cip);
gst_vaapi_context_new_full(GstVaapiDisplay *display,
const GstVaapiContextInfo *cip);
gboolean
gst_vaapi_context_reset(
......@@ -122,7 +78,8 @@ gst_vaapi_context_reset(
);
gboolean
gst_vaapi_context_reset_full(GstVaapiContext *context, GstVaapiContextInfo *cip);
gst_vaapi_context_reset_full(GstVaapiContext *context,
const GstVaapiContextInfo *new_cip);
GstVaapiID
gst_vaapi_context_get_id(GstVaapiContext *context);
......
......@@ -472,7 +472,7 @@ gst_vaapi_decoder_finalize(GObject *object)
priv->frames = NULL;
}
g_clear_object(&priv->context);
gst_vaapi_object_replace(&priv->context, NULL);
priv->va_context = VA_INVALID_ID;
g_clear_object(&priv->display);
......
This diff is collapsed.
......@@ -30,29 +30,11 @@
G_BEGIN_DECLS
#define GST_VAAPI_TYPE_IMAGE \
(gst_vaapi_image_get_type())
#define GST_VAAPI_IMAGE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_VAAPI_TYPE_IMAGE, \
GstVaapiImage))
#define GST_VAAPI_IMAGE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_VAAPI_TYPE_IMAGE, \
GstVaapiImageClass))
#define GST_VAAPI_IMAGE(obj) \
((GstVaapiImage *)(obj))
#define GST_VAAPI_IS_IMAGE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_IMAGE))
#define GST_VAAPI_IS_IMAGE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_IMAGE))
#define GST_VAAPI_IMAGE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_VAAPI_TYPE_IMAGE, \
GstVaapiImageClass))
((obj) != NULL)
/**
* GST_VAAPI_IMAGE_FORMAT:
......@@ -79,32 +61,8 @@ G_BEGIN_DECLS
#define GST_VAAPI_IMAGE_HEIGHT(image) gst_vaapi_image_get_height(image)
typedef struct _GstVaapiImage GstVaapiImage;
typedef struct _GstVaapiImagePrivate GstVaapiImagePrivate;
typedef struct _GstVaapiImageClass GstVaapiImageClass;
typedef struct _GstVaapiImageRaw GstVaapiImageRaw;
/**
* GstVaapiImage:
*
* A VA image wrapper
*/
struct _GstVaapiImage {
/*< private >*/
GstVaapiObject parent_instance;
GstVaapiImagePrivate *priv;
};
/**
* GstVaapiImageClass:
*
* A VA image wrapper class
*/
struct _GstVaapiImageClass {
/*< private >*/
GstVaapiObjectClass parent_class;
};
/**
* GstVaapiImageRaw:
*
......@@ -120,9 +78,6 @@ struct _GstVaapiImageRaw {
guint stride[3];
};
GType
gst_vaapi_image_get_type(void) G_GNUC_CONST;
GstVaapiImage *
gst_vaapi_image_new(
GstVaapiDisplay *display,
......
This diff is collapsed.
......@@ -30,33 +30,13 @@
G_BEGIN_DECLS
#define GST_VAAPI_TYPE_SUBPICTURE \
(gst_vaapi_subpicture_get_type())
#define GST_VAAPI_SUBPICTURE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_VAAPI_TYPE_SUBPICTURE, \
GstVaapiSubpicture))
#define GST_VAAPI_SUBPICTURE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_VAAPI_TYPE_SUBPICTURE, \
GstVaapiSubpictureClass))
#define GST_VAAPI_SUBPICTURE(obj) \
((GstVaapiSubpicture *)(obj))
#define GST_VAAPI_IS_SUBPICTURE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SUBPICTURE))
#define GST_VAAPI_IS_SUBPICTURE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SUBPICTURE))
#define GST_VAAPI_SUBPICTURE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_VAAPI_TYPE_SUBPICTURE, \
GstVaapiSubpictureClass))
((obj) != NULL)
typedef struct _GstVaapiSubpicture GstVaapiSubpicture;
typedef struct _GstVaapiSubpicturePrivate GstVaapiSubpicturePrivate;
typedef struct _GstVaapiSubpictureClass GstVaapiSubpictureClass;
/**
* GstVaapiSubpictureFlags:
......@@ -73,31 +53,6 @@ typedef enum {
GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA = (1 << 1),
} GstVaapiSubpictureFlags;
/**
* GstVaapiSubpicture:
*
* A VA subpicture wrapper
*/
struct _GstVaapiSubpicture {
/*< private >*/
GstVaapiObject parent_instance;
GstVaapiSubpicturePrivate *priv;
};
/**
* GstVaapiSubpictureClass:
*
* A VA subpicture wrapper class
*/
struct _GstVaapiSubpictureClass {
/*< private >*/
GstVaapiObjectClass parent_class;
};
GType
gst_vaapi_subpicture_get_type(void) G_GNUC_CONST;
GstVaapiSubpicture *
gst_vaapi_subpicture_new(GstVaapiImage *image, guint flags);
......@@ -116,11 +71,9 @@ gst_vaapi_subpicture_get_flags(GstVaapiSubpicture *subpicture);
GstVaapiImage *
gst_vaapi_subpicture_get_image(GstVaapiSubpicture *subpicture);
void
gst_vaapi_subpicture_set_image(
GstVaapiSubpicture *subpicture,
GstVaapiImage *image
);
gboolean
gst_vaapi_subpicture_set_image(GstVaapiSubpicture *subpicture,
GstVaapiImage *image);
gfloat
gst_vaapi_subpicture_get_global_alpha(GstVaapiSubpicture *subpicture);
......
This diff is collapsed.
......@@ -112,60 +112,15 @@ typedef enum {
GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 1 << 3,
} GstVaapiSurfaceRenderFlags;
#define GST_VAAPI_TYPE_SURFACE \
(gst_vaapi_surface_get_type())
#define GST_VAAPI_SURFACE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_VAAPI_TYPE_SURFACE, \
GstVaapiSurface))
#define GST_VAAPI_SURFACE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_VAAPI_TYPE_SURFACE, \
GstVaapiSurfaceClass))
#define GST_VAAPI_SURFACE(obj) \
((GstVaapiSurface *)(obj))
#define GST_VAAPI_IS_SURFACE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SURFACE))
#define GST_VAAPI_IS_SURFACE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SURFACE))
#define GST_VAAPI_SURFACE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_VAAPI_TYPE_SURFACE, \
GstVaapiSurfaceClass))
((obj) != NULL)
typedef struct _GstVaapiSurface GstVaapiSurface;
typedef struct _GstVaapiSurfacePrivate GstVaapiSurfacePrivate;
typedef struct _GstVaapiSurfaceClass GstVaapiSurfaceClass;
typedef struct _GstVaapiSurfaceProxy GstVaapiSurfaceProxy;
/**
* GstVaapiSurface:
*
* A VA surface wrapper.
*/
struct _GstVaapiSurface {
/*< private >*/
GstVaapiObject parent_instance;
GstVaapiSurfacePrivate *priv;
};
/**
* GstVaapiSurfaceClass:
*
* A VA surface wrapper class.
*/
struct _GstVaapiSurfaceClass {
/*< private >*/
GstVaapiObjectClass parent_class;
};
GType
gst_vaapi_surface_get_type(void) G_GNUC_CONST;
GstVaapiSurface *
gst_vaapi_surface_new(
GstVaapiDisplay *display,
......
......@@ -41,7 +41,7 @@ gst_vaapi_surface_proxy_finalize(GstVaapiSurfaceProxy *proxy)
if (proxy->surface) {
if (proxy->pool)
gst_vaapi_video_pool_put_object(proxy->pool, proxy->surface);
g_object_unref(proxy->surface);
gst_vaapi_object_unref(proxy->surface);
proxy->surface = NULL;
}
g_clear_object(&proxy->pool);
......@@ -76,7 +76,7 @@ gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool)
proxy->timestamp = GST_CLOCK_TIME_NONE;
proxy->duration = GST_CLOCK_TIME_NONE;
proxy->destroy_func = NULL;
g_object_ref(proxy->surface);
gst_vaapi_object_ref(proxy->surface);
return proxy;
error:
......
......@@ -27,6 +27,7 @@
#include "sysdeps.h"
#include "gstvaapivideopool.h"
#include "gstvaapiobject.h"
#define DEBUG 1
#include "gstvaapidebug.h"
......@@ -75,13 +76,13 @@ gst_vaapi_video_pool_clear(GstVaapiVideoPool *pool)
for (list = priv->used_objects; list; list = next) {
next = list->next;
g_object_unref(list->data);
gst_vaapi_object_unref(list->data);
g_list_free_1(list);
}
priv->used_objects = NULL;
while ((object = g_queue_pop_head(&priv->free_objects)))
g_object_unref(object);
gst_vaapi_object_unref(object);
}
static void
......@@ -313,7 +314,7 @@ gst_vaapi_video_pool_get_object(GstVaapiVideoPool *pool)
++priv->used_count;
priv->used_objects = g_list_prepend(priv->used_objects, object);
return g_object_ref(object);
return gst_vaapi_object_ref(object);
}
/**
......@@ -333,14 +334,14 @@ gst_vaapi_video_pool_put_object(GstVaapiVideoPool *pool, gpointer object)
GList *elem;
g_return_if_fail(GST_VAAPI_IS_VIDEO_POOL(pool));
g_return_if_fail(G_IS_OBJECT(object));
g_return_if_fail(GST_VAAPI_IS_OBJECT(object));
priv = pool->priv;
elem = g_list_find(priv->used_objects, object);
if (!elem)
return;
g_object_unref(object);
gst_vaapi_object_unref(object);
--priv->used_count;
priv->used_objects = g_list_delete_link(priv->used_objects, elem);
g_queue_push_tail(&priv->free_objects, object);
......@@ -361,9 +362,9 @@ gboolean
gst_vaapi_video_pool_add_object(GstVaapiVideoPool *pool, gpointer object)
{
g_return_val_if_fail(GST_VAAPI_IS_VIDEO_POOL(pool), FALSE);
g_return_val_if_fail(G_IS_OBJECT(object), FALSE);
g_return_val_if_fail(GST_VAAPI_IS_OBJECT(object), FALSE);
g_queue_push_tail(&pool->priv->free_objects, g_object_ref(object));
g_queue_push_tail(&pool->priv->free_objects, gst_vaapi_object_ref(object));
return TRUE;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment