gstvaapiimage.c \
gstvaapiimageformat.c \
gstvaapiimagepool.c \
+ gstvaapimarshal.c \
gstvaapiobject.c \
gstvaapisubpicture.c \
gstvaapisurface.c \
# Extra clean files so that maintainer-clean removes *everything*
MAINTAINERCLEANFILES = Makefile.in
+
+# glib-genmarshal rules
+glib_marshal_list = gstvaapimarshal.list
+glib_marshal_prefix = gst_vaapi_marshal
+
+marshal_h = $(glib_marshal_list:.list=.h)
+marshal_c = $(glib_marshal_list:.list=.c)
+
+CLEANFILES = stamp-marshal
+DISTCLEANFILES = $(marshal_h) $(marshal_c)
+BUILT_SOURCES = $(marshal_h) $(marshal_c)
+EXTRA_DIST = $(srcdir)/$(glib_marshal_list)
+
+stamp-marshal: $(glib_marshal_list)
+ $(GLIB_GENMARSHAL) \
+ --prefix=$(glib_marshal_prefix) \
+ --header \
+ $(srcdir)/$(glib_marshal_list) > xgen-mh \
+ && (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
+ && rm -f xgen-mh \
+ && echo timestamp > $(@F)
+
+$(marshal_h): stamp-marshal
+ @true
+
+$(marshal_c): $(marshal_h)
+ (echo "#include \"$(marshal_h)\"" ; \
+ $(GLIB_GENMARSHAL) \
+ --prefix=$(glib_marshal_prefix) \
+ --body \
+ $(srcdir)/$(glib_marshal_list)) > xgen-mc \
+ && cp xgen-mc $(marshal_c) \
+ && rm -f xgen-mc
#include "config.h"
#include "gstvaapiobject.h"
-
+#include "gstvaapimarshal.h"
#define DEBUG 1
#include "gstvaapidebug.h"
struct _GstVaapiObjectPrivate {
GstVaapiDisplay *display;
+ guint is_destroying : 1;
};
enum {
PROP_DISPLAY,
};
+enum {
+ DESTROY,
+
+ LAST_SIGNAL
+};
+
+static guint object_signals[LAST_SIGNAL] = { 0, };
+
+static void
+gst_vaapi_object_dispose(GObject *object)
+{
+ GstVaapiObjectPrivate * const priv = GST_VAAPI_OBJECT(object)->priv;
+
+ if (!priv->is_destroying) {
+ priv->is_destroying = TRUE;
+ g_signal_emit(object, object_signals[DESTROY], 0);
+ priv->is_destroying = FALSE;
+ }
+
+ G_OBJECT_CLASS(gst_vaapi_object_parent_class)->dispose(object);
+}
+
static void
gst_vaapi_object_finalize(GObject *object)
{
g_type_class_add_private(klass, sizeof(GstVaapiObjectPrivate));
+ object_class->dispose = gst_vaapi_object_dispose;
object_class->finalize = gst_vaapi_object_finalize;
object_class->set_property = gst_vaapi_object_set_property;
object_class->get_property = gst_vaapi_object_get_property;
"The GstVaapiDisplay this object is bound to",
GST_VAAPI_TYPE_DISPLAY,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GstVaapiObject::destroy:
+ * @object: the object which received the signal
+ *
+ * The ::destroy signal is emitted when an object is destroyed,
+ * when the user released the last reference to @object.
+ */
+ object_signals[DESTROY] = g_signal_new(
+ "destroy",
+ G_TYPE_FROM_CLASS(object_class),
+ G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
+ G_STRUCT_OFFSET(GstVaapiObjectClass, destroy),
+ NULL, NULL,
+ gst_vaapi_marshal_VOID__VOID,
+ G_TYPE_NONE, 0
+ );
}
static void
object->priv = priv;
priv->display = NULL;
+ priv->is_destroying = FALSE;
}
/**
#define MAX_SURFACES 4
+static void
+gst_vaapi_object_destroy_cb(gpointer object, gpointer user_data)
+{
+ g_print("Destroying GstVaapiObject %p\n", object);
+}
+
int
main(int argc, char *argv[])
{
surfaces[i] = NULL;
}
+ g_signal_connect(
+ G_OBJECT(surface),
+ "destroy",
+ G_CALLBACK(gst_vaapi_object_destroy_cb), NULL
+ );
+
/* Unref in random order to check objects are correctly refcounted */
g_print("unref display\n");
g_object_unref(display);