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); GST_DEBUG_CATEGORY_STATIC (GST_CAT_VULKAN_BUFFER_POOL);
#define GST_CAT_DEFAULT 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 #define gst_vulkan_buffer_pool_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanBufferPool, gst_vulkan_buffer_pool, 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")); "vulkanbufferpool", 0, "Vulkan Buffer Pool"));
static const gchar ** static const gchar **
@ -222,8 +220,6 @@ gst_vulkan_buffer_pool_class_init (GstVulkanBufferPoolClass * klass)
GObjectClass *gobject_class = (GObjectClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass;
GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass; GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
g_type_class_add_private (klass, sizeof (GstVulkanBufferPoolPrivate));
gobject_class->finalize = gst_vulkan_buffer_pool_finalize; gobject_class->finalize = gst_vulkan_buffer_pool_finalize;
gstbufferpool_class->get_options = gst_vulkan_buffer_pool_get_options; gstbufferpool_class->get_options = gst_vulkan_buffer_pool_get_options;
@ -234,7 +230,7 @@ gst_vulkan_buffer_pool_class_init (GstVulkanBufferPoolClass * klass)
static void static void
gst_vulkan_buffer_pool_init (GstVulkanBufferPool * pool) 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 static void

View file

@ -42,12 +42,6 @@ static const char *device_validation_layers[] = {
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT); 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); static void gst_vulkan_device_finalize (GObject * object);
struct _GstVulkanDevicePrivate struct _GstVulkanDevicePrivate
@ -55,6 +49,13 @@ struct _GstVulkanDevicePrivate
gboolean opened; 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 * GstVulkanDevice *
gst_vulkan_device_new (GstVulkanInstance * instance) gst_vulkan_device_new (GstVulkanInstance * instance)
{ {
@ -72,8 +73,7 @@ gst_vulkan_device_new (GstVulkanInstance * instance)
static void static void
gst_vulkan_device_init (GstVulkanDevice * device) gst_vulkan_device_init (GstVulkanDevice * device)
{ {
device->priv = G_TYPE_INSTANCE_GET_PRIVATE ((device), device->priv = gst_vulkan_device_get_instance_private (device);
GST_TYPE_VULKAN_DEVICE, GstVulkanDevicePrivate);
} }
static void static void
@ -81,8 +81,6 @@ gst_vulkan_device_class_init (GstVulkanDeviceClass * device_class)
{ {
GObjectClass *gobject_class = (GObjectClass *) device_class; GObjectClass *gobject_class = (GObjectClass *) device_class;
g_type_class_add_private (device_class, sizeof (GstVulkanDevicePrivate));
gobject_class->finalize = gst_vulkan_device_finalize; 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 enum
{ {
SIGNAL_0, SIGNAL_0,
@ -83,6 +77,9 @@ struct _GstVulkanDisplayPrivate
GCond thread_cond; GCond thread_cond;
}; };
G_DEFINE_TYPE_WITH_CODE (GstVulkanDisplay, gst_vulkan_display, GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstVulkanDisplay) _init_debug ());
static gpointer static gpointer
_event_thread_main (GstVulkanDisplay * display) _event_thread_main (GstVulkanDisplay * display)
{ {
@ -113,8 +110,6 @@ _event_thread_main (GstVulkanDisplay * display)
static void static void
gst_vulkan_display_class_init (GstVulkanDisplayClass * klass) 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->get_handle = gst_vulkan_display_default_get_handle;
klass->create_window = gst_vulkan_display_default_create_window; klass->create_window = gst_vulkan_display_default_create_window;
@ -124,7 +119,7 @@ gst_vulkan_display_class_init (GstVulkanDisplayClass * klass)
static void static void
gst_vulkan_display_init (GstVulkanDisplay * display) 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; display->type = GST_VULKAN_DISPLAY_TYPE_ANY;
g_mutex_init (&display->priv->thread_lock); g_mutex_init (&display->priv->thread_lock);

View file

@ -54,14 +54,6 @@ enum
static guint gst_vulkan_instance_signals[LAST_SIGNAL] = { 0 }; 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); static void gst_vulkan_instance_finalize (GObject * object);
struct _GstVulkanInstancePrivate struct _GstVulkanInstancePrivate
@ -69,6 +61,15 @@ struct _GstVulkanInstancePrivate
gboolean opened; 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 * GstVulkanInstance *
gst_vulkan_instance_new (void) gst_vulkan_instance_new (void)
{ {
@ -83,8 +84,7 @@ gst_vulkan_instance_new (void)
static void static void
gst_vulkan_instance_init (GstVulkanInstance * instance) gst_vulkan_instance_init (GstVulkanInstance * instance)
{ {
instance->priv = G_TYPE_INSTANCE_GET_PRIVATE ((instance), instance->priv = gst_vulkan_instance_get_instance_private (instance);
GST_TYPE_VULKAN_INSTANCE, GstVulkanInstancePrivate);
} }
static void static void
@ -94,8 +94,6 @@ gst_vulkan_instance_class_init (GstVulkanInstanceClass * klass)
gst_vulkan_image_memory_init_once (); gst_vulkan_image_memory_init_once ();
gst_vulkan_buffer_memory_init_once (); gst_vulkan_buffer_memory_init_once ();
g_type_class_add_private (klass, sizeof (GstVulkanInstancePrivate));
/** /**
* GstVulkanInstance::create-device: * GstVulkanInstance::create-device:
* @object: the #GstVulkanDisplay * @object: the #GstVulkanDisplay

View file

@ -29,11 +29,6 @@
#define GST_CAT_DEFAULT gst_vulkan_swapper_debug #define GST_CAT_DEFAULT gst_vulkan_swapper_debug
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT); 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_GET_LOCK(o) &(GST_VULKAN_SWAPPER (o)->priv->render_lock)
#define RENDER_LOCK(o) g_mutex_lock (RENDER_GET_LOCK(o)); #define RENDER_LOCK(o) g_mutex_lock (RENDER_GET_LOCK(o));
#define RENDER_UNLOCK(o) g_mutex_unlock (RENDER_GET_LOCK(o)); #define RENDER_UNLOCK(o) g_mutex_unlock (RENDER_GET_LOCK(o));
@ -45,6 +40,12 @@ struct _GstVulkanSwapperPrivate
GList *trash_list; 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, static void _on_window_draw (GstVulkanWindow * window,
GstVulkanSwapper * swapper); GstVulkanSwapper * swapper);
@ -389,9 +390,7 @@ gst_vulkan_swapper_finalize (GObject * object)
static void static void
gst_vulkan_swapper_init (GstVulkanSwapper * swapper) gst_vulkan_swapper_init (GstVulkanSwapper * swapper)
{ {
swapper->priv = swapper->priv = gst_vulkan_swapper_get_instance_private (swapper);
G_TYPE_INSTANCE_GET_PRIVATE (swapper, GST_TYPE_VULKAN_SWAPPER,
GstVulkanSwapperPrivate);
g_mutex_init (&swapper->priv->render_lock); g_mutex_init (&swapper->priv->render_lock);
} }
@ -399,8 +398,6 @@ gst_vulkan_swapper_init (GstVulkanSwapper * swapper)
static void static void
gst_vulkan_swapper_class_init (GstVulkanSwapperClass * klass) gst_vulkan_swapper_class_init (GstVulkanSwapperClass * klass)
{ {
g_type_class_add_private (klass, sizeof (GstVulkanSwapperPrivate));
G_OBJECT_CLASS (klass)->finalize = gst_vulkan_swapper_finalize; G_OBJECT_CLASS (klass)->finalize = gst_vulkan_swapper_finalize;
} }

View file

@ -50,18 +50,16 @@
#define GST_CAT_DEFAULT gst_vulkan_window_debug #define GST_CAT_DEFAULT gst_vulkan_window_debug
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT); 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 struct _GstVulkanWindowPrivate
{ {
guint surface_width; guint surface_width;
guint surface_height; 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); static void gst_vulkan_window_finalize (GObject * object);
typedef struct _GstVulkanDummyWindow typedef struct _GstVulkanDummyWindow
@ -132,16 +130,12 @@ _init_debug (void)
static void static void
gst_vulkan_window_init (GstVulkanWindow * window) gst_vulkan_window_init (GstVulkanWindow * window)
{ {
window->priv = window->priv = gst_vulkan_window_get_instance_private (window);
G_TYPE_INSTANCE_GET_PRIVATE (window, GST_TYPE_VULKAN_WINDOW,
GstVulkanWindowPrivate);
} }
static void static void
gst_vulkan_window_class_init (GstVulkanWindowClass * klass) 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->open = GST_DEBUG_FUNCPTR (gst_vulkan_window_default_open);
klass->close = GST_DEBUG_FUNCPTR (gst_vulkan_window_default_close); 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); gboolean gst_vulkan_window_xcb_handle_event (GstVulkanWindowXCB * window_xcb);
enum enum
@ -68,6 +64,10 @@ struct _GstVulkanWindowXCBPrivate
xcb_intern_atom_reply_t *atom_wm_delete_window; 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, static VkSurfaceKHR gst_vulkan_window_xcb_get_surface (GstVulkanWindow * window,
GError ** error); GError ** error);
static gboolean gst_vulkan_window_xcb_get_presentation_support (GstVulkanWindow 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); GObjectClass *obj_class = G_OBJECT_CLASS (klass);
GstVulkanWindowClass *window_class = (GstVulkanWindowClass *) klass; GstVulkanWindowClass *window_class = (GstVulkanWindowClass *) klass;
g_type_class_add_private (klass, sizeof (GstVulkanWindowXCBPrivate));
obj_class->finalize = gst_vulkan_window_xcb_finalize; obj_class->finalize = gst_vulkan_window_xcb_finalize;
window_class->open = GST_DEBUG_FUNCPTR (gst_vulkan_window_xcb_open); 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 static void
gst_vulkan_window_xcb_init (GstVulkanWindowXCB * window) 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 */ /* Must be called in the gl thread */