libs: window: x11/wayland: chaining up to GstVaapiWindow

Currently, GstVaapiWindowX11/Wayland are not descendants of GstVaapiWindow.
This patch chains them up to GstVaapiWindow to handle common members in GstVaapiWindow.

https://bugzilla.gnome.org/show_bug.cgi?id=759533
This commit is contained in:
Hyunjun Ko 2017-04-03 16:45:36 +09:00 committed by Víctor Manuel Jáquez Leal
parent 0343649667
commit 4752f68a37
5 changed files with 40 additions and 0 deletions

View file

@ -74,6 +74,23 @@ gst_vaapi_window_create (GstVaapiWindow * window, guint width, guint height)
return TRUE; return TRUE;
} }
static void
gst_vaapi_window_finalize (GstVaapiWindow * window)
{
}
void
gst_vaapi_window_class_init (GstVaapiWindowClass * klass)
{
GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_CLASS (klass);
object_class->finalize = (GstVaapiObjectFinalizeFunc)
gst_vaapi_window_finalize;
}
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindow,
gst_vaapi_window, gst_vaapi_window_class_init (&g_class));
GstVaapiWindow * GstVaapiWindow *
gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class, gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class,
GstVaapiDisplay * display, GstVaapiID id, guint width, guint height) GstVaapiDisplay * display, GstVaapiID id, guint width, guint height)

View file

@ -120,6 +120,9 @@ GstVaapiWindow *
gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class, gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class,
GstVaapiDisplay * display, GstVaapiID handle, guint width, guint height); GstVaapiDisplay * display, GstVaapiID handle, guint width, guint height);
void
gst_vaapi_window_class_init (GstVaapiWindowClass * klass);
/* Inline reference counting for core libgstvaapi library */ /* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE #ifdef IN_LIBGSTVAAPI_CORE
#define gst_vaapi_window_ref_internal(window) \ #define gst_vaapi_window_ref_internal(window) \

View file

@ -46,6 +46,12 @@
#define GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE(obj) \ #define GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE(obj) \
(&GST_VAAPI_WINDOW_WAYLAND_CAST(obj)->priv) (&GST_VAAPI_WINDOW_WAYLAND_CAST(obj)->priv)
#define GST_VAAPI_WINDOW_WAYLAND_CLASS(klass) \
((GstVaapiWindowWaylandClass *)(klass))
#define GST_VAAPI_WINDOW_WAYLAND_GET_CLASS(obj) \
GST_VAAPI_WINDOW_WAYLAND_CLASS (GST_VAAPI_WINDOW_GET_CLASS (obj))
typedef struct _GstVaapiWindowWaylandPrivate GstVaapiWindowWaylandPrivate; typedef struct _GstVaapiWindowWaylandPrivate GstVaapiWindowWaylandPrivate;
typedef struct _GstVaapiWindowWaylandClass GstVaapiWindowWaylandClass; typedef struct _GstVaapiWindowWaylandClass GstVaapiWindowWaylandClass;
typedef struct _FrameState FrameState; typedef struct _FrameState FrameState;
@ -135,6 +141,7 @@ struct _GstVaapiWindowWaylandClass
{ {
/*< private > */ /*< private > */
GstVaapiWindowClass parent_class; GstVaapiWindowClass parent_class;
GstVaapiObjectFinalizeFunc parent_finalize;
}; };
static gboolean static gboolean
@ -339,6 +346,9 @@ gst_vaapi_window_wayland_destroy (GstVaapiWindow * window)
gst_vaapi_video_pool_replace (&priv->surface_pool, NULL); gst_vaapi_video_pool_replace (&priv->surface_pool, NULL);
gst_poll_free (priv->poll); gst_poll_free (priv->poll);
GST_VAAPI_WINDOW_WAYLAND_GET_CLASS (window)->parent_finalize (GST_VAAPI_OBJECT
(window));
} }
static gboolean static gboolean
@ -593,6 +603,9 @@ gst_vaapi_window_wayland_class_init (GstVaapiWindowWaylandClass * klass)
GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_CLASS (klass); GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_CLASS (klass);
GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass); GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass);
gst_vaapi_window_class_init (&klass->parent_class);
klass->parent_finalize = object_class->finalize;
object_class->finalize = (GstVaapiObjectFinalizeFunc) object_class->finalize = (GstVaapiObjectFinalizeFunc)
gst_vaapi_window_wayland_destroy; gst_vaapi_window_wayland_destroy;

View file

@ -297,6 +297,9 @@ gst_vaapi_window_x11_destroy (GstVaapiWindow * window)
} }
GST_VAAPI_OBJECT_ID (window) = None; GST_VAAPI_OBJECT_ID (window) = None;
} }
GST_VAAPI_WINDOW_X11_GET_CLASS (window)->parent_finalize (GST_VAAPI_OBJECT
(window));
} }
static gboolean static gboolean
@ -536,6 +539,9 @@ gst_vaapi_window_x11_class_init (GstVaapiWindowX11Class * klass)
GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_CLASS (klass); GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_CLASS (klass);
GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass); GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass);
gst_vaapi_window_class_init (&klass->parent_class);
klass->parent_finalize = object_class->finalize;
object_class->finalize = (GstVaapiObjectFinalizeFunc) object_class->finalize = (GstVaapiObjectFinalizeFunc)
gst_vaapi_window_x11_destroy; gst_vaapi_window_x11_destroy;

View file

@ -79,6 +79,7 @@ struct _GstVaapiWindowX11Class
{ {
/*< private >*/ /*< private >*/
GstVaapiWindowClass parent_class; GstVaapiWindowClass parent_class;
GstVaapiObjectFinalizeFunc parent_finalize;
}; };
void void