vulkan: Update for g_type_class_add_private() deprecation in recent GLib

This commit is contained in:
Tim-Philipp Müller 2018-06-24 00:17:26 +02:00
parent bde76a7dd0
commit a862c0aa85
7 changed files with 42 additions and 66 deletions

View file

@ -52,12 +52,10 @@ static void gst_vulkan_buffer_pool_finalize (GObject * object);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_VULKAN_BUFFER_POOL);
#define GST_CAT_DEFAULT GST_CAT_VULKAN_BUFFER_POOL
#define GST_VULKAN_BUFFER_POOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_VULKAN_BUFFER_POOL, GstVulkanBufferPoolPrivate))
#define gst_vulkan_buffer_pool_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanBufferPool, gst_vulkan_buffer_pool,
GST_TYPE_BUFFER_POOL, GST_DEBUG_CATEGORY_INIT (GST_CAT_VULKAN_BUFFER_POOL,
GST_TYPE_BUFFER_POOL, G_ADD_PRIVATE (GstVulkanBufferPool)
GST_DEBUG_CATEGORY_INIT (GST_CAT_VULKAN_BUFFER_POOL,
"vulkanbufferpool", 0, "Vulkan Buffer Pool"));
static const gchar **
@ -222,8 +220,6 @@ gst_vulkan_buffer_pool_class_init (GstVulkanBufferPoolClass * klass)
GObjectClass *gobject_class = (GObjectClass *) klass;
GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
g_type_class_add_private (klass, sizeof (GstVulkanBufferPoolPrivate));
gobject_class->finalize = gst_vulkan_buffer_pool_finalize;
gstbufferpool_class->get_options = gst_vulkan_buffer_pool_get_options;
@ -234,7 +230,7 @@ gst_vulkan_buffer_pool_class_init (GstVulkanBufferPoolClass * klass)
static void
gst_vulkan_buffer_pool_init (GstVulkanBufferPool * pool)
{
pool->priv = GST_VULKAN_BUFFER_POOL_GET_PRIVATE (pool);
pool->priv = gst_vulkan_buffer_pool_get_instance_private (pool);
}
static void

View file

