libs: re-indent all GstVaapiObject related source code.

Re-indent and provide additional minor cosmetical changes to the
GstVaapiMiniObject and GstVaapiObject source files.
This commit is contained in:
Gwenole Beauchesne 2014-12-02 14:15:49 +01:00
parent bee7460f35
commit c2afdb4650
5 changed files with 210 additions and 198 deletions

View file

@ -1,7 +1,7 @@
/*
* gstvaapiminiobject.c - A lightweight reference counted object
*
* Copyright (C) 2012-2013 Intel Corporation
* Copyright (C) 2012-2014 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
*
* This library is free software; you can redistribute it and/or
@ -24,17 +24,17 @@
#include "gstvaapiminiobject.h"
static void
gst_vaapi_mini_object_free(GstVaapiMiniObject *object)
gst_vaapi_mini_object_free (GstVaapiMiniObject * object)
{
const GstVaapiMiniObjectClass * const klass = object->object_class;
const GstVaapiMiniObjectClass *const klass = object->object_class;
g_atomic_int_inc(&object->ref_count);
g_atomic_int_inc (&object->ref_count);
if (klass->finalize)
klass->finalize(object);
if (klass->finalize)
klass->finalize (object);
if (G_LIKELY(g_atomic_int_dec_and_test(&object->ref_count)))
g_slice_free1(klass->size, object);
if (G_LIKELY (g_atomic_int_dec_and_test (&object->ref_count)))
g_slice_free1 (klass->size, object);
}
/**
@ -52,27 +52,27 @@ gst_vaapi_mini_object_free(GstVaapiMiniObject *object)
* Returns: The newly allocated #GstVaapiMiniObject
*/
GstVaapiMiniObject *
gst_vaapi_mini_object_new(const GstVaapiMiniObjectClass *object_class)
gst_vaapi_mini_object_new (const GstVaapiMiniObjectClass * object_class)
{
GstVaapiMiniObject *object;
GstVaapiMiniObject *object;
static const GstVaapiMiniObjectClass default_object_class = {
.size = sizeof(GstVaapiMiniObject),
};
static const GstVaapiMiniObjectClass default_object_class = {
.size = sizeof (GstVaapiMiniObject),
};
if (G_UNLIKELY(!object_class))
object_class = &default_object_class;
if (G_UNLIKELY (!object_class))
object_class = &default_object_class;
g_return_val_if_fail(object_class->size >= sizeof(*object), NULL);
g_return_val_if_fail (object_class->size >= sizeof (*object), NULL);
object = g_slice_alloc(object_class->size);
if (!object)
return NULL;
object = g_slice_alloc (object_class->size);
if (!object)
return NULL;
object->object_class = object_class;
object->ref_count = 1;
object->flags = 0;
return object;
object->object_class = object_class;
object->ref_count = 1;
object->flags = 0;
return object;
}
/**
@ -86,21 +86,21 @@ gst_vaapi_mini_object_new(const GstVaapiMiniObjectClass *object_class)
* Returns: The newly allocated #GstVaapiMiniObject
*/
GstVaapiMiniObject *
gst_vaapi_mini_object_new0(const GstVaapiMiniObjectClass *object_class)
gst_vaapi_mini_object_new0 (const GstVaapiMiniObjectClass * object_class)
{
GstVaapiMiniObject *object;
guint sub_size;
GstVaapiMiniObject *object;
guint sub_size;
object = gst_vaapi_mini_object_new(object_class);
if (!object)
return NULL;
object = gst_vaapi_mini_object_new (object_class);
if (!object)
return NULL;
object_class = object->object_class;
object_class = object->object_class;
sub_size = object_class->size - sizeof(*object);
if (sub_size > 0)
memset(((guchar *)object) + sizeof(*object), 0, sub_size);
return object;
sub_size = object_class->size - sizeof (*object);
if (sub_size > 0)
memset (((guchar *) object) + sizeof (*object), 0, sub_size);
return object;
}
/**
@ -112,12 +112,12 @@ gst_vaapi_mini_object_new0(const GstVaapiMiniObjectClass *object_class)
* Returns: The same @object argument
*/
GstVaapiMiniObject *
gst_vaapi_mini_object_ref(GstVaapiMiniObject *object)
gst_vaapi_mini_object_ref (GstVaapiMiniObject * object)
{
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail (object != NULL, NULL);
g_atomic_int_inc(&object->ref_count);
return object;
g_atomic_int_inc (&object->ref_count);
return object;
}
/**
@ -128,13 +128,13 @@ gst_vaapi_mini_object_ref(GstVaapiMiniObject *object)
* the reference count reaches zero, the object will be free'd.
*/
void
gst_vaapi_mini_object_unref(GstVaapiMiniObject *object)
gst_vaapi_mini_object_unref (GstVaapiMiniObject * object)
{
g_return_if_fail(object != NULL);
g_return_if_fail(object->ref_count > 0);
g_return_if_fail (object != NULL);
g_return_if_fail (object->ref_count > 0);
if (g_atomic_int_dec_and_test(&object->ref_count))
gst_vaapi_mini_object_free(object);
if (g_atomic_int_dec_and_test (&object->ref_count))
gst_vaapi_mini_object_free (object);
}
/**
@ -147,25 +147,25 @@ gst_vaapi_mini_object_unref(GstVaapiMiniObject *object)
* valid object. However, @new_object can be NULL.
*/
void
gst_vaapi_mini_object_replace(GstVaapiMiniObject **old_object_ptr,
GstVaapiMiniObject *new_object)
gst_vaapi_mini_object_replace (GstVaapiMiniObject ** old_object_ptr,
GstVaapiMiniObject * new_object)
{
GstVaapiMiniObject *old_object;
GstVaapiMiniObject *old_object;
g_return_if_fail(old_object_ptr != NULL);
g_return_if_fail (old_object_ptr != NULL);
old_object = g_atomic_pointer_get((gpointer *)old_object_ptr);
old_object = g_atomic_pointer_get ((gpointer *) old_object_ptr);
if (old_object == new_object)
return;
if (old_object == new_object)
return;
if (new_object)
gst_vaapi_mini_object_ref(new_object);
if (new_object)
gst_vaapi_mini_object_ref (new_object);
while (!g_atomic_pointer_compare_and_exchange((gpointer *)old_object_ptr,
old_object, new_object))
old_object = g_atomic_pointer_get((gpointer *)old_object_ptr);
while (!g_atomic_pointer_compare_and_exchange ((gpointer *) old_object_ptr,
old_object, new_object))
old_object = g_atomic_pointer_get ((gpointer *) old_object_ptr);
if (old_object)
gst_vaapi_mini_object_unref(old_object);
if (old_object)
gst_vaapi_mini_object_unref (old_object);
}

