From fcd7807de8f8d437f2329c134a915b3535767a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 4 May 2024 11:54:16 +0300 Subject: [PATCH] play: Initialize debug category and error quark in class_init Doing it in gst_play_new() means that bindings that directly call g_object_new() with the GType wouldn't end up initializing both. This affects at least the Python and GJS bindings. gst_init() is nonetheless only called from gst_play_new() once because calling it from class_init would likely lead to problems as that's called from somewhere in the middle of GObject. Part-of: --- subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c | 6 +++--- subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c index 90e0ebe96e..da5546c449 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c @@ -382,6 +382,9 @@ gst_play_class_init (GstPlayClass * klass) { GObjectClass *gobject_class = (GObjectClass *) klass; + GST_DEBUG_CATEGORY_INIT (gst_play_debug, "gst-play", 0, "GstPlay"); + gst_play_error_quark (); + gobject_class->set_property = gst_play_set_property; gobject_class->get_property = gst_play_get_property; gobject_class->dispose = gst_play_dispose; @@ -2744,9 +2747,6 @@ gst_play_init_once (G_GNUC_UNUSED gpointer user_data) { gst_init (NULL, NULL); - GST_DEBUG_CATEGORY_INIT (gst_play_debug, "gst-play", 0, "GstPlay"); - gst_play_error_quark (); - return NULL; } diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c b/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c index b7b0089c44..b9f93f8367 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c @@ -206,6 +206,9 @@ gst_player_class_init (GstPlayerClass * klass) { GObjectClass *gobject_class = (GObjectClass *) klass; + GST_DEBUG_CATEGORY_INIT (gst_player_debug, "gst-player", 0, "GstPlayer"); + gst_player_error_quark (); + gobject_class->set_property = gst_player_set_property; gobject_class->get_property = gst_player_get_property; gobject_class->finalize = gst_player_finalize; @@ -444,9 +447,6 @@ gst_player_init_once (G_GNUC_UNUSED gpointer user_data) { gst_init (NULL, NULL); - GST_DEBUG_CATEGORY_INIT (gst_player_debug, "gst-player", 0, "GstPlayer"); - gst_player_error_quark (); - return NULL; }