@ -42,12 +42,6 @@ static const char *device_validation_layers[] = {
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
#define gst_vulkan_device_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanDevice, gst_vulkan_device, GST_TYPE_OBJECT,
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkandevice", 0,
"Vulkan Device");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"));
static void gst_vulkan_device_finalize (GObject * object);
struct _GstVulkanDevicePrivate
@ -55,6 +49,13 @@ struct _GstVulkanDevicePrivate
gboolean opened;
};
#define gst_vulkan_device_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanDevice, gst_vulkan_device, GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstVulkanDevice)
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkandevice", 0,
"Vulkan Device");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"));
GstVulkanDevice *
gst_vulkan_device_new (GstVulkanInstance * instance)
{
@ -72,8 +73,7 @@ gst_vulkan_device_new (GstVulkanInstance * instance)
static void
gst_vulkan_device_init (GstVulkanDevice * device)
{
device->priv = G_TYPE_INSTANCE_GET_PRIVATE ((device),
GST_TYPE_VULKAN_DEVICE, GstVulkanDevicePrivate);
device->priv = gst_vulkan_device_get_instance_private (device);
}
static void
@ -81,8 +81,6 @@ gst_vulkan_device_class_init (GstVulkanDeviceClass * device_class)
{
GObjectClass *gobject_class = (GObjectClass *) device_class;
g_type_class_add_private (device_class, sizeof (GstVulkanDevicePrivate));
gobject_class->finalize = gst_vulkan_device_finalize;
}

View file

@ -54,12 +54,6 @@ _init_debug (void)
}
}
G_DEFINE_TYPE_WITH_CODE (GstVulkanDisplay, gst_vulkan_display, GST_TYPE_OBJECT,
_init_debug ());
#define GST_VULKAN_DISPLAY_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_VULKAN_DISPLAY, GstVulkanDisplayPrivate))
enum
{
SIGNAL_0,
@ -83,6 +77,9 @@ struct _GstVulkanDisplayPrivate
GCond thread_cond;
};
G_DEFINE_TYPE_WITH_CODE (GstVulkanDisplay, gst_vulkan_display, GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstVulkanDisplay) _init_debug ());
static gpointer
_event_thread_main (GstVulkanDisplay * display)
{
@ -113,8 +110,6 @@ _event_thread_main (GstVulkanDisplay * display)
static void
gst_vulkan_display_class_init (GstVulkanDisplayClass * klass)
{
g_type_class_add_private (klass, sizeof (GstVulkanDisplayPrivate));
klass->get_handle = gst_vulkan_display_default_get_handle;
klass->create_window = gst_vulkan_display_default_create_window;
@ -124,7 +119,7 @@ gst_vulkan_display_class_init (GstVulkanDisplayClass * klass)
static void
gst_vulkan_display_init (GstVulkanDisplay * display)
{
display->priv = GST_VULKAN_DISPLAY_GET_PRIVATE (display);
display->priv = gst_vulkan_display_get_instance_private (display);
display->type = GST_VULKAN_DISPLAY_TYPE_ANY;
g_mutex_init (&display->priv->thread_lock);

View file

@ -54,14 +54,6 @@ enum
static guint gst_vulkan_instance_signals[LAST_SIGNAL] = { 0 };
#define gst_vulkan_instance_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanInstance, gst_vulkan_instance,
GST_TYPE_OBJECT, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
"vulkaninstance", 0, "Vulkan Instance");
GST_DEBUG_CATEGORY_INIT (GST_VULKAN_DEBUG_CAT,
"vulkandebug", 0, "Vulkan Debug");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"));
static void gst_vulkan_instance_finalize (GObject * object);
struct _GstVulkanInstancePrivate
@ -69,6 +61,15 @@ struct _GstVulkanInstancePrivate
gboolean opened;
};
#define gst_vulkan_instance_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanInstance, gst_vulkan_instance,
GST_TYPE_OBJECT, G_ADD_PRIVATE (GstVulkanInstance)
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
"vulkaninstance", 0, "Vulkan Instance");
GST_DEBUG_CATEGORY_INIT (GST_VULKAN_DEBUG_CAT,
"vulkandebug", 0, "Vulkan Debug");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"));
GstVulkanInstance *
gst_vulkan_instance_new (void)
{
@ -83,8 +84,7 @@ gst_vulkan_instance_new (void)
static void
gst_vulkan_instance_init (GstVulkanInstance * instance)
{
instance->priv = G_TYPE_INSTANCE_GET_PRIVATE ((instance),
GST_TYPE_VULKAN_INSTANCE, GstVulkanInstancePrivate);
instance->priv = gst_vulkan_instance_get_instance_private (instance);
}
static void
@ -94,8 +94,6 @@ gst_vulkan_instance_class_init (GstVulkanInstanceClass * klass)
gst_vulkan_image_memory_init_once ();
gst_vulkan_buffer_memory_init_once ();
g_type_class_add_private (klass, sizeof (GstVulkanInstancePrivate));
/**
* GstVulkanInstance::create-device:
* @object: the #GstVulkanDisplay

View file

@ -29,11 +29,6 @@
#define GST_CAT_DEFAULT gst_vulkan_swapper_debug
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
#define gst_vulkan_swapper_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanSwapper, gst_vulkan_swapper,
GST_TYPE_OBJECT, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
"vulkanswapper", 0, "Vulkan Swapper"));
#define RENDER_GET_LOCK(o) &(GST_VULKAN_SWAPPER (o)->priv->render_lock)
#define RENDER_LOCK(o) g_mutex_lock (RENDER_GET_LOCK(o));
#define RENDER_UNLOCK(o) g_mutex_unlock (RENDER_GET_LOCK(o));
@ -45,6 +40,12 @@ struct _GstVulkanSwapperPrivate
GList *trash_list;
};
#define gst_vulkan_swapper_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanSwapper, gst_vulkan_swapper,
GST_TYPE_OBJECT, G_ADD_PRIVATE (GstVulkanSwapper)
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
"vulkanswapper", 0, "Vulkan Swapper"));
static void _on_window_draw (GstVulkanWindow * window,
GstVulkanSwapper * swapper);
@ -389,9 +390,7 @@ gst_vulkan_swapper_finalize (GObject * object)
static void
gst_vulkan_swapper_init (GstVulkanSwapper * swapper)
{
swapper->priv =
G_TYPE_INSTANCE_GET_PRIVATE (swapper, GST_TYPE_VULKAN_SWAPPER,
GstVulkanSwapperPrivate);
swapper->priv = gst_vulkan_swapper_get_instance_private (swapper);
g_mutex_init (&swapper->priv->render_lock);
}
@ -399,8 +398,6 @@ gst_vulkan_swapper_init (GstVulkanSwapper * swapper)
static void
gst_vulkan_swapper_class_init (GstVulkanSwapperClass * klass)
{
g_type_class_add_private (klass, sizeof (GstVulkanSwapperPrivate));
G_OBJECT_CLASS (klass)->finalize = gst_vulkan_swapper_finalize;
}

View file

@ -50,18 +50,16 @@
#define GST_CAT_DEFAULT gst_vulkan_window_debug
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
#define gst_vulkan_window_parent_class parent_class
G_DEFINE_ABSTRACT_TYPE (GstVulkanWindow, gst_vulkan_window, GST_TYPE_OBJECT);
#define GST_VULKAN_WINDOW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_VULKAN_WINDOW, GstVulkanWindowPrivate))
struct _GstVulkanWindowPrivate
{
guint surface_width;
guint surface_height;
};
#define gst_vulkan_window_parent_class parent_class
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GstVulkanWindow, gst_vulkan_window,
GST_TYPE_OBJECT);
static void gst_vulkan_window_finalize (GObject * object);
typedef struct _GstVulkanDummyWindow
@ -132,16 +130,12 @@ _init_debug (void)
static void
gst_vulkan_window_init (GstVulkanWindow * window)
{
window->priv =
G_TYPE_INSTANCE_GET_PRIVATE (window, GST_TYPE_VULKAN_WINDOW,
GstVulkanWindowPrivate);
window->priv = gst_vulkan_window_get_instance_private (window);
}
static void
gst_vulkan_window_class_init (GstVulkanWindowClass * klass)
{
g_type_class_add_private (klass, sizeof (GstVulkanWindowPrivate));
klass->open = GST_DEBUG_FUNCPTR (gst_vulkan_window_default_open);
klass->close = GST_DEBUG_FUNCPTR (gst_vulkan_window_default_close);

View file

@ -46,10 +46,6 @@ _init_debug (void)
}
}
#define gst_vulkan_window_xcb_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanWindowXCB, gst_vulkan_window_xcb,
GST_TYPE_VULKAN_WINDOW, _init_debug ());
gboolean gst_vulkan_window_xcb_handle_event (GstVulkanWindowXCB * window_xcb);
enum
@ -68,6 +64,10 @@ struct _GstVulkanWindowXCBPrivate
xcb_intern_atom_reply_t *atom_wm_delete_window;
};
#define gst_vulkan_window_xcb_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanWindowXCB, gst_vulkan_window_xcb,
GST_TYPE_VULKAN_WINDOW, G_ADD_PRIVATE (GstVulkanWindowXCB) _init_debug ());
static VkSurfaceKHR gst_vulkan_window_xcb_get_surface (GstVulkanWindow * window,
GError ** error);
static gboolean gst_vulkan_window_xcb_get_presentation_support (GstVulkanWindow
@ -88,8 +88,6 @@ gst_vulkan_window_xcb_class_init (GstVulkanWindowXCBClass * klass)
GObjectClass *obj_class = G_OBJECT_CLASS (klass);
GstVulkanWindowClass *window_class = (GstVulkanWindowClass *) klass;
g_type_class_add_private (klass, sizeof (GstVulkanWindowXCBPrivate));
obj_class->finalize = gst_vulkan_window_xcb_finalize;
window_class->open = GST_DEBUG_FUNCPTR (gst_vulkan_window_xcb_open);
@ -102,7 +100,7 @@ gst_vulkan_window_xcb_class_init (GstVulkanWindowXCBClass * klass)
static void
gst_vulkan_window_xcb_init (GstVulkanWindowXCB * window)
{
window->priv = GST_VULKAN_WINDOW_XCB_GET_PRIVATE (window);
window->priv = gst_vulkan_window_xcb_get_instance_private (window);
}
/* Must be called in the gl thread */