diff options
author | Hyunjun Ko <zzoon@igalia.com> | 2017-04-03 16:45:36 +0900 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2017-04-11 16:41:41 +0200 |
commit | 4752f68a376afc59c27d9e3e94483d3387372098 (patch) | |
tree | 92a14011578530307845214a1a49a90c442bb8d5 | |
parent | 0343649667d58dfb24d002e9cc924fd356a1dd9f (diff) | |
download | gstreamer-4752f68a376afc59c27d9e3e94483d3387372098.tar.gz |
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
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow.c | 17 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow_priv.h | 3 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow_wayland.c | 13 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow_x11.c | 6 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiwindow_x11_priv.h | 1 |
5 files changed, 40 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow.c b/gst-libs/gst/vaapi/gstvaapiwindow.c index 2bb02e1f32..62cdeaf0ce 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow.c @@ -74,6 +74,23 @@ gst_vaapi_window_create (GstVaapiWindow * window, guint width, guint height) 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 * gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class, GstVaapiDisplay * display, GstVaapiID id, guint width, guint height) diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_priv.h b/gst-libs/gst/vaapi/gstvaapiwindow_priv.h index ea0e19a175..71b67559f2 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_priv.h +++ b/gst-libs/gst/vaapi/gstvaapiwindow_priv.h @@ -120,6 +120,9 @@ GstVaapiWindow * gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class, GstVaapiDisplay * display, GstVaapiID handle, guint width, guint height); +void +gst_vaapi_window_class_init (GstVaapiWindowClass * klass); + /* Inline reference counting for core libgstvaapi library */ #ifdef IN_LIBGSTVAAPI_CORE #define gst_vaapi_window_ref_internal(window) \ diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c index b299d762d5..9a2e664aef 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c @@ -46,6 +46,12 @@ #define GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE(obj) \ (&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 _GstVaapiWindowWaylandClass GstVaapiWindowWaylandClass; typedef struct _FrameState FrameState; @@ -135,6 +141,7 @@ struct _GstVaapiWindowWaylandClass { /*< private > */ GstVaapiWindowClass parent_class; + GstVaapiObjectFinalizeFunc parent_finalize; }; static gboolean @@ -339,6 +346,9 @@ gst_vaapi_window_wayland_destroy (GstVaapiWindow * window) gst_vaapi_video_pool_replace (&priv->surface_pool, NULL); gst_poll_free (priv->poll); + + GST_VAAPI_WINDOW_WAYLAND_GET_CLASS (window)->parent_finalize (GST_VAAPI_OBJECT + (window)); } static gboolean @@ -593,6 +603,9 @@ gst_vaapi_window_wayland_class_init (GstVaapiWindowWaylandClass * klass) GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_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) gst_vaapi_window_wayland_destroy; diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c index 10ff1d42fa..c34ecdee7c 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c @@ -297,6 +297,9 @@ gst_vaapi_window_x11_destroy (GstVaapiWindow * window) } GST_VAAPI_OBJECT_ID (window) = None; } + + GST_VAAPI_WINDOW_X11_GET_CLASS (window)->parent_finalize (GST_VAAPI_OBJECT + (window)); } static gboolean @@ -536,6 +539,9 @@ gst_vaapi_window_x11_class_init (GstVaapiWindowX11Class * klass) GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_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) gst_vaapi_window_x11_destroy; diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_x11_priv.h b/gst-libs/gst/vaapi/gstvaapiwindow_x11_priv.h index f57916c996..3abbc8129e 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_x11_priv.h +++ b/gst-libs/gst/vaapi/gstvaapiwindow_x11_priv.h @@ -79,6 +79,7 @@ struct _GstVaapiWindowX11Class { /*< private >*/ GstVaapiWindowClass parent_class; + GstVaapiObjectFinalizeFunc parent_finalize; }; void |