View file

@ -1,7 +1,7 @@
/*
* gstvaapiminiobject.h - A lightweight reference counted object
*
* Copyright (C) 2012-2013 Intel Corporation
* Copyright (C) 2012-2014 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
*
* This library is free software; you can redistribute it and/or
@ -28,8 +28,8 @@
G_BEGIN_DECLS
typedef struct _GstVaapiMiniObject GstVaapiMiniObject;
typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
typedef struct _GstVaapiMiniObject GstVaapiMiniObject;
typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
/**
* GST_VAAPI_MINI_OBJECT:
@ -38,7 +38,16 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* Casts the @object to a #GstVaapiMiniObject
*/
#define GST_VAAPI_MINI_OBJECT(object) \
((GstVaapiMiniObject *)(object))
((GstVaapiMiniObject *) (object))
/**
* GST_VAAPI_MINI_OBJECT_PTR:
* @object_ptr: a pointer #GstVaapiMiniObject
*
* Casts the @object_ptr to a pointer to #GstVaapiMiniObject
*/
#define GST_VAAPI_MINI_OBJECT_PTR(object_ptr) \
((GstVaapiMiniObject **) (object_ptr))
/**
* GST_VAAPI_MINI_OBJECT_CLASS:
@ -47,7 +56,7 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* Casts the @klass to a #GstVaapiMiniObjectClass
*/
#define GST_VAAPI_MINI_OBJECT_CLASS(klass) \
((GstVaapiMiniObjectClass *)(klass))
((GstVaapiMiniObjectClass *) (klass))
/**
* GST_VAAPI_MINI_OBJECT_GET_CLASS:
@ -56,7 +65,7 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* Retrieves the #GstVaapiMiniObjectClass associated with the @object
*/
#define GST_VAAPI_MINI_OBJECT_GET_CLASS(object) \
(GST_VAAPI_MINI_OBJECT(object)->object_class)
(GST_VAAPI_MINI_OBJECT (object)->object_class)
/**
* GST_VAAPI_MINI_OBJECT_FLAGS:
@ -65,7 +74,7 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* The entire set of flags for the @object
*/
#define GST_VAAPI_MINI_OBJECT_FLAGS(object) \
(GST_VAAPI_MINI_OBJECT(object)->flags)
(GST_VAAPI_MINI_OBJECT (object)->flags)
/**
* GST_VAAPI_MINI_OBJECT_FLAG_IS_SET:
@ -75,7 +84,7 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* Checks whether the given @flag is set
*/
#define GST_VAAPI_MINI_OBJECT_FLAG_IS_SET(object, flag) \
((GST_VAAPI_MINI_OBJECT_FLAGS(object) & (flag)) != 0)
((GST_VAAPI_MINI_OBJECT_FLAGS (object) & (flag)) != 0)
/**
* GST_VAAPI_MINI_OBJECT_FLAG_SET:
@ -85,7 +94,7 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* This macro sets the given bits
*/
#define GST_VAAPI_MINI_OBJECT_FLAG_SET(object, flags) \
(GST_VAAPI_MINI_OBJECT_FLAGS(object) |= (flags))
(GST_VAAPI_MINI_OBJECT_FLAGS (object) |= (flags))
/**
* GST_VAAPI_MINI_OBJECT_FLAG_UNSET:
@ -95,7 +104,7 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* This macro unsets the given bits.
*/
#define GST_VAAPI_MINI_OBJECT_FLAG_UNSET(object, flags) \
(GST_VAAPI_MINI_OBJECT_FLAGS(object) &= ~(flags))
(GST_VAAPI_MINI_OBJECT_FLAGS (object) &= ~(flags))
/**
* GstVaapiMiniObject:
@ -108,11 +117,12 @@ typedef struct _GstVaapiMiniObjectClass GstVaapiMiniObjectClass;
* A #GstVaapiMiniObject represents a minimal reference counted data
* structure that can hold a set of flags and user-provided data.
*/
struct _GstVaapiMiniObject {
/*< private >*/
gconstpointer object_class;
volatile gint ref_count;
guint flags;
struct _GstVaapiMiniObject
{
/*< private >*/
gconstpointer object_class;
volatile gint ref_count;
guint flags;
};
/**
@ -125,31 +135,33 @@ struct _GstVaapiMiniObject {
* defines the size of the #GstVaapiMiniObject and utility function to
* dispose child objects
*/
struct _GstVaapiMiniObjectClass {
guint size;
GDestroyNotify finalize;
struct _GstVaapiMiniObjectClass
{
/*< protected >*/
guint size;
GDestroyNotify finalize;
};
G_GNUC_INTERNAL
GstVaapiMiniObject *
gst_vaapi_mini_object_new(const GstVaapiMiniObjectClass *object_class);
gst_vaapi_mini_object_new (const GstVaapiMiniObjectClass * object_class);
G_GNUC_INTERNAL
GstVaapiMiniObject *
gst_vaapi_mini_object_new0(const GstVaapiMiniObjectClass *object_class);
gst_vaapi_mini_object_new0 (const GstVaapiMiniObjectClass * object_class);
G_GNUC_INTERNAL
GstVaapiMiniObject *
gst_vaapi_mini_object_ref(GstVaapiMiniObject *object);
gst_vaapi_mini_object_ref (GstVaapiMiniObject * object);
G_GNUC_INTERNAL
void
gst_vaapi_mini_object_unref(GstVaapiMiniObject *object);
gst_vaapi_mini_object_unref (GstVaapiMiniObject * object);
G_GNUC_INTERNAL
void
gst_vaapi_mini_object_replace(GstVaapiMiniObject **old_object_ptr,
GstVaapiMiniObject *new_object);
gst_vaapi_mini_object_replace (GstVaapiMiniObject ** old_object_ptr,
GstVaapiMiniObject * new_object);
G_END_DECLS

View file

@ -42,24 +42,23 @@
#undef gst_vaapi_object_replace
static void
gst_vaapi_object_finalize(GstVaapiObject *object)
gst_vaapi_object_finalize (GstVaapiObject * object)
{
const GstVaapiObjectClass * const klass =
GST_VAAPI_OBJECT_GET_CLASS(object);
const GstVaapiObjectClass *const klass = GST_VAAPI_OBJECT_GET_CLASS (object);
if (klass->finalize)
klass->finalize(object);
gst_vaapi_display_replace(&object->display, NULL);
if (klass->finalize)
klass->finalize (object);
gst_vaapi_display_replace (&object->display, NULL);
}
void
gst_vaapi_object_class_init(GstVaapiObjectClass *klass, guint size)
gst_vaapi_object_class_init (GstVaapiObjectClass * klass, guint size)
{
GstVaapiMiniObjectClass * const object_class =
GST_VAAPI_MINI_OBJECT_CLASS(klass);
GstVaapiMiniObjectClass *const object_class =
GST_VAAPI_MINI_OBJECT_CLASS (klass);
object_class->size = size;
object_class->finalize = (GDestroyNotify)gst_vaapi_object_finalize;
object_class->size = size;
object_class->finalize = (GDestroyNotify) gst_vaapi_object_finalize;
}
/**
@ -77,30 +76,31 @@ gst_vaapi_object_class_init(GstVaapiObjectClass *klass, guint size)
* Returns: The newly allocated #GstVaapiObject
*/
gpointer
gst_vaapi_object_new(const GstVaapiObjectClass *klass, GstVaapiDisplay *display)
gst_vaapi_object_new (const GstVaapiObjectClass * klass,
GstVaapiDisplay * display)
{
const GstVaapiMiniObjectClass * const object_class =
GST_VAAPI_MINI_OBJECT_CLASS(klass);
GstVaapiObject *object;
guint sub_size;
const GstVaapiMiniObjectClass *const object_class =
GST_VAAPI_MINI_OBJECT_CLASS (klass);
GstVaapiObject *object;
guint sub_size;
g_return_val_if_fail(klass != NULL, NULL);
g_return_val_if_fail(display != NULL, NULL);
g_return_val_if_fail (klass != NULL, NULL);
g_return_val_if_fail (display != NULL, NULL);
object = (GstVaapiObject *)gst_vaapi_mini_object_new(object_class);
if (!object)
return NULL;
object = (GstVaapiObject *) gst_vaapi_mini_object_new (object_class);
if (!object)
return NULL;
object->display = gst_vaapi_display_ref(display);
object->object_id = VA_INVALID_ID;
object->display = gst_vaapi_display_ref (display);
object->object_id = VA_INVALID_ID;
sub_size = object_class->size - sizeof(*object);
if (sub_size > 0)
memset(((guchar *)object) + sizeof(*object), 0, sub_size);
sub_size = object_class->size - sizeof (*object);
if (sub_size > 0)
memset (((guchar *) object) + sizeof (*object), 0, sub_size);
if (klass && klass->init)
klass->init (object);
return object;
if (klass && klass->init)
klass->init (object);
return object;
}
/**
@ -112,9 +112,9 @@ gst_vaapi_object_new(const GstVaapiObjectClass *klass, GstVaapiDisplay *display)
* Returns: The same @object argument
*/
gpointer
gst_vaapi_object_ref(gpointer object)
gst_vaapi_object_ref (gpointer object)
{
return gst_vaapi_object_ref_internal(object);
return gst_vaapi_object_ref_internal (object);
}
/**
@ -125,9 +125,9 @@ gst_vaapi_object_ref(gpointer object)
* the reference count reaches zero, the object will be free'd.
*/
void
gst_vaapi_object_unref(gpointer object)
gst_vaapi_object_unref (gpointer object)
{
gst_vaapi_object_unref_internal(object);
gst_vaapi_object_unref_internal (object);
}
/**
@ -140,9 +140,9 @@ gst_vaapi_object_unref(gpointer object)
* valid object. However, @new_object can be NULL.
*/
void
gst_vaapi_object_replace(gpointer old_object_ptr, gpointer new_object)
gst_vaapi_object_replace (gpointer old_object_ptr, gpointer new_object)
{
gst_vaapi_object_replace_internal(old_object_ptr, new_object);
gst_vaapi_object_replace_internal (old_object_ptr, new_object);
}
/**
@ -154,11 +154,11 @@ gst_vaapi_object_replace(gpointer old_object_ptr, gpointer new_object)
* Return value: the parent #GstVaapiDisplay object
*/
GstVaapiDisplay *
gst_vaapi_object_get_display(GstVaapiObject *object)
gst_vaapi_object_get_display (GstVaapiObject * object)
{
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail (object != NULL, NULL);
return GST_VAAPI_OBJECT_DISPLAY(object);
return GST_VAAPI_OBJECT_DISPLAY (object);
}
/**
@ -170,11 +170,11 @@ gst_vaapi_object_get_display(GstVaapiObject *object)
* unlocked by the other thread.
*/
void
gst_vaapi_object_lock_display(GstVaapiObject *object)
gst_vaapi_object_lock_display (GstVaapiObject * object)
{
g_return_if_fail(object != NULL);
g_return_if_fail (object != NULL);
GST_VAAPI_OBJECT_LOCK_DISPLAY(object);
GST_VAAPI_OBJECT_LOCK_DISPLAY (object);
}
/**
@ -186,11 +186,11 @@ gst_vaapi_object_lock_display(GstVaapiObject *object)
* display itself.
*/
void
gst_vaapi_object_unlock_display(GstVaapiObject *object)
gst_vaapi_object_unlock_display (GstVaapiObject * object)
{
g_return_if_fail(object != NULL);
g_return_if_fail (object != NULL);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(object);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (object);
}
/**
@ -202,9 +202,9 @@ gst_vaapi_object_unlock_display(GstVaapiObject *object)
* Return value: the #GstVaapiID of the @object
*/
GstVaapiID
gst_vaapi_object_get_id(GstVaapiObject *object)
gst_vaapi_object_get_id (GstVaapiObject * object)
{
g_return_val_if_fail(object != NULL, 0);
g_return_val_if_fail (object != NULL, 0);
return GST_VAAPI_OBJECT_ID(object);
return GST_VAAPI_OBJECT_ID (object);
}

View file

@ -31,9 +31,9 @@
G_BEGIN_DECLS
#define GST_VAAPI_OBJECT(obj) \
((GstVaapiObject *)(obj))
((GstVaapiObject *) (obj))
typedef struct _GstVaapiObject GstVaapiObject;
typedef struct _GstVaapiObject GstVaapiObject;
/**
* GST_VAAPI_OBJECT_DISPLAY:
@ -42,7 +42,7 @@ typedef struct _GstVaapiObject GstVaapiObject;
* Macro that evaluates to the #GstVaapiDisplay the @object is bound to.
*/
#define GST_VAAPI_OBJECT_DISPLAY(object) \
gst_vaapi_object_get_display(GST_VAAPI_OBJECT(object))
gst_vaapi_object_get_display (GST_VAAPI_OBJECT (object))
/**
* GST_VAAPI_OBJECT_ID:
@ -51,28 +51,28 @@ typedef struct _GstVaapiObject GstVaapiObject;
* Macro that evaluates to the #GstVaapiID contained in @object.
*/
#define GST_VAAPI_OBJECT_ID(object) \
gst_vaapi_object_get_id(GST_VAAPI_OBJECT(object))
gst_vaapi_object_get_id (GST_VAAPI_OBJECT (object))
gpointer
gst_vaapi_object_ref(gpointer object);
gst_vaapi_object_ref (gpointer object);
void
gst_vaapi_object_unref(gpointer object);
gst_vaapi_object_unref (gpointer object);
void
gst_vaapi_object_replace(gpointer old_object_ptr, gpointer new_object);
gst_vaapi_object_replace (gpointer old_object_ptr, gpointer new_object);
GstVaapiDisplay *
gst_vaapi_object_get_display(GstVaapiObject *object);
gst_vaapi_object_get_display (GstVaapiObject * object);
void
gst_vaapi_object_lock_display(GstVaapiObject *object);
gst_vaapi_object_lock_display (GstVaapiObject * object);
void
gst_vaapi_object_unlock_display(GstVaapiObject *object);
gst_vaapi_object_unlock_display (GstVaapiObject * object);
GstVaapiID
gst_vaapi_object_get_id(GstVaapiObject *object);
gst_vaapi_object_get_id (GstVaapiObject * object);
G_END_DECLS

View file

@ -32,50 +32,37 @@
G_BEGIN_DECLS
#define GST_VAAPI_OBJECT_CLASS(klass) \
((GstVaapiObjectClass *)(klass))
((GstVaapiObjectClass *) (klass))
#define GST_VAAPI_IS_OBJECT_CLASS(klass) \
((klass) != NULL)
((klass) != NULL)
#define GST_VAAPI_OBJECT_GET_CLASS(object) \
GST_VAAPI_OBJECT_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(object))
GST_VAAPI_OBJECT_CLASS (GST_VAAPI_MINI_OBJECT_GET_CLASS (object))
typedef struct _GstVaapiObjectClass GstVaapiObjectClass;
typedef void (*GstVaapiObjectInitFunc) (GstVaapiObject *object);
typedef void (*GstVaapiObjectFinalizeFunc) (GstVaapiObject *object);
typedef struct _GstVaapiObjectClass GstVaapiObjectClass;
typedef void (*GstVaapiObjectInitFunc) (GstVaapiObject * object);
typedef void (*GstVaapiObjectFinalizeFunc) (GstVaapiObject * object);
#define GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(TN, t_n, code) \
static inline const GstVaapiObjectClass * \
G_PASTE(t_n,_class)(void) \
G_PASTE(t_n,_class) (void) \
{ \
static G_PASTE(TN,Class) g_class; \
static gsize g_class_init = FALSE; \
\
if (g_once_init_enter(&g_class_init)) { \
if (g_once_init_enter (&g_class_init)) { \
GstVaapiObjectClass * const klass = \
GST_VAAPI_OBJECT_CLASS(&g_class); \
gst_vaapi_object_class_init(klass, sizeof(TN)); \
GST_VAAPI_OBJECT_CLASS (&g_class); \
gst_vaapi_object_class_init (klass, sizeof(TN)); \
code; \
klass->finalize = (GstVaapiObjectFinalizeFunc) \
G_PASTE(t_n,_finalize); \
g_once_init_leave(&g_class_init, TRUE); \
g_once_init_leave (&g_class_init, TRUE); \
} \
return GST_VAAPI_OBJECT_CLASS(&g_class); \
return GST_VAAPI_OBJECT_CLASS (&g_class); \
}
#define GST_VAAPI_OBJECT_DEFINE_CLASS(TN, t_n) \
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE(TN, t_n, /**/)
/**
* GST_VAAPI_OBJECT_DISPLAY:
* @object: a #GstVaapiObject
*
* Macro that evaluates to the #GstVaapiDisplay the @object is bound to.
* This is an internal macro that does not do any run-time type check.
*/
#undef GST_VAAPI_OBJECT_DISPLAY
#define GST_VAAPI_OBJECT_DISPLAY(object) \
GST_VAAPI_OBJECT(object)->display
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (TN, t_n, /**/)
/**
* GST_VAAPI_OBJECT_ID:
@ -86,7 +73,18 @@ G_PASTE(t_n,_class)(void) \
*/
#undef GST_VAAPI_OBJECT_ID
#define GST_VAAPI_OBJECT_ID(object) \
GST_VAAPI_OBJECT(object)->object_id
(GST_VAAPI_OBJECT (object)->object_id)
/**
* GST_VAAPI_OBJECT_DISPLAY:
* @object: a #GstVaapiObject
*
* Macro that evaluates to the #GstVaapiDisplay the @object is bound to.
* This is an internal macro that does not do any run-time type check.
*/
#undef GST_VAAPI_OBJECT_DISPLAY
#define GST_VAAPI_OBJECT_DISPLAY(object) \
(GST_VAAPI_OBJECT (object)->display)
/**
* GST_VAAPI_OBJECT_DISPLAY_X11:
@ -97,7 +95,7 @@ G_PASTE(t_n,_class)(void) \
* and requires #include "gstvaapidisplay_x11_priv.h"
*/
#define GST_VAAPI_OBJECT_DISPLAY_X11(object) \
GST_VAAPI_DISPLAY_X11_CAST(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_X11_CAST (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_DISPLAY_GLX:
@ -108,7 +106,7 @@ G_PASTE(t_n,_class)(void) \
* and requires #include "gstvaapidisplay_glx_priv.h".
*/
#define GST_VAAPI_OBJECT_DISPLAY_GLX(object) \
GST_VAAPI_DISPLAY_GLX_CAST(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_GLX_CAST (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_DISPLAY_WAYLAND:
@ -119,7 +117,7 @@ G_PASTE(t_n,_class)(void) \
* type check and requires #include "gstvaapidisplay_wayland_priv.h"
*/
#define GST_VAAPI_OBJECT_DISPLAY_WAYLAND(object) \
GST_VAAPI_DISPLAY_WAYLAND_CAST(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_WAYLAND_CAST (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_VADISPLAY:
@ -130,7 +128,7 @@ G_PASTE(t_n,_class)(void) \
* and requires #include "gstvaapidisplay_priv.h".
*/
#define GST_VAAPI_OBJECT_VADISPLAY(object) \
GST_VAAPI_DISPLAY_VADISPLAY(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_VADISPLAY (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_XDISPLAY:
@ -141,7 +139,7 @@ G_PASTE(t_n,_class)(void) \
* and requires #include "gstvaapidisplay_x11_priv.h".
*/
#define GST_VAAPI_OBJECT_XDISPLAY(object) \
GST_VAAPI_DISPLAY_XDISPLAY(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_XDISPLAY (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_XSCREEN:
@ -152,7 +150,7 @@ G_PASTE(t_n,_class)(void) \
* and requires #include "gstvaapidisplay_x11_priv.h".
*/
#define GST_VAAPI_OBJECT_XSCREEN(object) \
GST_VAAPI_DISPLAY_XSCREEN(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_XSCREEN (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_WL_DISPLAY:
@ -163,7 +161,7 @@ G_PASTE(t_n,_class)(void) \
* and requires #include "gstvaapidisplay_wayland_priv.h".
*/
#define GST_VAAPI_OBJECT_WL_DISPLAY(object) \
GST_VAAPI_DISPLAY_WL_DISPLAY(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_WL_DISPLAY (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_LOCK_DISPLAY:
@ -173,7 +171,7 @@ G_PASTE(t_n,_class)(void) \
* This is an internal macro that does not do any run-time type check.
*/
#define GST_VAAPI_OBJECT_LOCK_DISPLAY(object) \
GST_VAAPI_DISPLAY_LOCK(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_LOCK (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GST_VAAPI_OBJECT_UNLOCK_DISPLAY:
@ -183,19 +181,20 @@ G_PASTE(t_n,_class)(void) \
* This is an internal macro that does not do any run-time type check.
*/
#define GST_VAAPI_OBJECT_UNLOCK_DISPLAY(object) \
GST_VAAPI_DISPLAY_UNLOCK(GST_VAAPI_OBJECT_DISPLAY(object))
GST_VAAPI_DISPLAY_UNLOCK (GST_VAAPI_OBJECT_DISPLAY (object))
/**
* GstVaapiObject:
*
* VA object base.
*/
struct _GstVaapiObject {
/*< private >*/
GstVaapiMiniObject parent_instance;
struct _GstVaapiObject
{
/*< private >*/
GstVaapiMiniObject parent_instance;
GstVaapiDisplay *display;
GstVaapiID object_id;
GstVaapiDisplay *display;
GstVaapiID object_id;
};
/**
@ -203,53 +202,54 @@ struct _GstVaapiObject {
*
* VA object base class.
*/
struct _GstVaapiObjectClass {
/*< private >*/
GstVaapiMiniObjectClass parent_class;
struct _GstVaapiObjectClass
{
/*< private >*/
GstVaapiMiniObjectClass parent_class;
GstVaapiObjectInitFunc init;
GstVaapiObjectFinalizeFunc finalize;
GstVaapiObjectInitFunc init;
GstVaapiObjectFinalizeFunc finalize;
};
void
gst_vaapi_object_class_init(GstVaapiObjectClass *klass, guint size);
gst_vaapi_object_class_init (GstVaapiObjectClass * klass, guint size);
gpointer
gst_vaapi_object_new(const GstVaapiObjectClass *klass,
GstVaapiDisplay *display);
gst_vaapi_object_new (const GstVaapiObjectClass * klass,
GstVaapiDisplay * display);
/* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE
static inline gpointer
gst_vaapi_object_ref_internal(gpointer object)
gst_vaapi_object_ref_internal (gpointer object)
{
return gst_vaapi_mini_object_ref(object);
return gst_vaapi_mini_object_ref (object);
}
static inline void
gst_vaapi_object_unref_internal(gpointer object)
gst_vaapi_object_unref_internal (gpointer object)
{
gst_vaapi_mini_object_unref(object);
gst_vaapi_mini_object_unref (object);
}
static inline void
gst_vaapi_object_replace_internal(gpointer old_object_ptr, gpointer new_object)
gst_vaapi_object_replace_internal (gpointer old_object_ptr, gpointer new_object)
{
gst_vaapi_mini_object_replace((GstVaapiMiniObject **)old_object_ptr,
new_object);
gst_vaapi_mini_object_replace ((GstVaapiMiniObject **) old_object_ptr,
new_object);
}
#undef gst_vaapi_object_ref
#define gst_vaapi_object_ref(object) \
gst_vaapi_object_ref_internal((object))
gst_vaapi_object_ref_internal ((object))
#undef gst_vaapi_object_unref
#define gst_vaapi_object_unref(object) \
gst_vaapi_object_unref_internal((object))
gst_vaapi_object_unref_internal ((object))
#undef gst_vaapi_object_replace
#define gst_vaapi_object_replace(old_object_ptr, new_object) \
gst_vaapi_object_replace_internal((old_object_ptr), (new_object))
gst_vaapi_object_replace_internal ((old_object_ptr), (new_object))
#endif
G_END_DECLS